AMD64 - Sync AMD64 support from Jordan Gordeev's svn repository and
[dragonfly.git] / sys / platform / pc64 / isa / ascreg.h
1 /* ascreg.h - port and bit definitions for the GI-1904 interface 
2  *
3  * Copyright (c) 1995 Gunther Schadow.  All rights reserved.
4  * Copyright (c) 1995 Luigi Rizzo.  All rights reserved.
5  * Copyright (c) 2008 The DragonFly Project.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed by Gunther Schadow.
18  *      and Luigi Rizzo
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 /*
35  * $FreeBSD: src/sys/i386/isa/ascreg.h,v 1.5 1999/08/28 00:44:37 peter Exp $
36  * $DragonFly: src/sys/platform/pc64/isa/ascreg.h,v 1.1 2008/08/29 17:07:19 dillon Exp $
37  */
38
39     /***    Registers (base=3EB): ************/
40 #define ASC_CFG (scu->base)
41     /*** ASC_CFG 3EB: configuration register. Write only, mirror in RAM
42      ***   7   6   5   4   3   2   1   0
43      ***   -   -  I_5 I_3 I10 D_3  -  D_1
44      ***/
45     /*** #define ASC_CNF_MASK  0x3D */ /*  was 0x5a */
46 #define ASC_CNF_DMA1  0x01 /* was (~0x02 & ASC_CNF_MASK) */
47 #define ASC_CNF_DMA3  0x04 /* was (~0x08 & ASC_CNF_MASK) */
48 #define ASC_CNF_IRQ3  0x10 /* was (~0x10 & ASC_CNF_MASK) */
49 #define ASC_CNF_IRQ5  0x20 /* was (~0x40 & ASC_CNF_MASK) */
50 #define ASC_CNF_IRQ10 0x08 /* was (~0x40 & ASC_CNF_MASK) */
51
52     /*** ASC_STAT 3EC: command/status; rw, mirror in ram
53      ***    7   6   5   4   3   2   1   0
54      ***   BSY  -   -   -   -   -   -   -
55      ***            [<--  Resolution -->] 13h,10h,0eh,0ch,09h, 07h, 04h, 02h
56      ***/
57 #define ASC_STAT        (scu->base + 1)
58
59 #define ASC_RDY_FLAG  0x80
60 #define ASC_RES_MASK  0x3f
61 #define ASC_RES_800   0x13
62 #define ASC_RES_700   0x10
63 #define ASC_RES_600   0x0e
64 #define ASC_RES_500   0x0c
65 #define ASC_RES_400   0x09 /* 0x00 */
66 #define ASC_RES_300   0x07 /* 0x04 */
67 #define ASC_RES_200   0x04 /* 0x20 */
68 #define ASC_RES_100   0x02 /* 0x24 */
69
70     /*** ASC_CMD 3EC: command/status; rw, mirror in ram
71      *** W:  7   6   5   4   3   2   1   0
72      ***     .   -   -   .   .   .   .   .  
73      *** b0: 1: light on & get resolution, 0: light off
74      *** b1: 0: load scan len (sub_16, with b4=1, b7=1)
75      *** b2: 1/0 : dma stuff
76      *** b3: 0/1 : dma stuff
77      *** b4: 1   : load scan len (sub_16, with b1=0, b7=1)
78      *** b5: ?    
79      *** b6: ?    
80      *** b7: ?   : set at beginning of sub_16
81      ***/
82 #define ASC_CMD (scu->base + 1)
83
84 #define ASC_LIGHT_ON  0x01
85 #define ASC_SET_B2    0x04
86 #define ASC_OPERATE     0x91    /* from linux driver... */
87 #define ASC_STANDBY     0x05    /* from linux driver... */
88
89     /*** ASC_LEN_L, ASC_LEN_H 3ED, 3EE: transfer length, lsb first ***/
90 #define ASC_LEN_L       ((scu->base)+2)
91 #define ASC_LEN_H       ((scu->base)+3)
92
93     /*** 3EE ASC_PROBE (must read ASC_PROBE_VALUE) ***/
94 #define ASC_PROBE       ((scu->base)+3)
95 #define ASC_PROBE_VALUE 0xA5
96
97     /*** ASC_BOH 3EF: always write 0 at the moment, read some values ?  ***/
98 #define ASC_BOH         ((scu->base)+4)