NXP NFC Reader Library v4.040.05.011646

Modules | Functions
ISO/IEC 14443-4mC
Protocol Abstraction Layer

This component implements the PICC side of ISO/IEC 14443-4 Protocol. More...

Collaboration diagram for ISO/IEC 14443-4mC:

## Modules
| Component : Software

## Functions
phStatus_t | phpalI14443p4mC_ResetProtocol (void *pDataParams)
| Reset protocol parameters. More...
phStatus_t | phpalI14443p4mC_Activate (void *pDataParams, uint8_t *pRats, uint8_t bRatsLength, uint8_t *pAts, uint16_t wAtsLength)
| Validates received RATS request and send ATS response. More...
phStatus_t | phpalI14443p4mC_Receive (void *pDataParams, uint16_t wOption, uint8_t **ppRxBuffer, uint16_t *pRxLength)
| Perform receive operation and validate received block. More...
phStatus_t | phpalI14443p4mC_Transmit (void *pDataParams, uint16_t wOption, uint8_t *pTxBuffer, uint16_t wTxLength)
| Transmit I-Block block. More...
phStatus_t | phpalI14443p4mC_Wtx (void *pDataParams)
| Sends WTX request and receive WTX response. More...
phStatus_t | phpalI14443p4mC_SetConfig (void *pDataParams, uint16_t wConfig, uint16_t wValue)
| Set configuration parameter. More...
phStatus_t | phpalI14443p4mC_GetConfig (void *pDataParams, uint16_t wConfig, uint16_t *pValue)
| Get configuration parameter. More...

## ISO14443-4 card mode data rates
#define | PHPAL_I14443P4MC_106 0x00
| Set communication speed to 106 kbs. More...
#define | PHPAL_I14443P4MC_212 0x01
| Set communication speed to 212 kbs. More...
#define | PHPAL_I14443P4MC_424 0x02
| Set communication speed to 424 kbs. More...
#define | PHPAL_I14443P4MC_848 0x04
| Set communication speed to 848 kbs. More...

## ISO14443-4 card mode states
#define | PHPAL_I14443P4MC_STATE_NONE 0x00U
| Initialized State. More...
#define | PHPAL_I14443P4MC_STATE_ATS 0x01U
| State once we send successful ATS for RATS. More...
#define | PHPAL_I14443P4MC_STATE_PPS 0x02U
| State once we receive PPS Request. More...
#define | PHPAL_I14443P4MC_STATE_RX 0x03U
| Internal State once we are in Receive State. More...
#define | PHPAL_I14443P4MC_STATE_TX_I 0x04U
| State once we have received successful I (Information) Block. More...
#define | PHPAL_I14443P4MC_STATE_TX_R 0x05U
| State once we have received R Block. More...
#define | PHPAL_I14443P4MC_STATE_WTX 0x07U
| State once we have received S Block (WTX). More...
#define | PHPAL_I14443P4MC_STATE_DESELECT 0x08U
| State once we have received S Block (DESELECT). More...
#define | PHPAL_I14443P4MC_STATE_PARAMETERS 0x09U
| State once we have received S Block (PARAMETERS). More...
#define | PHPAL_I14443P4MC_STATE_RESEND 0x0AU
| State to handle errors, like in case of NAK. More...
#define | PHPAL_I14443P4MC_STATE_RXCHAINING 0x0BU
| State to handle RX Data Chaining. More...
#define | PHPAL_I14443P4MC_STATE_TXCHAINING 0x0CU
| State to handle TX Data Chaining. More...

## ISO14443-4 card mode configuration parameters
#define | PHPAL_I14443P4MC_CONFIG_WTX 0x0000U
| Enable/Disable WTX feature. More...
#define | PHPAL_I14443P4MC_CONFIG_WTX_VALUE 0x0001U
| Set the WTX value. More...
#define | PHPAL_I14443P4MC_CONFIG_BLOCKNO 0x0002U
| Get the value of current ISO14443-4 protocol block number. More...
#define | PHPAL_I14443P4MC_CONFIG_FSDI 0x0003U
| Get the FSDI value. More...
#define | PHPAL_I14443P4MC_CONFIG_MODE 0x0004U
| Set/Get the operation mode (RD_LIB_MODE_NFC or RD_LIB_MODE_ISO). More...
#define | PHPAL_I14443P4MC_CONFIG_FSD 0x0005U
| Get the current frame size (FSD) value. More...
#define | PHPAL_I14443P4MC_CONFIG_WT_PERCENTAGE 0x0006U
| Set/Get the percentage of actual time to be used in WTX timer. More...
#define | PHPAL_I14443P4MC_CONFIG_WT_DELTA 0x0007U
| Set/Get the delta time to be subtracted from the time in WTX timer. More...
#define | PHPAL_I14443P4MC_CONFIG_CID_PRESENCE 0x0008U
| Check if CID is present in current received block. More...
#define | PHPAL_I14443P4MC_CONFIG_NAD_PRESENCE 0x0009U
| Check if NAD is present in current received I-block. More...

## Detailed Description

This component implements the PICC side of ISO/IEC 14443-4 Protocol.

## Macro Definition Documentation

## § PHPAL_I14443P4MC_106

#define PHPAL_I14443P4MC_106 0x00

Set communication speed to 106 kbs.

## § PHPAL_I14443P4MC_212

#define PHPAL_I14443P4MC_212 0x01

Set communication speed to 212 kbs.

## § PHPAL_I14443P4MC_424

#define PHPAL_I14443P4MC_424 0x02

Set communication speed to 424 kbs.

## § PHPAL_I14443P4MC_848

#define PHPAL_I14443P4MC_848 0x04

Set communication speed to 848 kbs.

## § PHPAL_I14443P4MC_STATE_NONE

#define PHPAL_I14443P4MC_STATE_NONE 0x00U

Initialized State.

## § PHPAL_I14443P4MC_STATE_ATS

#define PHPAL_I14443P4MC_STATE_ATS 0x01U

State once we send successful ATS for RATS.

## § PHPAL_I14443P4MC_STATE_PPS

#define PHPAL_I14443P4MC_STATE_PPS 0x02U

State once we receive PPS Request.

## § PHPAL_I14443P4MC_STATE_RX

#define PHPAL_I14443P4MC_STATE_RX 0x03U

Internal State once we are in Receive State.

## § PHPAL_I14443P4MC_STATE_TX_I

#define PHPAL_I14443P4MC_STATE_TX_I 0x04U

State once we have received successful I (Information) Block.

## § PHPAL_I14443P4MC_STATE_TX_R

#define PHPAL_I14443P4MC_STATE_TX_R 0x05U

State once we have received R Block.

## § PHPAL_I14443P4MC_STATE_WTX

#define PHPAL_I14443P4MC_STATE_WTX 0x07U

State once we have received S Block (WTX).

## § PHPAL_I14443P4MC_STATE_DESELECT

#define PHPAL_I14443P4MC_STATE_DESELECT 0x08U

State once we have received S Block (DESELECT).

## § PHPAL_I14443P4MC_STATE_PARAMETERS

#define PHPAL_I14443P4MC_STATE_PARAMETERS 0x09U

State once we have received S Block (PARAMETERS).

## § PHPAL_I14443P4MC_STATE_RESEND

#define PHPAL_I14443P4MC_STATE_RESEND 0x0AU

State to handle errors, like in case of NAK.

## § PHPAL_I14443P4MC_STATE_RXCHAINING

#define PHPAL_I14443P4MC_STATE_RXCHAINING 0x0BU

State to handle RX Data Chaining.

## § PHPAL_I14443P4MC_STATE_TXCHAINING

#define PHPAL_I14443P4MC_STATE_TXCHAINING 0x0CU

State to handle TX Data Chaining.

## § PHPAL_I14443P4MC_CONFIG_WTX

#define PHPAL_I14443P4MC_CONFIG_WTX 0x0000U

Enable/Disable WTX feature.

## § PHPAL_I14443P4MC_CONFIG_WTX_VALUE

#define PHPAL_I14443P4MC_CONFIG_WTX_VALUE 0x0001U

Set the WTX value.

## § PHPAL_I14443P4MC_CONFIG_BLOCKNO

#define PHPAL_I14443P4MC_CONFIG_BLOCKNO 0x0002U

Get the value of current ISO14443-4 protocol block number.

## § PHPAL_I14443P4MC_CONFIG_FSDI

#define PHPAL_I14443P4MC_CONFIG_FSDI 0x0003U

Get the FSDI value.

## § PHPAL_I14443P4MC_CONFIG_MODE

#define PHPAL_I14443P4MC_CONFIG_MODE 0x0004U

Set/Get the operation mode (RD_LIB_MODE_NFC or RD_LIB_MODE_ISO).

## § PHPAL_I14443P4MC_CONFIG_FSD

#define PHPAL_I14443P4MC_CONFIG_FSD 0x0005U

Get the current frame size (FSD) value.

## § PHPAL_I14443P4MC_CONFIG_WT_PERCENTAGE

#define PHPAL_I14443P4MC_CONFIG_WT_PERCENTAGE 0x0006U

Set/Get the percentage of actual time to be used in WTX timer.

## § PHPAL_I14443P4MC_CONFIG_WT_DELTA

#define PHPAL_I14443P4MC_CONFIG_WT_DELTA 0x0007U

Set/Get the delta time to be subtracted from the time in WTX timer.

## § PHPAL_I14443P4MC_CONFIG_CID_PRESENCE

#define PHPAL_I14443P4MC_CONFIG_CID_PRESENCE 0x0008U

Check if CID is present in current received block.

1 - Present; 0 - Not present.

## § PHPAL_I14443P4MC_CONFIG_NAD_PRESENCE

#define PHPAL_I14443P4MC_CONFIG_NAD_PRESENCE 0x0009U

Check if NAD is present in current received I-block.

1 - Present; 0 - Not present.

## Function Documentation

## § phpalI14443p4mC_ResetProtocol()

phStatus_t phpalI14443p4mC_ResetProtocol | ( | void * | pDataParams | ) |

Reset protocol parameters.

Removes any state information stored in previous runs.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.

Parameters

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

## § phpalI14443p4mC_Activate()

phStatus_t phpalI14443p4mC_Activate | ( | void * | pDataParams,
|  | uint8_t * | pRats,
|  | uint8_t | bRatsLength,
|  | uint8_t * | pAts,
|  | uint16_t | wAtsLength
| ) |  |

Validates received RATS request and send ATS response.

The user has to call phpalI14443p4mC_Receive() once this function has returned with success status.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_EXT_RF_ERROR | External field turned OFF.
  PH_ERR_PROTOCOL_ERROR | Protocol Error, RATS is invalid.
  PH_ERR_INVALID_PARAMETER | Invalid input parameter, ATS is invalid.
  Other | depending on implementation and underlying components.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure
  [in] | pRats | Pointer to received RATS request
  [in] | bRatsLength | RATS Length
  [in] | pAts | ATS to be sent
  [in] | wAtsLength | ATS length

## § phpalI14443p4mC_Receive()

phStatus_t phpalI14443p4mC_Receive | ( | void * | pDataParams,
|  | uint16_t | wOption,
|  | uint8_t ** | ppRxBuffer,
|  | uint16_t * | pRxLength
| ) |  |

Perform receive operation and validate received block.

Used to receive the next command from PCD after the Activate() is successful. Responses to S-block and R-Block are sent internally. Response to I-Block can be sent using phpalI14443p4mC_Transmit. This function also handles PPS request sent from the reader by sending a PPS response. An I-Frame received from the reader is returned back to the user. Handles DESELECT by sending DESELECT response Starts WTx timer before returning with the valid received packet to the caller

`wOption` can be one of:

- PH_RECEIVE_DEFAULT
- PH_RECEIVE_CHAINING
- PH_RECEIVE_CHAINING_BUFSIZE

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_SUCCESS_CHAINING | RX chaining incomplete.
  PH_ERR_SUCCESS_DESELECTED | Card got DESELECTED.
  PH_ERR_EXT_RF_ERROR | External field turned OFF.
  PH_ERR_BUFFER_OVERFLOW | Buffer overflow.
  Other | depending on implementation and underlying components.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wOption | Option parameter.
  [out] | ppRxBuffer | Pointer to received data.
  [out] | pRxLength | Number of received data bytes.

## § phpalI14443p4mC_Transmit()

phStatus_t phpalI14443p4mC_Transmit | ( | void * | pDataParams,
|  | uint16_t | wOption,
|  | uint8_t * | pTxBuffer,
|  | uint16_t | wTxLength
| ) |  |

Transmit I-Block block.

This function transmits an information block. Stops the WTx timer if it is running.

`wOption` can be one of:

- PH_TRANSMIT_DEFAULT
- PH_TRANSMIT_BUFFER_FIRST
- PH_TRANSMIT_BUFFER_CONT
- PH_TRANSMIT_BUFFER_LAST

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_EXT_RF_ERROR | External field turned OFF.
  PH_ERR_BUFFER_OVERFLOW | buffer overflow.
  Other | depending on implementation and underlying components.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wOption | Option parameter.
  [in] | pTxBuffer | I-Block data to transmit.
  [in] | wTxLength | Length of data to transmit.

## § phpalI14443p4mC_Wtx()

phStatus_t phpalI14443p4mC_Wtx | ( | void * | pDataParams | ) |

Sends WTX request and receive WTX response.

Wait time extension request is sent by this function and this will block till it receives a response from the external reader.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_PROTOCOL_ERROR | Protocol Error.
  Other | Depending on implementation and underlying component.

Parameters

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

## § phpalI14443p4mC_SetConfig()

phStatus_t phpalI14443p4mC_SetConfig | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint16_t | wValue
| ) |  |

Set configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | Parameter value is invalid.
  Other | Depending on implementation and underlying component.

Parameters

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

## § phpalI14443p4mC_GetConfig()

phStatus_t phpalI14443p4mC_GetConfig | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint16_t * | pValue
| ) |  |

Get configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | Parameter value is invalid.

Parameters

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