NXP Reader Library  v17.1.0.2535
HAL Initialization for DUT (Serial) based Readers

Example code to configure HAL and BAL for serial based DUT readers. Readers like RC663 Plus (BlueBoard), PN5180, PN7462AU, Pegoda3, etc... More...

Collaboration diagram for HAL Initialization for DUT (Serial) based Readers:

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 serial based DUT readers. Readers like RC663 Plus (BlueBoard), PN5180, PN7462AU, Pegoda3, etc...

#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;
uint8_t aEnumBuff[512];
uint8_t aTx_HalBuffer[512];
uint8_t aRx_HalBuffer[512];
void* pBal_Generic = NULL;
void* pHal_Generic = NULL;
/* Initialize the reader BAL component */
wStatus = phbalReg_SerialWin_Init ( &stBal_Serial, sizeof ( phbalReg_SerialWin_DataParams_t ), sizeof ( aEnumBuff ), aEnumBuff );
CHECK_SUCCESS ( wStatus );
/* User proper comport number to be connected to. */
wStatus = phbalReg_SetPort ( &stBal_Serial, ( uint8_t * ) "\\\\.\\COM5" );
CHECK_SUCCESS ( wStatus );
/* Open the reader port. */
wStatus = phbalReg_OpenPort ( &stBal_Serial );
CHECK_SUCCESS ( wStatus );
/* Set the bitrate for BAL. */
CHECK_SUCCESS ( wStatus );
/* Initialize the reader HAL component. */
wStatus = phhalHw_DUT_Init ( &stHal_DUT, sizeof ( stHal_DUT ), &stBal_Serial, 0, aTx_HalBuffer, sizeof ( aTx_HalBuffer ),
aRx_HalBuffer, sizeof ( aRx_HalBuffer ) );
CHECK_SUCCESS ( wStatus );
CHECK_SUCCESS ( wStatus );
/* Update the generic components. */
pBal_Generic = &stBal_Serial;
pHal_Generic = &stHal_DUT;
PHBAL_REG_SERIALWIN_CONFIG_BITRATE
#define PHBAL_REG_SERIALWIN_CONFIG_BITRATE
Configure communication speed.
Definition: phbalReg.h:63
PHBAL_REG_SERIALWIN_VALUE_BITRATE_115200
#define PHBAL_REG_SERIALWIN_VALUE_BITRATE_115200
Serial bitrate as 115200 kBit/s.
Definition: phbalReg.h:85
phbalReg_SerialWin_DataParams_t
Serial (Windows) BAL parameter structure.
Definition: phbalReg.h:43
phhalHw_DUT_InitReader
phStatus_t phhalHw_DUT_InitReader(phhalHw_DUT_DataParams_t *pDataParams, uint16_t wCmd)
Performs the initialization of different Components.
phStatus_t
uint16_t phStatus_t
phcsBfl_Status_t is a signed short value, using the positive range.
Definition: ph_TypeDefs.h:158
phhalHw_DUT_Init
phStatus_t phhalHw_DUT_Init(phhalHw_DUT_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, void *pBalDataParams, uint8_t bSlotNumber, uint8_t *pTxBuffer, uint16_t wTxBufSize, uint8_t *pRxBuffer, uint16_t wRxBufSize)
Initialize the HAL component.
phbalReg_SetPort
phStatus_t phbalReg_SetPort(void *pDataParams, uint8_t *pPortName)
Select Port to be used.
PHHAL_HW_DUT_INIT_CONTACTLESS
#define PHHAL_HW_DUT_INIT_CONTACTLESS
Initialize the reader to perform Contactless operation.
Definition: phhalHw_DUT_Cmd.h:53
phbalReg_SetConfig
phStatus_t phbalReg_SetConfig(void *pDataParams, uint16_t wConfig, uint16_t wValue)
Set configuration parameter.
phbalReg_SerialWin_Init
phStatus_t phbalReg_SerialWin_Init(phbalReg_SerialWin_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, uint16_t wEnumBufSize, uint8_t *pEnumBuffer)
Initialise the RS232 BAL component.
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
phhalHw_DUT_DataParams_t
DUT HAL parameter structure.
Definition: phhalHw.h:1166