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.

166 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1998 Gemplus Development
  3. Name:
  4. GNTSER.H (Gemplus NT SERial management)
  5. Description :
  6. This module holds the prototypes of the functions from GNTSER.C
  7. Revision History :
  8. dd/mm/yy
  9. 13/03/98: V1.00.001 (GPZ)
  10. - Start of development.
  11. --*/
  12. #ifndef _GNTSER_
  13. #define _GNTSER_
  14. //
  15. // Constant section:
  16. // - HGTSER_MAX_PORT holds the number of managed port. Today 4.
  17. // - HGTSER_WORD_5, HGTSER_WORD_6, HGTSER_WORD_7 and HGTSER_WORD_8 allow to
  18. // configure the number of bits per word.
  19. // - HGTSER_STOP_BIT_1 and HGTSER_STOP_BIT_2 allow to configure the number of stop
  20. // bit.
  21. // - HGTSER_NO_PARITY, HGTSER_ODD_PARITY and HGTSER_EVEN_PARITY allow to configure
  22. // the communication parity.
  23. // - HGTSER_TX_QUEUE and HGTSER_RX_QUEUE are queues indentifiers.
  24. // - HGTSER_RX_OVER is set when the reception queue is full and characters has
  25. // been lost.
  26. // - WTX_TIMEOUT is the time out used when a WTX REQUEST is send by the CT.
  27. // - CHAR_TIMEOUT is the timeout at character level: today 1000 ms.
  28. //
  29. #define HGTSER_MAX_PORT 4
  30. #define HGTSER_WORD_5 0x00
  31. #define HGTSER_WORD_6 0x01
  32. #define HGTSER_WORD_7 0x02
  33. #define HGTSER_WORD_8 0x03
  34. #define HGTSER_STOP_BIT_1 0x00
  35. #define HGTSER_STOP_BIT_2 0x04
  36. #define HGTSER_NO_PARITY 0x00
  37. #define HGTSER_ODD_PARITY 0x08
  38. #define HGTSER_EVEN_PARITY 0x18
  39. #define HGTSER_TX_QUEUE 1
  40. #define HGTSER_RX_QUEUE 2
  41. #define HGTSER_RX_OVER 1
  42. #define WTX_TIMEOUT 3000
  43. #define CHAR_TIMEOUT 1000
  44. //
  45. // Type section:
  46. // - TGTSER_PORT gathers data used to manage a serial port:
  47. // * Port indicates the selected port.
  48. // G_COM1, G_COM2, G_COM3 or G_COM4
  49. // * BaudRate is used to set port baud rate when open routine is called.
  50. // 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
  51. // * Mode Memorises
  52. // WORD size : 5, 6, 7 or 8
  53. // stop bit number : 1 or 2
  54. // parity : no parity, odd or even parity
  55. // * TimeOut indicates the time out value, in milli-seconds, at character
  56. // level.
  57. // * TxSize is the transmit buffer size, in bytes.
  58. // * RxSize is the reception buffer size, in bytes.
  59. //
  60. typedef struct
  61. {
  62. SHORT Port;
  63. ULONG BaudRate;
  64. USHORT Mode;
  65. ULONG TimeOut;
  66. USHORT TxSize;
  67. USHORT RxSize;
  68. void *pSmartcardExtension;
  69. } TGTSER_PORT;
  70. //
  71. // Prototypes section:
  72. //
  73. NTSTATUS
  74. GDDK_SerPortOpen(
  75. const TGTSER_PORT *Param,
  76. SHORT *Handle
  77. );
  78. NTSTATUS
  79. GDDK_SerPortClose(
  80. const SHORT Handle
  81. );
  82. NTSTATUS
  83. GDDK_SerPortWrite(
  84. const SHORT Handle,
  85. const USHORT Length,
  86. const BYTE Buffer[]
  87. );
  88. NTSTATUS
  89. GDDK_SerPortRead(
  90. const SHORT Handle,
  91. USHORT *Length,
  92. BYTE Buffer[]
  93. );
  94. NTSTATUS
  95. GDDK_SerPortFlush(
  96. const SHORT Handle,
  97. const USHORT Select
  98. );
  99. NTSTATUS
  100. GDDK_SerPortAddUser(
  101. const SHORT Port,
  102. SHORT *Handle
  103. );
  104. NTSTATUS
  105. GDDK_SerPortGetState(
  106. const SHORT Handle,
  107. TGTSER_PORT *Param,
  108. USHORT *UserNb
  109. );
  110. NTSTATUS
  111. GDDK_SerPortSetState(
  112. const SHORT Handle,
  113. TGTSER_PORT *Param
  114. );
  115. BOOLEAN
  116. GDDK_SerPortLockComm(
  117. const SHORT Handle,
  118. const DWORD WaitRelease
  119. );
  120. VOID
  121. GDDK_SerPortUnlockComm(
  122. const SHORT Handle
  123. );
  124. NTSTATUS
  125. GDDKNT_SerPortIoRequest(
  126. CONST SHORT Handle,
  127. CONST ULONG SerialIoControlCode,
  128. CONST ULONG CmdTimeout,
  129. CONST USHORT LengthIn,
  130. CONST BYTE *BufferIn,
  131. USHORT *pLengthOut,
  132. BYTE *BufferOut
  133. );
  134. NTSTATUS
  135. GDDKNT_SetCommState(
  136. const SHORT Handle,
  137. SERIAL_READER_CONFIG *SerialConfig
  138. );
  139. NTSTATUS
  140. GDDKNT_GetCommState(
  141. const SHORT Handle,
  142. SERIAL_READER_CONFIG *SerialConfig
  143. );
  144. NTSTATUS SER_SetPortTimeout( const short Handle, ULONG Timeout);
  145. #endif