xref: /reactos/drivers/bus/isapnp/isapnphw.h (revision 6924b8ff)
1 /*
2  * PROJECT:     ReactOS ISA PnP Bus driver
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Hardware definitions
5  * COPYRIGHT:   Copyright 2010 Cameron Gutman <cameron.gutman@reactos.org>
6  *              Copyright 2020 Hervé Poussineau <hpoussin@reactos.org>
7  *              Copyright 2021 Dmitry Borisov <di.sean@protonmail.com>
8  */
9 
10 #pragma once
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #define ISAPNP_ADDRESS 0x279
17 #define ISAPNP_WRITE_DATA 0xA79
18 
19 #define ISAPNP_READPORT 0x00
20 #define ISAPNP_SERIALISOLATION 0x01
21 #define ISAPNP_CONFIGCONTROL 0x02
22 #define ISAPNP_WAKE 0x03
23 #define ISAPNP_RESOURCEDATA 0x04
24 #define ISAPNP_STATUS 0x05
25 #define ISAPNP_CARDSELECTNUMBER 0x06
26 #define ISAPNP_LOGICALDEVICENUMBER 0x07
27 
28 #define ISAPNP_ACTIVATE 0x30
29 #define ISAPNP_IORANGECHECK 0x31
30 
31 #define ISAPNP_MEMBASE(n) (0x40 + ((n) * 8))
32 #define ISAPNP_MEMCONTROL(n) (0x42 + ((n) * 8))
33 #define    MEMORY_UPPER_LIMIT 0x01
34 #define    MEMORY_USE_8_BIT_DECODER 0x00
35 #define    MEMORY_USE_16_BIT_DECODER 0x02
36 #define    MEMORY_USE_32_BIT_DECODER 0x06
37 #define ISAPNP_MEMLIMIT(n) (0x43 + ((n) * 8))
38 #define ISAPNP_IOBASE(n) (0x60 + ((n)*2))
39 #define ISAPNP_IRQNO(n) (0x70 + ((n)*2))
40 #define ISAPNP_IRQTYPE(n) (0x71 + ((n) * 2))
41 #define    IRQTYPE_LOW_LEVEL 0x01
42 #define    IRQTYPE_HIGH_EDGE 0x02
43 #define ISAPNP_DMACHANNEL(n) (0x74 + (n))
44 #define ISAPNP_MEMBASE32(n) ((n) == 0 ? 0x76 : (0x70 + (n) * 16))
45 #define ISAPNP_MEMCONTROL32(n) ((n) == 0 ? 0x7A : (0x74 + (n) * 16))
46 #define ISAPNP_MEMLIMIT32(n) ((n) == 0 ? 0x7B : (0x75 + (n) * 16))
47 
48 #define ISAPNP_CONFIG_RESET (1 << 0)
49 #define ISAPNP_CONFIG_WAIT_FOR_KEY (1 << 1)
50 #define ISAPNP_CONFIG_RESET_CSN (1 << 2)
51 
52 #define ISAPNP_LFSR_SEED 0x6A
53 
54 #define ISAPNP_IS_SMALL_TAG(t) (!((t) & 0x80))
55 #define ISAPNP_SMALL_TAG_NAME(t) (((t) >> 3) & 0xF)
56 #define ISAPNP_SMALL_TAG_LEN(t) (((t) & 0x7))
57 #define ISAPNP_TAG_PNPVERNO 0x01
58 #define ISAPNP_TAG_LOGDEVID 0x02
59 #define ISAPNP_TAG_COMPATDEVID 0x03
60 #define ISAPNP_TAG_IRQ 0x04
61 #define ISAPNP_TAG_DMA 0x05
62 #define ISAPNP_TAG_STARTDEP 0x06
63 #define ISAPNP_TAG_ENDDEP 0x07
64 #define ISAPNP_TAG_IOPORT 0x08
65 #define ISAPNP_TAG_FIXEDIO 0x09
66 #define ISAPNP_TAG_END 0x0F
67 
68 #define ISAPNP_IS_LARGE_TAG(t) (((t) & 0x80))
69 #define ISAPNP_LARGE_TAG_NAME(t) (t)
70 #define ISAPNP_TAG_MEMRANGE 0x81
71 #define    MEMRANGE_16_BIT_MEMORY_MASK (0x10 | 0x08)
72 #define       MEMRANGE_32_BIT_MEMORY_ONLY 0x18
73 #define ISAPNP_TAG_ANSISTR 0x82
74 #define ISAPNP_TAG_UNICODESTR 0x83
75 #define ISAPNP_TAG_MEM32RANGE 0x85
76 #define ISAPNP_TAG_FIXEDMEM32RANGE 0x86
77 
78 #define RANGE_LENGTH_TO_LENGTH(RangeLength) ((~(RangeLength) + 1) & 0xFFFFFF)
79 #define LENGTH_TO_RANGE_LENGTH(Length) (~(Length) + 1)
80 
81 #include <pshpack1.h>
82 
83 typedef struct _ISAPNP_IDENTIFIER
84 {
85     USHORT VendorId;
86     USHORT ProdId;
87     ULONG Serial;
88     UCHAR Checksum;
89 } ISAPNP_IDENTIFIER, *PISAPNP_IDENTIFIER;
90 
91 typedef struct _ISAPNP_LOGDEVID
92 {
93     USHORT VendorId;
94     USHORT ProdId;
95     USHORT Flags;
96 } ISAPNP_LOGDEVID, *PISAPNP_LOGDEVID;
97 
98 typedef struct _ISAPNP_COMPATID
99 {
100     USHORT VendorId;
101     USHORT ProdId;
102 } ISAPNP_COMPATID, *PISAPNP_COMPATID;
103 
104 typedef struct _ISAPNP_IO_DESCRIPTION
105 {
106     UCHAR Information;
107     USHORT Minimum;
108     USHORT Maximum;
109     UCHAR Alignment;
110     UCHAR Length;
111 } ISAPNP_IO_DESCRIPTION, *PISAPNP_IO_DESCRIPTION;
112 
113 typedef struct _ISAPNP_FIXED_IO_DESCRIPTION
114 {
115     USHORT IoBase;
116     UCHAR Length;
117 } ISAPNP_FIXED_IO_DESCRIPTION, *PISAPNP_FIXED_IO_DESCRIPTION;
118 
119 typedef struct _ISAPNP_IRQ_DESCRIPTION
120 {
121     USHORT Mask;
122     UCHAR Information;
123 } ISAPNP_IRQ_DESCRIPTION, *PISAPNP_IRQ_DESCRIPTION;
124 
125 typedef struct _ISAPNP_DMA_DESCRIPTION
126 {
127     UCHAR Mask;
128     UCHAR Information;
129 } ISAPNP_DMA_DESCRIPTION, *PISAPNP_DMA_DESCRIPTION;
130 
131 typedef struct _ISAPNP_MEMRANGE_DESCRIPTION
132 {
133     UCHAR Information;
134     USHORT Minimum;
135     USHORT Maximum;
136     USHORT Alignment;
137     USHORT Length;
138 } ISAPNP_MEMRANGE_DESCRIPTION, *PISAPNP_MEMRANGE_DESCRIPTION;
139 
140 typedef struct _ISAPNP_MEMRANGE32_DESCRIPTION
141 {
142     UCHAR Information;
143     ULONG Minimum;
144     ULONG Maximum;
145     ULONG Alignment;
146     ULONG Length;
147 } ISAPNP_MEMRANGE32_DESCRIPTION, *PISAPNP_MEMRANGE32_DESCRIPTION;
148 
149 typedef struct _ISAPNP_FIXEDMEMRANGE_DESCRIPTION
150 {
151     UCHAR Information;
152     ULONG MemoryBase;
153     ULONG Length;
154 } ISAPNP_FIXEDMEMRANGE_DESCRIPTION, *PISAPNP_FIXEDMEMRANGE_DESCRIPTION;
155 
156 #include <poppack.h>
157 
158 #ifdef __cplusplus
159 }
160 #endif
161