1 /******************************************************************************
2  *
3  *  Copyright 2018-2023 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 reset type used in 7816-3 stack
122  */
123 typedef enum phNxpEseProto7816_ResetType {
124   RESET_TYPE_NONE,
125   RESET_TYPE_RECOVERY,
126   RESET_TYPE_OS_RESET
127 } phNxpEseProto7816_ResetType_t;
128 
129 /*!
130  * \brief I-frame information structure for ISO 7816-3
131  *
132  * This structure holds the  information of I-frame used for sending
133  * and receiving the frame packet.
134  *
135  */
136 typedef struct iFrameInfo {
137   bool isChained;  /*!< I-frame: Indicates if more frames to follow in the same
138                         data packet or not */
139   uint8_t* p_data; /*!< I-frame: Actual data (Information field (INF)) */
140 
141   uint8_t seqNo; /*!< I-frame: Sequence number of the I-frame */
142 
143   uint32_t maxDataLenIFSC; /*!< I-frame: Maximum data length to be allowed in a
144                           single I-frame */
145   uint32_t defaultDataLenIFSC; /*!< I-frame: Maximum data length to be allowed
146                           in a single I-frame */
147   uint32_t currentDataLenIFS;  /*!< I-frame: Current data length agreed
148                            between PCD and Card to be allowed in a
149                            single I-frame */
150 
151   uint32_t dataOffset;   /*!< I-frame: Offset to the actual data(INF) for the
152                             current frame of the packet */
153   uint32_t totalDataLen; /*!< I-frame: Total data left in the packet, used to
154                             set the chained flag/calculating offset */
155   uint32_t sendDataLen;  /*!< I-frame: the length of the I-frame actual data */
156 } iFrameInfo_t;
157 
158 /*!
159  * \brief S-frame information structure for ISO 7816-3
160  *
161  * This structure holds the  information of S-frame used for sending
162  * and receiving the frame packet.
163  *
164  */
165 typedef struct sFrameInfo {
166   sFrameTypes_t sFrameType; /*!< S-frame: Type of S-frame cmd/rsp */
167   uint8_t* p_data; /*!< S-frame: Actual data (Information field (INF)) */
168   uint8_t len;     /*!< S-frame: the length of the I-frame actual data */
169 } sFrameInfo_t;
170 
171 /*!
172  * \brief R-frame information structure for ISO 7816-3
173  *
174  * This structure holds the  information of R-frame used for sending
175  * and receiving the frame packet.
176  *
177  */
178 typedef struct rFrameInfo {
179   uint8_t seqNo; /*!< R-frame: Sequence number of the expected I-frame */
180   rFrameErrorTypes_t errCode; /*!< R-frame: Error type */
181 } rFrameInfo_t;
182 
183 /*!
184  * \brief ATRInfo: ISO7816 ATR Information bytes
185  *
186  * This structure holds ATR information bytes
187  *
188  */
189 typedef struct phNxpEseProto7816_ATR_Info {
190   uint8_t len;         /*!< ATR: ATR length in bytes */
191   uint8_t vendorID[5]; /*!< ATR: VendorID according to ISO7816-5 */
192   uint8_t dll_IC;      /*!< ATR: Data Link Layer - Interface Character */
193   uint8_t bgt[2];      /*!< ATR: Minimum guard time in milliseconds for
194                      T=1 blocks sent in opposite directions */
195   uint8_t
196       bwt[2];              /*!< ATR: Maximum allowed command processing
197                          time in milliseconds before card has sent either
198                          command response or S(WTX) requesting processing time extension */
199   uint8_t maxFreq[2];      /*!< ATR: Max supported  clock frequency in kHz  */
200   uint8_t checksum;        /*!< ATR: Checksum (0 = LRC / 1 = CRC) */
201   uint8_t defaultIFSC;     /*!< ATR: Default IFS size */
202   uint8_t numChannels;     /*!< ATR: Number of logical connections supported */
203   uint8_t maxIFSC[2];      /*!< ATR: Maximum size of IFS supported */
204   uint8_t capabilities[2]; /*!< ATR: Bitmap to indicate various features
205                         supported by SE Bit-1: SE Data Available Line supported.
206                         Bit-2: SE Data available polarity. 1 - Data available
207                         GPIO will be pulled HIGH when SE response is ready Bit
208                         3: SE chip reset S-blk command supported Bit-4: Extended
209                         frame length feature supported Bit-5: Support for more
210                         than one logical channel Bit 6 to 16: Reserved for
211                         future use
212                         */
213 } phNxpEseProto7816_ATR_Info_t;
214 
215 typedef struct phNxpEseProto7816_ATR_Info2 {
216   uint8_t channelNo; /*!< ATR: Current ongoing channel no */
217   uint8_t osType;    /*!< ATR: Indicates OS Type
218                        JCOP_OS    = 0x01
219                        UPDATER_OS = 0x02 */
220 } phNxpEseProto7816_ATR_Info2_t;
221 
222 /*!
223  * \brief Next/Last Tx information structure holding transceive data
224  *
225  * This structure holds the information of the next/last sent
226  * I-frame/R-frame/S-frame depending on the frame type
227  *
228  */
229 typedef struct phNxpEseProto7816_NextTx_Info {
230   iFrameInfo_t
231       IframeInfo; /*!< Information of the I-frame to be send next or the last
232                      sent I-frame depending on the frame type */
233   rFrameInfo_t
234       RframeInfo; /*!< Information of the R-frame to be send next or the last
235                      sent R-frame depending on the frame type */
236   sFrameInfo_t
237       SframeInfo; /*!< Information of the S-frame to be send next or the last
238                      sent S-frame depending on the frame type */
239   phNxpEseProto7816_FrameTypes_t
240       FrameType; /*!< Frame (I/R/S frames) type to be sent next */
241 } phNxpEseProto7816_NextTx_Info_t;
242 
243 /*!
244  * \brief Last sent Tx transceive data
245  *
246  * This structure holds the information of the last sent
247  * I-frame/R-frame/S-frame
248  *
249  */
250 typedef phNxpEseProto7816_NextTx_Info_t phNxpEseProto7816_LastTx_Info_t;
251 
252 /*!
253  * \brief Last Rx information structure holding transceive data
254  *
255  * This structure holds the information of the next/last sent
256  * I-frame/R-frame/S-frame
257  *
258  */
259 typedef struct phNxpEseRx_Cntx {
260   iFrameInfo_t lastRcvdIframeInfo; /*!< I-frame: Last received frame */
261   rFrameInfo_t lastRcvdRframeInfo; /*!< R-frame: Last received frame */
262   sFrameInfo_t lastRcvdSframeInfo; /*!< S-frame: Last received frame */
263   phNxpEseProto7816_FrameTypes_t
264       lastRcvdFrameType; /*!< Last received frame type */
265 } phNxpEseRx_Cntx_t;
266 
267 /*!
268  * \brief Proprietary: Secure timer value updates
269  *
270  * This structure holds the secure timer value
271  *
272  */
273 typedef struct phNxpEseProto7816SecureTimer {
274   unsigned int secureTimer1;
275   unsigned int secureTimer2;
276   unsigned int secureTimer3;
277 } phNxpEseProto7816SecureTimer_t;
278 
279 /*!
280  * \brief  structure to hold the interface reset parameters
281  * secure timer(only for PN8xT products) and atr info.
282  *
283  */
284 typedef struct phNxpEseProto7816_IntfResetParams {
285   phNxpEseProto7816SecureTimer_t* pSecureTimerParam;
286   phNxpEse_data* pAtrData;
287 } phNxpEseProto7816_IntfResetParams_t;
288 /*!
289  * \brief 7816-3 protocol stack context structure
290  *
291  * This structure holds the complete information of the
292  * 7816-3 protocol stack context
293  *
294  */
295 typedef struct phNxpEseProto7816 {
296   phNxpEseProto7816_LastTx_Info_t
297       phNxpEseLastTx_Cntx; /*!< Last transmitted frame information */
298   phNxpEseProto7816_NextTx_Info_t
299       phNxpEseNextTx_Cntx;           /*!< Next frame to be transmitted */
300   phNxpEseRx_Cntx_t phNxpEseRx_Cntx; /*!< Last received frame information */
301   phNxpEseProto7816_TransceiveStates_t
302       phNxpEseProto7816_nextTransceiveState; /*!< Next Transceive state. It
303                                                 determines the next
304                                                                                                         action to be done from host */
305   phNxpEseProto7816_State_t
306       phNxpEseProto7816_CurrentState; /*!< Current protocol stack state */
307   uint8_t recoveryCounter; /*!< Keeps track of number of error recovery done.
308                               Stack exits after it reaches max. count  */
309   unsigned long int wtx_counter_limit; /*!< Max. WTX counter limit */
310   unsigned long int wtx_counter;       /*!< WTX count tracker */
311   uint8_t timeoutCounter; /*!< Keeps track of number of timeout happened. Stack
312                              exits after it reaches max. count  */
313   phNxpEseProto7816_FrameTypes_t
314       lastSentNonErrorframeType; /*!< Copy of the last sent non-error frame
315                                     type: R-ACK, S-frame, I-frame */
316   unsigned long int rnack_retry_limit;
317   unsigned long int rnack_retry_counter;
318   unsigned long int
319       wtx_ntf_limit; /*!< Wtx count interval to notify service registered*/
320   phNxpEseProto7816SecureTimer_t secureTimerParams;
321   unsigned long int reset_type;
322   uint32_t currentIFSDSize;
323   phNxpEseProto7816_ATR_Info_t atrInfo;
324   phNxpEseProto7816_ATR_Info2_t extndAtrInfo;
325 } phNxpEseProto7816_t;
326 
327 /*!
328  * \brief 7816-3 protocol stack init params
329  *
330  * This structure holds the parameters to be passed to open 7816-3 protocol
331  *stack instance
332  *
333  */
334 typedef struct phNxpEseProto7816InitParam {
335   unsigned long int wtx_counter_limit; /*!< WTX count limit */
336   bool interfaceReset;                 /*!< INTF reset required or not>*/
337   unsigned long int rnack_retry_limit;
338   phNxpEseProto7816SecureTimer_t*
339       pSecureTimerParams; /*!< Secure timer value updated here >*/
340   unsigned long int
341       wtx_ntf_limit; /*!< Wtx count interval to notify service registered*/
342 } phNxpEseProto7816InitParam_t;
343 
344 /*!
345  * \brief 7816-3 protocol PCB bit level structure
346  *
347  * This structure holds the bit level information of PCB byte
348  * as per 7816-3 protocol
349  *
350  */
351 typedef struct phNxpEseProto7816_PCB_bits {
352   uint8_t lsb : 1;  /*!< PCB: lsb */
353   uint8_t bit2 : 1; /*!< PCB: bit2 */
354   uint8_t bit3 : 1; /*!< PCB: bit3 */
355   uint8_t bit4 : 1; /*!< PCB: bit4 */
356   uint8_t bit5 : 1; /*!< PCB: bit5 */
357   uint8_t bit6 : 1; /*!< PCB: bit6 */
358   uint8_t bit7 : 1; /*!< PCB: bit7 */
359   uint8_t msb : 1;  /*!< PCB: msb */
360 } phNxpEseProto7816_PCB_bits_t;
361 
362 /*!
363  * \brief Max. size of the frame that can be sent
364  */
365 #define IFSC_SIZE_SEND 254
366 /*!
367  * \brief Delay to be used before sending the next frame, after error reported
368  * by ESE
369  */
370 #define DELAY_ERROR_RECOVERY_1_MS 1000
371 
372 #define GET_DELAY_ERROR_RECOVERY()           \
373   ((GET_CHIP_OS_VERSION() != OS_VERSION_4_0) \
374        ? (10 * DELAY_ERROR_RECOVERY_1_MS)    \
375        : (3.5 * DELAY_ERROR_RECOVERY_1_MS))
376 /*!
377  * \brief 7816-3 protocol frame
378  * header length
379  */
380 #define PH_PROTO_7816_HEADER_LEN 0x03
381 /*!
382  * \brief 7816-3 protocol ext.frame header length
383  */
384 #define PH_PROTO_7816_EXT_HEADER_LEN 0x05
385 /*!
386  * \brief 7816-3 protocol frame CRC length
387  */
388 #define PH_PROTO_7816_CRC_LEN 0x01
389 /*!
390  * \brief 7816-3 Chaining flag bit for masking
391  */
392 #define PH_PROTO_7816_CHAINING 0x20
393 /*!
394  * \brief 7816-3 PCB byte offset
395  */
396 #define PH_PROPTO_7816_PCB_OFFSET 0x01
397 /*!
398  * \brief 7816-3 frame length offset
399  */
400 #define PH_PROPTO_7816_FRAME_LENGTH_OFFSET 0x02
401 /*!
402  * \brief 7816-3 S-frame timer 1
403  */
404 #define PH_PROPTO_7816_SFRAME_TIMER1 0xF1
405 /*!
406  * \brief 7816-3 S-frame timer 2
407  */
408 #define PH_PROPTO_7816_SFRAME_TIMER2 0xF2
409 /*!
410  * \brief 7816-3 S-frame timer 3
411  */
412 #define PH_PROPTO_7816_SFRAME_TIMER3 0xF3
413 
414 /*!
415  * \brief 7816-3 S-block request command mask
416  */
417 #define PH_PROTO_7816_S_BLOCK_REQ 0xC0
418 /*!
419  * \brief 7816-3 S-block response mask
420  */
421 #define PH_PROTO_7816_S_BLOCK_RSP 0xE0
422 /*!
423  * \brief 7816-3 S-block reset command mask
424  */
425 #define PH_PROTO_7816_S_RESET 0x04
426 /*!
427  * \brief 7816-3 S-block End of APDU cmd mask
428  */
429 #define PH_PROTO_7816_S_END_OF_APDU 0x05
430 /*!
431  * \brief 7816-3 S-block WTX mask
432  */
433 #define PH_PROTO_7816_S_WTX 0x03
434 /*!
435  * \brief 7816-3 S-block re-sync mask
436  */
437 #define PH_PROTO_7816_S_RESYNCH 0x00
438 /*!
439  * \brief 7816-3 S-block hard reset cmd mask
440  */
441 #define PH_PROTO_7816_S_HRD_RST_CMD 0x06
442 /*!
443  * \brief 7816-3 protocol max. error retry counter
444  */
445 #define PH_PROTO_7816_FRAME_RETRY 01
446 /*!
447  * \brief 7816-3 protocol max. error retry counter based on OS version
448  */
449 #define GET_FRAME_RETRY_COUNT()              \
450   ((GET_CHIP_OS_VERSION() != OS_VERSION_4_0) \
451        ? (3 * PH_PROTO_7816_FRAME_RETRY)     \
452        : (10 * PH_PROTO_7816_FRAME_RETRY))
453 
454 /*!
455  * \brief 7816-3 protocol max. WTX default count
456  */
457 #define PH_PROTO_WTX_DEFAULT_COUNT 500
458 /*!
459  * \brief 7816-3 protocol max. timeout retry count
460  */
461 #define PH_PROTO_7816_TIMEOUT_RETRY_COUNT 1
462 /*!
463  * \brief 7816-3 to represent magic number zero
464  */
465 #define PH_PROTO_7816_VALUE_ZERO 0x00
466 /*!
467  * \brief 7816-3 to represent magic number one
468  */
469 #define PH_PROTO_7816_VALUE_ONE 0x01
470 /*!
471  * \brief 7816-3 for max retry for CRC error
472  */
473 #define MAX_RNACK_RETRY_LIMIT 0x02
474 /*!
475  * \brief APIs exposed from the 7816-3 protocol layer
476  */
477 #define EXTENDED_FRAME_MARKER 0xFF
478 /*!
479  * \brief APIs exposed from the 7816-3 protocol layer
480  */
481 #define PH_PROTO_CLOSE_ALL_SESSION_INF 0x01
482 /*!
483  * \brief APIs exposed from the 7816-3 protocol layer
484  */
485 #define PH_PROTO_CLOSE_ALL_SESSION_LEN 0x01
486 /*!
487  * \brief APIs exposed from the 7816-3 protocol layer
488  */
489 #define PH_PROTO_ATR_RSP_VENDOR_ID_LEN 0x05
490 /*!
491  * \brief APIs exposed from the 7816-3 protocol layer
492  */
493 #define PH_SE_OS_VERSION_10 0x10
494 /*!
495  * \brief APIs exposed from the 7816-3 protocol layer
496  */
497 #define PH_SE_OS_VERSION_11 0x11
498 /*!
499  * \brief OS version on SE for SN220
500  */
501 #define PH_SE_OS_VERSION_20 0x20
502 /*!
503  * \brief OS version on SE for SN220
504  */
505 #define PH_SE_OS_VERSION_21 0x21
506 /*!
507  * \brief OS version on SE for SN300
508  */
509 #define PH_SE_OS_VERSION_30 0x30
510 /*!
511  * \brief Default wait extension notification interval
512  */
513 #define PH_DEFAULT_WTX_NTF_LIMIT 0x03
514 /*!
515  * \delay for hard reset response
516  */
517 #define HARD_RESET_RES_DELAY 4000
518 
519 /**
520  * \ingroup ISO7816-3_protocol_lib
521  * \brief This function is used to reset just the current interface
522  *
523  * \param[in]      secureTimerParams - secure timer instance
524  *
525  */
526 ESESTATUS phNxpEseProto7816_IntfReset(
527     phNxpEseProto7816SecureTimer_t* secureTimerParams);
528 
529 /**
530  * \ingroup ISO7816-3_protocol_lib
531  * \brief This function is used to close the 7816 protocol stack instance
532  *
533  * \param[in]      secureTimerParams - secure timer instance
534  *
535  */
536 ESESTATUS phNxpEseProto7816_Close(
537     phNxpEseProto7816SecureTimer_t* secureTimerParams);
538 
539 /**
540  * \ingroup ISO7816-3_protocol_lib
541  * \brief This function is used to open the 7816 protocol stack instance
542  *
543  * \param[in]      initParam: Initialization params
544  *
545  */
546 ESESTATUS phNxpEseProto7816_Open(phNxpEseProto7816InitParam_t initParam);
547 
548 /**
549  * \ingroup ISO7816-3_protocol_lib
550  * \brief This function is used to
551  *                  1. Send the raw data received from application after
552  *computing LRC
553  *                  2. Receive the response data from ESE, decode, process
554  *and
555  *                     store the data.
556  *                  3. Get the final complete data and sent back to application
557  *
558  * \param[in]       pCmd: Command to ESE
559  * \param[out]     pRsp: Response from ESE
560  *
561  *
562  */
563 ESESTATUS phNxpEseProto7816_Transceive(phNxpEse_data* pCmd,
564                                        phNxpEse_data* pRsp);
565 
566 /**
567  * \ingroup ISO7816-3_protocol_lib
568  * \brief This function is used to reset the 7816 protocol stack instance
569  *
570  *
571  *
572  */
573 ESESTATUS phNxpEseProto7816_Reset(void);
574 
575 /**
576  * \ingroup ISO7816-3_protocol_lib
577  * \brief This function is used to set the max T=1 data send size
578  *
579  * \param[in]   IFS_Size: Max. size of the I-frame
580  *
581  */
582 ESESTATUS phNxpEseProto7816_SetIfs(uint16_t IFS_Size);
583 /**
584  * \ingroup ISO7816-3_protocol_lib
585  * \brief This function is used to set the endpoint
586  *
587  * \param[in]  uEndPoint:   END_POINT_ESE = 0 (eSE services), END_POINT_EUICC
588  * =1(UICC services)
589  *
590  */
591 ESESTATUS phNxpEseProto7816_SetEndPoint(uint8_t uEndPoint);
592 /**
593  * \ingroup ISO7816-3_protocol_lib
594  * \brief This function is used to reset the endpoint
595  *
596  * \param[in]  uEndPoint:   END_POINT_ESE = 0 (eSE services), END_POINT_EUICC
597  * =1(UICC services)
598  *
599  */
600 ESESTATUS phNxpEseProto7816_ResetEndPoint(uint8_t uEndPoint);
601 /**
602  * \ingroup ISO7816-3_protocol_lib
603  * \brief This function is used to get ATR bytes for the application
604  *
605  * \param[out] pATRRsp: Response ATR bytes from ESE
606  *
607  */
608 ESESTATUS phNxpEseProto7816_getAtr(phNxpEse_data* pATRRsp);
609 
610 /**
611  * \ingroup ISO7816-3_protocol_lib
612  * \brief This function is used to get the max T=1 data send size
613  *
614  * \retval Current IFS adjusted value wrt card.
615  *
616  */
617 uint16_t phNxpEseProto7816_GetIfs(void);
618 
619 /**
620  * \ingroup ISO7816-3_protocol_lib
621  * \brief This function is used to get OS mode(JCOP/OSU)
622  *
623  * \retval OS mode(JCOP/OSU).
624  *
625  */
626 phNxpEseProto7816_OsType_t phNxpEseProto7816_GetOsMode(void);
627 /**
628  * \ingroup ISO7816-3_protocol_lib
629  * \brief This function is used to check eSE is alive/responding
630  *
631  *
632  *
633  */
634 ESESTATUS phNxpEseProto7816_CloseAllSessions(void);
635 /** @} */
636 #endif /* _PHNXPESEPROTO7816_3_H_ */
637