Initial import from FreeBSD RELENG_4:
[games.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  */
36
37     /***    Registers (base=3EB): ************/
38 #define ASC_CFG (scu->base)
39     /*** ASC_CFG 3EB: configuration register. Write only, mirror in RAM
40      ***   7   6   5   4   3   2   1   0
41      ***   -   -  I_5 I_3 I10 D_3  -  D_1
42      ***/
43     /*** #define ASC_CNF_MASK  0x3D */ /*  was 0x5a */
44 #define ASC_CNF_DMA1  0x01 /* was (~0x02 & ASC_CNF_MASK) */
45 #define ASC_CNF_DMA3  0x04 /* was (~0x08 & ASC_CNF_MASK) */
46 #define ASC_CNF_IRQ3  0x10 /* was (~0x10 & ASC_CNF_MASK) */
47 #define ASC_CNF_IRQ5  0x20 /* was (~0x40 & ASC_CNF_MASK) */
48 #define ASC_CNF_IRQ10 0x08 /* was (~0x40 & ASC_CNF_MASK) */
49
50     /*** ASC_STAT 3EC: command/status; rw, mirror in ram
51      ***    7   6   5   4   3   2   1   0
52      ***   BSY  -   -   -   -   -   -   -
53      ***            [<--  Resolution -->] 13h,10h,0eh,0ch,09h, 07h, 04h, 02h
54      ***/
55 #define ASC_STAT        (scu->base + 1)
56
57 #define ASC_RDY_FLAG  0x80
58 #define ASC_RES_MASK  0x3f
59 #define ASC_RES_800   0x13
60 #define ASC_RES_700   0x10
61 #define ASC_RES_600   0x0e
62 #define ASC_RES_500   0x0c
63 #define ASC_RES_400   0x09 /* 0x00 */
64 #define ASC_RES_300   0x07 /* 0x04 */
65 #define ASC_RES_200   0x04 /* 0x20 */
66 #define ASC_RES_100   0x02 /* 0x24 */
67
68     /*** ASC_CMD 3EC: command/status; rw, mirror in ram
69      *** W:  7   6   5   4   3   2   1   0
70      ***     .   -   -   .   .   .   .   .  
71      *** b0: 1: light on & get resolution, 0: light off
72      *** b1: 0: load scan len (sub_16, with b4=1, b7=1)
73      *** b2: 1/0 : dma stuff
74      *** b3: 0/1 : dma stuff
75      *** b4: 1   : load scan len (sub_16, with b1=0, b7=1)
76      *** b5: ?    
77      *** b6: ?    
78      *** b7: ?   : set at beginning of sub_16
79      ***/
80 #define ASC_CMD (scu->base + 1)
81
82 #define ASC_LIGHT_ON  0x01
83 #define ASC_SET_B2    0x04
84 #define ASC_OPERATE     0x91    /* from linux driver... */
85 #define ASC_STANDBY     0x05    /* from linux driver... */
86
87     /*** ASC_LEN_L, ASC_LEN_H 3ED, 3EE: transfer length, lsb first ***/
88 #define ASC_LEN_L       ((scu->base)+2)
89 #define ASC_LEN_H       ((scu->base)+3)
90
91     /*** 3EE ASC_PROBE (must read ASC_PROBE_VALUE) ***/
92 #define ASC_PROBE       ((scu->base)+3)
93 #define ASC_PROBE_VALUE 0xA5
94
95     /*** ASC_BOH 3EF: always write 0 at the moment, read some values ?  ***/
96 #define ASC_BOH         ((scu->base)+4)