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