blob: 7184ad8d8e810416f7d8741296e1d9a71fe854d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
/*
* Copyright (C) 2009 Samsung Electronics, Co. Ltd.
* All rights reserved.
*
* Oem_ril_sap.h
*
* author: young jin Park (lucky29.park@samsung.com)
* data : 20100129
*/
#ifndef __OEM_RIL_SAP_H__
#define __OEM_RIL_SAP_H__
/**
* OEM request header data(for RIL_REQUEST_OEM_HOOK_RAW)
typedef struct _OemReqDataHdr
{
char func_id;
char sub_func_id;
char len;
} __attribute__((packed)) OemReqDataHdr;
* OEM request data(for RIL_REQUEST_OEM_HOOK_RAW)
typedef struct _OemReqData
{
OemReqDataHdr hdr;
char *payload;
} __attribute__((packed)) OemReqData;
**/
/* -- OEM RIL SAP Main Cmd --*/
#define OEM_FUNCTION_ID_SAP 0x14
/* -- OEM RIL SAP SUB FUNCTION ID -- */
#define OEM_SAP_CONNECT 0x01
/** OEM_SAP_CONNECT
Req - Format info
1. MSG ID (1 byte)
Res - Format info
1. MSG ID (1 byte)
2. CONNECTION STATUS (1 byte)
3. MAX MSG SIZE (2 byte)
Noti(Unsol) - Format info
1. DISCONNECT TYPE (1 byte)
**/
#define OEM_SAP_STATUS 0x02
/** OEM_SAP_STATUS
Req - Format info
non.
Res - Format info
1. SAP Status (1 byte)
Noti(Unsol) - Format info
1. Card Status (1 byte)
**/
#define OEM_SAP_READER_STATUS 0x03
/** OEM_SAP_READER_STATUS
Req - Format info
non.
Res - Format info
1. Result code (1 byte)
2. Card reader status (1 byte)
Noti(Unsol) - Format info
non.
**/
#define OEM_SAP_SIM_POWER 0x04
/** OEM_SAP_SIM_POWER
Req - Format info
1. MSG ID (1 byte)
Res - Format info
1. MSG ID (1 byte)
2. Result code (1 byte)
Noti(Unsol) - Format info
non.
**/
#define OEM_SAP_TRANSFER_ATR 0x05
/** OEM_SAP_TRANSFER_ATR
Req - Format info
non.
Res - Format info
1. Result code (1 byte)
2. ATR length (2 byte)
3. ATR (variables)
Noti(Unsol) - Format info
non.
**/
#define OEM_SAP_TRANSFER_APDU 0x06
/** OEM_SAP_TRANSFER_APDU
Req - Format info
1. APDU length(2 byte)
2. commadn apdu or apdu_7816 (variables)
Res - Format info
1. Result code (1 byte)
2. Res APDU length (2 byte)
3. Res APDU (variables)
Noti(Unsol) - Format info
non.
**/
#define OEM_SAP_SET_PROTOCOL 0x07
/** OEM_SAP_SET_PROTOCOL
Req - Format info
1. Transport protocol (1 byte)
Res - Format info
1. Result code (1 byte)
Noti(Unsol) - Format info
non.
**/
/*MAX_MSG_SIZE */
#define MAX_MSG_SIZE 512 // 256->512
/* MSG_ID Table */
#define OEM_SAP_CONNECT_REQ 0x00 /*Client -> Server*/
#define OEM_SAP_CONNECT_RESP 0x01 /*Server -> Client */
#define OEM_SAP_DISCONNECT_REQ 0x02 /*Client -> Server*/
#define OEM_SAP_DISCONNECT_RESP 0x03 /*Server -> Client */
#define OEM_SAP_DISCONNECT_IND 0x04 /*Server -> Client */
#define OEM_SAP_TRANSFER_APDU_REQ 0x05 /*Client -> Server*/
#define OEM_SAP_TRANSFER_APDU_RESP 0x06 /*Server -> Client */
#define OEM_SAP_TRANSFER_ATR_REQ 0x07 /*Client -> Server*/
#define OEM_SAP_TRANSFER_ATR_RESP 0x08 /*Server -> Client */
#define OEM_SAP_POWER_SIM_OFF_REQ 0x09 /*Client -> Server*/
#define OEM_SAP_POWER_SIM_OFF_RESP 0x0A /*Server -> Client */
#define OEM_SAP_POWER_SIM_ON_REQ 0x0B /*Client -> Server*/
#define OEM_SAP_POWER_SIM_ON_RESP 0x0C /*Server -> Client */
#define OEM_SAP_RESET_SIM_REQ 0x0D /*Client -> Server*/
#define OEM_SAP_RESET_SIM_RESP 0x0E /*Server -> Client */
#define OEM_SAP_TRANSFER_CARD_READER_STATUS_REQ 0x0F /*Client -> Server*/
#define OEM_SAP_TRANSFER_CARD_READER_STATUS_RESP 0x10 /*Server -> Client */
#define OEM_SAP_STATUS_IND 0x11 /*Client -> Server*/
#define OEM_SAP_ERROR_RESP 0x12 /*Server -> Client */
#define OEM_SAP_SET_TRANSPORT_PROTOCOL_REQ 0x13 /*Client -> Server*/
#define OEM_SAP_SET_TRANSPORT_PROTOCOL_RESP 0x14 /*Server -> Client */
/*CONNECTIN STATUS */
#define OEM_SAP_CONNECT_OK 0x00
#define OEM_SAP_CONNECT_UNABLE_ESTABLISH 0x01
#define OEM_SAP_CONNECT_NOT_SUPPORT_MAX_SIZE 0x02
#define OEM_SAP_CONNECT_TOO_SMALL_MAX_SIZE 0x03
/*DISCONNECT TYPE */
#define OEM_SAP_DISCONNECT_TYPE_GRACEFUL 0x00
#define OEM_SAP_DISCONNECT_TYPE_IMMEDIATE 0x01
/*SAP STATUS */
#define OEM_SAP_STATUS_UNKNOWN 0x00
#define OEM_SAP_STATUS_NO_SIM 0x01
#define OEM_SAP_STATUS_NOT_READY 0x02
#define OEM_SAP_STATUS_READY 0x03
#define OEM_SAP_STATUS_CONNECTED 0x04
/*CARD STATUS */
#define OEM_SAP_CARD_STATUS_UNKNOWN 0x00
#define OEM_SAP_CARD_STATUS_RESET 0x01
#define OEM_SAP_CARD_STATUS_NOT_ACCESSIBLE 0x02
#define OEM_SAP_CARD_STATUS_REMOVED 0x03
#define OEM_SAP_CARD_STATUS_INSERTED 0x04
#define OEM_SAP_CARD_STATUS_RECOVERED 0x05
/*RESULT CODE */
#define OEM_SAP_RESULT_OK 0x00
#define OEM_SAP_RESULT_NO_REASON 0x01
#define OEM_SAP_RESULT_CARD_NOT_ACCESSIBLE 0x02
#define OEM_SAP_RESULT_CARD_ALREADY_POWER_OFF 0x03
#define OEM_SAP_RESULT_REMOVED 0x04
#define OEM_SAP_RESULT_ALREADY_POWER_ON 0x05
#define OEM_SAP_RESULT_DATA_NOT_AVAILABLE 0x06
#define OEM_SAP_RESULT_NOT_SUPPORT 0x07
/*TRANSPORT PROTOCOL*/
#define OEM_SAP_TRANSPORT_PROTOCOL_T_ZERO 0x00
#define OEM_SAP_TRANSPORT_PROTOCOL_T_ONE 0x01
typedef struct {
uint8_t func_id;
uint8_t cmd;
uint16_t len;
} __attribute__((packed)) oem_ril_sap_hdr;
typedef struct {
uint8_t msg_id;
} __attribute__((packed)) ril_sap_req_sap_connect;
typedef struct {
uint16_t apdu_len;
uint8_t apdu[MAX_MSG_SIZE];
} __attribute__((packed)) ril_sap_req_transfer_apdu;
typedef struct {
uint8_t transport_protocol;
} __attribute__((packed)) ril_sap_req_transport_protocol;
typedef struct {
uint8_t msg_id;
} __attribute__((packed)) ril_sap_req_sim_power;
typedef struct {
uint8_t msg_id;
uint8_t connection_status;
uint16_t max_msg_size;
} __attribute__((packed)) ril_sap_res_connect;
typedef struct {
uint8_t sap_status;
} __attribute__((packed)) ril_sap_res_sap_status;
typedef struct {
uint8_t result_code;
uint16_t atr_len;
uint8_t atr[MAX_MSG_SIZE];
} __attribute__((packed)) ril_sap_res_transfer_atr;
typedef struct {
uint8_t result_code;
uint16_t res_apdu_len;
uint8_t res_apdu[MAX_MSG_SIZE];
} __attribute__((packed)) ril_sap_res_transfer_apdu;
typedef struct {
uint8_t result_code;
} __attribute__((packed)) ril_sap_res_transport_protocol;
typedef struct {
uint8_t msg_id;
uint8_t result_code;
} __attribute__((packed)) ril_sap_res_sim_power;
typedef struct {
uint8_t result_code;
uint8_t card_reader_status;
} __attribute__((packed)) ril_sap_res_card_reader_status;
typedef struct {
uint8_t disconnect_type;
} __attribute__((packed)) unsol_sap_connect;
typedef struct {
uint8_t card_status;
} __attribute__((packed)) unsol_sap_status;
typedef union {
unsol_sap_connect connect;
unsol_sap_status status;
} __attribute__((packed)) unsol_sap_parameters;
typedef struct {
uint8_t sub_id;
unsol_sap_parameters param;
} __attribute__((packed)) unsol_sap_notification;
#endif
|