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.

175 lines
5.4 KiB

  1. /*******************************************************************************
  2. * Copyright (c) 1997 Gemplus developpement
  3. *
  4. * Name : GNTSER.H (Gemplus NT SERial management)
  5. *
  6. * Description : This module holds the prototypes of the functions from GNTSER.C
  7. *
  8. * Release : 1.00.001
  9. *
  10. * Last Modif : 22/06/97: V1.00.001 (GPZ)
  11. * - Start of development.
  12. *
  13. ********************************************************************************
  14. *
  15. * Warning :
  16. *
  17. * Remark :
  18. *
  19. *******************************************************************************/
  20. /*------------------------------------------------------------------------------
  21. Constant section:
  22. - HGTSER_MAX_PORT holds the number of managed port. Today 4.
  23. - HGTSER_WORD_5, HGTSER_WORD_6, HGTSER_WORD_7 and HGTSER_WORD_8 allow to
  24. configure the number of bits per word.
  25. - HGTSER_STOP_BIT_1 and HGTSER_STOP_BIT_2 allow to configure the number of stop
  26. bit.
  27. - HGTSER_NO_PARITY, HGTSER_ODD_PARITY and HGTSER_EVEN_PARITY allow to configure
  28. the communication parity.
  29. - HGTSER_TX_QUEUE and HGTSER_RX_QUEUE are queues indentifiers.
  30. - HGTSER_RX_OVER is set when the reception queue is full and characters has
  31. been lost.
  32. - HGTSER_RTS_LINE is identifier of RTS line for Line status functions.
  33. - HGTSER_DTR_LINE is identifier of DTR line for Line status functions.
  34. ------------------------------------------------------------------------------*/
  35. #define HGTSER_MAX_PORT 4
  36. #define HGTSER_WORD_5 0x00
  37. #define HGTSER_WORD_6 0x01
  38. #define HGTSER_WORD_7 0x02
  39. #define HGTSER_WORD_8 0x03
  40. #define HGTSER_STOP_BIT_1 0x00
  41. #define HGTSER_STOP_BIT_2 0x04
  42. #define HGTSER_NO_PARITY 0x00
  43. #define HGTSER_ODD_PARITY 0x08
  44. #define HGTSER_EVEN_PARITY 0x18
  45. #define HGTSER_TX_QUEUE 1
  46. #define HGTSER_RX_QUEUE 2
  47. #define HGTSER_RX_OVER 1
  48. #define HGTSER_RTS_LINE 0
  49. #define HGTSER_DTR_LINE 1
  50. /*------------------------------------------------------------------------------
  51. Constant section:
  52. - WTX_TIMEOUT is the time out used when a WTX REQUEST is send by the CT.
  53. - CHAR_TIMEOUT is the timeout at character level: today 1000 ms.
  54. ------------------------------------------------------------------------------*/
  55. #define WTX_TIMEOUT 3000
  56. #define CHAR_TIMEOUT 1000
  57. /*------------------------------------------------------------------------------
  58. Type section:
  59. - TGTSER_PORT gathers data used to manage a serial port:
  60. * Port indicates the selected port.
  61. G_COM1, G_COM2, G_COM3 or G_COM4
  62. * BaudRate is used to set port baud rate when open routine is called.
  63. 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
  64. * ITNumber indicates the interrupt number to use. The 0XFF value indicates
  65. the default value. Allowed number are from 0 to 15.
  66. * Mode Memorises
  67. WORD size : 5, 6, 7 or 8
  68. stop bit number : 1 or 2
  69. parity : no parity, odd or even parity
  70. * TimeOut indicates the time out value, in milli-seconds, at character
  71. level.
  72. * TxSize is the transmit buffer size, in bytes.
  73. * RxSize is the reception buffer size, in mbytes.
  74. ------------------------------------------------------------------------------*/
  75. typedef struct
  76. {
  77. INT16 Port;
  78. WORD32 BaudRate;
  79. WORD16 ITNumber;
  80. WORD16 Mode;
  81. WORD16 TimeOut;
  82. WORD16 TxSize;
  83. WORD16 RxSize;
  84. void *pSmartcardExtension;
  85. } TGTSER_PORT;
  86. /*------------------------------------------------------------------------------
  87. - TGTSER_STATUS holds status bit about the serial communication.
  88. Today only HGTSER_RX_OVER can be set or not.
  89. ------------------------------------------------------------------------------*/
  90. typedef WORD16 TGTSER_STATUS;
  91. /*------------------------------------------------------------------------------
  92. Prototypes section:
  93. ------------------------------------------------------------------------------*/
  94. INT16 G_SerPortOpen
  95. (
  96. const TGTSER_PORT *Param
  97. );
  98. INT16 G_SerPortClose
  99. (
  100. const INT16 Handle
  101. );
  102. INT16 G_SerPortWrite
  103. (
  104. const INT16 Handle,
  105. const WORD16 Length,
  106. const BYTE Buffer[]
  107. );
  108. INT16 G_SerPortRead
  109. (
  110. const INT16 Handle,
  111. WORD16 *Length,
  112. BYTE Buffer[]
  113. );
  114. INT16 G_SerPortFlush
  115. (
  116. const INT16 Handle,
  117. const WORD16 Select
  118. );
  119. INT16 G_SerPortStatus
  120. (
  121. const INT16 Handle,
  122. WORD16 *TxLength,
  123. WORD16 *RxLength,
  124. TGTSER_STATUS *Status
  125. );
  126. INT16 G_SerPortAddUser
  127. (
  128. const INT16 Port
  129. );
  130. INT16 G_SerPortGetState
  131. (
  132. TGTSER_PORT *Param,
  133. WORD16 *UserNb
  134. );
  135. INT16 G_SerPortSetState
  136. (
  137. TGTSER_PORT *Param
  138. );
  139. INT32 G_SerPortLockComm
  140. (
  141. const INT16 Handle,
  142. const DWORD WaitRelease
  143. );
  144. void G_SerPortUnlockComm
  145. (
  146. const INT16 Handle
  147. );
  148. NTSTATUS GDDKNT_SerPortIoRequest
  149. (
  150. IN CONST INT16 Handle,
  151. IN CONST ULONG SerialIoControlCode,
  152. IN CONST ULONG CmdTimeout,
  153. IN CONST WORD16 LengthIn,
  154. IN CONST BYTE *BufferIn,
  155. IN OUT WORD16 *pLengthOut,
  156. OUT BYTE *BufferOut
  157. );
  158. NTSTATUS GDDKNT_SetCommState
  159. (
  160. const INT16 Handle,
  161. SERIAL_READER_CONFIG *SerialConfig
  162. );
  163. NTSTATUS GDDKNT_GetCommState
  164. (
  165. const INT16 Handle,
  166. SERIAL_READER_CONFIG *SerialConfig
  167. );