Source code of Windows XP (NT5)
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.

343 lines
8.2 KiB

  1. /*++
  2. Copyright (c) 1994-1999 Microsoft Corporation
  3. Module Name:
  4. 82365sl.h
  5. Abstract:
  6. This module defines the PCMCIA tuple structures.
  7. Author(s):
  8. Bob Rinne (BobRi) 2-Aug-1994
  9. prototype from Jeff McLeman (mcleman@zso.dec.com)
  10. Revision History:
  11. Ravisankar Pudipeddi (ravisp) 1-Feb-1997
  12. Additional definitions, more macros to parse tuples etc.
  13. Notes:
  14. Tuple codes and names derived from the "PCMCIA PC CARD STANDARD"
  15. Release 2.01 CARD METAFORMAT section (Basic Compatibility Layer 1)
  16. Revisions:
  17. --*/
  18. #if _MSC_VER > 1000
  19. #pragma once
  20. #endif
  21. //
  22. // Tuple codes
  23. //
  24. #define CISTPL_NULL 0x00
  25. #define CISTPL_DEVICE 0x01
  26. #define CISTPL_INDIRECT 0x03
  27. #define CISTPL_CONFIG_CB 0x04
  28. #define CISTPL_CFTABLE_ENTRY_CB 0x05
  29. #define CISTPL_LONGLINK_MFC 0x06
  30. #define CISTPL_CHECKSUM 0x10
  31. #define CISTPL_LONGLINK_A 0x11
  32. #define CISTPL_LONGLINK_C 0x12
  33. #define CISTPL_LINKTARGET 0x13
  34. #define CISTPL_NO_LINK 0x14
  35. #define CISTPL_VERS_1 0x15
  36. #define CISTPL_ALTSTR 0x16
  37. #define CISTPL_DEVICE_A 0x17
  38. #define CISTPL_JEDEC_C 0x18
  39. #define CISTPL_JEDEC_A 0x19
  40. #define CISTPL_CONFIG 0x1a
  41. #define CISTPL_CFTABLE_ENTRY 0x1b
  42. #define CISTPL_DEVICE_OC 0x1c
  43. #define CISTPL_DEVICE_OA 0x1d
  44. #define CISTPL_GEODEVICE 0x1e
  45. #define CISTPL_GEODEVICE_A 0x1f
  46. #define CISTPL_MANFID 0x20
  47. #define CISTPL_FUNCID 0x21
  48. #define CISTPL_FUNCE 0x22
  49. #define CISTPL_VERS_2 0x40
  50. #define CISTPL_FORMAT 0x41
  51. #define CISTPL_GEOMETRY 0x42
  52. #define CISTPL_BYTEORDER 0x43
  53. #define CISTPL_DATE 0x44
  54. #define CISTPL_BATTERY 0x45
  55. #define CISTPL_ORG 0x46
  56. #define CISTPL_LONGLINK_CB 0x47
  57. #define CISTPL_END 0xFF
  58. //
  59. // Tuple structures and offsets - used based on tuple code.
  60. //
  61. //
  62. // UCHAR
  63. // CodeByte(
  64. // IN PUCHAR TupleBase
  65. // );
  66. //
  67. // Routine Description:
  68. //
  69. // This returns the contents of the tuple code byte for the tuple
  70. // pointer passed in.
  71. //
  72. // Arguments:
  73. //
  74. // TupleBase - a pointer to the current tuple.
  75. //
  76. // Return Values:
  77. //
  78. // The contents of the tupleCode byte in the tuple.
  79. //
  80. #define CodeByte(TUPLE_BASE) (*(TUPLE_BASE))
  81. //
  82. // UCHAR
  83. // LinkByte(
  84. // IN PUCHAR TupleBase
  85. // );
  86. //
  87. // Routine Description:
  88. //
  89. // This returns the contents of the link byte for the tuple
  90. // pointer passed in.
  91. //
  92. // Arguments:
  93. //
  94. // TupleBase - a pointer to the current tuple.
  95. //
  96. // Return Values:
  97. //
  98. // The contents of the link byte in the tuple.
  99. //
  100. #define LinkByte(TUPLE_BASE) (*(TUPLE_BASE + 1))
  101. //
  102. //
  103. // PUCHAR
  104. // TupleBody(
  105. // IN PUCHAR TupleBase
  106. // );
  107. //
  108. // Routine Description:
  109. //
  110. // This returns the pointer to the tuple body for the tuple
  111. // pointer passed in
  112. //
  113. // Arguments:
  114. //
  115. // TupleBase - a pointer to the current tuple.
  116. //
  117. // Return Values:
  118. //
  119. // The pointer to the body of the tuple
  120. //
  121. #define TupleBody(TUPLE_BASE) (TUPLE_BASE+2)
  122. //
  123. //
  124. // PUCHAR
  125. // NextTuple(
  126. // IN PUCHAR TupleBase
  127. // );
  128. //
  129. // Routine Description:
  130. //
  131. // This macro locates the next tuple in a stream of bytes given a pointer
  132. // to the current tuple. This is done by adding the appropriate
  133. // link value to the current pointer.
  134. //
  135. // Arguments:
  136. //
  137. // TupleBase - a pointer to the current tuple.
  138. //
  139. // Return Values:
  140. //
  141. // A pointer to the next tuple.
  142. //
  143. #define NextTuple(TUPLE_BASE) (*TUPLE_BASE ? \
  144. /* there is a link pointer case */ \
  145. (TUPLE_BASE + LinkByte(TUPLE_BASE) + 2) :\
  146. /* this is a NULL tuple */ \
  147. (TUPLE_BASE + 1))
  148. //
  149. // Device Tuple information.
  150. //
  151. #define DSPEED_MASK 0x07
  152. #define DeviceSpeedField(X) (X & DSPEED_MASK)
  153. #define WPS_MASK 0x08
  154. #define DeviceWPS(X) ((X & WPS_MASK) >> 3)
  155. #define DTYPE_MASK 0xF0
  156. #define DeviceTypeCode(X) ((X & DTYPE_MASK) >> 4)
  157. #define DTYPE_NULL 0x00
  158. #define DTYPE_ROM 0x01
  159. #define DTYPE_OTPROM 0x02
  160. #define DTYPE_EPROM 0x03
  161. #define DTYPE_EEPROM 0x04
  162. #define DTYPE_FLASH 0x05
  163. #define DTYPE_SRAM 0x06
  164. #define DTYPE_DRAM 0x07
  165. #define DTYPE_FUNCSPEC 0x0d
  166. #define DTYPE_EXTEND 0x0e
  167. #define DSPEED_NULL 0x00
  168. #define DSPEED_250NS 0x01
  169. #define DSPEED_200NS 0x02
  170. #define DSPEED_150NS 0x03
  171. #define DSPEED_100NS 0x04
  172. #define DSPEED_RES1 0x05
  173. #define DSPEED_RES2 0x06
  174. #define DSPEED_EXT 0x07
  175. //
  176. // extended speed definitions
  177. //
  178. #define SPEED_MANTISSA_MASK 0x78
  179. #define SpeedMantissa(X) ((X & SPEED_MANTISSA_MASK) > 3)
  180. #define SPEED_EXPONENT_MASK 0x07
  181. #define SpeedExponent(X) (X & SPEED_EXPONENT_MASK)
  182. #define SPEED_EXT_MASK 0x80
  183. #define SpeedEXT(X) ((X & SPEED_EXT_MASK) > 7)
  184. #define MANTISSA_RES1 0x00
  185. #define MANTISSA_1_0 0x01
  186. #define MANTISSA_1_2 0x02
  187. #define MANTISSA_1_3 0x03
  188. #define MANTISSA_1_5 0x04
  189. #define MANTISSA_2_0 0x05
  190. #define MANTISSA_2_5 0x06
  191. #define MANTISSA_3_0 0x07
  192. #define MANTISSA_3_5 0x08
  193. #define MANTISSA_4_0 0x09
  194. #define MANTISSA_4_5 0x0a
  195. #define MANTISSA_5_0 0x0b
  196. #define MANTISSA_5_5 0x0c
  197. #define MANTISSA_6_0 0x0d
  198. #define MANTISSA_7_0 0x0e
  199. #define MANTISSA_8_0 0x0f
  200. #define EXPONENT_1ns 0x00
  201. #define EXPONENT_10ns 0x01
  202. #define EXPONENT_100ns 0x02
  203. #define EXPONENT_1us 0x03
  204. #define EXPONENT_10us 0x04
  205. #define EXPONENT_100us 0x05
  206. #define EXPONENT_1ms 0x06
  207. #define EXPONENT_10ms 0x07
  208. //
  209. // Configuration tuple
  210. //
  211. #define CCST_CIF 0xC0
  212. #define TPCC_RFSZ_MASK 0xc0
  213. #define TpccRfsz(X) ((X & TPCC_RFSZ_MASK) >> 6)
  214. #define TPCC_RMSZ_MASK 0x3c
  215. #define TpccRmsz(X) ((X & TPCC_RMSZ_MASK) >> 2)
  216. #define TPCC_RASZ_MASK 0x03
  217. #define TpccRasz(X) (X & TPCC_RASZ_MASK)
  218. //
  219. // CFTABLE_ENTRY data items
  220. //
  221. #define IntFace(X) ((X & 0x80) >> 7)
  222. #define Default(X) ((X & 0x40) >> 6)
  223. #define ConfigEntryNumber(X) (X & 0x3f)
  224. #define PowerInformation(X) (X & 0x03)
  225. #define TimingInformation(X) ((X & 0x04) >> 2)
  226. #define IoSpaceInformation(X) ((X & 0x08) >> 3)
  227. #define IRQInformation(X) ((X & 0x10) >> 4)
  228. #define MemSpaceInformation(X) ((X & 0x60) >> 5)
  229. #define MiscInformation(X) ((X & 0x80) >> 7)
  230. //
  231. // Power information (part of CISTPL_CFTABLE_ENTRY) defines.
  232. //
  233. #define EXTENSION_BYTE_FOLLOWS 0x80
  234. //
  235. // Io Space information (part of CISTPL_CFTABLE_ENTRY) defines.
  236. //
  237. #define IO_ADDRESS_LINES_MASK 0x1f
  238. #define RANGE_MASK 0x0f
  239. #define Is8BitAccess(X) ((X & 0x20) >> 5)
  240. #define Is16BitAccess(X) ((X & 0x40) >> 6)
  241. #define HasRanges(X) ((X & 0x80) >> 7)
  242. #define GetAddressSize(X) ((X & 0x30) >> 4)
  243. #define GetLengthSize(X) ((X & 0xc0) >> 6)
  244. //
  245. // CISTPL_FUNCID function codes
  246. //
  247. #define PCCARD_TYPE_MULTIFUNCTION 0
  248. #define PCCARD_TYPE_MEMORY 1
  249. #define PCCARD_TYPE_SERIAL 2
  250. #define PCCARD_TYPE_PARALLEL 3
  251. #define PCCARD_TYPE_ATA 4
  252. #define PCCARD_TYPE_VIDEO 5
  253. #define PCCARD_TYPE_NETWORK 6
  254. #define PCCARD_TYPE_AIMS 7
  255. #define PCCARD_TYPE_SCSI_BRIDGE 8
  256. #define PCCARD_TYPE_SECURITY 9
  257. //LATER: definitions not in spec
  258. #define PCCARD_TYPE_MULTIFUNCTION3 10
  259. #define PCCARD_TYPE_FLASH_MEMORY 11
  260. #define PCCARD_TYPE_MODEM 12
  261. #define PCCARD_TYPE_RESERVED 0xff
  262. /******************************************************************
  263. * Tuple Flags.
  264. ******************************************************************/
  265. #define TPLF_COMMON 0x0001
  266. #define TPLF_READ 0x0002 // Only passed to AccessCISMem
  267. #define TPLF_INDIRECT 0x0004
  268. #define TPLF_IND_LINK 0x0008
  269. #define TPLF_NOTHING 0x0000 // 0 is an unused entry
  270. #define TPLF_IMPLIED_LINK 0x0010
  271. #define TPLF_NO_LINK 0x0020
  272. #define TPLF_LINK_TO_A 0x0030
  273. #define TPLF_LINK_TO_C 0x0040
  274. #define TPLF_LINK_TO_CB 0x0050
  275. #define TPLF_LINK_MASK 0x0070
  276. #define TPLF_ASI 0x0700
  277. #define TPLF_ASI_SHIFT 8
  278. #define TPLF_RESERVED_BITS 0xF882
  279. //
  280. // Tuple attributes
  281. //
  282. #define TPLA_RET_LINKS 0x0001
  283. #define TPLA_RESERVED_BITS 0xFFFE
  284. #define TPLL_ADDR 0x2
  285. #define TPLMFC_NUM 0x2