NXP Reader Library  v17.1.0.2535
HAL Initialization for Simulator

Example code to configure HAL and BAL for Simulator. More...

Collaboration diagram for HAL Initialization for Simulator:

Modules

 Software Initialization
 Example code to configure PAL 3A, 4A, 4, MIFARE and SLI15693 to work in software mode.
 

Detailed Description

Example code to configure HAL and BAL for Simulator.

#define CHECK_SUCCESS(x) \
if ( (x) != PH_ERR_SUCCESS ) \
{ \
printf ( "\n\n" ); \
printf ( "An error occurred: (0x%04X)\n", (x) ); \
printf ( "Pressing any key will exit the demo.\n" ); \
_getch (); \
return 0; \
}
/* Variables */
phStatus_t wStatus = 0;
phKeyStore_Sw_KeyEntry_t aKeyEntry[0xFF];
phKeyStore_Sw_KeyVersionPair_t aKeyVersionPair[0xFF];
phKeyStore_Sw_KUCEntry_t aKeyUsageCounter[0xFF];
uint8_t aPortName[] = {'1','2','7','.','0','.','0','.','1','\0','1','5','2','0','0','\0','0','0','0','1','\0'};
uint8_t aTx_SocketBuffer[0x800];
uint8_t aRx_SocketBuffer[0x200];
uint8_t aTx_SimBuffer[0x800];
uint8_t aRx_SimBuffer[0x800];
uint8_t aInt_SimBuffer[0xff00];
void* pBal_Generic = NULL;
void* pHal_Generic = NULL;
/* Initialize software KeyStore component. */
wStatus = phKeyStore_Sw_Init ( &stKeyStore, sizeof ( stKeyStore ), aKeyEntry, 0xFF, aKeyVersionPair, 0x03,
aKeyUsageCounter, 0xFF );
CHECK_SUCCESS ( wStatus );
/* Initialize the reader BAL component */
wStatus = phbalReg_SocketWin_Init ( &stBal_Socket, sizeof ( stBal_Socket ), 0, sizeof ( aTx_SocketBuffer ),
aTx_SocketBuffer, sizeof ( aRx_SocketBuffer ), aRx_SocketBuffer );
CHECK_SUCCESS ( wStatus );
wStatus = phbalReg_SetPort ( &stBal_Socket, aPortName );
CHECK_SUCCESS ( wStatus );
/* Open the reader port. */
wStatus = phbalReg_OpenPort ( &stBal_Socket );
CHECK_SUCCESS ( wStatus );
/* Initialize the reader HAL component. */
wStatus = phhalHw_RdCardSim_Init ( &stHal_Sim, sizeof ( stHal_Sim ), &stBal_Socket, &stKeyStore, aTx_SimBuffer,
sizeof ( aTx_SimBuffer ), aRx_SimBuffer, sizeof ( aRx_SimBuffer ), aInt_SimBuffer, sizeof ( aInt_SimBuffer ) );
CHECK_SUCCESS ( wStatus );
/* Update the generic components. */
pBal_Generic = &stBal_Socket;
pHal_Generic = &stHal_Sim;
phKeyStore_Sw_Init
phStatus_t phKeyStore_Sw_Init(phKeyStore_Sw_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, phKeyStore_Sw_KeyEntry_t *pKeyEntries, uint16_t wNoOfKeyEntries, phKeyStore_Sw_KeyVersionPair_t *pKeyVersionPairs, uint16_t wNoOfVersionPairs, phKeyStore_Sw_KUCEntry_t *pKUCEntries, uint16_t wNoOfKUCEntries)
Initializes the KeyStore component as software component.
phbalReg_SocketWin_Init
phStatus_t phbalReg_SocketWin_Init(phbalReg_SocketWin_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, uint8_t bMode, uint16_t wTxBufSize, uint8_t *pTxBuffer, uint16_t wWsaBufferSize, uint8_t *pWsaBuffer)
Initialise the Socket Win BAL component.
phhalHw_RdCardSim_Init
phStatus_t phhalHw_RdCardSim_Init(phhalHw_RdCardSim_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, void *pBalDataParams, void *pKeyStoreDataParams, uint8_t *pTxBuffer, uint16_t wTxBufSize, uint8_t *pRxBuffer, uint16_t wRxBufSize, uint8_t *pIntBuffer, uint16_t wIntBufferLen)
Initialise the HAL component.
phKeyStore_Sw_KeyEntry_t
Software KeyEntry structure.
Definition: phKeyStore.h:66
phKeyStore_Sw_DataParams_t
Software parameter structure.
Definition: phKeyStore.h:82
phKeyStore_Sw_KeyVersionPair_t
Software KeyVersionPair structure for Symmetric and ASymmetric keys.
Definition: phKeyStore.h:51
phStatus_t
uint16_t phStatus_t
phcsBfl_Status_t is a signed short value, using the positive range.
Definition: ph_TypeDefs.h:158
phbalReg_SetPort
phStatus_t phbalReg_SetPort(void *pDataParams, uint8_t *pPortName)
Select Port to be used.
phKeyStore_Sw_KUCEntry_t
Software KeyUsageCounter structure.
Definition: phKeyStore.h:75
phhalHw_RdCardSim_DataParams_t
RdCardSim HAL parameter structure.
Definition: phhalHw.h:509
phbalReg_OpenPort
phStatus_t phbalReg_OpenPort(void *pDataParams)
Open communication port.
uint8_t
unsigned char uint8_t
8 bit unsigned integer
Definition: ph_TypeDefs.h:56
phbalReg_SocketWin_DataParams_t
SocketWin(Windows) BAL parameter structure.
Definition: phbalReg.h:842