Home | History | Annotate | Download | only in ddk
      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 (at) 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 #ifndef _NTDDPCMH_
     24 #define _NTDDPCMH_
     25 
     26 #ifdef __cplusplus
     27 extern "C" {
     28 #endif
     29 
     30 #define IOCTL_PCMCIA_BASE                 FILE_DEVICE_CONTROLLER
     31 
     32 #define DD_PCMCIA_DEVICE_NAME             "\\\\.\\Pcmcia"
     33 #define DD_PCMCIA_DEVICE_NAME_U           L"\\\\.\\Pcmcia"
     34 
     35 #define IOCTL_GET_TUPLE_DATA \
     36   CTL_CODE(IOCTL_PCMCIA_BASE, 3000, METHOD_BUFFERED, FILE_ANY_ACCESS)
     37 
     38 #define IOCTL_SOCKET_INFORMATION \
     39   CTL_CODE(IOCTL_PCMCIA_BASE, 3004, METHOD_BUFFERED, FILE_ANY_ACCESS)
     40 
     41 #define DEVICE_IDENTIFIER_LENGTH          64
     42 #define DRIVER_NAME_LENGTH                32
     43 #define MANUFACTURER_NAME_LENGTH          64
     44 
     45 #define PcmciaInvalidControllerType       0xffffffff
     46 
     47 typedef struct _TUPLE_REQUEST {
     48  USHORT  Socket;
     49 } TUPLE_REQUEST, *PTUPLE_REQUEST;
     50 
     51 typedef enum _PCMCIA_CONTROLLER_CLASS {
     52 	PcmciaInvalidControllerClass = -1,
     53 	PcmciaIntelCompatible,
     54 	PcmciaCardBusCompatible,
     55 	PcmciaElcController,
     56 	PcmciaDatabook,
     57 	PcmciaPciPcmciaBridge,
     58 	PcmciaCirrusLogic,
     59 	PcmciaTI,
     60 	PcmciaTopic,
     61 	PcmciaRicoh,
     62 	PcmciaDatabookCB,
     63 	PcmciaOpti,
     64 	PcmciaTrid,
     65 	PcmciaO2Micro,
     66 	PcmciaNEC,
     67 	PcmciaNEC_98
     68 } PCMCIA_CONTROLLER_CLASS, *PPCMCIA_CONTROLLER_CLASS;
     69 
     70 typedef struct _PCMCIA_SOCKET_INFORMATION {
     71 	USHORT  Socket;
     72 	USHORT  TupleCrc;
     73 	UCHAR  Manufacturer[MANUFACTURER_NAME_LENGTH];
     74 	UCHAR  Identifier[DEVICE_IDENTIFIER_LENGTH];
     75 	UCHAR  DriverName[DRIVER_NAME_LENGTH];
     76 	UCHAR  DeviceFunctionId;
     77 	UCHAR  Reserved;
     78 	UCHAR  CardInSocket;
     79 	UCHAR  CardEnabled;
     80 	ULONG  ControllerType;
     81 } PCMCIA_SOCKET_INFORMATION, *PPCMCIA_SOCKET_INFORMATION;
     82 
     83 #define PcmciaClassFromControllerType(type)     ((PCMCIA_CONTROLLER_CLASS)((type) & 0xff))
     84 #define PcmciaModelFromControllerType(type)     (((type) >> 8) & 0x3ffff)
     85 #define PcmciaRevisionFromControllerType(type)  ((type) >> 26)
     86 
     87 
     88 DEFINE_GUID(GUID_PCMCIA_INTERFACE_STANDARD, \
     89   0xbed5dadfL, 0x38fb, 0x11d1, 0x94, 0x62, 0x00, 0xc0, 0x4f, 0xb9, 0x60, 0xee);
     90 
     91 typedef ULONG MEMORY_SPACE;
     92 
     93 typedef ULONG
     94 (NTAPI *PPCMCIA_READ_WRITE_CONFIG)(
     95   IN PVOID  Context,
     96   IN ULONG  WhichSpace,
     97   IN PUCHAR  Buffer,
     98   IN ULONG  Offset,
     99   IN ULONG  Length);
    100 
    101 #define PCCARD_PCI_CONFIGURATION_SPACE    0
    102 #define PCCARD_ATTRIBUTE_MEMORY           1
    103 #define PCCARD_COMMON_MEMORY              2
    104 #define PCCARD_ATTRIBUTE_MEMORY_INDIRECT  3
    105 #define PCCARD_COMMON_MEMORY_INDIRECT     4
    106 
    107 typedef struct _PCMCIA_BUS_INTERFACE_STANDARD {
    108 	USHORT  Size;
    109 	USHORT  Version;
    110 	PVOID  Context;
    111 	PINTERFACE_REFERENCE  InterfaceReference;
    112 	PINTERFACE_DEREFERENCE  InterfaceDereference;
    113 	PPCMCIA_READ_WRITE_CONFIG ReadConfig;
    114 	PPCMCIA_READ_WRITE_CONFIG  WriteConfig;
    115 } PCMCIA_BUS_INTERFACE_STANDARD, *PPCMCIA_BUS_INTERFACE_STANDARD;
    116 
    117 #define PCMCIA_MEMORY_8BIT_ACCESS         0
    118 #define PCMCIA_MEMORY_16BIT_ACCESS        1
    119 
    120 typedef BOOLEAN
    121 (NTAPI *PPCMCIA_MODIFY_MEMORY_WINDOW)(
    122   IN PVOID  Context,
    123   IN ULONGLONG  HostBase,
    124   IN ULONGLONG  CardBase,
    125   IN BOOLEAN  Enable,
    126   IN ULONG  WindowSize  OPTIONAL,
    127   IN UCHAR  AccessSpeed  OPTIONAL,
    128   IN UCHAR  BusWidth  OPTIONAL,
    129   IN BOOLEAN  IsAttributeMemory  OPTIONAL);
    130 
    131 #define PCMCIA_VPP_0V                     0
    132 #define PCMCIA_VPP_12V                    1
    133 #define PCMCIA_VPP_IS_VCC                 2
    134 
    135 typedef BOOLEAN
    136 (NTAPI *PPCMCIA_SET_VPP)(
    137   IN PVOID  Context,
    138   IN UCHAR  VppLevel);
    139 
    140 typedef BOOLEAN
    141 (NTAPI *PPCMCIA_IS_WRITE_PROTECTED)(
    142   IN PVOID  Context);
    143 
    144 typedef struct _PCMCIA_INTERFACE_STANDARD {
    145 	USHORT  Size;
    146 	USHORT  Version;
    147 	PINTERFACE_REFERENCE  InterfaceReference;
    148 	PINTERFACE_DEREFERENCE  InterfaceDereference;
    149 	PVOID  Context;
    150 	PPCMCIA_MODIFY_MEMORY_WINDOW  ModifyMemoryWindow;
    151 	PPCMCIA_SET_VPP  SetVpp;
    152 	PPCMCIA_IS_WRITE_PROTECTED  IsWriteProtected;
    153 } PCMCIA_INTERFACE_STANDARD, *PPCMCIA_INTERFACE_STANDARD;
    154 
    155 #ifdef __cplusplus
    156 }
    157 #endif
    158 
    159 #endif /* _NTDDPCMH_ */
    160