home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / usbd0906.zip / usb_20020906.zip / usbcalls / samples / Cardreader / GemCore.h < prev    next >
C/C++ Source or Header  |  2001-11-13  |  2KB  |  69 lines

  1. /*
  2.  *  GemPC430.h
  3.  *  ifd-GemPC430
  4.  *
  5.  *  Created by JL Giraud <jl.giraud@free.fr> on Sun Nov 19 2000.
  6.  *  License:   See file COPYING
  7.  *
  8.  */
  9.  
  10. #ifndef _GEMCORE_H_
  11. #define _GEMCORE_H_
  12.  
  13. // Communication buffer size (max=cmd+adpu+Lc+data+Le)
  14. #define CMD_BUF_SIZE (1+4+1+255+1)
  15. // Larger communication buffer size (max=reader status+data+sw)
  16. #define RESP_BUF_SIZE (1+256+2)
  17.  
  18. // Offset of the status byte in a reader answer (CMD level)
  19. #define STATUS_OFFSET 0
  20. // Offset of the first byte of the ATR in a reader answer  (CMD level)
  21. #define ATR_OFFSET 1
  22.  
  23. // Offset of the command byte in a GemCore command (CMD level)
  24. #define OFFSET_CMD 0
  25. // Offset of the APDU in a GemCore command (CMD level)
  26. #define OFFSET_APDU 1
  27. // Offset of the DATA in a GemCore response (CMD level)
  28. #define OFFSET_DATA 1
  29. // Nb of bytes added to the APDU in a GemCore command (CMD level)
  30. #define FORMAT_SIZE 1
  31. // STAT byte offset in a response to CARD STATUS command (CMD level)
  32. #define OFFSET_STAT_BYTE 1
  33. // Size of an ADPU
  34. #define APDU_SIZE 4
  35.  
  36. // Bit mask to detect ICC presence
  37. #define MASK_ICC_PRESENCE 0x04
  38.  
  39. // Gemcore error codes
  40. enum {
  41.     GCORE_OK               = 0x00,
  42.     GCORE_UNKNOWN_CMD      = 0x01,
  43.     GCORE_WRONG_TCK    = 0x1D,
  44.     GCORE_CARD_PROT_ERR    = 0xA1,
  45.     GCORE_CARD_MUTE        = 0xA2,
  46.     GCORE_CARD_EXC_INT     = 0xE5,
  47.     GCORE_NOT_9000       = 0xE7
  48. };
  49.  
  50. // Protocols
  51. enum
  52. {
  53.     T_0                    = 0,
  54.     T_1                    = 1
  55. };
  56.  
  57. // Number of slots a GemCore reader can address
  58. #define MAX_SLOT_NB 2
  59.  
  60. #define MAX_ATR_SIZE       33
  61. typedef struct GCORE_DESC
  62. {
  63.   ULONG nATRLength;
  64.   UCHAR pcATRBuffer[MAX_ATR_SIZE];
  65. } GCoreDesc;
  66.  
  67. #define GCoreLunToSlotNb(x) (0)
  68. #endif
  69.