/****************************************************************************** * * Copyright 2018-2019 NXP * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ #ifndef _PHNXPSPILIB_H_ #define _PHNXPSPILIB_H_ #include /* Macro to enable SPM Module */ #define SPM_INTEGRATED //#undef SPM_INTEGRATED #ifdef SPM_INTEGRATED #include "../spm/phNxpEse_Spm.h" #endif /********************* Definitions and structures *****************************/ typedef enum { ESE_STATUS_CLOSE = 0x00, ESE_STATUS_BUSY, ESE_STATUS_RECOVERY, ESE_STATUS_IDLE, ESE_STATUS_OPEN, } phNxpEse_LibStatus; typedef enum { PN67T_POWER_SCHEME = 0x01, PN80T_LEGACY_SCHEME, PN80T_EXT_PMU_SCHEME, } phNxpEse_PowerScheme; typedef enum { END_POINT_ESE = 0, /*!< eSE services */ END_POINT_EUICC, /*!< UICC services*/ MAX_END_POINTS } phNxpEse_EndPoint; /* Macros definition */ #define MAX_DATA_LEN 780 #define SECOND_TO_MILLISECOND(X) X * 1000 #define CONVERT_TO_PERCENTAGE(X, Y) X* Y / 100 #define ADDITIONAL_SECURE_TIME_PERCENTAGE 5 #define ESE_JCOP_OS_DWNLD_RETRY_CNT \ 10 /* Maximum retry count for ESE JCOP OS Dwonload*/ #define ESE_FW_DWNLD_RETRY_CNT 10 /* Maximum retry count for FW Dwonload*/ /*! * \brief Secure timer values F1, F2, F3 * * */ typedef struct phNxpEse_SecureTimer { unsigned int secureTimer1; /*!< Secure timer 1 value */ unsigned int secureTimer2; /*!< Secure timer 2 value */ unsigned int secureTimer3; /*!< Secure timer 3 value */ } phNxpEse_SecureTimer_t; typedef enum nadInfoTx { ESE_NAD_TX = 0x5A, /*!< R-frame Acknowledgement frame indicator */ EUICC_NAD_TX = 0x4B /*!< R-frame Negative-Acknowledgement frame indicator */ } nadInfoTx_t; /*! * \brief R-Frame types used in 7816-3 protocol stack */ typedef enum nadInfoRx { ESE_NAD_RX = 0xA5, /*!< R-frame Acknowledgement frame indicator */ EUICC_NAD_RX = 0xB4 /*!< R-frame Negative-Acknowledgement frame indicator */ } nadInfoRx_t; /*! * \brief Node address Info structure * * */ typedef struct phNxpEseNadInfo { nadInfoTx_t nadTx; /*!< nod address for tx */ nadInfoRx_t nadRx; /*!< nod address for rx */ } phNxpEseNadInfo_t; /* JCOP download states */ typedef enum jcop_dwnld_state { JCP_DWNLD_IDLE = SPM_STATE_JCOP_DWNLD, /* jcop dwnld is not ongoing*/ JCP_DWNLD_INIT = 0x8010, /* jcop dwonload init state*/ JCP_DWNLD_START = 0x8020, /* download started */ JCP_SPI_DWNLD_COMPLETE = 0x8040, /* jcop download complete in spi interface*/ JCP_DWP_DWNLD_COMPLETE = 0x8080, /* jcop download complete */ } phNxpEse_JcopDwnldState; /*! * \brief SPI Control structure * * */ typedef struct phNxpEse_Context { void* pDevHandle; /*!