Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

238 lines
10 KiB

  1. /*++
  2. Copyright (c) 1994-1999 Microsoft Corporation
  3. Module Name:
  4. pcmciap.h
  5. Abstract:
  6. This is the include file that defines constants
  7. accessing the PCMCIA Adapters.
  8. Author:
  9. Ravisankar Pudipeddi (ravisp) 1-Jan-1997
  10. Revision History:
  11. Neil Sandlin (neilsa) 10-Oct-2001 (split from ntddpcm.h)
  12. --*/
  13. #ifndef _PCMCIAPH_
  14. #define _PCMCIAPH_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. //
  19. // These are macros to manipulate the PcCardConfig type resource
  20. // descriptors - which are set by configmgr when passing in override
  21. // configurations.
  22. //
  23. //
  24. // Type of the descriptor: 1 .. 0xFFFF
  25. //
  26. #define DPTYPE_PCMCIA_CONFIGURATION 0x1
  27. #define DPTYPE_PCMCIA_MF_CONFIGURATION 0x2
  28. //
  29. // The device private structure for PC-Card configuration:
  30. //
  31. // Data[0] is configuration descriptior. Lay out below.
  32. // Byte 0: Configuration entry number (config index)
  33. // Byte 1: IO window flags
  34. // Byte 2: Type of configuration, hardcoded to DPTYPE_PCMCIA_CONFIGURATION
  35. // Byte 3: unused
  36. //
  37. // Data [1]: Cardbase offset for first memory window, flags in upper byte
  38. // Data [2]: Cardbase offset for second memory window, flags in upper byte
  39. //
  40. //
  41. // The device private structure for MF-Card configuration:
  42. //
  43. // Data[0] is configuration descriptior. Lay out below.
  44. // Byte 0: Configuration Option Register (config index)
  45. // Byte 1: Configuration and Status Register
  46. // Audio Enable (bit 3)
  47. // Byte 2: Type of configuration, hardcoded to DPTYPE_PCMCIA_MF_CONFIGURATION
  48. // Byte 3: Port Io resource descriptor index
  49. //
  50. // Data [1]: Configuration Register base
  51. // Data [2]: Unused
  52. //
  53. //
  54. // Macros for manipulating the IoResource device privates
  55. //
  56. #define PCMRES_SET_DESCRIPTOR_TYPE(IoResourceDesc, Type) (IoResourceDesc)->u.DevicePrivate.Data[0] |= ((Type) << sizeof(UCHAR)*8*2)
  57. #define PCMRES_GET_DESCRIPTOR_TYPE(IoResourceDesc) ((UCHAR) ((IoResourceDesc)->u.DevicePrivate.Data[0] >> sizeof(UCHAR)*8*2))
  58. //
  59. // Macros specific to DPTYPE_PCMCIA_CONFIGURATION
  60. //
  61. #define PCMRES_SET_CONFIG_INDEX(desc, ConfigIndex) (desc)->u.DevicePrivate.Data[0] |= ConfigIndex
  62. #define PCMRES_GET_CONFIG_INDEX(desc) ((UCHAR) ((desc)->u.DevicePrivate.Data[0]))
  63. //
  64. // Define maximum indeces for i/o and memory
  65. //
  66. #define PCMRES_PCMCIA_MAX_IO 2
  67. #define PCMRES_PCMCIA_MAX_MEM 2
  68. //
  69. // Flag definitions for Data[0]
  70. //
  71. #define PCMRESF_IO_16BIT_ACCESS 0x00000100
  72. #define PCMRESF_IO_ZERO_WAIT_8 0x00000200
  73. #define PCMRESF_IO_SOURCE_16 0x00000400
  74. #define PCMRESF_IO_WAIT_16 0x00000800
  75. #define PCMRESF_IO_FLAGS_2 0x0000F000 // used by second window
  76. #define PCMRESF_PCMCIA_TYPE_2 0x80000000 // new format indicator
  77. //
  78. // Flag definitions for Data[1], Data[2]
  79. //
  80. #define PCMRES_BASE64MB_MASK 0x03ffffff
  81. #define PCMRESF_MEM_16BIT_ACCESS 0x04000000
  82. #define PCMRESF_MEM_ATTRIBUTE 0x08000000
  83. #define PCMRESF_MEM_WAIT_1 0x10000000
  84. #define PCMRESF_MEM_WAIT_2 0x20000000
  85. #define PCMRESF_MEM_WAIT_3 0x30000000
  86. //
  87. // Macros specific to DPTYPE_PCMCIA_CONFIGURATION
  88. //
  89. #define PCMRES_SET_IO_FLAG(desc, index, flag) (desc)->u.DevicePrivate.Data[0] |= (flag << (index * 4))
  90. #define PCMRES_GET_IO_FLAG(desc, index, flag) (((desc)->u.DevicePrivate.Data[0] & (flag << (index * 4))) != 0)
  91. #define PCMRES_SET_MEMORY_FLAG(desc, index, flag) (desc)->u.DevicePrivate.Data[index+1] |= flag
  92. #define PCMRES_GET_MEMORY_FLAG(desc, index, flag) (((desc)->u.DevicePrivate.Data[index+1] & flag) != 0)
  93. #define PCMRES_SET_MEMORY_CARDBASE(desc, index, base) (desc)->u.DevicePrivate.Data[index+1] |= (base & PCMRES_BASE64MB_MASK)
  94. #define PCMRES_GET_MEMORY_CARDBASE(desc, index) ((ULONG) ((desc)->u.DevicePrivate.Data[index+1] & PCMRES_BASE64MB_MASK))
  95. #define PCMRES_SET_MEMORY_WAITSTATES PCMRES_SET_MEMORY_FLAG
  96. #define PCMRES_GET_MEMORY_WAITSTATES(desc, index) ((UCHAR) (((desc)->u.DevicePrivate.Data[index+1] >> 28)) & 3)
  97. //
  98. // Macros specific to DPTYPE_PCMCIA_MF_CONFIGURATION
  99. //
  100. #define PCMRESF_AUDIO_ENABLE 0x00000800
  101. #define PCMRES_MF_PORT_INDEX_SHIFT 24
  102. #define PCMRES_SET_CONFIG_OPTIONS(desc, opt) (desc)->u.DevicePrivate.Data[0] |= opt
  103. #define PCMRES_GET_CONFIG_OPTIONS(desc) ((UCHAR) ((desc)->u.DevicePrivate.Data[0]))
  104. #define PCMRES_SET_PORT_RESOURCE_INDEX(desc, Index) (desc)->u.DevicePrivate.Data[0] |= ((Index) << PCMRES_MF_PORT_INDEX_SHIFT)
  105. #define PCMRES_GET_PORT_RESOURCE_INDEX(desc) ((UCHAR) ((desc)->u.DevicePrivate.Data[0] >> PCMRES_MF_PORT_INDEX_SHIFT))
  106. #define PCMRES_SET_AUDIO_ENABLE(desc) (desc)->u.DevicePrivate.Data[0] |= PCMRESF_AUDIO_ENABLE
  107. #define PCMRES_GET_AUDIO_ENABLE(desc) ((UCHAR) ((desc)->u.DevicePrivate.Data[0] & PCMRESF_AUDIO_ENABLE) != 0)
  108. #define PCMRES_SET_CONFIG_REGISTER_BASE(desc, cfgbase) (desc)->u.DevicePrivate.Data[1] = cfgbase
  109. #define PCMRES_GET_CONFIG_REGISTER_BASE(desc) ((desc)->u.DevicePrivate.Data[1])
  110. //
  111. // The following macros are in the process of being obseleted
  112. //
  113. #define IORES_SET_DESCRIPTOR_TYPE PCMRES_SET_DESCRIPTOR_TYPE
  114. #define IORES_GET_DESCRIPTOR_TYPE PCMRES_GET_DESCRIPTOR_TYPE
  115. #define IORES_SET_CONFIG_INDEX PCMRES_SET_CONFIG_INDEX
  116. #define IORES_GET_CONFIG_INDEX PCMRES_GET_CONFIG_INDEX
  117. #define IORES_SET_IO_16BIT_ACCESS(desc) PCMRES_SET_IO_FLAG(desc, 0, PCMRESF_IO_16BIT_ACCESS)
  118. #define IORES_GET_IO_16BIT_ACCESS(desc) PCMRES_GET_IO_FLAG(desc, 0, PCMRESF_IO_16BIT_ACCESS)
  119. #define IORES_SET_IO_8BIT_ACCESS(desc)
  120. #define IORES_SET_IO_ZERO_WAIT_8(desc) PCMRES_SET_IO_FLAG(desc, 0, PCMRESF_IO_ZERO_WAIT_8)
  121. #define IORES_SET_IO_SOURCE_16(desc) PCMRES_SET_IO_FLAG(desc, 0, PCMRESF_IO_SOURCE_16)
  122. #define IORES_SET_IO_WAIT_16(desc) PCMRES_SET_IO_FLAG(desc, 0, PCMRESF_IO_WAIT_16)
  123. #define IORES_GET_IO_ZERO_WAIT_8(desc) PCMRES_GET_IO_FLAG(desc, 0, PCMRESF_IO_ZERO_WAIT_8)
  124. #define IORES_GET_IO_SOURCE_16(desc) PCMRES_GET_IO_FLAG(desc, 0, PCMRESF_IO_SOURCE_16)
  125. #define IORES_GET_IO_WAIT_16(desc) PCMRES_GET_IO_FLAG(desc, 0, PCMRESF_IO_WAIT_16)
  126. #define IORES_SET_MEM_16BIT_ACCESS(desc) PCMRES_SET_MEMORY_FLAG(desc, 0, PCMRESF_MEM_16BIT_ACCESS)
  127. #define IORES_GET_MEM_16BIT_ACCESS(desc) PCMRES_GET_MEMORY_FLAG(desc, 0, PCMRESF_MEM_16BIT_ACCESS)
  128. #define IORES_SET_MEM_8BIT_ACCESS(desc)
  129. #define IORES_SET_MEM_1_ATTRIBUTE_ACCESS(desc) PCMRES_SET_MEMORY_FLAG(desc, 0, PCMRESF_MEM_ATTRIBUTE)
  130. #define IORES_GET_MEM_1_ATTRIBUTE_ACCESS(desc) PCMRES_GET_MEMORY_FLAG(desc, 0, PCMRESF_MEM_ATTRIBUTE)
  131. #define IORES_SET_MEM_2_ATTRIBUTE_ACCESS(desc) PCMRES_SET_MEMORY_FLAG(desc, 1, PCMRESF_MEM_ATTRIBUTE)
  132. #define IORES_GET_MEM_2_ATTRIBUTE_ACCESS(desc) PCMRES_GET_MEMORY_FLAG(desc, 1, PCMRESF_MEM_ATTRIBUTE)
  133. #define IORES_SET_MEMORY_CARDBASE_1(desc, base) PCMRES_SET_MEMORY_CARDBASE(desc, 0, base)
  134. #define IORES_GET_MEMORY_CARDBASE_1(desc) PCMRES_GET_MEMORY_CARDBASE(desc, 0)
  135. #define IORES_SET_MEMORY_CARDBASE_2(desc, base) PCMRES_SET_MEMORY_CARDBASE(desc, 1, base)
  136. #define IORES_GET_MEMORY_CARDBASE_2(desc) PCMRES_GET_MEMORY_CARDBASE(desc, 1)
  137. #define IORES_SET_MEM_WAIT_ONE(desc) PCMRES_SET_MEMORY_WAITSTATES(desc, 0, PCMRESF_MEM_WAIT_1)
  138. #define IORES_SET_MEM_WAIT_TWO(desc) PCMRES_SET_MEMORY_WAITSTATES(desc, 0, PCMRESF_MEM_WAIT_2)
  139. #define IORES_SET_MEM_WAIT_THREE(desc) PCMRES_SET_MEMORY_WAITSTATES(desc, 0, PCMRESF_MEM_WAIT_3)
  140. #define IORES_GET_MEM_WAIT(desc) PCMRES_GET_MEMORY_WAITSTATES(desc, 0)
  141. #define IORES_SET_CONFIG_OPTIONS PCMRES_SET_CONFIG_OPTIONS
  142. #define IORES_GET_CONFIG_OPTIONS PCMRES_GET_CONFIG_OPTIONS
  143. #define IORES_SET_PORT_RESOURCE_INDEX PCMRES_SET_PORT_RESOURCE_INDEX
  144. #define IORES_GET_PORT_RESOURCE_INDEX PCMRES_GET_PORT_RESOURCE_INDEX
  145. #define IORES_SET_AUDIO_ENABLE PCMRES_SET_AUDIO_ENABLE
  146. #define IORES_GET_AUDIO_ENABLE PCMRES_GET_AUDIO_ENABLE
  147. #define IORES_SET_CONFIG_REGISTER_BASE PCMRES_SET_CONFIG_REGISTER_BASE
  148. #define IORES_GET_CONFIG_REGISTER_BASE PCMRES_GET_CONFIG_REGISTER_BASE
  149. #define CMRES_SET_DESCRIPTOR_TYPE IORES_SET_DESCRIPTOR_TYPE
  150. #define CMRES_GET_DESCRIPTOR_TYPE IORES_GET_DESCRIPTOR_TYPE
  151. #define CMRES_SET_CONFIG_INDEX IORES_SET_CONFIG_INDEX
  152. #define CMRES_GET_CONFIG_INDEX IORES_GET_CONFIG_INDEX
  153. #define CMRES_SET_IO_16BIT_ACCESS IORES_SET_IO_16BIT_ACCESS
  154. #define CMRES_GET_IO_16BIT_ACCESS IORES_GET_IO_16BIT_ACCESS
  155. #define CMRES_SET_IO_8BIT_ACCESS IORES_SET_IO_8BIT_ACCESS
  156. #define CMRES_SET_IO_ZERO_WAIT_8 IORES_SET_IO_ZERO_WAIT_8
  157. #define CMRES_SET_IO_SOURCE_16 IORES_SET_IO_SOURCE_16
  158. #define CMRES_SET_IO_WAIT_16 IORES_SET_IO_WAIT_16
  159. #define CMRES_GET_IO_ZERO_WAIT_8 IORES_GET_IO_ZERO_WAIT_8
  160. #define CMRES_GET_IO_SOURCE_16 IORES_GET_IO_SOURCE_16
  161. #define CMRES_GET_IO_WAIT_16 IORES_GET_IO_WAIT_16
  162. #define CMRES_SET_MEM_16BIT_ACCESS IORES_SET_MEM_16BIT_ACCESS
  163. #define CMRES_GET_MEM_16BIT_ACCESS IORES_GET_MEM_16BIT_ACCESS
  164. #define CMRES_SET_MEM_8BIT_ACCESS IORES_SET_MEM_8BIT_ACCESS
  165. #define CMRES_SET_MEM_WAIT_ONE IORES_SET_MEM_WAIT_ONE
  166. #define CMRES_SET_MEM_WAIT_TWO IORES_SET_MEM_WAIT_TWO
  167. #define CMRES_SET_MEM_WAIT_THREE IORES_SET_MEM_WAIT_THREE
  168. #define CMRES_GET_MEM_WAIT IORES_GET_MEM_WAIT
  169. #define CMRES_SET_MEM_1_ATTRIBUTE_ACCESS IORES_SET_MEM_1_ATTRIBUTE_ACCESS
  170. #define CMRES_GET_MEM_1_ATTRIBUTE_ACCESS IORES_GET_MEM_1_ATTRIBUTE_ACCESS
  171. #define CMRES_SET_MEM_2_ATTRIBUTE_ACCESS IORES_SET_MEM_2_ATTRIBUTE_ACCESS
  172. #define CMRES_GET_MEM_2_ATTRIBUTE_ACCESS IORES_GET_MEM_2_ATTRIBUTE_ACCESS
  173. #define CMRES_SET_MEMORY_CARDBASE_1 IORES_SET_MEMORY_CARDBASE_1
  174. #define CMRES_GET_MEMORY_CARDBASE_1 IORES_GET_MEMORY_CARDBASE_1
  175. #define CMRES_SET_MEMORY_CARDBASE_2 IORES_SET_MEMORY_CARDBASE_2
  176. #define CMRES_GET_MEMORY_CARDBASE_2 IORES_GET_MEMORY_CARDBASE_2
  177. #define CMRES_SET_CONFIG_OPTIONS IORES_SET_CONFIG_OPTIONS
  178. #define CMRES_GET_CONFIG_OPTIONS IORES_GET_CONFIG_OPTIONS
  179. #define CMRES_SET_PORT_RESOURCE_INDEX IORES_SET_PORT_RESOURCE_INDEX
  180. #define CMRES_GET_PORT_RESOURCE_INDEX IORES_GET_PORT_RESOURCE_INDEX
  181. #define CMRES_SET_AUDIO_ENABLE IORES_SET_AUDIO_ENABLE
  182. #define CMRES_GET_AUDIO_ENABLE IORES_GET_AUDIO_ENABLE
  183. #define CMRES_SET_CONFIG_REGISTER_BASE IORES_SET_CONFIG_REGISTER_BASE
  184. #define CMRES_GET_CONFIG_REGISTER_BASE IORES_GET_CONFIG_REGISTER_BASE
  185. #endif