NXP NFC Reader Library  v4.040.05.011646
Bus Abstraction Layer

These components implement the interfaces between physical host-device and physical reader-device. More...

Collaboration diagram for Bus Abstraction Layer:

Modules

 Component : LpcOpenSpi
 Component abstracting the functionality of LPC Open stack SPI interface.
 
 Component : LpcOpenI2c
 Component abstracting the functionality of LPC Open stack I2C interface.
 
 Component : KinetisSpi
 Component abstracting the functionality of Kinetis KSDK 2.0 SPI interface.
 
 Component : KinetisI2C
 Component abstracting the functionality of Kinetis KSDK 2.0 I2C interface.
 
 Component : Linux Kernel Spi
 Component without functionality to ease implementation of additional busses.
 
 Component : Linux User Spi
 Component without functionality to ease implementation of additional busses.
 
 Component : Linux User I2C
 Component without functionality to ease implementation of additional busses.
 

Data Structures

struct  phbalReg_Type_t
 BAL type structure. More...
 

Functions

phStatus_t phbalReg_GetPortList (void *pDataParams, uint16_t wPortBufSize, uint8_t *pPortNames, uint16_t *pNumOfPorts)
 List all available ports. More...
 
phStatus_t phbalReg_SetPort (void *pDataParams, uint8_t *pPortName)
 Select port to be used. More...
 
phStatus_t phbalReg_OpenPort (void *pDataParams)
 Open communication port. More...
 
phStatus_t phbalReg_ClosePort (void *pDataParams)
 Close communication port. More...
 
phStatus_t phbalReg_Exchange (void *pDataParams, uint16_t wOption, uint8_t *pTxBuffer, uint16_t wTxLength, uint16_t wRxBufSize, uint8_t *pRxBuffer, uint16_t *pRxLength)
 Perform data exchange on the bus. More...
 
phStatus_t phbalReg_SetConfig (void *pDataParams, uint16_t wConfig, uint16_t wValue)
 Set configuration parameter. More...
 
phStatus_t phbalReg_GetConfig (void *pDataParams, uint16_t wConfig, uint16_t *pValue)
 Get configuration parameter. More...
 

Generic BAL configuration parameters

#define PHBAL_REG_CONFIG_WRITE_TIMEOUT_MS   0x0000U
 Configure transmission timeout in milliseconds. More...
 
#define PHBAL_REG_CONFIG_READ_TIMEOUT_MS   0x0001U
 Configure reception timeout in milliseconds. More...
 

BAL types

#define PHBAL_REG_TYPE_SPI   0x0001U
 Configure transmission timeout in milliseconds. More...
 
#define PHBAL_REG_TYPE_I2C   0x0002U
 Configure reception timeout in milliseconds. More...
 
#define PHBAL_REG_TYPE_SERIAL_WIN   0x0003U
 Configure reception timeout in milliseconds. More...
 

Detailed Description

These components implement the interfaces between physical host-device and physical reader-device.

Macro Definition Documentation

§ PHBAL_REG_CONFIG_WRITE_TIMEOUT_MS

#define PHBAL_REG_CONFIG_WRITE_TIMEOUT_MS   0x0000U

Configure transmission timeout in milliseconds.

§ PHBAL_REG_CONFIG_READ_TIMEOUT_MS

#define PHBAL_REG_CONFIG_READ_TIMEOUT_MS   0x0001U

Configure reception timeout in milliseconds.

§ PHBAL_REG_TYPE_SPI

#define PHBAL_REG_TYPE_SPI   0x0001U

Configure transmission timeout in milliseconds.

§ PHBAL_REG_TYPE_I2C

#define PHBAL_REG_TYPE_I2C   0x0002U

Configure reception timeout in milliseconds.

§ PHBAL_REG_TYPE_SERIAL_WIN

#define PHBAL_REG_TYPE_SERIAL_WIN   0x0003U

Configure reception timeout in milliseconds.

Function Documentation

§ phbalReg_GetPortList()

phStatus_t phbalReg_GetPortList ( void *  pDataParams,
uint16_t  wPortBufSize,
uint8_t pPortNames,
uint16_t pNumOfPorts 
)

List all available ports.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_BUFFER_OVERFLOWGiven enumeration buffer is too small.
PH_ERR_INTERFACE_ERRORError while enumerating devices.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wPortBufSizeBuffer Size of Port Name String.
[out]pPortNamesPort Name as Multi-String.
[out]pNumOfPortsNumber of found port strings.

§ phbalReg_SetPort()

phStatus_t phbalReg_SetPort ( void *  pDataParams,
uint8_t pPortName 
)

Select port to be used.

Example SerialWin: The caller has to ensure that pPortName is valid throughout the whole lifetime of pDataParams.
Furthermore, the caller is responsible for prepending "\\.\" if COM ports above COM9 need to be accessed.

Example:

strcpy(pPortName, "COM9"); <-- correct
strcpy(pPortName, "\\\\.\\COM9"); <-- correct
strcpy(pPortName, "\\\\.\\COM10"); <-- correct
strcpy(pPortName, "COM10"); <-- wrong
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]pPortNamePort Name as String.

§ phbalReg_OpenPort()

phStatus_t phbalReg_OpenPort ( void *  pDataParams)

Open communication port.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_USE_CONDITIONCommunication port is already open.
PH_ERR_INTERFACE_ERRORError while opening port.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.

§ phbalReg_ClosePort()

phStatus_t phbalReg_ClosePort ( void *  pDataParams)

Close communication port.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_USE_CONDITIONCommunication port is not open.
PH_ERR_INTERFACE_ERRORError while closing port.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.

§ phbalReg_Exchange()

phStatus_t phbalReg_Exchange ( void *  pDataParams,
uint16_t  wOption,
uint8_t pTxBuffer,
uint16_t  wTxLength,
uint16_t  wRxBufSize,
uint8_t pRxBuffer,
uint16_t pRxLength 
)

Perform data exchange on the bus.

This API is used for command exchange between front-end CLIF and HOST. SPI : This API will also perform required flow control for particular front-end.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERwOption is invalid.
PH_ERR_IO_TIMEOUTNo response received within given time frame.
PH_ERR_BUFFER_OVERFLOWResponse is too big for either given receive buffer or internal buffer.
PH_ERR_INTERFACE_ERRORCommunication error.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wOptionOption parameter.
[in]pTxBufferData to transmit.
[in]wTxLengthNumber of bytes to transmit.
[in]wRxBufSizeSize of receive buffer / Number of bytes to receive (depending on implementation).
[out]pRxBufferReceived data.
[out]pRxLengthNumber of received data bytes.

§ phbalReg_SetConfig()

phStatus_t phbalReg_SetConfig ( void *  pDataParams,
uint16_t  wConfig,
uint16_t  wValue 
)

Set configuration parameter.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_UNSUPPORTED_PARAMETERConfiguration is not supported or invalid.
PH_ERR_INVALID_PARAMETERParameter value is invalid.
PH_ERR_INTERFACE_ERRORCommunication error.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wConfigConfiguration identifier.
[in]wValueConfiguration value.

§ phbalReg_GetConfig()

phStatus_t phbalReg_GetConfig ( void *  pDataParams,
uint16_t  wConfig,
uint16_t pValue 
)

Get configuration parameter.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_UNSUPPORTED_PARAMETERConfiguration is not supported or invalid.
PH_ERR_INTERFACE_ERRORCommunication error.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wConfigConfiguration identifier.
[out]pValueConfiguration value.