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.

311 lines
11 KiB

  1. /*****************************************************************************
  2. @doc INT EXT
  3. ******************************************************************************
  4. * $ProjectName: $
  5. * $ProjectRevision: $
  6. *-----------------------------------------------------------------------------
  7. * $Source: z:/pr/cmbp0/sw/cmbp0.ms/rcs/cmbp0scr.h $
  8. * $Revision: 1.3 $
  9. *-----------------------------------------------------------------------------
  10. * $Author: WFrischauf $
  11. *-----------------------------------------------------------------------------
  12. * History: see EOF
  13. *-----------------------------------------------------------------------------
  14. *
  15. * Copyright 2000 OMNIKEY AG
  16. ******************************************************************************/
  17. #if !defined ( __CMMOB_PNP_SCR_H__ )
  18. #define __CMMOB_PNP_SCR_H__
  19. #ifdef MEMORYCARD
  20. #define ADDR_WRITEREG_FLAGS0 0x00
  21. #define ADDR_WRITEREG_FLAGS1 0x02
  22. #define ADDR_WRITEREG_PROCEDURE_T0 0x08
  23. #define ADDR_WRITEREG_MESSAGE_LENGTH 0x0A
  24. #define ADDR_WRITEREG_BAUDRATE 0x0C
  25. #define ADDR_WRITEREG_STOPBITS 0x0E
  26. #define ADDR_READREG_FLAGS0 0x00
  27. #define ADDR_READREG_LASTPROCEDURE_T0 0x02
  28. #define ADDR_READREG_BYTESTORECEIVE_T1 0x02
  29. #define ADDR_READREG_BYTES_RECEIVED 0x04
  30. #define ADDR_READREG_FLAGS1 0x06
  31. // Flags 0 Read Register
  32. #define FLAG_INSERTED 0x01
  33. #define FLAG_POWERED 0x02
  34. #define FLAG_BYTES_RECEIVED_B9 0x04
  35. #define FLAG_RECEIVE 0x08
  36. // Flag Procedure Bytes Received
  37. #define FLAG_NOPROCEDURE_RECEIVED 0x80
  38. // Flags 1 Write Register
  39. #define FLAG_BAUDRATE_HIGH 0x01
  40. #define FLAG_INVERS_PARITY 0x02
  41. #define FLAG_CLOCK_8MHZ 0x04
  42. #define FLAG_T0_WRITE 0x08
  43. // Flags 0 Write Register (Commands)
  44. #define CMD_RESET_SM 0x80
  45. #define CMD_POWERON_COLD 0x44
  46. #define CMD_POWERON_WARM 0x46
  47. #define CMD_POWEROFF 0x42
  48. #define CMD_WRITE_T0 0x48
  49. #define CMD_WRITE_T1 0x50
  50. #endif
  51. #ifdef IOCARD
  52. #define ADDR_WRITEREG_FLAGS0 0x00
  53. #define ADDR_WRITEREG_FLAGS1 0x01
  54. #define ADDR_WRITEREG_PROCEDURE_T0 0x02
  55. #define ADDR_WRITEREG_BUFFER_ADDR 0x03
  56. #define ADDR_WRITEREG_BUFFER_DATA 0x04
  57. #define ADDR_WRITEREG_MESSAGE_LENGTH 0x05
  58. #define ADDR_WRITEREG_BAUDRATE 0x06
  59. #define ADDR_WRITEREG_STOPBITS 0x07
  60. #define ADDR_READREG_FLAGS0 0x00
  61. #define ADDR_READREG_LASTPROCEDURE_T0 0x01
  62. #define ADDR_READREG_BYTESTORECEIVE_T1 0x01
  63. #define ADDR_READREG_BYTES_RECEIVED 0x02
  64. #define ADDR_READREG_FLAGS1 0x03
  65. #define ADDR_READREG_BUFFER_DATA 0x04
  66. // Flags 0 Read Register
  67. #define FLAG_INSERTED 0x01
  68. #define FLAG_POWERED 0x02
  69. #define FLAG_BYTES_RECEIVED_B9 0x04
  70. // meaning of the flag: Receiving T1
  71. // Receiving T0 finished
  72. // Reader detection
  73. #define FLAG_RECEIVE 0x08
  74. // Flag 1 Read Register
  75. #define FLAG_NOPROCEDURE_RECEIVED 0x80
  76. // Flags 1 Write Register
  77. #define FLAG_BAUDRATE_HIGH 0x01
  78. #define FLAG_INVERS_PARITY 0x02
  79. #define FLAG_CLOCK_8MHZ 0x04
  80. #define FLAG_T0_WRITE 0x08
  81. #define FLAG_BUFFER_ADDR_B9 0x10
  82. #define FLAG_TACTIVE 0x20
  83. #define FLAG_CHECK_PRESENCE 0x40
  84. #define FLAG_READ_CIS 0x80
  85. // Flags 0 Write Register (Commands)
  86. #define CMD_RESET_SM 0x80
  87. #define CMD_POWERON_COLD 0x44
  88. #define CMD_POWERON_WARM 0x46
  89. #define CMD_POWEROFF 0x42
  90. #define CMD_WRITE_T0 0x48
  91. #define CMD_WRITE_T1 0x50
  92. #endif
  93. NTSTATUS CMMOB_CardPower (
  94. IN PSMARTCARD_EXTENSION SmartcardExtension
  95. );
  96. NTSTATUS CMMOB_PowerOnCard (
  97. IN PSMARTCARD_EXTENSION SmartcardExtension,
  98. IN PUCHAR pbATR,
  99. IN BOOLEAN fMaxWaitTime,
  100. OUT PULONG pulATRLength
  101. );
  102. NTSTATUS CMMOB_PowerOffCard (
  103. IN PSMARTCARD_EXTENSION SmartcardExtension
  104. );
  105. NTSTATUS CMMOB_Transmit (
  106. IN PSMARTCARD_EXTENSION SmartcardExtension
  107. );
  108. NTSTATUS CMMOB_TransmitT0 (
  109. PSMARTCARD_EXTENSION SmartcardExtension
  110. );
  111. NTSTATUS CMMOB_TransmitT1 (
  112. PSMARTCARD_EXTENSION SmartcardExtension
  113. );
  114. NTSTATUS CMMOB_SetProtocol (
  115. IN PSMARTCARD_EXTENSION SmartcardExtension
  116. );
  117. NTSTATUS CMMOB_SetFlags1 (
  118. PREADER_EXTENSION ReaderExtension
  119. );
  120. NTSTATUS CMMOB_IoCtlVendor (
  121. IN PSMARTCARD_EXTENSION SmartcardExtension
  122. );
  123. NTSTATUS CMMOB_SetHighSpeed_CR80S_SAMOS (
  124. IN PSMARTCARD_EXTENSION SmartcardExtension
  125. );
  126. NTSTATUS CMMOB_SetSpeed (
  127. IN PSMARTCARD_EXTENSION SmartcardExtension,
  128. IN PUCHAR abFIDICommand
  129. );
  130. NTSTATUS CMMOB_SetReader_9600Baud (
  131. IN PSMARTCARD_EXTENSION SmartcardExtension
  132. );
  133. NTSTATUS CMMOB_SetReader_38400Baud (
  134. IN PSMARTCARD_EXTENSION SmartcardExtension
  135. );
  136. NTSTATUS CMMOB_ReadDeviceDescription(
  137. IN PSMARTCARD_EXTENSION SmartcardExtension
  138. );
  139. NTSTATUS CMMOB_GetFWVersion (
  140. IN PSMARTCARD_EXTENSION SmartcardExtension
  141. );
  142. NTSTATUS CMMOB_CardTracking (
  143. IN PSMARTCARD_EXTENSION SmartcardExtension
  144. );
  145. VOID CMMOB_CompleteCardTracking(
  146. IN PSMARTCARD_EXTENSION SmartcardExtension
  147. );
  148. NTSTATUS CMMOB_CancelCardTracking(
  149. PDEVICE_OBJECT DeviceObject,
  150. PIRP Irp
  151. );
  152. NTSTATUS CMMOB_StartCardTracking(
  153. IN PDEVICE_OBJECT DeviceObject
  154. );
  155. VOID CMMOB_StopCardTracking(
  156. IN PDEVICE_OBJECT DeviceObject
  157. );
  158. VOID CMMOB_UpdateCurrentStateThread(
  159. IN PVOID Context
  160. );
  161. NTSTATUS CMMOB_UpdateCurrentState(
  162. IN PSMARTCARD_EXTENSION SmartcardExtension
  163. );
  164. NTSTATUS CMMOB_ResetReader(
  165. IN PREADER_EXTENSION ReaderExtension
  166. );
  167. NTSTATUS CMMOB_BytesReceived(
  168. IN PREADER_EXTENSION ReaderExtension,
  169. OUT PULONG pulBytesReceived
  170. );
  171. NTSTATUS CMMOB_SetCardParameters(
  172. IN PREADER_EXTENSION ReaderExtension
  173. );
  174. BOOLEAN CMMOB_CardInserted(
  175. IN PREADER_EXTENSION ReaderExtension
  176. );
  177. BOOLEAN CMMOB_CardPowered(
  178. IN PREADER_EXTENSION ReaderExtension
  179. );
  180. BOOLEAN CMMOB_ProcedureReceived(
  181. IN PREADER_EXTENSION ReaderExtension
  182. );
  183. BOOLEAN CMMOB_GetReceiveFlag(
  184. IN PREADER_EXTENSION ReaderExtension
  185. );
  186. NTSTATUS CMMOB_GetProcedureByte(
  187. IN PREADER_EXTENSION ReaderExtension,
  188. OUT PUCHAR pbProcedureByte
  189. );
  190. NTSTATUS CMMOB_ReadRegister(
  191. IN PREADER_EXTENSION ReaderExtension,
  192. IN USHORT usAddress,
  193. OUT PUCHAR pbData
  194. );
  195. NTSTATUS CMMOB_WriteRegister(
  196. IN PREADER_EXTENSION ReaderExtension,
  197. IN USHORT usAddress,
  198. IN UCHAR bData
  199. );
  200. NTSTATUS CMMOB_ReadBuffer(
  201. IN PREADER_EXTENSION ReaderExtension,
  202. IN ULONG ulOffset,
  203. IN ULONG ulLength,
  204. OUT PUCHAR pbData
  205. );
  206. NTSTATUS CMMOB_WriteBuffer(
  207. IN PREADER_EXTENSION ReaderExtension,
  208. IN ULONG ulLength,
  209. IN PUCHAR pbData
  210. );
  211. NTSTATUS CMMOB_ReadT0(
  212. IN PREADER_EXTENSION ReaderExtension,
  213. IN ULONG ulBytesToRead,
  214. IN ULONG ulBytesSent,
  215. IN ULONG ulCWT,
  216. OUT PUCHAR pbData,
  217. OUT PULONG pulBytesRead,
  218. OUT PBOOLEAN pfDataSent
  219. );
  220. NTSTATUS CMMOB_ReadT1(
  221. IN PREADER_EXTENSION ReaderExtension,
  222. IN LONG ulBytesToRead,
  223. IN ULONG ulBWT,
  224. IN ULONG ulCWT,
  225. OUT PUCHAR pbData,
  226. OUT PULONG pulBytesRead
  227. );
  228. NTSTATUS CMMOB_WriteT0(
  229. IN PREADER_EXTENSION ReaderExtension,
  230. IN ULONG ulBytesToWrite,
  231. IN ULONG ulBytesToReceive,
  232. IN PUCHAR pbData
  233. );
  234. NTSTATUS CMMOB_WriteT1(
  235. IN PREADER_EXTENSION ReaderExtension,
  236. IN ULONG ulBytesToWrite,
  237. IN PUCHAR pbData
  238. );
  239. VOID CMMOB_InverseBuffer (
  240. PUCHAR pbBuffer,
  241. ULONG ulBufferSize
  242. );
  243. #endif // __CMMOB_PNP_SCR_H__
  244. /*****************************************************************************
  245. * History:
  246. * $Log: cmbp0scr.h $
  247. * Revision 1.3 2000/07/27 13:53:05 WFrischauf
  248. * No comment given
  249. *
  250. *
  251. ******************************************************************************/