OSDN Git Service

Insert removed author attribution.
[mingw/mingw-org-wsl.git] / include / ddk / ntddpcm.h
1 /**
2  * @file ntddpcm.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 /* Created by Casper S. Hornstrup <chorns@users.sourceforge.net> */
25 #ifndef __NTDDPCM_H
26 #define __NTDDPCM_H
27 #pragma GCC system_header
28 #include <_mingw.h>
29
30 /*
31  * PCMCIA IOCTL interface
32  */
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include "ntddk.h"
39
40 #define IOCTL_PCMCIA_BASE                 FILE_DEVICE_CONTROLLER
41
42 #define DD_PCMCIA_DEVICE_NAME             "\\\\.\\Pcmcia"
43 #define DD_PCMCIA_DEVICE_NAME_U           L"\\\\.\\Pcmcia"
44
45 #define IOCTL_GET_TUPLE_DATA \
46   CTL_CODE(IOCTL_PCMCIA_BASE, 3000, METHOD_BUFFERED, FILE_ANY_ACCESS)
47
48 #define IOCTL_SOCKET_INFORMATION \
49   CTL_CODE(IOCTL_PCMCIA_BASE, 3004, METHOD_BUFFERED, FILE_ANY_ACCESS)
50
51 #define DEVICE_IDENTIFIER_LENGTH          64
52 #define DRIVER_NAME_LENGTH                32
53 #define MANUFACTURER_NAME_LENGTH          64
54
55 #define PcmciaInvalidControllerType       0xffffffff
56
57 typedef struct _TUPLE_REQUEST {
58  USHORT  Socket;
59 } TUPLE_REQUEST, *PTUPLE_REQUEST;
60
61 typedef enum _PCMCIA_CONTROLLER_CLASS {
62         PcmciaInvalidControllerClass = -1,
63         PcmciaIntelCompatible,
64         PcmciaCardBusCompatible,
65         PcmciaElcController,
66         PcmciaDatabook,     
67         PcmciaPciPcmciaBridge,
68         PcmciaCirrusLogic,  
69         PcmciaTI,           
70         PcmciaTopic,        
71         PcmciaRicoh,        
72         PcmciaDatabookCB,   
73         PcmciaOpti,         
74         PcmciaTrid,         
75         PcmciaO2Micro,      
76         PcmciaNEC,          
77         PcmciaNEC_98                
78 } PCMCIA_CONTROLLER_CLASS, *PPCMCIA_CONTROLLER_CLASS;
79
80 typedef struct _PCMCIA_SOCKET_INFORMATION {
81         USHORT  Socket;
82         USHORT  TupleCrc;
83         UCHAR  Manufacturer[MANUFACTURER_NAME_LENGTH];
84         UCHAR  Identifier[DEVICE_IDENTIFIER_LENGTH];
85         UCHAR  DriverName[DRIVER_NAME_LENGTH];
86         UCHAR  DeviceFunctionId;
87         UCHAR  Reserved;
88         UCHAR  CardInSocket;
89         UCHAR  CardEnabled;
90         ULONG  ControllerType;
91 } PCMCIA_SOCKET_INFORMATION, *PPCMCIA_SOCKET_INFORMATION;
92
93 #define PcmciaClassFromControllerType(type)     ((PCMCIA_CONTROLLER_CLASS)((type) & 0xff))
94 #define PcmciaModelFromControllerType(type)     (((type) >> 8) & 0x3ffff)
95 #define PcmciaRevisionFromControllerType(type)  ((type) >> 26)
96
97
98 DEFINE_GUID(GUID_PCMCIA_INTERFACE_STANDARD, \
99   0xbed5dadfL, 0x38fb, 0x11d1, 0x94, 0x62, 0x00, 0xc0, 0x4f, 0xb9, 0x60, 0xee);
100
101 typedef ULONG MEMORY_SPACE;
102
103 typedef ULONG STDCALL
104 (*PPCMCIA_READ_WRITE_CONFIG)(
105   /*IN*/ PVOID  Context,
106   /*IN*/ ULONG  WhichSpace,
107   /*IN*/ PUCHAR  Buffer,
108   /*IN*/ ULONG  Offset,
109   /*IN*/ ULONG  Length);
110
111 #define PCCARD_PCI_CONFIGURATION_SPACE    0
112 #define PCCARD_ATTRIBUTE_MEMORY           1
113 #define PCCARD_COMMON_MEMORY              2
114 #define PCCARD_ATTRIBUTE_MEMORY_INDIRECT  3
115 #define PCCARD_COMMON_MEMORY_INDIRECT     4
116
117 typedef struct _PCMCIA_BUS_INTERFACE_STANDARD {
118         USHORT  Size;
119         USHORT  Version;
120         PVOID  Context;
121         PINTERFACE_REFERENCE  InterfaceReference;
122         PINTERFACE_DEREFERENCE  InterfaceDereference;
123         PPCMCIA_READ_WRITE_CONFIG ReadConfig; 
124         PPCMCIA_READ_WRITE_CONFIG  WriteConfig;
125 } PCMCIA_BUS_INTERFACE_STANDARD, *PPCMCIA_BUS_INTERFACE_STANDARD;
126
127 #define PCMCIA_MEMORY_8BIT_ACCESS         0
128 #define PCMCIA_MEMORY_16BIT_ACCESS        1
129
130 typedef BOOLEAN STDCALL
131 (*PPCMCIA_MODIFY_MEMORY_WINDOW)(
132   /*IN*/ PVOID  Context,
133   /*IN*/ ULONGLONG  HostBase,
134   /*IN*/ ULONGLONG  CardBase,
135   /*IN*/ BOOLEAN  Enable,
136   /*IN*/ ULONG  WindowSize  /*OPTIONAL*/,
137   /*IN*/ UCHAR  AccessSpeed  /*OPTIONAL*/,
138   /*IN*/ UCHAR  BusWidth  /*OPTIONAL*/,
139   /*IN*/ BOOLEAN  IsAttributeMemory  /*OPTIONAL*/);
140
141 #define PCMCIA_VPP_0V                     0
142 #define PCMCIA_VPP_12V                    1
143 #define PCMCIA_VPP_IS_VCC                 2
144
145 typedef BOOLEAN STDCALL
146 (*PPCMCIA_SET_VPP)(
147   /*IN*/ PVOID  Context,
148   /*IN*/ UCHAR  VppLevel);
149
150 typedef BOOLEAN STDCALL
151 (*PPCMCIA_IS_WRITE_PROTECTED)(
152   /*IN*/ PVOID  Context);
153
154 typedef struct _PCMCIA_INTERFACE_STANDARD {
155         USHORT  Size;
156         USHORT  Version;
157         PINTERFACE_REFERENCE  InterfaceReference;
158         PINTERFACE_DEREFERENCE  InterfaceDereference;
159         PVOID  Context;
160         PPCMCIA_MODIFY_MEMORY_WINDOW  ModifyMemoryWindow;
161         PPCMCIA_SET_VPP  SetVpp;
162         PPCMCIA_IS_WRITE_PROTECTED  IsWriteProtected;
163 } PCMCIA_INTERFACE_STANDARD, *PPCMCIA_INTERFACE_STANDARD;
164
165 #ifdef __cplusplus
166 }
167 #endif
168
169 #endif /* __NTDDPCM_H */