xref: /reactos/sdk/include/ddk/ntddpcm.h (revision 40462c92)
1 /*
2  * ntddpcm.h
3  *
4  * PCMCIA IOCTL interface
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #pragma once
24 
25 #ifndef _NTDDPCMH_
26 #define _NTDDPCMH_
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define IOCTL_PCMCIA_BASE FILE_DEVICE_CONTROLLER
33 
34 #define DD_PCMCIA_DEVICE_NAME   "\\\\.\\Pcmcia"
35 #define DD_PCMCIA_DEVICE_NAME_U L"\\\\.\\Pcmcia"
36 
37 #define IOCTL_GET_TUPLE_DATA \
38   CTL_CODE(IOCTL_PCMCIA_BASE, 3000, METHOD_BUFFERED, FILE_ANY_ACCESS)
39 
40 #define IOCTL_SOCKET_INFORMATION \
41   CTL_CODE(IOCTL_PCMCIA_BASE, 3004, METHOD_BUFFERED, FILE_ANY_ACCESS)
42 
43 #define DEVICE_IDENTIFIER_LENGTH 64
44 #define DRIVER_NAME_LENGTH       32
45 #define MANUFACTURER_NAME_LENGTH 64
46 
47 #define PcmciaInvalidControllerType 0xffffffff
48 
49 typedef struct _TUPLE_REQUEST {
50   USHORT Socket;
51 } TUPLE_REQUEST, *PTUPLE_REQUEST;
52 
53 typedef enum _PCMCIA_CONTROLLER_CLASS {
54   PcmciaInvalidControllerClass = -1,
55   PcmciaIntelCompatible,
56   PcmciaCardBusCompatible,
57   PcmciaElcController,
58   PcmciaDatabook,
59   PcmciaPciPcmciaBridge,
60   PcmciaCirrusLogic,
61   PcmciaTI,
62   PcmciaTopic,
63   PcmciaRicoh,
64   PcmciaDatabookCB,
65   PcmciaOpti,
66   PcmciaTrid,
67   PcmciaO2Micro,
68   PcmciaNEC,
69   PcmciaNEC_98
70 } PCMCIA_CONTROLLER_CLASS, *PPCMCIA_CONTROLLER_CLASS;
71 
72 typedef struct _PCMCIA_SOCKET_INFORMATION {
73   USHORT Socket;
74   USHORT TupleCrc;
75   UCHAR Manufacturer[MANUFACTURER_NAME_LENGTH];
76   UCHAR Identifier[DEVICE_IDENTIFIER_LENGTH];
77   UCHAR DriverName[DRIVER_NAME_LENGTH];
78   UCHAR DeviceFunctionId;
79   UCHAR Reserved;
80   UCHAR CardInSocket;
81   UCHAR CardEnabled;
82   ULONG ControllerType;
83 } PCMCIA_SOCKET_INFORMATION, *PPCMCIA_SOCKET_INFORMATION;
84 
85 #define PcmciaClassFromControllerType(type)    ((PCMCIA_CONTROLLER_CLASS)((type) & 0xff))
86 #define PcmciaModelFromControllerType(type)    (((type) >> 8) & 0x3ffff)
87 #define PcmciaRevisionFromControllerType(type) ((type) >> 26)
88 
89 DEFINE_GUID(GUID_PCMCIA_INTERFACE_STANDARD, \
90   0xbed5dadfL, 0x38fb, 0x11d1, 0x94, 0x62, 0x00, 0xc0, 0x4f, 0xb9, 0x60, 0xee);
91 
92 typedef ULONG MEMORY_SPACE;
93 
94 typedef
95 _Function_class_(PCMCIA_READ_CONFIG)
96 ULONG
97 (NTAPI PCMCIA_READ_CONFIG)(
98   _In_opt_ PVOID Context,
99   _In_ ULONG WhichSpace,
100   _Out_writes_bytes_all_(Length) PUCHAR Buffer,
101   _In_ ULONG Offset,
102   _In_ ULONG Length);
103 typedef PCMCIA_READ_CONFIG *PPCMCIA_READ_CONFIG;
104 
105 typedef
106 _Function_class_(PCMCIA_WRITE_CONFIG)
107 ULONG
108 (NTAPI PCMCIA_WRITE_CONFIG)(
109   _In_opt_ PVOID Context,
110   _In_ ULONG WhichSpace,
111   _In_reads_bytes_(Length) PUCHAR Buffer,
112   _In_ ULONG Offset,
113   _In_ ULONG Length);
114 typedef PCMCIA_WRITE_CONFIG *PPCMCIA_WRITE_CONFIG;
115 
116 #define PCCARD_PCI_CONFIGURATION_SPACE   0
117 #define PCCARD_ATTRIBUTE_MEMORY          1
118 #define PCCARD_COMMON_MEMORY             2
119 #define PCCARD_ATTRIBUTE_MEMORY_INDIRECT 3
120 #define PCCARD_COMMON_MEMORY_INDIRECT    4
121 
122 typedef struct _PCMCIA_BUS_INTERFACE_STANDARD {
123   USHORT Size;
124   USHORT Version;
125   PVOID Context;
126   PINTERFACE_REFERENCE InterfaceReference;
127   PINTERFACE_DEREFERENCE InterfaceDereference;
128   PPCMCIA_READ_WRITE_CONFIG ReadConfig;
129   PPCMCIA_READ_WRITE_CONFIG WriteConfig;
130 } PCMCIA_BUS_INTERFACE_STANDARD, *PPCMCIA_BUS_INTERFACE_STANDARD;
131 
132 #define PCMCIA_MEMORY_8BIT_ACCESS  0
133 #define PCMCIA_MEMORY_16BIT_ACCESS 1
134 
135 typedef
136 _Function_class_(PCMCIA_MODIFY_MEMORY_WINDOW)
137 BOOLEAN
138 (NTAPI PCMCIA_MODIFY_MEMORY_WINDOW)(
139   _In_opt_ PVOID Context,
140   _In_ ULONGLONG HostBase,
141   _In_ ULONGLONG CardBase,
142   _In_ BOOLEAN Enable,
143   _In_opt_ ULONG WindowSize,
144   _In_opt_ UCHAR AccessSpeed,
145   _In_opt_ UCHAR BusWidth,
146   _In_opt_ BOOLEAN IsAttributeMemory);
147 typedef PCMCIA_MODIFY_MEMORY_WINDOW *PPCMCIA_MODIFY_MEMORY_WINDOW;
148 
149 #define PCMCIA_VPP_0V     0
150 #define PCMCIA_VPP_12V    1
151 #define PCMCIA_VPP_IS_VCC 2
152 
153 typedef
154 _Function_class_(PCMCIA_SET_VPP)
155 BOOLEAN
156 (NTAPI PCMCIA_SET_VPP)(
157   _In_opt_ PVOID Context,
158   _In_ UCHAR VppLevel);
159 typedef PCMCIA_SET_VPP *PPCMCIA_SET_VPP;
160 
161 typedef
162 _Function_class_(PCMCIA_IS_WRITE_PROTECTED)
163 BOOLEAN
164 (NTAPI PCMCIA_IS_WRITE_PROTECTED)(
165   _In_opt_ PVOID Context);
166 typedef PCMCIA_IS_WRITE_PROTECTED *PPCMCIA_IS_WRITE_PROTECTED;
167 
168 typedef struct _PCMCIA_INTERFACE_STANDARD {
169   USHORT Size;
170   USHORT Version;
171   PINTERFACE_REFERENCE InterfaceReference;
172   PINTERFACE_DEREFERENCE InterfaceDereference;
173   PVOID Context;
174   PPCMCIA_MODIFY_MEMORY_WINDOW ModifyMemoryWindow;
175   PPCMCIA_SET_VPP SetVpp;
176   PPCMCIA_IS_WRITE_PROTECTED IsWriteProtected;
177 } PCMCIA_INTERFACE_STANDARD, *PPCMCIA_INTERFACE_STANDARD;
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif /* _NTDDPCMH_ */
184