Merge branch 'WirelessLanSetup' into vuplus_experimental
[vuplus_dvbapp] / lib / driver / sc_test.h
1 #ifdef BUILD_VUPLUS /* ikseong  */
2 #ifndef __sc_test_h
3 #define __sc_test_h
4
5 #include <lib/base/object.h>
6 #include <lib/python/connections.h>
7
8 class eSctest
9 {
10         static eSctest *instance;
11 protected:
12         int VFD_fd;
13         
14 public:
15         eSctest();
16         ~eSctest();
17         int n_check_smart_card(char *dev_name);
18         int check_smart_card(char *dev_name);
19         int eject_smart_card(char *dev_name);
20         int VFD_Open();
21         void VFD_Close();
22         int turnon_VFD();
23         int turnoff_VFD();
24         int getFrontendstatus(int fe);
25         
26         static eSctest *getInstance() { return instance; }
27 };
28
29 #if !defined(_sci_global_h_)
30 #define _sci_global_h_
31
32 #define INT int
33 #define UCHAR unsigned char
34 #define ULONG unsigned long
35
36 #define SCI_CLASS_A                 1   /* only 5V Vcc to Smart Card */
37 #define SCI_CLASS_B                 2   /* only 3V Vcc to Smart Card */
38 #define SCI_CLASS_AB                3   /* 5V or 3V Vcc to Smart Card */
39 #define SCI_NUMBER_OF_CONTROLLERS   2   /* number of SCI controllers */
40
41 #define SCI_BUFFER_SIZE             512
42
43 #define SCI_CLOCK_STOP_DISABLED     0
44 #define SCI_CLOCK_STOP_LOW          1
45 #define SCI_CLOCK_STOP_HIGH         2
46
47 #define SCI_MAX_ATR_SIZE            33
48
49 #define SCI_MAX_F                   80000000
50 #define SCI_MAX_ETU                 0xFFF
51 #define SCI_MAX_WWT                 0xFFFFFFFF
52 #define SCI_MAX_CWT                 0xFFFF
53 #define SCI_MAX_BWT                 0xFFFFFFFF
54 #define SCI_MAX_EGT                 0xFF
55
56 #define SCI_MIN_F                   1000000
57 #define SCI_MIN_ETU                 8
58 #define SCI_MIN_WWT                 12
59 #define SCI_MIN_CWT                 12
60 #define SCI_MIN_BWT                 971
61 #define SCI_MIN_EGT                 0
62
63 #define SCI_SYNC                    0x00000001
64 #define SCI_DATA_ANY                0x00000002
65
66 /* Reserved for Future Use defined as 0 */
67 #define RFU                         0
68
69 /* error codes */
70 typedef enum
71 {
72     SCI_ERROR_OK = 0,
73     SCI_ERROR_DRIVER_NOT_INITIALIZED = -1691,
74     SCI_ERROR_FAIL,
75     SCI_ERROR_KERNEL_FAIL,
76     SCI_ERROR_NO_ATR,
77     SCI_ERROR_TS_CHARACTER_INVALID,
78     SCI_ERROR_LRC_FAIL,
79     SCI_ERROR_CRC_FAIL,
80     SCI_ERROR_LENGTH_FAIL,
81     SCI_ERROR_PARITY_FAIL,
82     SCI_ERROR_RX_OVERFLOW_FAIL,
83     SCI_ERROR_TX_OVERFLOW_FAIL,
84     SCI_ERROR_TX_UNDERRUN_FAIL,
85     SCI_ERROR_CARD_NOT_PRESENT,
86     SCI_ERROR_CARD_NOT_ACTIVATED,
87     SCI_ERROR_AWT_TIMEOUT,
88     SCI_ERROR_WWT_TIMEOUT,
89     SCI_ERROR_CWT_TIMEOUT,
90     SCI_ERROR_BWT_TIMEOUT,
91     SCI_ERROR_PARAMETER_OUT_OF_RANGE,
92     SCI_ERROR_TRANSACTION_ABORTED,
93     SCI_ERROR_CLOCK_STOP_DISABLED,
94     SCI_ERROR_TX_PENDING,
95     SCI_ERROR_ATR_PENDING
96 }
97 SCI_ERROR;
98
99 /* SCI driver modes */
100 typedef struct sci_modes
101 {
102     INT emv2000;
103     INT dma;
104     INT man_act;
105     INT rw_mode;
106 }
107 SCI_MODES;
108
109 /* SCI communication parameters */
110 typedef struct sci_parameters
111 {
112     UCHAR T;
113     ULONG FI;                           // Contains the clock rate conversion. This factor is used as an index into a table of maximum operating frequencies. When the smart card is reset, the smart card driver library uses this value to calculate a new clock frequency. 
114     ULONG ETU;                  //elementary time unit 
115     ULONG WWT;
116     ULONG CWT;
117     ULONG BWT;
118     ULONG EGT;                  //Extra Guard Time 
119     ULONG clock_stop_polarity;
120     UCHAR check;
121     UCHAR P;
122     UCHAR I;
123     UCHAR U;
124 }
125 SCI_PARAMETERS;
126
127 /* SCI ATR status */
128 typedef enum
129 {
130     SCI_WITHOUT_ATR = 0,
131     SCI_ATR_READY
132 }
133 SCI_ATR_STATUS;
134
135 #endif /* _sci_global_h_ */
136
137 #endif
138 #endif
139