NXP Reader Library  v17.1.0.2535
HAL Initialization for PCSC Reader

Example code to configure HAL and BAL for PCSC reader. More...

Collaboration diagram for HAL Initialization for PCSC Reader:

Modules

 Pcsc Initialization
 Example code to configure PAL 3A, 4A, 4 and MIFARE to work in Pcsc mode. This is valid for Pcsc readers only.
 

Detailed Description

Example code to configure HAL and BAL for PCSC reader.

#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 aAtr[512];
uint8_t aTx_HalBuffer[512];
uint8_t aRx_HalBuffer[512];
void* pBal_Generic = NULL;
void* pHal_Generic = NULL;
/* Initialize software KeyStore component. */
wStatus = phKeyStore_Sw_Init ( &stKeyStore, sizeof ( phKeyStore_Sw_DataParams_t ), aKeyEntry, 0xFF, aKeyVersionPair, 0x03,
aKeyUsageCounter, 0xFF );
CHECK_SUCCESS ( wStatus );
/* Initialize the reader BAL component */
wStatus = phbalReg_PcscWin_Init ( &stBal_Pcsc, sizeof ( phbalReg_SerialWin_DataParams_t ), aAtr, ( uint16_t ) sizeof ( aAtr ) );
CHECK_SUCCESS ( wStatus );
/* Set the BAL Communication Configuration values */
CHECK_SUCCESS ( wStatus );
CHECK_SUCCESS ( wStatus );
/* User proper Reader String to be connected. */
wStatus = phbalReg_SetPort ( &stBal_Pcsc, ( uint8_t * ) "Identiv CLOUD 3700 F Contactless Reader 0" );
CHECK_SUCCESS ( wStatus );
/* Open the reader port. */
wStatus = phbalReg_OpenPort ( &stBal_Pcsc );
CHECK_SUCCESS ( wStatus );
/* Initialize the reader HAL component. */
wStatus = phhalHw_Pcsc_Init ( &stHal_Pcsc, sizeof ( stHal_Pcsc ), &stBal_Pcsc, stKeyStore, aTx_HalBuffer, sizeof ( aTx_HalBuffer ),
aRx_HalBuffer, sizeof ( aRx_HalBuffer ) );
CHECK_SUCCESS ( wStatus );
/* Update the generic components. */
pBal_Generic = &stBal_Pcsc;
pHal_Generic = &stHal_Pcsc;
phbalReg_PcscWin_DataParams_t
PCSC (Windows) BAL parameter structure.
Definition: phbalReg.h:522
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_SerialWin_DataParams_t
Serial (Windows) BAL parameter structure.
Definition: phbalReg.h:43
phKeyStore_Sw_KeyEntry_t
Software KeyEntry structure.
Definition: phKeyStore.h:66
PHBAL_REG_PCSCWIN_VALUE_PROTOCOL_T1
#define PHBAL_REG_PCSCWIN_VALUE_PROTOCOL_T1
T=1 protocol.
Definition: phbalReg.h:560
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.
uint16_t
unsigned short uint16_t
16 bit unsigned integer
Definition: ph_TypeDefs.h:62
phKeyStore_Sw_KUCEntry_t
Software KeyUsageCounter structure.
Definition: phKeyStore.h:75
phbalReg_SetConfig
phStatus_t phbalReg_SetConfig(void *pDataParams, uint16_t wConfig, uint16_t wValue)
Set configuration parameter.
PHBAL_REG_PCSCWIN_VALUE_PROTOCOL_T0
#define PHBAL_REG_PCSCWIN_VALUE_PROTOCOL_T0
T=0 protocol.
Definition: phbalReg.h:559
phhalHw_Pcsc_DataParams_t
PCSC HAL component.
Definition: phhalHw.h:1317
PHBAL_REG_PCSCWIN_CONFIG_SHARE
#define PHBAL_REG_PCSCWIN_CONFIG_SHARE
Used Access mode; e.g.
Definition: phbalReg.h:550
phbalReg_OpenPort
phStatus_t phbalReg_OpenPort(void *pDataParams)
Open communication port.
phbalReg_PcscWin_Init
phStatus_t phbalReg_PcscWin_Init(phbalReg_PcscWin_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, uint8_t *pAtrBuffer, uint16_t wAtrBufSize)
Initialise the PCSC BAL component.
PHBAL_REG_PCSCWIN_CONFIG_PROTOCOL
#define PHBAL_REG_PCSCWIN_CONFIG_PROTOCOL
Used Protocol; e.g.
Definition: phbalReg.h:549
uint8_t
unsigned char uint8_t
8 bit unsigned integer
Definition: ph_TypeDefs.h:56
PHBAL_REG_PCSCWIN_VALUE_SHARE_SHARED
#define PHBAL_REG_PCSCWIN_VALUE_SHARE_SHARED
SHARED access.
Definition: phbalReg.h:564
phhalHw_Pcsc_Init
phStatus_t phhalHw_Pcsc_Init(phhalHw_Pcsc_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, void *pBalDataParams, void *pKeyStoreDataParams, uint8_t *pTxBuffer, uint16_t wTxBufSize, uint8_t *pRxBuffer, uint16_t wRxBufSize)
Initializes the PCSC HAL component.