1 /******************************************************************************
2  *
3  *  Copyright 2018-2021 NXP
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 #ifndef _PHNXPESEPROTO7816_3_H_
19 #define _PHNXPESEPROTO7816_3_H_
20 #include <ese_config.h>
21 #include <phNxpEseDataMgr.h>
22 #include <phNxpEseFeatures.h>
23 #include <phNxpEse_Internal.h>
24 
25 /**
26  * \addtogroup ISO7816-3_protocol_lib
27  * \brief 7816-3 PROTOCOL STACK
28  * @{ */
29 
30 /********************* Definitions and structures *****************************/
31 
32 /*!
33  * \brief S-Frame types used in 7816-3 protocol stack
34  */
35 typedef enum sFrameTypes {
36   RESYNCH_REQ = 0x00, /*!< Re-synchronisation request between host and ESE */
37   RESYNCH_RSP = 0x20, /*!< Re-synchronisation response between host and ESE */
38   IFS_REQ = 0x01,     /*!< IFSC size request */
39   IFS_RES = 0x21,     /*!< IFSC size response */
40   ABORT_REQ = 0x02,   /*!< Abort request */
41   ABORT_RES = 0x22,   /*!< Abort response */
42   WTX_REQ = 0x03,     /*!< WTX request */
43   WTX_RSP = 0x23,     /*!< WTX response */
44   INTF_RESET_REQ = 0x04,    /*!< Interface reset request */
45   INTF_RESET_RSP = 0x24,    /*!< Interface reset response */
46   PROP_END_APDU_REQ = 0x05, /*!< Proprietary Enf of APDU request */
47   PROP_END_APDU_RSP = 0x25, /*!< Proprietary Enf of APDU response */
48   HARD_RESET_REQ = 0x06,    /*!< Chip reset request */
49   HARD_RESET_RSP = 0x26,    /*!< Chip reset request */
50   ATR_REQ = 0x07,           /*!< ATR request */
51   ATR_RSP = 0x27,           /*!< ATR response */
52   INVALID_REQ_RES           /*!< Invalid request */
53 } sFrameTypes_t;
54 
55 /*!
56  * \brief R-Frame types used in 7816-3 protocol stack
57  */
58 typedef enum rFrameTypes {
59   RACK = 0x01, /*!< R-frame Acknowledgement frame indicator */
60   RNACK = 0x02 /*!< R-frame Negative-Acknowledgement frame indicator */
61 } rFrameTypes_t;
62 
63 /*!
64  * \brief R-Frame error types used 7816-3 protocol stack
65  */
66 typedef enum rFrameErrorTypes {
67   NO_ERROR,         /*!< R-frame received with success */
68   PARITY_ERROR,     /*!< R-frame received with parity error */
69   OTHER_ERROR,      /*!< R-frame received with Other error */
70   SOF_MISSED_ERROR, /*!< R-frame received with frame missing error */
71   UNDEFINED_ERROR   /*!< R-frame received with some undefined error */
72 } rFrameErrorTypes_t;
73 
74 /*!
75  * \brief Frame types used in 7816-3 protocol stack
76  */
77 typedef enum phNxpEseProto7816_FrameTypes {
78   IFRAME,  /*!< Frame type: I-frame */
79   SFRAME,  /*!< Frame type: S-frame */
80   RFRAME,  /*!< Frame type: R-frame */
81   INVALID, /*!< Frame type: Invalid */
82   UNKNOWN  /*!< Frame type: Unknown */
83 } phNxpEseProto7816_FrameTypes_t;
84 
85 /*!
86  * \brief 7816-3 protocol stack states
87  */
88 typedef enum phNxpEseProto7816_State {
89   PH_NXP_ESE_PROTO_7816_IDLE,       /*!< 7816-3 protocol state: IDLE */
90   PH_NXP_ESE_PROTO_7816_TRANSCEIVE, /*!< 7816-3 protocol state: TRANSCEIVE going
91                                        on */
92   PH_NXP_ESE_PROTO_7816_DEINIT /*!< 7816-3 protocol state: DeInit going on */
93 } phNxpEseProto7816_State_t;
94 
95 /*!
96  * \brief 7816-3 protocol transceive states
97  */
98 typedef enum phNxpEseProto7816_TransceiveStates {
99   IDLE_STATE,  /*!< 7816-3 protocol transceive state: IDLE */
100   SEND_IFRAME, /*!< 7816-3 protocol transceive state: I-frame to be sent */
101   SEND_R_NACK, /*!< 7816-3 protocol transceive state: R-NACK frame to be sent */
102   SEND_R_ACK,  /*!< 7816-3 protocol transceive state: R-ACK frame to be sent */
103   SEND_S_RSYNC,    /*!< 7816-3 protocol transceive state: S-frame
104                       re-synchronisation command to be sent */
105   SEND_S_INTF_RST, /*!< 7816-3 protocol transceive state: S-frame interface
106                       reset command to be sent */
107   SEND_S_EOS,      /*!< 7816-3 protocol transceive state: S-frame end of session
108                       command to be sent */
109   SEND_S_HRD_RST,  /*!< 7816-3 protocol transceive state: S-frame
110                          chip/hard reset command to be sent */
111   SEND_S_WTX_REQ,  /*!< 7816-3 protocol transceive state: S-frame WTX command to
112                       be sent */
113   SEND_S_WTX_RSP, /*!< 7816-3 protocol transceive state: S-frame WTX response to
114                     be sent */
115   SEND_S_IFS_ADJ, /*!< 7816-3 protocol transceive state: S-frame IFS adjustment
116                    */
117   SEND_S_ATR_REQ, /*!< 7816-3 protocol transceive state: S-frame ATR request */
118 } phNxpEseProto7816_TransceiveStates_t;
119 
120 /*!
121  * \brief I-frame information structure for ISO 7816-3
122  *
123  * This structure holds the  information of I-frame used for sending
124  * and receiving the frame packet.
125  *
126  */
127 typedef struct iFrameInfo {
128   bool isChained;  /*!< I-frame: Indicates if more frames to follow in the same
129                         data packet or not */
130   uint8_t* p_data; /*!< I-frame: Actual data (Information field (INF)) */
131 
132   uint8_t seqNo; /*!< I-frame: Sequence number of the I-frame */
133 
134   uint32_t maxDataLenIFSC; /*!< I-frame: Maximum data length to be allowed in a
135                           single I-frame */
136   uint32_t defaultDataLenIFSC; /*!< I-frame: Maximum data length to be allowed
137                           in a single I-frame */
138   uint32_t currentDataLenIFS;  /*!< I-frame: Current data length agreed
139                            between PCD and Card to be allowed in a
140                            single I-frame */
141 
142   uint32_t dataOffset;   /*!< I-frame: Offset to the actual data(INF) for the
143                             current frame of the packet */
144   uint32_t totalDataLen; /*!< I-frame: Total data left in the packet, used to
145                             set the chained flag/calculating offset */
146   uint32_t sendDataLen;  /*!< I-frame: the length of the I-frame actual data */
147 } iFrameInfo_t;
148 
149 /*!
150  * \brief S-frame information structure for ISO 7816-3
151  *
152  * This structure holds the  information of S-frame used for sending
153  * and receiving the frame packet.
154  *
155  */
156 typedef struct sFrameInfo {
157   sFrameTypes_t sFrameType; /*!< S-frame: Type of S-frame cmd/rsp */
158   uint8_t* p_data; /*!< S-frame: Actual data (Information field (INF)) */
159   uint8_t len;     /*!< S-frame: the length of the I-frame actual data */
160 } sFrameInfo_t;
161 
162 /*!
163  * \brief R-frame information structure for ISO 7816-3
164  *
165  * This structure holds the  information of R-frame used for sending
166  * and receiving the frame packet.
167  *
168  */
169 typedef struct rFrameInfo {
170   uint8_t seqNo; /*!< R-frame: Sequence number of the expected I-frame */
171   rFrameErrorTypes_t errCode; /*!< R-frame: Error type */
172 } rFrameInfo_t;
173 
174 /*!
175  * \brief ATRInfo: ISO7816 ATR Information bytes
176  *
177  * This structure holds ATR information bytes
178  *
179  */
180 typedef struct phNxpEseProto7816_ATR_Info {
181   uint8_t len;         /*!< ATR: ATR length in bytes */
182   uint8_t vendorID[5]; /*!< ATR: VendorID according to ISO7816-5 */
183   uint8_t dll_IC;      /*!< ATR: Data Link Layer - Interface Character */
184   uint8_t bgt[2];      /*!< ATR: Minimum guard time in milliseconds for
185                      T=1 blocks sent in opposite directions */
186   uint8_t
187       bwt[2];              /*!< ATR: Maximum allowed command processing
188                          time in milliseconds before card has sent either
189                          command response or S(WTX) requesting processing time extension */
190   uint8_t maxFreq[2];      /*!< ATR: Max supported  clock frequency in kHz  */
191   uint8_t checksum;        /*!< ATR: Checksum (0 = LRC / 1 = CRC) */
192   uint8_t defaultIFSC;     /*!< ATR: Default IFS size */
193   uint8_t numChannels;     /*!< ATR: Number of logical connections supported */
194   uint8_t maxIFSC[2];      /*!< ATR: Maximum size of IFS supported */
195   uint8_t capabilities[2]; /*!< ATR: Bitmap to indicate various features
196                          supported by SE Bit-1: SE Data Available Line
197                          supported. Bit-2: SE Data available polarity. 1 - Data
198                          available GPIO will be pulled HIGH when SE response is
199                          ready Bit 3: SE chip reset S-blk command supported
200                          Bit-4: Extended frame length feature supported Bit-5:
201                          Support for more than one logical channel Bit 6 to 16:
202                          Reserved for future use
203                          */
204 } phNxpEseProto7816_ATR_Info_t;
205 
206 typedef struct phNxpEseProto7816_ATR_Info2 {
207   uint8_t channelNo; /*!< ATR: Current ongoing channel no */
208   uint8_t osType;    /*!< ATR: Indicates OS Type
209                        JCOP_OS    = 0x01
210                        UPDATER_OS = 0x02 */
211 } phNxpEseProto7816_ATR_Info2_t;
212 
213 /*!
214  * \brief Next/Last Tx information structure holding transceive data
215  *
216  * This structure holds the information of the next/last sent
217  * I-frame/R-frame/S-frame depending on the frame type
218  *
219  */
220 typedef struct phNxpEseProto7816_NextTx_Info {
221   iFrameInfo_t
222       IframeInfo; /*!< Information of the I-frame to be send next or the last
223                      sent I-frame depending on the frame type */
224   rFrameInfo_t
225       RframeInfo; /*!< Information of the R-frame to be send next or the last
226                      sent R-frame depending on the frame type */
227   sFrameInfo_t
228       SframeInfo; /*!< Information of the S-frame to be send next or the last
229                      sent S-frame depending on the frame type */
230   phNxpEseProto7816_FrameTypes_t
231       FrameType; /*!< Frame (I/R/S frames) type to be sent next */
232 } phNxpEseProto7816_NextTx_Info_t;
233 
234 /*!
235  * \brief Last sent Tx ransceive data
236  *
237  * This structure holds the information of the last sent
238  * I-frame/R-frame/S-frame
239  *
240  */
241 typedef phNxpEseProto7816_NextTx_Info_t phNxpEseProto7816_LastTx_Info_t;
242 
243 /*!
244  * \brief Last Rx information structure holding transceive data
245  *
246  * This structure holds the information of the next/last sent
247  * I-frame/R-frame/S-frame
248  *
249  */
250 typedef struct phNxpEseRx_Cntx {
251   iFrameInfo_t lastRcvdIframeInfo; /*!< I-frame: Last received frame */
252   rFrameInfo_t lastRcvdRframeInfo; /*!< R-frame: Last received frame */
253   sFrameInfo_t lastRcvdSframeInfo; /*!< S-frame: Last received frame */
254   phNxpEseProto7816_FrameTypes_t
255       lastRcvdFrameType; /*!< Last received frame type */
256 } phNxpEseRx_Cntx_t;
257 
258 /*!
259  * \brief Proprietery: Secure timer value updates
260  *
261  * This structure holds the secure timer value
262  *
263  */
264 typedef struct phNxpEseProto7816SecureTimer {
265   unsigned int secureTimer1;
266   unsigned int secureTimer2;
267   unsigned int secureTimer3;
268 } phNxpEseProto7816SecureTimer_t;
269 
270 /*!
271  * \brief  structure to hold the interface reset parameters
272  * secure timer(only for PN8xT products) and atr info.
273  *
274  */
275 typedef struct phNxpEseProto7816_IntfResetParams {
276   phNxpEseProto7816SecureTimer_t* pSecureTimerParam;
277   phNxpEse_data* pAtrData;
278 } phNxpEseProto7816_IntfResetParams_t;
279 /*!
280  * \brief 7816-3 protocol stack context structure
281  *
282  * This structure holds the complete information of the
283  * 7816-3 protocol stack context
284  *
285  */
286 typedef struct phNxpEseProto7816 {
287   phNxpEseProto7816_LastTx_Info_t
288       phNxpEseLastTx_Cntx; /*!< Last transmitted frame information */
289   phNxpEseProto7816_NextTx_Info_t
290       phNxpEseNextTx_Cntx;           /*!< Next frame to be transmitted */
291   phNxpEseRx_Cntx_t phNxpEseRx_Cntx; /*!< Last received frame information */
292   phNxpEseProto7816_TransceiveStates_t
293       phNxpEseProto7816_nextTransceiveState; /*!< Next Transceive state. It
294                                                 determines the next
295                                                                                                         action to be done from host */
296   phNxpEseProto7816_State_t
297       phNxpEseProto7816_CurrentState; /*!< Current protocol stack state */
298   uint8_t recoveryCounter; /*!< Keeps track of number of error recovery done.
299                               Stack exits after it reaches max. count  */
300   unsigned long int wtx_counter_limit; /*!< Max. WTX counter limit */
301   unsigned long int wtx_counter;       /*!< WTX count tracker */
302   uint8_t timeoutCounter; /*!< Keeps track of number of timeout happened. Stack
303                              exits after it reaches max. count  */
304   phNxpEseProto7816_FrameTypes_t
305       lastSentNonErrorframeType; /*!< Copy of the last sent non-error frame
306                                     type: R-ACK, S-frame, I-frame */
307   unsigned long int rnack_retry_limit;
308   unsigned long int rnack_retry_counter;
309   unsigned long int
310       wtx_ntf_limit; /*!< Wtx count interval to notify service registered*/
311   phNxpEseProto7816SecureTimer_t secureTimerParams;
312   unsigned long int reset_type;
313   uint32_t currentIFSDSize;
314   phNxpEseProto7816_ATR_Info_t atrInfo;
315   phNxpEseProto7816_ATR_Info2_t extndAtrInfo;
316 } phNxpEseProto7816_t;
317 
318 /*!
319  * \brief 7816-3 protocol stack init params
320  *
321  * This structure holds the parameters to be passed to open 7816-3 protocl stack
322  *instance
323  *
324  */
325 typedef struct phNxpEseProto7816InitParam {
326   unsigned long int wtx_counter_limit; /*!< WTX count limit */
327   bool interfaceReset;                 /*!< INTF reset required or not>*/
328   unsigned long int rnack_retry_limit;
329   phNxpEseProto7816SecureTimer_t*
330       pSecureTimerParams; /*!< Secure timer value updated here >*/
331   unsigned long int
332       wtx_ntf_limit; /*!< Wtx count interval to notify service registered*/
333 } phNxpEseProto7816InitParam_t;
334 
335 /*!
336  * \brief 7816-3 protocol PCB bit level structure
337  *
338  * This structure holds the bit level information of PCB byte
339  * as per 7816-3 protocol
340  *
341  */
342 typedef struct phNxpEseProto7816_PCB_bits {
343   uint8_t lsb : 1;  /*!< PCB: lsb */
344   uint8_t bit2 : 1; /*!< PCB: bit2 */
345   uint8_t bit3 : 1; /*!< PCB: bit3 */
346   uint8_t bit4 : 1; /*!< PCB: bit4 */
347   uint8_t bit5 : 1; /*!< PCB: bit5 */
348   uint8_t bit6 : 1; /*!< PCB: bit6 */
349   uint8_t bit7 : 1; /*!< PCB: bit7 */
350   uint8_t msb : 1;  /*!< PCB: msb */
351 } phNxpEseProto7816_PCB_bits_t;
352 
353 /*!
354  * \brief Max. size of the frame that can be sent
355  */
356 #define IFSC_SIZE_SEND 254
357 /*!
358  * \brief Delay to be used before sending the next frame, after error reported
359  * by ESE
360  */
361 #define DELAY_ERROR_RECOVERY_1_MS 1000
362 
363 #define GET_DELAY_ERROR_RECOVERY()           \
364   ((GET_CHIP_OS_VERSION() != OS_VERSION_4_0) \
365        ? (10 * DELAY_ERROR_RECOVERY_1_MS)    \
366        : (3.5 * DELAY_ERROR_RECOVERY_1_MS))
367 /*!
368  * \brief 7816-3 protocol frame
369  * header length
370  */
371 #define PH_PROTO_7816_HEADER_LEN 0x03
372 /*!
373  * \brief 7816-3 protocol ext.frame header length
374  */
375 #define PH_PROTO_7816_EXT_HEADER_LEN 0x05
376 /*!
377  * \brief 7816-3 protocol frame CRC length
378  */
379 #define PH_PROTO_7816_CRC_LEN 0x01
380 /*!
381  * \brief 7816-3 Chaining flag bit for masking
382  */
383 #define PH_PROTO_7816_CHAINING 0x20
384 /*!
385  * \brief 7816-3 PCB byte offset
386  */
387 #define PH_PROPTO_7816_PCB_OFFSET 0x01
388 /*!
389  * \brief 7816-3 frame length offset
390  */
391 #define PH_PROPTO_7816_FRAME_LENGTH_OFFSET 0x02
392 /*!
393  * \brief 7816-3 S-frame timer 1
394  */
395 #define PH_PROPTO_7816_SFRAME_TIMER1 0xF1
396 /*!
397  * \brief 7816-3 S-frame timer 2
398  */
399 #define PH_PROPTO_7816_SFRAME_TIMER2 0xF2
400 /*!
401  * \brief 7816-3 S-frame timer 3
402  */
403 #define PH_PROPTO_7816_SFRAME_TIMER3 0xF3
404 
405 /*!
406  * \brief 7816-3 S-block request command mask
407  */
408 #define PH_PROTO_7816_S_BLOCK_REQ 0xC0
409 /*!
410  * \brief 7816-3 S-block response mask
411  */
412 #define PH_PROTO_7816_S_BLOCK_RSP 0xE0
413 /*!
414  * \brief 7816-3 S-block reset command mask
415  */
416 #define PH_PROTO_7816_S_RESET 0x04
417 /*!
418  * \brief 7816-3 S-block End of APDU cmd mask
419  */
420 #define PH_PROTO_7816_S_END_OF_APDU 0x05
421 /*!
422  * \brief 7816-3 S-block WTX mask
423  */
424 #define PH_PROTO_7816_S_WTX 0x03
425 /*!
426  * \brief 7816-3 S-block re-sync mask
427  */
428 #define PH_PROTO_7816_S_RESYNCH 0x00
429 /*!
430  * \brief 7816-3 S-block hard reset cmd mask
431  */
432 #define PH_PROTO_7816_S_HRD_RST_CMD 0x06
433 /*!
434  * \brief 7816-3 protocol max. error retry counter
435  */
436 #define PH_PROTO_7816_FRAME_RETRY 01
437 /*!
438  * \brief 7816-3 protocol max. error retry counter based on OS version
439  */
440 #define GET_FRAME_RETRY_COUNT()              \
441   ((GET_CHIP_OS_VERSION() != OS_VERSION_4_0) \
442        ? (3 * PH_PROTO_7816_FRAME_RETRY)     \
443        : (10 * PH_PROTO_7816_FRAME_RETRY))
444 
445 /*!
446  * \brief 7816-3 protocol max. WTX default count
447  */
448 #define PH_PROTO_WTX_DEFAULT_COUNT 500
449 /*!
450  * \brief 7816-3 protocol max. timeout retry count
451  */
452 #define PH_PROTO_7816_TIMEOUT_RETRY_COUNT 1
453 /*!
454  * \brief 7816-3 to represent magic number zero
455  */
456 #define PH_PROTO_7816_VALUE_ZERO 0x00
457 /*!
458  * \brief 7816-3 to represent magic number one
459  */
460 #define PH_PROTO_7816_VALUE_ONE 0x01
461 /*!
462  * \brief 7816-3 for max retry for CRC error
463  */
464 #define MAX_RNACK_RETRY_LIMIT 0x02
465 /*!
466  * \brief APIs exposed from the 7816-3 protocol layer
467  */
468 #define RESET_TYPE_NONE 0x00
469 /*!
470  * \brief APIs exposed from the 7816-3 protocol layer
471  */
472 #define EXTENDED_FRAME_MARKER 0xFF
473 /*!
474  * \brief APIs exposed from the 7816-3 protocol layer
475  */
476 #define PH_PROTO_CLOSE_ALL_SESSION_INF 0x01
477 /*!
478  * \brief APIs exposed from the 7816-3 protocol layer
479  */
480 #define PH_PROTO_CLOSE_ALL_SESSION_LEN 0x01
481 /*!
482  * \brief APIs exposed from the 7816-3 protocol layer
483  */
484 #define PH_PROTO_ATR_RSP_VENDOR_ID_LEN 0x05
485 /*!
486  * \brief APIs exposed from the 7816-3 protocol layer
487  */
488 #define PH_SE_OS_VERSION_10 0x10
489 /*!
490  * \brief APIs exposed from the 7816-3 protocol layer
491  */
492 #define PH_SE_OS_VERSION_11 0x11
493 /*!
494  * \brief OS version on SE for SN220
495  */
496 #define PH_SE_OS_VERSION_20 0x20
497 /*!
498  * \brief Default wait extension notification interval
499  */
500 #define PH_DEFAULT_WTX_NTF_LIMIT 0x03
501 /*!
502  * \delay for hard reset response
503  */
504 #define HARD_RESET_RES_DELAY 4000
505 
506 /**
507  * \ingroup ISO7816-3_protocol_lib
508  * \brief This function is used to reset just the current interface
509  *
510  * \param[in]      secureTimerParams - secure timer instance
511  *
512  */
513 ESESTATUS phNxpEseProto7816_IntfReset(
514     phNxpEseProto7816SecureTimer_t* secureTimerParams);
515 
516 /**
517  * \ingroup ISO7816-3_protocol_lib
518  * \brief This function is used to close the 7816 protocol stack instance
519  *
520  * \param[in]      secureTimerParams - secure timer instance
521  *
522  */
523 ESESTATUS phNxpEseProto7816_Close(
524     phNxpEseProto7816SecureTimer_t* secureTimerParams);
525 
526 /**
527  * \ingroup ISO7816-3_protocol_lib
528  * \brief This function is used to open the 7816 protocol stack instance
529  *
530  * \param[in]      initParam: Initialization params
531  *
532  */
533 ESESTATUS phNxpEseProto7816_Open(phNxpEseProto7816InitParam_t initParam);
534 
535 /**
536  * \ingroup ISO7816-3_protocol_lib
537  * \brief This function is used to
538  *                  1. Send the raw data received from application after
539  *computing LRC
540  *                  2. Receive the response data from ESE, decode, process
541  *and
542  *                     store the data.
543  *                  3. Get the final complete data and sent back to application
544  *
545  * \param[in]       pCmd: Command to ESE
546  * \param[out]     pRsp: Response from ESE
547  *
548  *
549  */
550 ESESTATUS phNxpEseProto7816_Transceive(phNxpEse_data* pCmd,
551                                        phNxpEse_data* pRsp);
552 
553 /**
554  * \ingroup ISO7816-3_protocol_lib
555  * \brief This function is used to reset the 7816 protocol stack instance
556  *
557  *
558  *
559  */
560 ESESTATUS phNxpEseProto7816_Reset(void);
561 
562 /**
563  * \ingroup ISO7816-3_protocol_lib
564  * \brief This function is used to set the max T=1 data send size
565  *
566  * \param[in]   IFS_Size: Max. size of the I-frame
567  *
568  */
569 ESESTATUS phNxpEseProto7816_SetIfs(uint16_t IFS_Size);
570 /**
571  * \ingroup ISO7816-3_protocol_lib
572  * \brief This function is used to set the endpoint
573  *
574  * \param[in]  uEndPoint:   END_POINT_ESE = 0 (eSE services), END_POINT_EUICC
575  * =1(UICC services)
576  *
577  */
578 ESESTATUS phNxpEseProto7816_SetEndPoint(uint8_t uEndPoint);
579 /**
580  * \ingroup ISO7816-3_protocol_lib
581  * \brief This function is used to reset the endpoint
582  *
583  * \param[in]  uEndPoint:   END_POINT_ESE = 0 (eSE services), END_POINT_EUICC
584  * =1(UICC services)
585  *
586  */
587 ESESTATUS phNxpEseProto7816_ResetEndPoint(uint8_t uEndPoint);
588 /**
589  * \ingroup ISO7816-3_protocol_lib
590  * \brief This function is used to get ATR bytes for the application
591  *
592  * \param[out] pATRRsp: Response ATR bytes from ESE
593  *
594  */
595 ESESTATUS phNxpEseProto7816_getAtr(phNxpEse_data* pATRRsp);
596 
597 /**
598  * \ingroup ISO7816-3_protocol_lib
599  * \brief This function is used to get the max T=1 data send size
600  *
601  * \retval Current IFS adjusted value wrt card.
602  *
603  */
604 uint16_t phNxpEseProto7816_GetIfs(void);
605 
606 /**
607  * \ingroup ISO7816-3_protocol_lib
608  * \brief This function is used to get OS mode(JCOP/OSU)
609  *
610  * \retval OS mode(JCOP/OSU).
611  *
612  */
613 phNxpEseProto7816_OsType_t phNxpEseProto7816_GetOsMode(void);
614 /**
615  * \ingroup ISO7816-3_protocol_lib
616  * \brief This function is used to check eSE is alive/responding
617  *
618  *
619  *
620  */
621 ESESTATUS phNxpEseProto7816_CloseAllSessions(void);
622 /** @} */
623 #endif /* _PHNXPESEPROTO7816_3_H_ */
624