NXP NFC Reader Library v4.040.05.011646

Modules | Data Structures | Functions
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_SUCCESS | Operation successful.
  PH_ERR_BUFFER_OVERFLOW | Given enumeration buffer is too small.
  PH_ERR_INTERFACE_ERROR | Error while enumerating devices.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wPortBufSize | Buffer Size of Port Name String.
  [out] | pPortNames | Port Name as Multi-String.
  [out] | pNumOfPorts | Number 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_SUCCESS | Operation successful.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | pPortName | Port Name as String.

## § phbalReg_OpenPort()

phStatus_t phbalReg_OpenPort | ( | void * | pDataParams | ) |

Open communication port.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_USE_CONDITION | Communication port is already open.
  PH_ERR_INTERFACE_ERROR | Error while opening port.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.

## § phbalReg_ClosePort()

phStatus_t phbalReg_ClosePort | ( | void * | pDataParams | ) |

Close communication port.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_USE_CONDITION | Communication port is not open.
  PH_ERR_INTERFACE_ERROR | Error while closing port.

Parameters

  [in] | pDataParams | Pointer 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_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | wOption is invalid.
  PH_ERR_IO_TIMEOUT | No response received within given time frame.
  PH_ERR_BUFFER_OVERFLOW | Response is too big for either given receive buffer or internal buffer.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wOption | Option parameter.
  [in] | pTxBuffer | Data to transmit.
  [in] | wTxLength | Number of bytes to transmit.
  [in] | wRxBufSize | Size of receive buffer / Number of bytes to receive (depending on implementation).
  [out] | pRxBuffer | Received data.
  [out] | pRxLength | Number 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_SUCCESS | Operation successful.
  PH_ERR_UNSUPPORTED_PARAMETER | Configuration is not supported or invalid.
  PH_ERR_INVALID_PARAMETER | Parameter value is invalid.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration identifier.
  [in] | wValue | Configuration 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_SUCCESS | Operation successful.
  PH_ERR_UNSUPPORTED_PARAMETER | Configuration is not supported or invalid.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration identifier.
  [out] | pValue | Configuration value.