NXP NFC Reader Library v4.040.05.011646

Modules | Data Structures | Typedefs | Functions
Hardware Abstraction Layer

These are the components which are used to abstract the functionality of the physical reader device to a generic interface. More...

Collaboration diagram for Hardware Abstraction Layer:

## Modules
| component : Rc663
| RC663 Reader HAL.
| component : Rc523
| RC523 Reader HAL.
| component : Pn5180
| Pn5180 HAL component.

## Data Structures
struct | phhalHw_Nfc_Ic_DataParams_t
| HAL parameter structure. More...

## Typedefs
typedef void(* | ppRFCallBck_t) (void *pDataParams)
| RF callback which will be called by ISR handler implementation in Platform Layer. More...

## Functions
phStatus_t | phhalHw_Nfc_IC_Init (phhalHw_Nfc_Ic_DataParams_t *pDataParams, uint16_t wSizeOfDataParams, void *pBalDataParams, void *pKeyStoreDataParams, uint8_t *pTxBuffer, uint16_t wTxBufSize, uint8_t *pRxBuffer, uint16_t wRxBufSize)
| Initialize the HAL component. More...
phStatus_t | phhalHw_Exchange (void *pDataParams, uint16_t wOption, uint8_t *pTxBuffer, uint16_t wTxLength, uint8_t **ppRxBuffer, uint16_t *pRxLength)
| Perform data exchange with target/PICC in initiator/PCD mode. More...
phStatus_t | phhalHw_ApplyProtocolSettings (void *pDataParams, uint8_t bMode)
| Configure reader IC for a particular reader/initiator protocol. More...
phStatus_t | phhalHw_MfcAuthenticateKeyNo (void *pDataParams, uint8_t bBlockNo, uint8_t bKeyType, uint16_t wKeyNo, uint16_t wKeyVersion, uint8_t *pUid)
| Perform MIFARE(R) Classic authentication using a key number. More...
phStatus_t | phhalHw_MfcAuthenticate (void *pDataParams, uint8_t bBlockNo, uint8_t bKeyType, uint8_t *pKey, uint8_t *pUid)
| Perform MIFARE(R) Classic authentication using a key. More...
phStatus_t | phhalHw_SetConfig (void *pDataParams, uint16_t wConfig, uint16_t wValue)
| Set configuration parameter. More...
phStatus_t | phhalHw_GetConfig (void *pDataParams, uint16_t wConfig, uint16_t *pValue)
| Get configuration parameter. More...
phStatus_t | phhalHw_FieldOn (void *pDataParams)
| Switch ON the RF-field. More...
phStatus_t | phhalHw_FieldOff (void *pDataParams)
| Switch off the RF-field. More...
phStatus_t | phhalHw_FieldReset (void *pDataParams)
| Perform RF-Reset. More...
phStatus_t | phhalHw_Wait (void *pDataParams, uint8_t bUnit, uint16_t wTimeout)
| phhalHw_Wait function waits/loops until the input time value is elapsed. More...
phStatus_t | phhalHw_Transmit (void *pDataParams, uint16_t wOption, uint8_t *pTxBuffer, uint16_t wTxLength)
| Used to transmit data. More...
phStatus_t | phhalHw_Receive (void *pDataParams, uint16_t wOption, uint8_t **ppRxBuffer, uint16_t *pRxLength)
| Used to receive data. More...
phStatus_t | phhalHw_Autocoll (void *pDataParams, uint16_t wMode, uint8_t **ppRxBuffer, uint16_t *pRxLength, uint16_t *pProtParams)
| Used to configure the IC to NFC target or card mode based on the configured option. More...
phStatus_t | phhalHw_Lpcd (void *pDataParams)
| Perform Low-Power-Card-Detection. More...
phStatus_t | phhalHw_AsyncAbort (void *pDataParams)
| Used to asynchronously stop HAL waiting for RF event and exit from HAL. More...
phStatus_t | phhalHw_I18000p3m3Inventory (void *pDataParams, uint8_t *pSelCmd, uint8_t bSelCmdLen, uint8_t bNumValidBitsinLastByte, uint8_t *pBeginRndCmd, uint8_t bTSprocessing, uint8_t **ppRxBuffer, uint16_t *wRxBufferLen)
| ISO 18000p3m3 Inventory command. More...
phStatus_t | phhalHw_I18000p3m3ResumeInventory (void *pDataParams, uint8_t **ppRxBuffer, uint16_t *wRxBufferLen)
| ISO 18000p3m3 resume inventory command. More...
phStatus_t | phhalHw_EventConsume (void *pDataParams)
| Used to consume all the event generated in Hal. More...
phStatus_t | phhalHw_EventWait (void *pDataParams, uint32_t dwEventTimeout)
| Used to wait any event generate in Hal. More...
phStatus_t | phhalHw_DeInit (void *pDataParams)
| De-initializes the contactless IC HAL. More...

## HAL events
#define | E_PH_OSAL_EVT_WAITING 0
#define | E_PH_OSAL_EVT_RF (1 << 0)
| Event posted by CLIF ISR once the interrupt line goes high to the CLIF HAL. More...
#define | E_PH_OSAL_EVT_ABORT (1 << 5)
| Event posted by the application to shut down the reader library thread. More...

## Communication configuration parameters \n
These parameters are used to configure hardware/HAL in a particular manner before performing an operation.
#define | PHHAL_HW_CONFIG_PARITY 0x0000U
| Enable (PH_ON) or Disable (PH_OFF) Parity. More...
#define | PHHAL_HW_CONFIG_TXCRC 0x0001U
| Enable (PH_ON) or disable (PH_OFF) transmit CRC. More...
#define | PHHAL_HW_CONFIG_RXCRC 0x0002U
| Enable (PH_ON) or disable (PH_OFF) receive CRC. More...
#define | PHHAL_HW_CONFIG_TXLASTBITS 0x0003U
| Set number of valid bits for the last transmitted byte. More...
#define | PHHAL_HW_CONFIG_RXLASTBITS 0x0004U
| Get number of valid bits of last received byte. More...
#define | PHHAL_HW_CONFIG_RXALIGN 0x0005U
| Set Rx-Aligned Bits. More...
#define | PHHAL_HW_CONFIG_RXWAIT_US 0x0006U
| Configure receiver deaf-time (time after a send where every reception is ignored) in microseconds. More...
#define | PHHAL_HW_CONFIG_TXWAIT_US 0x0007U
| Set Tx wait time (time between last RxIrq and Tx of succeeding frame) in microseconds. More...
#define | PHHAL_HW_CONFIG_TXDATARATE_FRAMING 0x0009U
| Configure data-rate and framing for transmission. More...
#define | PHHAL_HW_CONFIG_CLEARBITSAFTERCOLL 0x0008U
| Enable or disable clearing of bits after collision. More...
#define | PHHAL_HW_CONFIG_RXDATARATE_FRAMING 0x000AU
| Configure data-rate and framing for reception. More...
#define | PHHAL_HW_CONFIG_MODINDEX 0x000BU
| Set modulation index (unit and value are hardware-dependent). More...
#define | PHHAL_HW_CONFIG_ASK100 0x000CU
| Enable (PH_ON) or disable (PH_OFF) 100% modulation. More...
#define | PHHAL_HW_CONFIG_TIMEOUT_VALUE_US 0x000DU
| Set RC timeout (in [us]). More...
#define | PHHAL_HW_CONFIG_TIMEOUT_VALUE_MS 0x000EU
| Set RC timeout (in [ms]). More...
#define | PHHAL_HW_CONFIG_SUBCARRIER 0x000FU
| Sub-carrier setting for ISO 15693. More...
#define | PHHAL_HW_CONFIG_FIELD_OFF_TIME 0x0013U
| Set the field off time for field-reset ([ms]); Note: A value of `0` is not allowed. More...
#define | PHHAL_HW_CONFIG_FIELD_RECOVERY_TIME 0x0014U
| Set the field recovery time for field-reset ([ms]); Note: For ISO15693 operation, this should be at least set to `1ms`. More...
#define | PHHAL_HW_CONFIG_SYMBOL_START 0x0015U
| Disable / Set the SOF symbol of a frame. More...
#define | PHHAL_HW_CONFIG_SYMBOL_END 0x0016U
| Disable / Set the EOF symbol of a frame. More...
#define | PHHAL_HW_CONFIG_CRCTYPE 0x0017U
| Sets the CRC type for Tx(PHHAL_HW_CONFIG_TXCRC) and Rx(PHHAL_HW_CONFIG_RXCRC). More...
#define | PHHAL_HW_CONFIG_TXWAIT_MS 0x0018U
| Set TxWait (time between last RxIrq and transmit start of succeeding frame) in milliseconds. More...
#define | PHHAL_HW_CONFIG_JEWEL_MODE 0x0020U
| Set the PH_ON/PH_OFF Jewel exchange mode. More...
#define | PHHAL_HW_CONFIG_CARD_TYPE 0x0021U
| Get config to get the card type.
#define | PHHAL_HW_CONFIG_DISABLE_MF_CRYPTO1 0x002EU
| Disable MIFARE(R) Classic Crypto1. More...
#define | PHHAL_HW_CONFIG_TXBUFFER_OFFSET 0x002FU
| Set/Get an offset value A value at this offset on HAL Tx Buffer can be read or written by using Get/Set(PHHAL_HW_CONFIG_TXBUFFER) once the offset is set using this parameter. More...
#define | PHHAL_HW_CONFIG_RXBUFFER_STARTPOS 0x0030U
| Set/Get start position of RX buffer to be used (never changed by HAL). More...
#define | PHHAL_HW_CONFIG_RXBUFFER_BUFSIZE 0x0031U
| Get size of Rx buffer set at HAL initialization. More...
#define | PHHAL_HW_CONFIG_TXBUFFER_BUFSIZE 0x0032U
| Get size of TX buffer set at HAL initialization. More...
#define | PHHAL_HW_CONFIG_TXBUFFER_LENGTH 0x0033U
| Set/Get the amount of valid bytes in Tx buffer. More...
#define | PHHAL_HW_CONFIG_TXBUFFER 0x0034U
| Access the transmit buffer(TxBuffer) at the byte offset defined by PHHAL_HW_CONFIG_TXBUFFER_OFFSET. More...
#define | PHHAL_HW_CONFIG_SETMINFDT 0x0051U
| Set/Reset minimum FDT (only for proximity check). More...
#define | PHHAL_HW_CONFIG_EXT_RF_ON 0x0052U
| Get the status of external RF field. More...
#define | PHHAL_HW_CONFIG_RXMULTIPLE 0x0053U
| Enable (PH_ON) or disable (PH_OFF) multiple reception. More...
#define | PHHAL_HW_CONFIG_ACTIVEMODE 0x0054U
| Get the status if active communication mode is PH_ON / PH_OFF. More...
#define | PHHAL_HW_CONFIG_MFHALTED 0x0055U
| Set/Reset MFHalted bit in MifNFCReg. More...
#define | PHHAL_HW_CONFIG_RFCA 0x0056U
| Enable/disable RF collision avoidance for passive communication mode. More...
#define | PHHAL_HW_CONFIG_RFON_INTERRUPT 0x0057U
| Enable RF-ON interrupt . More...
#define | PHHAL_HW_CONFIG_TARGET_DATARATE_FRAMING 0x0059U
| Get the framing and speed at which target is operating. More...
#define | PHHAL_HW_CONFIG_OPE_MODE 0x005AU
| Configure operation mode for this Layer. More...
#define | PHHAL_HW_CONFIG_NFCIP_STARTBYTE 0x005CU
| Enable/Disable handling start byte at 106kbps in NFCIP Mode of communication. More...
#define | PHHAL_HW_CONFIG_SET_SYMBOL_SEND 0x005DU
| Enable symbol send (PH_ON). More...
#define | PHHAL_HW_CONFIG_SET_EMD 0x005EU
| Enable (PH_ON) or Disable (PH_OFF) EMD error check for Emvco. More...

## IC specific configuration parameters
These are not applicable to all ICs and are not mandatory to be implemented to comply with this HAL specification.
#define | PHHAL_HW_CONFIG_TIMING_MODE 0x8010U
| Sets the exchange time measurement mode in the IC. More...
#define | PHHAL_HW_CONFIG_TIMING_US 0x8011U
| Retrieve elapsed time of receive timer ([us]). More...
#define | PHHAL_HW_CONFIG_TIMING_MS 0x8012U
| Retrieve elapsed time of receive timer ([ms]). More...
#define | PHHAL_HW_CONFIG_MAX_PRECACHED_BYTES 0x8035U
| Configures the max. More...
#define | PHHAL_HW_CONFIG_BAL_CONNECTION 0x8040U
| Set the BAL connection type. More...
#define | PHHAL_HW_CONFIG_SERIAL_BITRATE 0x8041U
| Bit rate for serial UART communication for Rc523, CLRC663 valid values range from - PHHAL_HW_RS232_BITRATE_9600 to PHHAL_HW_RS232_BITRATE_460800.
#define | PHHAL_HW_CONFIG_RFRESET_ON_TIMEOUT 0x8050U
| Perform an RF-reset in case of a timeout (only for phhalHw_Exchange) Valid values are PH_ON, PH_OFF.
#define | PHHAL_HW_CONFIG_ADDITIONAL_INFO 0x802FU
| Get any additional information that the HAL might provide For example any specific error information.

## Card Configuration
#define | PHHAL_HW_CARDTYPE_CURRENT 0x0000U
| Re-Apply settings for current communication mode. More...
#define | PHHAL_HW_CARDTYPE_ISO14443A 0x0001U
| ISO/IEC 14443A mode. More...
#define | PHHAL_HW_CARDTYPE_ISO14443B 0x0002U
| ISO/IEC 14443B mode. More...
#define | PHHAL_HW_CARDTYPE_FELICA_212 0x0003U
| Felica (JIS X 6319) mode. More...
#define | PHHAL_HW_CARDTYPE_ISO15693 0x0004U
| ISO/IEC 15693 mode. More...
#define | PHHAL_HW_CARDTYPE_ICODEEPCUID 0x0005U
| NXP I-Code EPC/UID mode. More...
#define | PHHAL_HW_CARDTYPE_I18000P3M3 0x0006U
| ISO/IEC 18000-3 mode3. More...
#define | PHHAL_HW_CARDTYPE_I18092M_ACTIVE_106 0x0007U
| ISO/IEC ISO18092 (NFC) initiator mode at 106 baud. More...
#define | PHHAL_HW_CARDTYPE_I18092M_ACTIVE_212 0x0008U
| ISO/IEC ISO18092 (NFC) initiator mode at 212 baud. More...
#define | PHHAL_HW_CARDTYPE_I18092M_ACTIVE_424 0x0009U
| ISO/IEC ISO18092 (NFC) initiator mode at 424 baud. More...
#define | PHHAL_HW_CARDTYPE_FELICA_424 0x000AU
| Felica mode at 424 baud. More...
#define | PHHAL_HW_CARDTYPE_UNKNOWN 0x00FFU
| Unknown card type. More...

## CRC Values
#define | PHHAL_HW_CRCTYPE_CRC5 0x0001U
| 5 bit length, polynomial x^5+x^3+1, preset value 01001b, residue 00000b. More...
#define | PHHAL_HW_CRCTYPE_CRC16 0x0002U
| ISO/IEC 13239, 16 bit length, polynomial x^16+x^12+x^5+1, preset value 0xFFFF, residue 0x1D0F. More...
#define | PHHAL_HW_CRCOPTION_INVERTED 0x0100U
| To indicate that the CRC generated should be inverted. More...

## RF Data rate values
#define | PHHAL_HW_RF_DATARATE_106 0x0000U
| Data rate setting for 106 kBit/s. More...
#define | PHHAL_HW_RF_DATARATE_212 0x0001U
| Data rate setting for 212 kBit/s. More...
#define | PHHAL_HW_RF_DATARATE_424 0x0002U
| Data rate setting for 424 kBit/s. More...
#define | PHHAL_HW_RF_DATARATE_848 0x0003U
| Data rate setting for 848 kBit/s. More...
#define | PHHAL_HW_RF_TX_DATARATE_1_OUT_OF_256 0x000AU
| Data rate setting for ISO15693 '1 out of 256' mode. More...
#define | PHHAL_HW_RF_TX_DATARATE_1_OUT_OF_4 0x000BU
| Data rate setting for ISO15693 '1 out of 4' mode. More...
#define | PHHAL_HW_RF_RX_DATARATE_LOW 0x000CU
| Data rate setting for ISO15693 low data rate. More...
#define | PHHAL_HW_RF_RX_DATARATE_HIGH 0x000DU
| Data rate setting for ISO15693 high data rate. More...
#define | PHHAL_HW_RF_RX_DATARATE_FAST_LOW 0x000EU
| Data rate setting for ISO15693 fast (low*2) data rate (FAST INVENTORY (PAGE) READ). More...
#define | PHHAL_HW_RF_RX_DATARATE_FAST_HIGH 0x000FU
| Data rate setting for ISO15693 fast (high*2) data rate (FAST INVENTORY (PAGE) READ). More...
#define | PHHAL_HW_RF_DATARATE_EPCUID 0x0010U
| Data rate setting for EPC/UID. More...
#define | PHHAL_HW_RF_TX_DATARATE_I18000P3M3 0x0011U
| Tx data rate setting for ISO18000-3 mode3. More...
#define | PHHAL_HW_RF_TX_DATARATE_I18000P3M3_TARI1888 0x0012U
| Tx data rate setting for ISO18000-3 mode3. More...
#define | PHHAL_HW_RX_I18000P3M3_FL_423_MAN2 0x0013U
| ICode ISO18000-3 Mode3 424 kBit/s (M=2). More...
#define | PHHAL_HW_RX_I18000P3M3_FL_847_MAN2 0x0014U
| ICode ISO18000-3 Mode3 847 kBit/s (M=2). More...
#define | PHHAL_HW_RX_I18000P3M3_FL_423_MAN4 0x0015U
| ICode ISO18000-3 Mode3 424 kBit/s (M=4). More...
#define | PHHAL_HW_RX_I18000P3M3_FL_847_MAN4 0x0016U
| ICode ISO18000-3 Mode3 847 kBit/s (M=4). More...

## RF Framing Mode Values
#define | PHHAL_HW_RF_TYPE_A_FRAMING 0x0100U
| Data rate setting for 106 kBit/s. More...
#define | PHHAL_HW_RF_TYPE_B_FRAMING 0x0200U
| Data rate setting for 212 kBit/s. More...
#define | PHHAL_HW_RF_TYPE_F_FRAMING 0x0300U
| Data rate setting for 424 kBit/s. More...
#define | PHHAL_HW_RF_TYPE_ACTIVE_FRAMING 0x0400U
| Data rate setting for 848 kBit/s. More...
#define | PHHAL_HW_RF_DATARATE_OPTION_MASK 0x00FFU
| Option-mask for data rate. More...
#define | PHHAL_HW_RF_FRAMING_OPTION_MASK 0xFF00U
| Option-mask for framing. More...
#define | PHHAL_HW_RF_TYPE_A_START_BYTE 0xF0U
| Start byte used at passive 106kbps. More...

## Helper macros used for \ref phhalHw_Autocoll.
Used to extract data rate and framing values.
#define | PHHAL_HW_GETFRAMING(protParams) ((protParams) >> 8)
#define | PHHAL_HW_GETBITRATE(protParams) ((protParams) & 0x00FF)

## RF sub carrier Values
#define | PHHAL_HW_SUBCARRIER_SINGLE 0x0000U
| Sub carrier setting for ISO15693 single sub carrier. More...
#define | PHHAL_HW_SUBCARRIER_DUAL 0x0001U
| Sub carrier setting for ISO15693 / EPC V2 dual sub carrier. More...
#define | PHHAL_HW_SUBCARRIER_QUAD 0x0002U
| Sub carrier setting for EPC V2 quad sub carrier. More...

## Time units
#define | PHHAL_HW_TIME_MICROSECONDS 0x0000U
| Time in microseconds (us). More...
#define | PHHAL_HW_TIME_MILLISECONDS 0x0001U
| Time in milliseconds (ms). More...

## Timing mode settings
#define | PHHAL_HW_TIMING_MODE_OFF 0x0000U
| Time measurement disabled. More...
#define | PHHAL_HW_TIMING_MODE_FDT 0x0001U
| Measures time from Tx-end until Rx-begin. More...
#define | PHHAL_HW_TIMING_MODE_COMM 0x0002U
| Measures the duration of the complete communication. More...
#define | PHHAL_HW_TIMING_MODE_OPTION_MASK 0xFF00U
| Additional option-mask for time measurement. More...
#define | PHHAL_HW_TIMING_MODE_OPTION_DEFAULT 0x0000U
| The timing value is accumulated on each exchange until it gets retrieved by phhalHw_GetConfig. More...
#define | PHHAL_HW_TIMING_MODE_OPTION_AUTOCLEAR 0x0100U
| Automatically resets the current timing value prior to any communication. More...

## Field reset default times
#define | PHHAL_HW_FIELD_OFF_DEFAULT 0x0005U
| Default field-off time. More...
#define | PHHAL_HW_FIELD_RECOVERY_DEFAULT 0x0005U
| Default field-recovery time. More...

## Frame Symbols (use #PH_OFF to disable)
#define | PHHAL_HW_SYMBOL_ICODEEPCUID_SSOF 0x0001U
| ICode EPC/UID short start of frame. More...
#define | PHHAL_HW_SYMBOL_ICODEEPCUID_LSOF 0x0002U
| ICode EPC/UID long start of frame. More...
#define | PHHAL_HW_SYMBOL_ICODEEPCUID_CEOF 0x0003U
| ICode EPC/UID common end of frame. More...
#define | PHHAL_HW_SYMBOL_ICODEEPCUID_CS 0x0004U
| ICode EPC/UID close slot. More...
#define | PHHAL_HW_SYMBOL_I15693_SOF 0x0005U
| ISO15693 SOF (automatically chosen between 1/256 and 1/4). More...
#define | PHHAL_HW_SYMBOL_I18000P3M3_PREAMBLE 0x0006U
| ISO18000-3 mode3 preamble. More...
#define | PHHAL_HW_SYMBOL_I18000P3M3_FSYNC 0x0007U
| ISO18000-3 mode3 frame-sync. More...

## MIFARE Classic authenticate options
#define | PHHAL_HW_MFC_KEYA 0x0AU
| MIFARE Classic key type A. More...
#define | PHHAL_HW_MFC_KEYB 0x0BU
| MIFARE Classic key type B. More...
#define | PHHAL_HW_MFC_KEY_LENGTH 0x06U
| Length of a MIFARE Classic key (for completeness). More...

## BAL Connection types
#define | PHHAL_HW_BAL_CONNECTION_RS232 0x0000U
| Reader IC is connected via RS232. More...
#define | PHHAL_HW_BAL_CONNECTION_SPI 0x0001U
| Reader IC is connected via SPI. More...
#define | PHHAL_HW_BAL_CONNECTION_I2C 0x0002U
| Reader IC is connected via I2C. More...

## RS232 Bitrate Values
#define | PHHAL_HW_RS232_BITRATE_7200 0x0000U
| 7.200 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_9600 0x0001U
| 9.600 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_14400 0x0002U
| 14.400 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_19200 0x0003U
| 19.200 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_38400 0x0004U
| 38.400 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_57600 0x0005U
| 57.500 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_115200 0x0006U
| 115.200 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_128000 0x0007U
| 128.000 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_230400 0x0008U
| 230.400 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_460800 0x0009U
| 460.800 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_921600 0x000AU
| 921.600 kBit/s. More...
#define | PHHAL_HW_RS232_BITRATE_1228800 0x000BU
| 1.228.800 kBit/s. More...

## Min FDT values
#define | PHHAL_HW_MINFDT_106_US 91+10
| (n * 128 + 84) / 13.56; n = 9. More...
#define | PHHAL_HW_MINFDT_212_US 87+40
| (n * 128 + 148) / 13.56; n = 8. More...
#define | PHHAL_HW_MINFDT_424_US 84+35
| (n * 128 + 116) / 13.56; n = 8. More...
#define | PHHAL_HW_MINFDT_848_US 83+45
| (n * 128 + 100) / 13.56; n = 8. More...

## Framing mode values
#define | PHHAL_HW_I14443A_106_FRAMING 0x00
| ISO/IEC 14443A/MIFARE and passive communication mode 106 kBit. More...
#define | PHHAL_HW_ACTIVE_MODE_FRAMING 0x01
| Active communication mode. More...
#define | PHHAL_HW_FELICA_FRAMING 0x02
| FeliCa and passive communication mode 212 and 424 kBit. More...
#define | PHHAL_HW_I14443B_FRAMING 0x03
| ISO/IEC 14443B. More...

## Target Bit Coding
#define | PHHAL_HW_EMULATE_TYPE_A_TARGET 0x0001U
| Bit setting to emulate Type A target. More...
#define | PHHAL_HW_EMULATE_TYPE_B_TARGET 0x0002U
| Bit setting to emulate Type B target. More...
#define | PHHAL_HW_EMULATE_TYPE_F_TARGET 0x0004U
| Bit setting to emulate Type F target. More...

## Felica Response Frame Coding \n
Applicable when PHHAL_HW_CONFIG_RXMULTIPLE is enable
#define | PHHAL_HW_REQC_MIN_LEN 19U
| Minimum length of valid ReqC response when multiple reception is enabled. More...
#define | PHHAL_HW_RESP_FRAME_SIZE 32U
| Frame size of one felica response when multiple reception is enable. More...
#define | PHHAL_HW_STATUS_FRAME_LEN_BYTE_POS 28U
| Byte position where length information in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_ERR_BYTE_POS 29U
| Byte position where error information in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_CL_ERR_POS (1 << 0)
| Bit position for contact less Error in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_DATA_ERR_POS (1 << 1)
| Bit position for data(CRC or Parity) error in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_PROT_ERR_POS (1 << 2)
| Bit position for protocol error in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_COLL_ERR_POS (1 << 3)
| Bit position for collision error in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_LEN_ERR_POS (1 << 4)
| Bit position for length error in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_ERR_MASK 0x1FU
| Bit mask for error byte in felica response frame. More...
#define | PHHAL_HW_STATUS_FRAME_LEN_MASK 0x1FU
| Bit mask for Length byte in felica response frame. More...

## Parameter values for ISO/IEC 18000p3m3 HAL APIs \n
#define | PHHAL_HW_I18000P3M3_GET_MAX_RESPS 0
| Gets responses from more than one slots limited by the RX buffer size and number of slots. More...
#define | PHHAL_HW_I18000P3M3_ONE_TS_ONLY 1
| Gets response for only one time slot.
#define | PHHAL_HW_I18000P3M3_GET_TAG_HANDLE 2
| Gets response for only one time slot. More...
#define | PHHAL_HW_I18000P3M3_PERFORM_RESIZE 3
| Perform Resize Round.
#define | PHHAL_HW_I18000P3M3_SESSION_S0 0x00U
| Session S0. More...
#define | PHHAL_HW_I18000P3M3_SESSION_S2 0x02U
| Session S2. More...
#define | PHHAL_HW_I18000P3M3_TARGET_INVENTORIED_S0 0x00U
| INVENTORIED_S0 target. More...
#define | PHHAL_HW_I18000P3M3_TARGET_INVENTORIED_S2 0x02U
| INVENTORIED_S2 target. More...
#define | PHHAL_HW_I18000P3M3_TARGET_SL 0x04U
| SL target. More...
#define | PHHAL_HW_I18000P3M3_UPDN_INCREMENT 0x06U
| Increment Q. More...
#define | PHHAL_HW_I18000P3M3_UPDN_NOCHANGE 0x00U
| Do not change Q. More...
#define | PHHAL_HW_I18000P3M3_UPDN_DECREMENT 0x03U
| Decrement Q. More...
#define | PHHAL_HW_I18000P3M3_CMD_RESIZE_ROUND 0x09U
| ResizeRound command code. More...

## Detailed Description

These are the components which are used to abstract the functionality of the physical reader device to a generic interface.

HAL API usage in common use cases are described in the sequence diagrams below

Reader mode: This sequence diagram describes the usage of HAL APIs to implement a simple reader mode application.

Passive initiator mode: This sequence diagram describes the usage of HAL APIs to implement a simple ISO 18092 Initiator in
passive communication mode.

Card mode: This sequence diagram describes the usage of HAL APIs to implement a ISO 14443-3A PICC / ISO 18092 passive target.

Active initiator: This sequence diagram describes the usage of HAL APIs to implement ISO 18092 initiator in active communication mode.

Active target: This sequence diagram describes the usage of HAL APIs to implement ISO 18092 target in active communication mode.

Low power card detection(LPCD): This sequence diagram describes the usage of HAL APIs to implement a simple ISO/IEC 14443-3a
reader that uses LPCD functionality of reader IC.

ISO 18000P3M3 Inventory: This sequence diagram describes the usage of HAL APIs to implement a simple application that
inventories and activates an ISO 18000p3m3 tag.

ISO 18000P3M3 Resume Inventory: This sequence diagram describes the usage of HAL APIs to implement a simple application that
inventories and activates an ISO 18000p3m3 tag.
In this specific diagram, it is shown how to use phhalHw_I18000p3m3ResumeInventory() API.

OSAL usage in HAL: This sequence diagram describes the usage of OS event from within the HAL.
HAL uses OSAL call to wait for a CLIF event that is triggered by a CLIF interrupt.

## Macro Definition Documentation

## § E_PH_OSAL_EVT_RF

#define E_PH_OSAL_EVT_RF (1 << 0)

Event posted by CLIF ISR once the interrupt line goes high to the CLIF HAL.

## § E_PH_OSAL_EVT_ABORT

#define E_PH_OSAL_EVT_ABORT (1 << 5)

Event posted by the application to shut down the reader library thread.

## § PHHAL_HW_CONFIG_PARITY

#define PHHAL_HW_CONFIG_PARITY 0x0000U

Enable (PH_ON) or Disable (PH_OFF) Parity.

## § PHHAL_HW_CONFIG_TXCRC

#define PHHAL_HW_CONFIG_TXCRC 0x0001U

Enable (PH_ON) or disable (PH_OFF) transmit CRC.

## § PHHAL_HW_CONFIG_RXCRC

#define PHHAL_HW_CONFIG_RXCRC 0x0002U

Enable (PH_ON) or disable (PH_OFF) receive CRC.

## § PHHAL_HW_CONFIG_TXLASTBITS

#define PHHAL_HW_CONFIG_TXLASTBITS 0x0003U

Set number of valid bits for the last transmitted byte.

Valid range is 1 to 7

## § PHHAL_HW_CONFIG_RXLASTBITS

#define PHHAL_HW_CONFIG_RXLASTBITS 0x0004U

Get number of valid bits of last received byte.

Valid range is 1 to 7

## § PHHAL_HW_CONFIG_RXALIGN

#define PHHAL_HW_CONFIG_RXALIGN 0x0005U

Set Rx-Aligned Bits.

Used for reception of bit oriented frames. RxAlign defines the bit position for the first bit received to be stored in the FIFO. Further received bits are stored at the following bit positions. Used only for bitwise anti-collision at 106kbps. For all other modes it is set to logic 0.

## § PHHAL_HW_CONFIG_RXWAIT_US

#define PHHAL_HW_CONFIG_RXWAIT_US 0x0006U

Configure receiver deaf-time (time after a send where every reception is ignored) in microseconds.

This is the time for which the IC cannot receive any data after transmit.

## § PHHAL_HW_CONFIG_TXWAIT_US

#define PHHAL_HW_CONFIG_TXWAIT_US 0x0007U

Set Tx wait time (time between last RxIrq and Tx of succeeding frame) in microseconds.

## § PHHAL_HW_CONFIG_TXDATARATE_FRAMING

#define PHHAL_HW_CONFIG_TXDATARATE_FRAMING 0x0009U

Configure data-rate and framing for transmission.

Use LSB for data-rate and MSB to specify framing.
MSB values can be PHHAL_HW_RF_TYPE_A_FRAMING, PHHAL_HW_RF_TYPE_B_FRAMING, PHHAL_HW_RF_TYPE_F_FRAMING
LSB values can be PHHAL_HW_RF_DATARATE_106, PHHAL_HW_RF_DATARATE_212, PHHAL_HW_RF_DATARATE_424, PHHAL_HW_RF_DATARATE_848

## § PHHAL_HW_CONFIG_CLEARBITSAFTERCOLL

#define PHHAL_HW_CONFIG_CLEARBITSAFTERCOLL 0x0008U

Enable or disable clearing of bits after collision.

Deprecated. Not used anymore.

## § PHHAL_HW_CONFIG_RXDATARATE_FRAMING

#define PHHAL_HW_CONFIG_RXDATARATE_FRAMING 0x000AU

Configure data-rate and framing for reception.

Use LSB for data-rate and MSB to specify framing.
MSB values can be PHHAL_HW_RF_TYPE_A_FRAMING, PHHAL_HW_RF_TYPE_B_FRAMING, PHHAL_HW_RF_TYPE_F_FRAMING
LSB values can be PHHAL_HW_RF_DATARATE_106, PHHAL_HW_RF_DATARATE_212, PHHAL_HW_RF_DATARATE_424, PHHAL_HW_RF_DATARATE_848

## § PHHAL_HW_CONFIG_MODINDEX

#define PHHAL_HW_CONFIG_MODINDEX 0x000BU

Set modulation index (unit and value are hardware-dependent).

Example values are

- PHHAL_HW_RC663_MODINDEX_I14443B
- PHHAL_HW_RC663_MODINDEX_I15693
- PHHAL_HW_RC663_MODINDEX_EPCUID
- PHHAL_HW_RC663_MODINDEX_I18000P3M3

## § PHHAL_HW_CONFIG_ASK100

#define PHHAL_HW_CONFIG_ASK100 0x000CU

Enable (PH_ON) or disable (PH_OFF) 100% modulation.

## § PHHAL_HW_CONFIG_TIMEOUT_VALUE_US

#define PHHAL_HW_CONFIG_TIMEOUT_VALUE_US 0x000DU

Set RC timeout (in [us]).

## § PHHAL_HW_CONFIG_TIMEOUT_VALUE_MS

#define PHHAL_HW_CONFIG_TIMEOUT_VALUE_MS 0x000EU

Set RC timeout (in [ms]).

## § PHHAL_HW_CONFIG_SUBCARRIER

#define PHHAL_HW_CONFIG_SUBCARRIER 0x000FU

Sub-carrier setting for ISO 15693.

Possible values are
PHHAL_HW_SUBCARRIER_SINGLE,
PHHAL_HW_SUBCARRIER_DUAL,
PHHAL_HW_SUBCARRIER_QUAD

## § PHHAL_HW_CONFIG_FIELD_OFF_TIME

#define PHHAL_HW_CONFIG_FIELD_OFF_TIME 0x0013U

Set the field off time for field-reset ([ms]); Note: A value of `0` is not allowed.

Default value is PHHAL_HW_FIELD_OFF_DEFAULT

## § PHHAL_HW_CONFIG_FIELD_RECOVERY_TIME

#define PHHAL_HW_CONFIG_FIELD_RECOVERY_TIME 0x0014U

Set the field recovery time for field-reset ([ms]); Note: For ISO15693 operation, this should be at least set to `1ms`.

Default value is PHHAL_HW_FIELD_RECOVERY_DEFAULT

## § PHHAL_HW_CONFIG_SYMBOL_START

#define PHHAL_HW_CONFIG_SYMBOL_START 0x0015U

Disable / Set the SOF symbol of a frame.

Sets the start of frame symbol for a frame for ICODE EPIC UID, ISO 15693, ISO 18000p3m3. The values can be one of:

- PH_OFF - Disable SoF
- PHHAL_HW_SYMBOL_ICODEEPCUID_SSOF - Short start of frame
- PHHAL_HW_SYMBOL_ICODEEPCUID_LSOF - Long start of frame
- PHHAL_HW_SYMBOL_ICODEEPCUID_CS - Close slot
- PHHAL_HW_SYMBOL_I15693_SOF - SOF for ISO 15693. Automatically chosen between 1/256 and 1/4
- PHHAL_HW_SYMBOL_I18000P3M3_PREAMBLE - ISO 18000p3m3 Preamble
- PHHAL_HW_SYMBOL_I18000P3M3_FSYNC - ISO 18000p3m3 Frame Sync

## § PHHAL_HW_CONFIG_SYMBOL_END

#define PHHAL_HW_CONFIG_SYMBOL_END 0x0016U

Disable / Set the EOF symbol of a frame.

Sets the end of frame symbol for a frame for ICODE EPIC UID protocol.
PH_OFF - Disable EoF
PHHAL_HW_SYMBOL_ICODEEPCUID_CEOF - Common end of frame

## § PHHAL_HW_CONFIG_CRCTYPE

#define PHHAL_HW_CONFIG_CRCTYPE 0x0017U

Sets the CRC type for Tx(PHHAL_HW_CONFIG_TXCRC) and Rx(PHHAL_HW_CONFIG_RXCRC).

Values can be one of
PHHAL_HW_CRCTYPE_CRC5,
PHHAL_HW_CRCTYPE_CRC16
optionally combined with the following inversion option.
PHHAL_HW_CRCOPTION_INVERTED.

## § PHHAL_HW_CONFIG_TXWAIT_MS

#define PHHAL_HW_CONFIG_TXWAIT_MS 0x0018U

Set TxWait (time between last RxIrq and transmit start of succeeding frame) in milliseconds.

## § PHHAL_HW_CONFIG_JEWEL_MODE

#define PHHAL_HW_CONFIG_JEWEL_MODE 0x0020U

Set the PH_ON/PH_OFF Jewel exchange mode.

This should be done by user before T1T/Jewel functions are called.

## § PHHAL_HW_CONFIG_DISABLE_MF_CRYPTO1

#define PHHAL_HW_CONFIG_DISABLE_MF_CRYPTO1 0x002EU

Disable MIFARE(R) Classic Crypto1.

Disables the MIFARE crypto1 in the IC. Only value PH_OFF is allowed.
The MIFARE Crypto1 will be enabled by the MFAuthent command. This bit cannot be set by software.

## § PHHAL_HW_CONFIG_TXBUFFER_OFFSET

#define PHHAL_HW_CONFIG_TXBUFFER_OFFSET 0x002FU

Set/Get an offset value
A value at this offset on HAL Tx Buffer can be read or written by using
Get/Set(PHHAL_HW_CONFIG_TXBUFFER) once the offset is set using this parameter.

Used by Protocol components.

## § PHHAL_HW_CONFIG_RXBUFFER_STARTPOS

#define PHHAL_HW_CONFIG_RXBUFFER_STARTPOS 0x0030U

Set/Get start position of RX buffer to be used (never changed by HAL).

## § PHHAL_HW_CONFIG_RXBUFFER_BUFSIZE

#define PHHAL_HW_CONFIG_RXBUFFER_BUFSIZE 0x0031U

Get size of Rx buffer set at HAL initialization.

This is read-only parameter.
Used by protocols to know the Rx buffer size for chaining purposes.

## § PHHAL_HW_CONFIG_TXBUFFER_BUFSIZE

#define PHHAL_HW_CONFIG_TXBUFFER_BUFSIZE 0x0032U

Get size of TX buffer set at HAL initialization.

This is read-only parameter.
Used by protocols to know the TxBuffer size.

## § PHHAL_HW_CONFIG_TXBUFFER_LENGTH

#define PHHAL_HW_CONFIG_TXBUFFER_LENGTH 0x0033U

Set/Get the amount of valid bytes in Tx buffer.

## § PHHAL_HW_CONFIG_TXBUFFER

#define PHHAL_HW_CONFIG_TXBUFFER 0x0034U

Access the transmit buffer(TxBuffer) at the byte offset defined by PHHAL_HW_CONFIG_TXBUFFER_OFFSET.

Used to get or set two bytes from/to a particular position in TxBuffer.
The position in transmit buffer is defined by setting TXBUFFER_OFFSET.
Used by protocol components.

## § PHHAL_HW_CONFIG_SETMINFDT

#define PHHAL_HW_CONFIG_SETMINFDT 0x0051U

Set/Reset minimum FDT (only for proximity check).

Used to set minimum frame delay time (timeout) in microseconds as required for proximity check
command of MIFARE Plus.

## § PHHAL_HW_CONFIG_EXT_RF_ON

#define PHHAL_HW_CONFIG_EXT_RF_ON 0x0052U

Get the status of external RF field.

Returned values are PH_ON or PH_OFF. Deprecated.

## § PHHAL_HW_CONFIG_RXMULTIPLE

#define PHHAL_HW_CONFIG_RXMULTIPLE 0x0053U

Enable (PH_ON) or disable (PH_OFF) multiple reception.

Please refer to phpalFelica.h and phpalFelica_ReqC function documentation to know the frame format in which the data is returned.

## § PHHAL_HW_CONFIG_ACTIVEMODE

#define PHHAL_HW_CONFIG_ACTIVEMODE 0x0054U

Get the status if active communication mode is PH_ON / PH_OFF.

Used by protocols to know the mode.

## § PHHAL_HW_CONFIG_MFHALTED

#define PHHAL_HW_CONFIG_MFHALTED 0x0055U

Set/Reset MFHalted bit in MifNFCReg.

When set, this indicates that the IC is set to HALT mode in card operation mode at 106 kBit.
Once set, when phhalHw_Autocoll API is called in card/target mode, will only accept WUPA/ALL_REQ command to respond.

## § PHHAL_HW_CONFIG_RFCA

#define PHHAL_HW_CONFIG_RFCA 0x0056U

Enable/disable RF collision avoidance for passive communication mode.

(PH_ON or PH_OFF).
This parameter should be set before phhalHw_FieldOn to perform Initial RFCA. By default after IC HAL initialization, this should be set to PH_ON

## § PHHAL_HW_CONFIG_RFON_INTERRUPT

#define PHHAL_HW_CONFIG_RFON_INTERRUPT 0x0057U

Enable RF-ON interrupt
.

This is typically used in card/target mode. When there is no external RF, this configuration is set in the HAL
and the controller can go into a wait state for the external RF-ON interrupt to occur.

## § PHHAL_HW_CONFIG_TARGET_DATARATE_FRAMING

#define PHHAL_HW_CONFIG_TARGET_DATARATE_FRAMING 0x0059U

Get the framing and speed at which target is operating.

Read-only parameter. RF data rate values in the LSB and framing in the MSB are returned.
MSB values can be PHHAL_HW_RF_TYPE_A_FRAMING, PHHAL_HW_RF_TYPE_B_FRAMING, PHHAL_HW_RF_TYPE_F_FRAMING
LSB values can be PHHAL_HW_RF_DATARATE_106, PHHAL_HW_RF_DATARATE_212, PHHAL_HW_RF_DATARATE_424

## § PHHAL_HW_CONFIG_OPE_MODE

#define PHHAL_HW_CONFIG_OPE_MODE 0x005AU

Configure operation mode for this Layer.

Values can be RD_LIB_MODE_NFC or RD_LIB_MODE_EMVCO

## § PHHAL_HW_CONFIG_NFCIP_STARTBYTE

#define PHHAL_HW_CONFIG_NFCIP_STARTBYTE 0x005CU

Enable/Disable handling start byte at 106kbps in NFCIP Mode of communication.

This is to tell the HAL to prepend the start byte as required for passive
communication mode at 106kbps.

## § PHHAL_HW_CONFIG_SET_SYMBOL_SEND

#define PHHAL_HW_CONFIG_SET_SYMBOL_SEND 0x005DU

Enable symbol send (PH_ON).

ISO/IEC 18000p3m3 protocol will use data send (PH_OFF).

## § PHHAL_HW_CONFIG_SET_EMD

#define PHHAL_HW_CONFIG_SET_EMD 0x005EU

Enable (PH_ON) or Disable (PH_OFF) EMD error check for Emvco.

The EMD check should be enabled only after ISO 14443A/B layer 3
activation.

## § PHHAL_HW_CONFIG_TIMING_MODE

#define PHHAL_HW_CONFIG_TIMING_MODE 0x8010U

Sets the exchange time measurement mode in the IC.

The values can be one of:
PHHAL_HW_TIMING_MODE_OFF - Time measurement disabled
PHHAL_HW_TIMING_MODE_FDT - Frame delay time to be measured
PHHAL_HW_TIMING_MODE_COMM - Overall time to be measured
PHHAL_HW_TIMING_MODE_OPTION_MASK - Additional option-mask for time measurement.
PHHAL_HW_TIMING_MODE_OPTION_DEFAULT - The timing value is accumulated on each exchange until it gets retrieved by phhalHw_GetConfig.
PHHAL_HW_TIMING_MODE_OPTION_AUTOCLEAR - Automatically resets the current timing value prior to any communication.

## § PHHAL_HW_CONFIG_TIMING_US

#define PHHAL_HW_CONFIG_TIMING_US 0x8011U

Retrieve elapsed time of receive timer ([us]).

## § PHHAL_HW_CONFIG_TIMING_MS

#define PHHAL_HW_CONFIG_TIMING_MS 0x8012U

Retrieve elapsed time of receive timer ([ms]).

## § PHHAL_HW_CONFIG_MAX_PRECACHED_BYTES

#define PHHAL_HW_CONFIG_MAX_PRECACHED_BYTES 0x8035U

Configures the max.

number of bytes which are pre-cached prior to command execution.
Bytes up to the maximum pre-cache limit can be written into the FIFO before the command is started.
The maximum pre-cache limit depends upon the FIFO size of the IC.
This will ensure faster transmission in comparison to starting the command and then writing the
parameters + data to the FIFO. Rc523(Pn512) and Rc663 HALs provide such a functionality.

## § PHHAL_HW_CONFIG_BAL_CONNECTION

#define PHHAL_HW_CONFIG_BAL_CONNECTION 0x8040U

Set the BAL connection type.

The default value is always PHHAL_HW_BAL_CONNECTION_RS232.
Other supported values are
PHHAL_HW_BAL_CONNECTION_SPI
PHHAL_HW_BAL_CONNECTION_I2C

## § PHHAL_HW_CARDTYPE_CURRENT

#define PHHAL_HW_CARDTYPE_CURRENT 0x0000U

Re-Apply settings for current communication mode.

## § PHHAL_HW_CARDTYPE_ISO14443A

#define PHHAL_HW_CARDTYPE_ISO14443A 0x0001U

ISO/IEC 14443A mode.

## § PHHAL_HW_CARDTYPE_ISO14443B

#define PHHAL_HW_CARDTYPE_ISO14443B 0x0002U

ISO/IEC 14443B mode.

## § PHHAL_HW_CARDTYPE_FELICA_212

#define PHHAL_HW_CARDTYPE_FELICA_212 0x0003U

Felica (JIS X 6319) mode.

## § PHHAL_HW_CARDTYPE_ISO15693

#define PHHAL_HW_CARDTYPE_ISO15693 0x0004U

ISO/IEC 15693 mode.

## § PHHAL_HW_CARDTYPE_ICODEEPCUID

#define PHHAL_HW_CARDTYPE_ICODEEPCUID 0x0005U

NXP I-Code EPC/UID mode.

## § PHHAL_HW_CARDTYPE_I18000P3M3

#define PHHAL_HW_CARDTYPE_I18000P3M3 0x0006U

ISO/IEC 18000-3 mode3.

## § PHHAL_HW_CARDTYPE_I18092M_ACTIVE_106

#define PHHAL_HW_CARDTYPE_I18092M_ACTIVE_106 0x0007U

ISO/IEC ISO18092 (NFC) initiator mode at 106 baud.

## § PHHAL_HW_CARDTYPE_I18092M_ACTIVE_212

#define PHHAL_HW_CARDTYPE_I18092M_ACTIVE_212 0x0008U

ISO/IEC ISO18092 (NFC) initiator mode at 212 baud.

## § PHHAL_HW_CARDTYPE_I18092M_ACTIVE_424

#define PHHAL_HW_CARDTYPE_I18092M_ACTIVE_424 0x0009U

ISO/IEC ISO18092 (NFC) initiator mode at 424 baud.

## § PHHAL_HW_CARDTYPE_FELICA_424

#define PHHAL_HW_CARDTYPE_FELICA_424 0x000AU

Felica mode at 424 baud.

## § PHHAL_HW_CARDTYPE_UNKNOWN

#define PHHAL_HW_CARDTYPE_UNKNOWN 0x00FFU

Unknown card type.

## § PHHAL_HW_CRCTYPE_CRC5

#define PHHAL_HW_CRCTYPE_CRC5 0x0001U

5 bit length, polynomial x^5+x^3+1, preset value 01001b, residue 00000b.

## § PHHAL_HW_CRCTYPE_CRC16

#define PHHAL_HW_CRCTYPE_CRC16 0x0002U

ISO/IEC 13239, 16 bit length, polynomial x^16+x^12+x^5+1, preset value 0xFFFF, residue 0x1D0F.

## § PHHAL_HW_CRCOPTION_INVERTED

#define PHHAL_HW_CRCOPTION_INVERTED 0x0100U

To indicate that the CRC generated should be inverted.

This should be ORed with the CRCTYPEs above.

## § PHHAL_HW_RF_DATARATE_106

#define PHHAL_HW_RF_DATARATE_106 0x0000U

Data rate setting for 106 kBit/s.

## § PHHAL_HW_RF_DATARATE_212

#define PHHAL_HW_RF_DATARATE_212 0x0001U

Data rate setting for 212 kBit/s.

## § PHHAL_HW_RF_DATARATE_424

#define PHHAL_HW_RF_DATARATE_424 0x0002U

Data rate setting for 424 kBit/s.

## § PHHAL_HW_RF_DATARATE_848

#define PHHAL_HW_RF_DATARATE_848 0x0003U

Data rate setting for 848 kBit/s.

## § PHHAL_HW_RF_TX_DATARATE_1_OUT_OF_256

#define PHHAL_HW_RF_TX_DATARATE_1_OUT_OF_256 0x000AU

Data rate setting for ISO15693 '1 out of 256' mode.

## § PHHAL_HW_RF_TX_DATARATE_1_OUT_OF_4

#define PHHAL_HW_RF_TX_DATARATE_1_OUT_OF_4 0x000BU

Data rate setting for ISO15693 '1 out of 4' mode.

## § PHHAL_HW_RF_RX_DATARATE_LOW

#define PHHAL_HW_RF_RX_DATARATE_LOW 0x000CU

Data rate setting for ISO15693 low data rate.

## § PHHAL_HW_RF_RX_DATARATE_HIGH

#define PHHAL_HW_RF_RX_DATARATE_HIGH 0x000DU

Data rate setting for ISO15693 high data rate.

## § PHHAL_HW_RF_RX_DATARATE_FAST_LOW

#define PHHAL_HW_RF_RX_DATARATE_FAST_LOW 0x000EU

Data rate setting for ISO15693 fast (low*2) data rate (FAST INVENTORY (PAGE) READ).

## § PHHAL_HW_RF_RX_DATARATE_FAST_HIGH

#define PHHAL_HW_RF_RX_DATARATE_FAST_HIGH 0x000FU

Data rate setting for ISO15693 fast (high*2) data rate (FAST INVENTORY (PAGE) READ).

## § PHHAL_HW_RF_DATARATE_EPCUID

#define PHHAL_HW_RF_DATARATE_EPCUID 0x0010U

Data rate setting for EPC/UID.

## § PHHAL_HW_RF_TX_DATARATE_I18000P3M3

#define PHHAL_HW_RF_TX_DATARATE_I18000P3M3 0x0011U

Tx data rate setting for ISO18000-3 mode3.

TARI Value = 9.44us

## § PHHAL_HW_RF_TX_DATARATE_I18000P3M3_TARI1888

#define PHHAL_HW_RF_TX_DATARATE_I18000P3M3_TARI1888 0x0012U

Tx data rate setting for ISO18000-3 mode3.

TARI Value = 18.88 us

## § PHHAL_HW_RX_I18000P3M3_FL_423_MAN2

#define PHHAL_HW_RX_I18000P3M3_FL_423_MAN2 0x0013U

ICode ISO18000-3 Mode3 424 kBit/s (M=2).

## § PHHAL_HW_RX_I18000P3M3_FL_847_MAN2

#define PHHAL_HW_RX_I18000P3M3_FL_847_MAN2 0x0014U

ICode ISO18000-3 Mode3 847 kBit/s (M=2).

## § PHHAL_HW_RX_I18000P3M3_FL_423_MAN4

#define PHHAL_HW_RX_I18000P3M3_FL_423_MAN4 0x0015U

ICode ISO18000-3 Mode3 424 kBit/s (M=4).

## § PHHAL_HW_RX_I18000P3M3_FL_847_MAN4

#define PHHAL_HW_RX_I18000P3M3_FL_847_MAN4 0x0016U

ICode ISO18000-3 Mode3 847 kBit/s (M=4).

## § PHHAL_HW_RF_TYPE_A_FRAMING

#define PHHAL_HW_RF_TYPE_A_FRAMING 0x0100U

Data rate setting for 106 kBit/s.

## § PHHAL_HW_RF_TYPE_B_FRAMING

#define PHHAL_HW_RF_TYPE_B_FRAMING 0x0200U

Data rate setting for 212 kBit/s.

## § PHHAL_HW_RF_TYPE_F_FRAMING

#define PHHAL_HW_RF_TYPE_F_FRAMING 0x0300U

Data rate setting for 424 kBit/s.

## § PHHAL_HW_RF_TYPE_ACTIVE_FRAMING

#define PHHAL_HW_RF_TYPE_ACTIVE_FRAMING 0x0400U

Data rate setting for 848 kBit/s.

## § PHHAL_HW_RF_DATARATE_OPTION_MASK

#define PHHAL_HW_RF_DATARATE_OPTION_MASK 0x00FFU

Option-mask for data rate.

## § PHHAL_HW_RF_FRAMING_OPTION_MASK

#define PHHAL_HW_RF_FRAMING_OPTION_MASK 0xFF00U

Option-mask for framing.

## § PHHAL_HW_RF_TYPE_A_START_BYTE

#define PHHAL_HW_RF_TYPE_A_START_BYTE 0xF0U

Start byte used at passive 106kbps.

## § PHHAL_HW_SUBCARRIER_SINGLE

#define PHHAL_HW_SUBCARRIER_SINGLE 0x0000U

Sub carrier setting for ISO15693 single sub carrier.

## § PHHAL_HW_SUBCARRIER_DUAL

#define PHHAL_HW_SUBCARRIER_DUAL 0x0001U

Sub carrier setting for ISO15693 / EPC V2 dual sub carrier.

## § PHHAL_HW_SUBCARRIER_QUAD

#define PHHAL_HW_SUBCARRIER_QUAD 0x0002U

Sub carrier setting for EPC V2 quad sub carrier.

## § PHHAL_HW_TIME_MICROSECONDS

#define PHHAL_HW_TIME_MICROSECONDS 0x0000U

Time in microseconds (us).

## § PHHAL_HW_TIME_MILLISECONDS

#define PHHAL_HW_TIME_MILLISECONDS 0x0001U

Time in milliseconds (ms).

## § PHHAL_HW_TIMING_MODE_OFF

#define PHHAL_HW_TIMING_MODE_OFF 0x0000U

Time measurement disabled.

## § PHHAL_HW_TIMING_MODE_FDT

#define PHHAL_HW_TIMING_MODE_FDT 0x0001U

Measures time from Tx-end until Rx-begin.

## § PHHAL_HW_TIMING_MODE_COMM

#define PHHAL_HW_TIMING_MODE_COMM 0x0002U

Measures the duration of the complete communication.

## § PHHAL_HW_TIMING_MODE_OPTION_MASK

#define PHHAL_HW_TIMING_MODE_OPTION_MASK 0xFF00U

Additional option-mask for time measurement.

## § PHHAL_HW_TIMING_MODE_OPTION_DEFAULT

#define PHHAL_HW_TIMING_MODE_OPTION_DEFAULT 0x0000U

The timing value is accumulated on each exchange until it gets retrieved by phhalHw_GetConfig.

## § PHHAL_HW_TIMING_MODE_OPTION_AUTOCLEAR

#define PHHAL_HW_TIMING_MODE_OPTION_AUTOCLEAR 0x0100U

Automatically resets the current timing value prior to any communication.

## § PHHAL_HW_FIELD_OFF_DEFAULT

#define PHHAL_HW_FIELD_OFF_DEFAULT 0x0005U

Default field-off time.

## § PHHAL_HW_FIELD_RECOVERY_DEFAULT

#define PHHAL_HW_FIELD_RECOVERY_DEFAULT 0x0005U

Default field-recovery time.

## § PHHAL_HW_SYMBOL_ICODEEPCUID_SSOF

#define PHHAL_HW_SYMBOL_ICODEEPCUID_SSOF 0x0001U

ICode EPC/UID short start of frame.

## § PHHAL_HW_SYMBOL_ICODEEPCUID_LSOF

#define PHHAL_HW_SYMBOL_ICODEEPCUID_LSOF 0x0002U

ICode EPC/UID long start of frame.

## § PHHAL_HW_SYMBOL_ICODEEPCUID_CEOF

#define PHHAL_HW_SYMBOL_ICODEEPCUID_CEOF 0x0003U

ICode EPC/UID common end of frame.

## § PHHAL_HW_SYMBOL_ICODEEPCUID_CS

#define PHHAL_HW_SYMBOL_ICODEEPCUID_CS 0x0004U

ICode EPC/UID close slot.

## § PHHAL_HW_SYMBOL_I15693_SOF

#define PHHAL_HW_SYMBOL_I15693_SOF 0x0005U

ISO15693 SOF (automatically chosen between 1/256 and 1/4).

## § PHHAL_HW_SYMBOL_I18000P3M3_PREAMBLE

#define PHHAL_HW_SYMBOL_I18000P3M3_PREAMBLE 0x0006U

ISO18000-3 mode3 preamble.

## § PHHAL_HW_SYMBOL_I18000P3M3_FSYNC

#define PHHAL_HW_SYMBOL_I18000P3M3_FSYNC 0x0007U

ISO18000-3 mode3 frame-sync.

## § PHHAL_HW_MFC_KEYA

#define PHHAL_HW_MFC_KEYA 0x0AU

MIFARE Classic key type A.

## § PHHAL_HW_MFC_KEYB

#define PHHAL_HW_MFC_KEYB 0x0BU

MIFARE Classic key type B.

## § PHHAL_HW_MFC_KEY_LENGTH

#define PHHAL_HW_MFC_KEY_LENGTH 0x06U

Length of a MIFARE Classic key (for completeness).

## § PHHAL_HW_BAL_CONNECTION_RS232

#define PHHAL_HW_BAL_CONNECTION_RS232 0x0000U

Reader IC is connected via RS232.

## § PHHAL_HW_BAL_CONNECTION_SPI

#define PHHAL_HW_BAL_CONNECTION_SPI 0x0001U

Reader IC is connected via SPI.

## § PHHAL_HW_BAL_CONNECTION_I2C

#define PHHAL_HW_BAL_CONNECTION_I2C 0x0002U

Reader IC is connected via I2C.

## § PHHAL_HW_RS232_BITRATE_7200

#define PHHAL_HW_RS232_BITRATE_7200 0x0000U

7.200 kBit/s.

## § PHHAL_HW_RS232_BITRATE_9600

#define PHHAL_HW_RS232_BITRATE_9600 0x0001U

9.600 kBit/s.

## § PHHAL_HW_RS232_BITRATE_14400

#define PHHAL_HW_RS232_BITRATE_14400 0x0002U

14.400 kBit/s.

## § PHHAL_HW_RS232_BITRATE_19200

#define PHHAL_HW_RS232_BITRATE_19200 0x0003U

19.200 kBit/s.

## § PHHAL_HW_RS232_BITRATE_38400

#define PHHAL_HW_RS232_BITRATE_38400 0x0004U

38.400 kBit/s.

## § PHHAL_HW_RS232_BITRATE_57600

#define PHHAL_HW_RS232_BITRATE_57600 0x0005U

57.500 kBit/s.

## § PHHAL_HW_RS232_BITRATE_115200

#define PHHAL_HW_RS232_BITRATE_115200 0x0006U

115.200 kBit/s.

## § PHHAL_HW_RS232_BITRATE_128000

#define PHHAL_HW_RS232_BITRATE_128000 0x0007U

128.000 kBit/s.

## § PHHAL_HW_RS232_BITRATE_230400

#define PHHAL_HW_RS232_BITRATE_230400 0x0008U

230.400 kBit/s.

## § PHHAL_HW_RS232_BITRATE_460800

#define PHHAL_HW_RS232_BITRATE_460800 0x0009U

460.800 kBit/s.

## § PHHAL_HW_RS232_BITRATE_921600

#define PHHAL_HW_RS232_BITRATE_921600 0x000AU

921.600 kBit/s.

## § PHHAL_HW_RS232_BITRATE_1228800

#define PHHAL_HW_RS232_BITRATE_1228800 0x000BU

1.228.800 kBit/s.

## § PHHAL_HW_MINFDT_106_US

#define PHHAL_HW_MINFDT_106_US 91+10

(n * 128 + 84) / 13.56; n = 9.

## § PHHAL_HW_MINFDT_212_US

#define PHHAL_HW_MINFDT_212_US 87+40

(n * 128 + 148) / 13.56; n = 8.

## § PHHAL_HW_MINFDT_424_US

#define PHHAL_HW_MINFDT_424_US 84+35

(n * 128 + 116) / 13.56; n = 8.

## § PHHAL_HW_MINFDT_848_US

#define PHHAL_HW_MINFDT_848_US 83+45

(n * 128 + 100) / 13.56; n = 8.

## § PHHAL_HW_I14443A_106_FRAMING

#define PHHAL_HW_I14443A_106_FRAMING 0x00

ISO/IEC 14443A/MIFARE and passive communication mode 106 kBit.

## § PHHAL_HW_ACTIVE_MODE_FRAMING

#define PHHAL_HW_ACTIVE_MODE_FRAMING 0x01

Active communication mode.

## § PHHAL_HW_FELICA_FRAMING

#define PHHAL_HW_FELICA_FRAMING 0x02

FeliCa and passive communication mode 212 and 424 kBit.

## § PHHAL_HW_I14443B_FRAMING

#define PHHAL_HW_I14443B_FRAMING 0x03

ISO/IEC 14443B.

## § PHHAL_HW_EMULATE_TYPE_A_TARGET

#define PHHAL_HW_EMULATE_TYPE_A_TARGET 0x0001U

Bit setting to emulate Type A target.

## § PHHAL_HW_EMULATE_TYPE_B_TARGET

#define PHHAL_HW_EMULATE_TYPE_B_TARGET 0x0002U

Bit setting to emulate Type B target.

## § PHHAL_HW_EMULATE_TYPE_F_TARGET

#define PHHAL_HW_EMULATE_TYPE_F_TARGET 0x0004U

Bit setting to emulate Type F target.

## § PHHAL_HW_REQC_MIN_LEN

#define PHHAL_HW_REQC_MIN_LEN 19U

Minimum length of valid ReqC response when multiple reception is enabled.

## § PHHAL_HW_RESP_FRAME_SIZE

#define PHHAL_HW_RESP_FRAME_SIZE 32U

Frame size of one felica response when multiple reception is enable.

## § PHHAL_HW_STATUS_FRAME_LEN_BYTE_POS

#define PHHAL_HW_STATUS_FRAME_LEN_BYTE_POS 28U

Byte position where length information in felica response frame.

## § PHHAL_HW_STATUS_FRAME_ERR_BYTE_POS

#define PHHAL_HW_STATUS_FRAME_ERR_BYTE_POS 29U

Byte position where error information in felica response frame.

## § PHHAL_HW_STATUS_FRAME_CL_ERR_POS

#define PHHAL_HW_STATUS_FRAME_CL_ERR_POS (1 << 0)

Bit position for contact less Error in felica response frame.

## § PHHAL_HW_STATUS_FRAME_DATA_ERR_POS

#define PHHAL_HW_STATUS_FRAME_DATA_ERR_POS (1 << 1)

Bit position for data(CRC or Parity) error in felica response frame.

## § PHHAL_HW_STATUS_FRAME_PROT_ERR_POS

#define PHHAL_HW_STATUS_FRAME_PROT_ERR_POS (1 << 2)

Bit position for protocol error in felica response frame.

## § PHHAL_HW_STATUS_FRAME_COLL_ERR_POS

#define PHHAL_HW_STATUS_FRAME_COLL_ERR_POS (1 << 3)

Bit position for collision error in felica response frame.

## § PHHAL_HW_STATUS_FRAME_LEN_ERR_POS

#define PHHAL_HW_STATUS_FRAME_LEN_ERR_POS (1 << 4)

Bit position for length error in felica response frame.

## § PHHAL_HW_STATUS_FRAME_ERR_MASK

#define PHHAL_HW_STATUS_FRAME_ERR_MASK 0x1FU

Bit mask for error byte in felica response frame.

## § PHHAL_HW_STATUS_FRAME_LEN_MASK

#define PHHAL_HW_STATUS_FRAME_LEN_MASK 0x1FU

Bit mask for Length byte in felica response frame.

## § PHHAL_HW_I18000P3M3_GET_MAX_RESPS

#define PHHAL_HW_I18000P3M3_GET_MAX_RESPS 0

Gets responses from more than one slots limited by the RX buffer size and number of slots.

## § PHHAL_HW_I18000P3M3_GET_TAG_HANDLE

#define PHHAL_HW_I18000P3M3_GET_TAG_HANDLE 2

Gets response for only one time slot.

Also sends a ReqRN to get the tag handle for this slot.

## § PHHAL_HW_I18000P3M3_SESSION_S0

#define PHHAL_HW_I18000P3M3_SESSION_S0 0x00U

Session S0.

## § PHHAL_HW_I18000P3M3_SESSION_S2

#define PHHAL_HW_I18000P3M3_SESSION_S2 0x02U

Session S2.

## § PHHAL_HW_I18000P3M3_TARGET_INVENTORIED_S0

#define PHHAL_HW_I18000P3M3_TARGET_INVENTORIED_S0 0x00U

INVENTORIED_S0 target.

## § PHHAL_HW_I18000P3M3_TARGET_INVENTORIED_S2

#define PHHAL_HW_I18000P3M3_TARGET_INVENTORIED_S2 0x02U

INVENTORIED_S2 target.

## § PHHAL_HW_I18000P3M3_TARGET_SL

#define PHHAL_HW_I18000P3M3_TARGET_SL 0x04U

SL target.

## § PHHAL_HW_I18000P3M3_UPDN_INCREMENT

#define PHHAL_HW_I18000P3M3_UPDN_INCREMENT 0x06U

Increment Q.

## § PHHAL_HW_I18000P3M3_UPDN_NOCHANGE

#define PHHAL_HW_I18000P3M3_UPDN_NOCHANGE 0x00U

Do not change Q.

## § PHHAL_HW_I18000P3M3_UPDN_DECREMENT

#define PHHAL_HW_I18000P3M3_UPDN_DECREMENT 0x03U

Decrement Q.

## § PHHAL_HW_I18000P3M3_CMD_RESIZE_ROUND

#define PHHAL_HW_I18000P3M3_CMD_RESIZE_ROUND 0x09U

ResizeRound command code.

## Typedef Documentation

## § ppRFCallBck_t

typedef void(* ppRFCallBck_t) (void *pDataParams)

RF callback which will be called by ISR handler implementation in Platform Layer.

Return values

  None |

## Function Documentation

## § phhalHw_Nfc_IC_Init()

phStatus_t phhalHw_Nfc_IC_Init | ( | phhalHw_Nfc_Ic_DataParams_t * | pDataParams,
|  | uint16_t | wSizeOfDataParams,
|  | void * | pBalDataParams,
|  | void * | pKeyStoreDataParams,
|  | uint8_t * | pTxBuffer,
|  | uint16_t | wTxBufSize,
|  | uint8_t * | pRxBuffer,
|  | uint16_t | wRxBufSize
| ) |  |

Initialize the HAL component.

Returns
  Status code

Return values

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

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wSizeOfDataParams | Specifies the size of the data parameter structure.
  [in] | pBalDataParams | Pointer to the lower layers parameter structure.
  [in] | pKeyStoreDataParams | Pointer to configuration buffer for LoadReg mode; See description above.
  [in] | pTxBuffer | Pointer to global transmit buffer used by the phhalHw_Exchange() function.
  [in] | wTxBufSize | Size of the global transmit buffer.
  [in] | pRxBuffer | Pointer to global receive buffer used by the phhalHw_Exchange() function.
  [in] | wRxBufSize | Size of the global receive buffer. Specify the buffer +1 byte, because one byte is reserved for SPI communication.

## § phhalHw_Exchange()

phStatus_t phhalHw_Exchange | ( | void * | pDataParams,
|  | uint16_t | wOption,
|  | uint8_t * | pTxBuffer,
|  | uint16_t | wTxLength,
|  | uint8_t ** | ppRxBuffer,
|  | uint16_t * | pRxLength
| ) |  |

Perform data exchange with target/PICC in initiator/PCD mode.

This is a blocking exchange function to be used by all PAL components of reader, initiator. Frame step option required for T1T/Jewel protocol can be set using a SetConfig - PHHAL_HW_CONFIG_JEWEL_MODE It is recommended that the Tx Buffer pointer supplied to this function is word aligned (word alignment specific to the micro-controller platform where this is used)

Before this function is called, it is expected that the user/upper layer has performed

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings()
- Field ON - phhalHw_FieldOn(); or phhalHw_FieldReset()
- Wait for initial guard time using phhalHw_Wait() in case phhalHw_FieldOn() was called earlier
- Set or modify any configuration parameters using phhalHw_SetConfig()
- Call phhalHw_Exchange() with relevant protocol command/data.

wOption can be one of:

- PH_EXCHANGE_DEFAULT

wOption can be combined with:

- PH_EXCHANGE_BUFFERED_BIT
- PH_EXCHANGE_LEAVE_BUFFER_BIT

Note: When activated in target mode using phhalHw_Autocoll API, exchange should not be used.
Please refer to PHHAL_HW_CONFIG_PARITY from where all the configuration parameters are defined that will affect the behavior of this API.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | wOption is invalid.
  PH_ERR_SUCCESS_INCOMPLETE_BYTE | Operation successful, incomplete byte received; Retrieve number of valid bits of last byte with PHHAL_HW_CONFIG_RXLASTBITS.
  PH_ERR_IO_TIMEOUT | No response detected within the configured time frame.
  PH_ERR_INTEGRITY_ERROR | Response received but CRC or parity is invalid.
  PH_ERR_COLLISION_ERROR | Response received but a collision occurred; Retrieve number of valid bits of last byte with PHHAL_HW_CONFIG_RXLASTBITS.
  PH_ERR_BUFFER_OVERFLOW | Internal receive buffer is too small for transmission or smaller than the response.
  PH_ERR_FRAMING_ERROR | Frame format is either invalid for configured protocol or corrupted.
  PH_ERR_PROTOCOL_ERROR | Frame format is definitely invalid for configured protocol or received response by Type 1 Tag is less than 4 Bytes.
  PH_ERR_ABORTED | Returned when this API exits after phhalHw_AsyncAbort API is called from another thread.
  PH_ERR_EXT_RF_ERROR | External RF is ON during this exchange or if peer RF did not turn ON within Tadt in Active Mode.
  PH_ERR_READ_WRITE_ERROR | Hardware problem.
  PH_ERR_TEMPERATURE_ERROR | Hardware problem.
  PH_ERR_INTERFACE_ERROR | Hardware problem.
  PH_ERR_INTERNAL_ERROR | Unexpected Hardware problem or Software logic that should never be executed.

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.
  [out] | ppRxBuffer | Pointer to received data.
  [out] | pRxLength | Number of received data bytes.

## § phhalHw_ApplyProtocolSettings()

phStatus_t phhalHw_ApplyProtocolSettings | ( | void * | pDataParams,
|  | uint8_t | bMode
| ) |  |

Configure reader IC for a particular reader/initiator protocol.

Used to apply hardware settings for a particular protocol for reader, initiator modes. Example: ISO 14443-3A, ISO 14443-3B, ISO 18092 initiator etc. For target or card emulation phhalHw_Autocoll should be used. An IC specific configuration for setting antenna type before applying protocol settings may be required during development phase and this should be managed by IC specific HALs.

bMode can be:

- PHHAL_HW_CARDTYPE_CURRENT
- PHHAL_HW_CARDTYPE_ISO14443A
- PHHAL_HW_CARDTYPE_ISO14443B
- PHHAL_HW_CARDTYPE_FELICA_212
- PHHAL_HW_CARDTYPE_ISO15693
- PHHAL_HW_CARDTYPE_ICODEEPCUID
- PHHAL_HW_CARDTYPE_I18000P3M3
- PHHAL_HW_CARDTYPE_I18092M_ACTIVE_106
- PHHAL_HW_CARDTYPE_I18092M_ACTIVE_212
- PHHAL_HW_CARDTYPE_I18092M_ACTIVE_424
- PHHAL_HW_CARDTYPE_FELICA_424

Before this function is called, it is expected that the user/upper layer has performed

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();

Only after calling this function, the RF field has to be turned ON using phhalHw_FieldOn() or phhalHw_FieldReset()

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | bCardType is invalid or not supported.
  PH_ERR_INTERFACE_ERROR | Hardware problem.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | bMode | Mode in which the IC hardware is to be configured.

## § phhalHw_MfcAuthenticateKeyNo()

phStatus_t phhalHw_MfcAuthenticateKeyNo | ( | void * | pDataParams,
|  | uint8_t | bBlockNo,
|  | uint8_t | bKeyType,
|  | uint16_t | wKeyNo,
|  | uint16_t | wKeyVersion,
|  | uint8_t * | pUid
| ) |  |

Perform MIFARE(R) Classic authentication using a key number.

wKeyVersion and wKeyNo parameters are assigned for a particular key.
When hardware key store is used, the keys are stored in the reader IC.
The keys are referenced by using key number and key version.
When software key store is used (please refer to phKeyStore.h), the key number
and key version are as assigned in the phKeyStore_Sw_KeyVersionPair_t structure.
Before this function is called, it is expected that the user/upper layer has performed

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings()
- Field ON - phhalHw_FieldOn(); or phhalHw_FieldReset()
- Wait for initial Guard time using phhalHw_Wait()
- Activate the MIFARE Classic / MIFARE Plus SL1 card using ISO14443-3A commands.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | bKeyType, wKeyNo or wKeyVersion is invalid.
  PH_ERR_IO_TIMEOUT | Error in authentication.
  PH_ERR_AUTH_ERROR | Error in authentication.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | bBlockNo | Block number on card to authenticate to.
  [in] | bKeyType | Either PHHAL_HW_MFC_KEYA or PHHAL_HW_MFC_KEYB.
  [in] | wKeyNo | Key number to be used in authentication.
  [in] | wKeyVersion | Key version to be used in authentication.
  [in] | pUid | Serial number of current cascade level; uint8_t[4].

## § phhalHw_MfcAuthenticate()

phStatus_t phhalHw_MfcAuthenticate | ( | void * | pDataParams,
|  | uint8_t | bBlockNo,
|  | uint8_t | bKeyType,
|  | uint8_t * | pKey,
|  | uint8_t * | pUid
| ) |  |

Perform MIFARE(R) Classic authentication using a key.

Here the 6 byte MIFARE Key is supplied as an argument (pKey).

Before this function is called, it is expected that the user/upper layer has performed

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings();
- Field ON - phhalHw_FieldOn();
- Wait for initial Guard time using phhalHw_Wait();
- Activate the MIFARE Classic / MIFARE Plus SL1 card using ISO14443-3A commands

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | bKeyType is invalid.
  PH_ERR_IO_TIMEOUT | Error in authentication.
  PH_ERR_AUTH_ERROR | Error in authentication.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | bBlockNo | Block number on card to authenticate to.
  [in] | bKeyType | Either PHHAL_HW_MFC_KEYA or PHHAL_HW_MFC_KEYB
  [in] | pKey | Key to be used in authentication.
  [in] | pUid | Serial number of current cascade level; uint8_t[4].

## § phhalHw_SetConfig()

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

Set configuration parameter.

All mandatory configuration parameters are to be implemented to be compliant to generic HAL specification
Refer PHHAL_HW_CONFIG_PARITY and subsequent configuration parameters that can be set using this API.

This operation is performed by user application or upper layer to set/change the behavior of the HAL APIs. For example - To enable parity during phhalHw_Exchange(),
phhalHw_SetConfig(pHal, PHHAL_HW_CONFIG_PARITY, PH_ON); needs to be called.

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_PARAMETER_OVERFLOW | Setting the parameter value would lead to an overflow.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

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

## § phhalHw_GetConfig()

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

Get configuration parameter.

All mandatory configuration parameters are to be implemented to be compliant to generic HAL specification.
Refer PHHAL_HW_CONFIG_PARITY and subsequent configuration parameters whose value can be read using this API.

This operation is performed by user application or upper layer to get the value of a configuration parameter of the HAL. For example - To get the number of last bits received during phhalHw_Exchange(),
phhalHw_GetConfig(pHal, PHHAL_HW_CONFIG_RXLASTBITS, &wLastBits); needs to be called.

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_PARAMETER_OVERFLOW | The parameter value is larger than the range of pValue.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

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

## § phhalHw_FieldOn()

phStatus_t phhalHw_FieldOn | ( | void * | pDataParams | ) |

Switch ON the RF-field.

If the configuration parameter PHHAL_HW_CONFIG_RFCA is set, it performs initial RF collision avoidance(I-RFCA) in initiator/reader mode before switching ON the field.
If parameter PHHAL_HW_CONFIG_RFCA is not set, field ON is done without performing RFCA.
This API shall be called only after phhalHw_ApplyProtocolSettings. An example sequence is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings(pHal, PHHAL_HW_CARDTYPE_I18092M_ACTIVE_106);
- Field ON - phhalHw_FieldOn();

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INTERFACE_ERROR | Communication error.
  PH_ERR_RF_ERROR | External RF is detected during RF Collision avoidance when RFCA is enabled.

Parameters

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

## § phhalHw_FieldOff()

phStatus_t phhalHw_FieldOff | ( | void * | pDataParams | ) |

Switch off the RF-field.

If this API is called when communication mode is "active initiator", this will reset the Auto-RF OFF behavior of the active initiator mode

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

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

## § phhalHw_FieldReset()

phStatus_t phhalHw_FieldReset | ( | void * | pDataParams | ) |

Perform RF-Reset.

Switches OFF, waits for a configured time, and then turns the RF back to ON.
This is expected to retain the protocol settings that were applied before calling this function. The time to wait before RF ON is configured using a SetConfig call.

PHHAL_HW_CONFIG_FIELD_OFF_TIME (in milliseconds) can be set to a particular value to keep the field OFF for the configured time value before turning it ON.

PHHAL_HW_CONFIG_FIELD_RECOVERY_TIME (in milliseconds) can be set to a particular value to wait for RF recovery time after field is switched ON.

A typical sequence in which this API is called is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings();
- Field ON - phhalHw_FieldOn();
- Wait for initial guard time - phalHw_Wait();
- Send/Receive protocol commands
- Field reset - phhalHw_FieldReset();
- Restart activation commands followed by other protocol commands.
- Field OFF - phhalHw_FieldOff();

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

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

## § phhalHw_Wait()

phStatus_t phhalHw_Wait | ( | void * | pDataParams,
|  | uint8_t | bUnit,
|  | uint16_t | wTimeout
| ) |  |

phhalHw_Wait function waits/loops until the input time value is elapsed.

This function can be configured to generate Time delays in micro or milliseconds. This can be used as initial RF guard time delay in discovery loop

A typical sequence in which this API is called is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init();
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings();
- Field ON - phhalHw_FieldOn();
- Wait for initial guard time - phalHw_Wait(pHal, 5100, PHHAL_HW_TIME_MICROSECONDS);
- Send/Receive protocol commands
- Field Reset - phhalHw_FieldReset();
- Restart activation commands followed by other protocol commands.
- Field OFF - phhalHw_FieldOff();

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | bUnit is invalid.
  PH_ERR_INTERFACE_ERROR | Communication error.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | bUnit | Unit of given timeout value (either PHHAL_HW_TIME_MICROSECONDS or PHHAL_HW_TIME_MILLISECONDS).
  [in] | wTimeout | Timeout value.

## § phhalHw_Transmit()

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

Used to transmit data.

This is a generic transmit-only function that can be used in initiator/PCD and target modes.

In the initiator/reader mode, the FWT timer starts after last bit transmitted to handle timeout and is automatically stopped after first bit is received in a phhalHw_Receive() function call.

Note: Special behavior: To use phhalHw_Transmit API in target mode phhalHw_Autocoll API shall be executed before.

wOption can be one of:

- PH_TRANSMIT_DEFAULT
- PH_TRANSMIT_PREV_FRAME

If wOption can be combined with:

- PH_TRANSMIT_BUFFERED_BIT
- PH_TRANSMIT_LEAVE_BUFFER_BIT

NOTE : PH_TRANSMIT_PREV_FRAME cannot be combined with any of the buffering options above.

A typical sequence in which this API is called in initiator mode is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init();
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings(pHal, PHHAL_HW_CARDTYPE_I18092M_ACTIVE_106);
- Field ON - phhalHw_FieldOn();
- Wait for initial guard time - phalHw_Wait(pHal, 5100, PHHAL_HW_TIME_MICROSECONDS);
- Transmit the ATR_REQ - phhalHw_Transmit(pHal, PH_EXCHANGE_DEFAULT, pATR_REQ, wATR_len);
- Receive the response - phhalHw_Receive(pHal, 0x00, &pResponse, &wRxLen);
- Other command exchanges
- Field OFF - phhalHw_FieldOff();

A typical sequence in which this API is called in target/PICC mode is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- HAL specific listen mode configuration - Example phhalHw_Rc523_SetListenParameters(pHal, pSENS_RES, pNfcId1, bSelelctResponse, pFelicaResponse, bNfcId3);
- Start target mode - phhalHw_Autocoll(pHal, 0x05, &pResponse, &wRxlen, &wProtParams);
- if (pResponse is valid ATR_REQ) then phhalHw_Transmit(pHal, PH_TRANSMIT_DEFAULT, pATR_RES, wATR_len);
- Receive the response - phhalHw_Receive(pHal, 0x00, &pResponse, &wRxLen);
- Other response/command exchanges
- Termination of the target flow.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | wOption parameter is invalid.
  PH_ERR_INTERFACE_ERROR | Communication error.
  PH_ERR_EXT_RF_ERROR | In active mode if External RF is present during this transmit or in passive target mode if external field is not present before initiating this transmit.
  PH_ERR_ABORTED | Returned when this API exits after phhalHw_AsyncAbort API is called from another thread.
  PH_ERR_INTERNAL_ERROR | If transmission was not successful due to some Hardware or Memory alignment issues.
  PH_ERR_BUFFER_OVERFLOW | If the buffer provided by PAL or Application to HAL exceeds the HAL Tx Buffer and other platform specific reasons.

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.

## § phhalHw_Receive()

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

Used to receive data.

Can be used in initiator/PCD and target/PICC Modes.

Note: Special behavior: To use phhalHw_Receive API in target Mode, phhalHw_Autocoll API shall be executed previously. In target mode this API will wait for receive interrupt or external RF OFF interrupt (in case of passive mode).

wOption is RFU and should be set to 0x00

A typical sequence in which this API is called in initiator mode is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- Load the protocol - phhalHw_ApplyProtocolSettings(pHal, PHHAL_HW_CARDTYPE_I18092M_ACTIVE_106);
- Field ON - phhalHw_FieldOn()
- Wait for initial guard time - phalHw_Wait(pHal, 5100, PHHAL_HW_TIME_MICROSECONDS);
- Transmit the ATR_REQ - phhalHw_Transmit(pHal, PH_EXCHANGE_DEFAULT, pATR_REQ, wATR_len);
- Receive the response - phhalHw_Receive(pHal, 0x00, &pResponse, &wRxLen);
- Other command exchanges
- Field OFF - phhalHw_FieldOff();

A typical sequence in which this API is called in target/PICC mode is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- HAL specific listen mode configuration - Example phhalHw_Rc523_SetListenParameters(pHal, pSENS_RES, pNfcId1, bSelelctResponse, pFelicaResponse, bNfcId3);
- Start target mode - phhalHw_Autocoll(pHal, 0x05, &pResponse, &wRxlen, &wProtParams);
- if (pResponse is valid RATS) then phhalHw_Transmit(pHal, PH_EXCHANGE_DEFAULT, pATS, wATS_len);
- Receive the response - phhalHw_Receive(pHal, 0x00, &pResponse, &wRxLen);
- Other response/command exchanges
- Termination of the target flow.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_PARAMETER | The option provided is invalid.
  PH_ERR_IO_TIMEOUT | No response detected within the configured time frame.
  PH_ERR_INTEGRITY_ERROR | Response received but CRC or parity is invalid.
  PH_ERR_COLLISION_ERROR | Response received but a collision occurred; Retrieve number of valid bits of last byte with PHHAL_HW_CONFIG_RXLASTBITS.
  PH_ERR_BUFFER_OVERFLOW | Internal receive buffer is smaller than the received response.
  PH_ERR_FRAMING_ERROR | Frame format is either invalid for configured protocol or corrupted.
  PH_ERR_PROTOCOL_ERROR | Frame format is definitely invalid for configured protocol.
  PH_ERR_ABORTED | Returned when this API exits after phhalHw_AsyncAbort API is called from another thread.
  PH_ERR_EXT_RF_ERROR | In passive target mode, external reader/initiator switched OFF its field before/during reception or if peer RF did not turn ON within Tadt in Active Mode.
  PH_ERR_READ_WRITE_ERROR | Hardware problem.
  PH_ERR_TEMPERATURE_ERROR | Hardware problem.
  PH_ERR_INTERFACE_ERROR | Communication error.
  PH_ERR_INTERNAL_ERROR | Unexpected Hardware problem (like in active mode if modem state is WAIT_RECIEVE but the internal RF field is ON).

Parameters

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

## § phhalHw_Autocoll()

phStatus_t phhalHw_Autocoll | ( | void * | pDataParams,
|  | uint16_t | wMode,
|  | uint8_t ** | ppRxBuffer,
|  | uint16_t * | pRxLength,
|  | uint16_t * | pProtParams
| ) |  |

Used to configure the IC to NFC target or card mode based on the configured option.

Before calling this API phhalHw_FieldOff API should be called.

This is a blocking call that waits for reception of polling frames for the technologies mentioned in the wMode bit map and terminates with a response having command buffer received from an external reader/initiator. After target / PICC activation, the CRC is validated and removed before handing over the received frame to the caller. If target is activated in Active communication mode, then Auto RF-OFF is enabled by this API. The technologies mentioned in wMode or a combination of these depends on the hardware capability.
Note: If PHHAL_HW_CONFIG_MFHALTED configuration parameter is set then this function will only respond to WUPA/ALL_REQ.

IC specific phhalHw_XXX_SetListenParameters API has to be called to configure the NFC Type A, Type B(Optional) and Type F responses in the IC before calling this function.

The LSB and MSB of wMode has to be coded as follows.

         | - - - - - - - - - - - - - - - - - - - - - - - -|
     bit |  7 | 6 | 5 | 4 | 3 |   2    |   1     |   0    |
         | - - - - - - - - - - - - - - - - - - - - - - - -|
     Val |  x | x | x | x | x | Type F |  Type B | Type A |
         | - - - - - - - - - - - - - - - - - - - - - - - -|

The LSB codes target/PICC technology supported for NFC passive technology and MSB codes target/PICC technology supported for NFC active technology

A typical sequence in which this API is called in a target/PICC use case is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc523_Init();
- HAL specific listen mode configuration - Example phhalHw_Rc523_SetListenParameters(pHal, pSENS_RES, pNfcId1, bSelelctResponse, pFelicaResponse, bNfcId3);
- Field OFF - phhalHw_FieldOff();
- Start target mode - phhalHw_Autocoll(pHal, 0x05, &pResponse, &wRxlen, &wProtParams);
- if (pResponse is valid ATR_REQ) then phhalHw_Transmit(pHal, PH_EXCHANGE_DEFAULT, pATR_RES, wATR_len);
- Receive the next command - phhalHw_Receive(pHal, 0x00, &pResponse, &wRxLen);
- Other response/command exchanges
- Termination of the target flow.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_IO_TIMEOUT | No response received.
  PH_ERR_EXT_RF_ERROR | External RF was OFF when this API is called or switched OFF before active/passive activation.
  PH_ERR_PROTOCOL_ERROR | Protocol error.
  PH_ERR_INTEGRITY_ERROR | Response received but CRC or Parity is invalid.
  PH_ERR_BUFFER_OVERFLOW | Internal receive buffer is too small for transmission or smaller than the response.
  PH_ERR_FRAMING_ERROR | Frame format is either invalid for configured protocol or corrupted.
  PH_ERR_PROTOCOL_ERROR | Frame format is definitely invalid for configured protocol.
  PH_ERR_ABORTED | Returned when this API exits after phhalHw_AsyncAbort API is called from another thread.
  PH_ERR_READ_WRITE_ERROR | Hardware problem.
  PH_ERR_TEMPERATURE_ERROR | Hardware problem.
  PH_ERR_INTERFACE_ERROR | Communication error.
  PH_ERR_UNSUPPORTED_COMMAND | Target Mode is not supported by the Front End/Nfc Controller

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wMode | Bitmap of the modes that this will support in target/card emulation mode.
  [out] | ppRxBuffer | Pointer to received data after Activation. It can be an error frame or ATR_REQ/RATS.
  [out] | pRxLength | Number of received data bytes.
  [out] | pProtParams | Contains frame mode in the MSB Byte and Rx speed information in the LSB Byte. MSB value can be one of PHHAL_HW_RF_TYPE_A_FRAMING, PHHAL_HW_RF_TYPE_B_FRAMING, PHHAL_HW_RF_TYPE_F_FRAMING. LSB value can be one of PHHAL_HW_RF_DATARATE_106, PHHAL_HW_RF_DATARATE_212, PHHAL_HW_RF_DATARATE_424, PHHAL_HW_RF_DATARATE_848.

## § phhalHw_Lpcd()

phStatus_t phhalHw_Lpcd | ( | void * | pDataParams | ) |

Perform Low-Power-Card-Detection.

Note: IC specific API has to be called to configure required parameters for LPCD before calling this function. Example - phhalHw_Rc663_Cmd_Lpcd_SetConfig for CLRC663 has to be called to configure LPCD.

A typical sequence in which this API is called is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc663_Init();
- HAL specific LPCD configuration - phhalHw_Rc663_phhalHw_Rc663_Cmd_Lpcd_SetConfig(pHal, bLPCD_MODE, I_Value, Q_Value, wPowerDownTimeMs, wDetectionTimeUs);
- Start LPCD - phhalHw_Lpcd(pHal); This blocks until a card comes in the field or due to disturbance in the field.
- Upon LPCD return - phhalHw_ApplyProtocolSettings(pHal, PHHAL_HW_CARDTYPE_ISO14443A);
- Turn ON the field - phhalHw_FieldOn();
- Wait for initial guard time - phalHw_Wait(pHal, 5100, PHHAL_HW_TIME_MICROSECONDS);
- Start card activation and subsequent card read/write command exchanges.
- Turn OFF the field - phhalHw_FieldOff();
- Termination of the application flow.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Card present.
  PH_ERR_IO_TIMEOUT | No card found.
  Other | Depending on implementation and underlying component.

Parameters

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

## § phhalHw_AsyncAbort()

phStatus_t phhalHw_AsyncAbort | ( | void * | pDataParams | ) |

Used to asynchronously stop HAL waiting for RF event and exit from HAL.

Note: This function will post an 'abort' event which is used by the HAL to move into 'Idle' state and exit from polling for RF Event. The functions that were waiting for a HAL event will return PH_ERR_ABORTED error code once this function is executed.

This function shall be called in a task other than the task where reader library is running. This API can be called at any time after the HAL has been initialized and any of the HAL operations like transmit, receive, exchange, autocoll are in progress.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.

Parameters

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

## § phhalHw_I18000p3m3Inventory()

phStatus_t phhalHw_I18000p3m3Inventory | ( | void * | pDataParams,
|  | uint8_t * | pSelCmd,
|  | uint8_t | bSelCmdLen,
|  | uint8_t | bNumValidBitsinLastByte,
|  | uint8_t * | pBeginRndCmd,
|  | uint8_t | bTSprocessing,
|  | uint8_t ** | ppRxBuffer,
|  | uint16_t * | wRxBufferLen
| ) |  |

ISO 18000p3m3 Inventory command.

Note: This function does ISO18000p3m3 BeginRound Sends an Ack Optionally sends a ReqRN Stores the information related to tag reply in the HAL RX Buffer Continues with NextSlot or else pauses and returns based on the option specified Can return multi card information based on the configuration option and the size of HAL RX Buffer. The bTSprocessing (Time slot processing behavior) can take the following values

- PHHAL_HW_I18000P3M3_GET_MAX_RESPS - Gets responses from more than one slot limited by the Rx Buffer size and number of slots specified in begin round.
- PHHAL_HW_I18000P3M3_ONE_TS_ONLY - Gets response for only one time slot. Here the number of time slots should be zero in the begin round command.
- PHHAL_HW_I18000P3M3_GET_TAG_HANDLE - Gets response for only one time slot. Also send a ReqRN to get the tag handle for this slot. Here the number of time slots should be zero in the begin round command.

The response is a Pointer to a buffer containing the result of the inventory. The buffer may contain the result of one or more timeslots. Each timeslot result has the following structure: 1 Byte time slot status ( 0 ... Tag response available. 'Tag reply length field', 'Valid bits in last byte field' and 'Tag reply field' are present. 1 ... Tag response available. In addition to three field above, 'Tag handle field' also present. 2 ... No tag replied in timeslot. 'Tag reply length field', 'Valid bits in last byte field' and 'Tag reply field', 'Tag Handle' are not present. 3 ... Two or more tags responded in the timeslot. (Collision). Tag Reply Length, valid bits in last byte and tag reply field not present. ) 1 Byte 'Tag reply' Length (1-66) 1 Byte Valid bits in last Byte (0-7, 0 means all bits are valid) 0-66 Bytes Tag reply 0 or 2 Bytes Handle of the tag, in case the field

A typical sequence in which this API is called is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc663_Init();
- Load ISO 1800p3m3 protocol - phhalHw_ApplyProtocolSettings(pHal, PHHAL_HW_CARDTYPE_I18000P3M3);
- Turn ON the field - phhalHw_FieldOn();
- Wait for initial guard time - phalHw_Wait(pHal, 5100, PHHAL_HW_TIME_MICROSECONDS);
- Start inventory - phhalHw_I18000p3m3Inventory(pHal,pSelectFrame, bSelectFrameLen, bNumValidBits, pBeginRndFrame, bTSProcessing, &pResponse, &wRxLen);
- Use phpalI18000p3m3 and phalI18000p3m3 APIs to further communicate with the tag.
- Turn OFF the field - phhalHw_FieldOff();
- Termination of the application flow.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_IO_TIMEOUT | When there is no tag in the field.
  PH_ERR_INVALID_PARAMETER | If wrong value specified for bNumValidBits or pBeginRound.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | pSelCmd | ISO 18000p3m3 Select command frame.
  [in] | bSelCmdLen | Select command length in bytes- 1 to 39 bytes.
  [in] | bNumValidBitsinLastByte | Number of valid bits in last byte of pSelCmd.
  [in] | pBeginRndCmd | ISO 18000p3m3 BeginRound command frame. This is 17bits i.e., 3 bytes are expected. CRC5 should not be provided.
  [in] | bTSprocessing | TimeSlot processing behavior.
  [out] | ppRxBuffer | Pointer to HAL RX Buffer containing response from single/multiple tags.
  [out] | wRxBufferLen | Length of response in HAL RX Buffer.

## § phhalHw_I18000p3m3ResumeInventory()

phStatus_t phhalHw_I18000p3m3ResumeInventory | ( | void * | pDataParams,
|  | uint8_t ** | ppRxBuffer,
|  | uint16_t * | wRxBufferLen
| ) |  |

ISO 18000p3m3 resume inventory command.

Note: This function is to be called after phhalHw_I18000p3m3Inventory. This internally calls the ISO 18000p3m3 NextSlot command once or multiple times to get responses from remaining slots.

Resume inventory also returns the response similar to phhalHw_I18000p3m3Inventory.

A typical sequence in which this API is called is given below

- BAL initialization (where applicable) - Example - phbalReg_Serial_Init()
- HAL initialization - Example phhalHw_Rc663_Init();
- Load ISO 1800p3m3 protocol - phhalHw_ApplyProtocolSettings(pHal, PHHAL_HW_CARDTYPE_I18000P3M3);
- Turn ON the field - phhalHw_FieldOn();
- Wait for initial guard time - phalHw_Wait(pHal, 5100, PHHAL_HW_TIME_MICROSECONDS);
- Start inventory - phhalHw_I18000p3m3Inventory(pHal,pSelectFrame, bSelectFrameLen, bNumValidBits, pBeginRndFrame, bTSProcessing, &pResponse, &wRxLen);
- Store the responses received for the tags.
- If inventory has to be continued then issue the ResumeInventory command - phhalHw_I18000p3m3ResumeInventory(pHal, &pResponse, &wRxLen);
- Use phpalI18000p3m3 and phalI18000p3m3 APIs to further communicate with the tag.
- Turn OFF the field - phhalHw_FieldOff();
- Termination of the application flow.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_IO_TIMEOUT | When there is no tag in the field.
  PH_ERR_USE_CONDITION | If called when the phhalHw_I18000p3m3 was not called previously with bTSprocessing = PHHAL_HW_I18000P3M3_GET_MAX_RESPS.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [out] | ppRxBuffer | Pointer to HAL Rx Buffer containing response from single/multiple tags.
  [out] | wRxBufferLen | Length of response in hal Rx Buffer.

## § phhalHw_EventConsume()

phStatus_t phhalHw_EventConsume | ( | void * | pDataParams | ) |

Used to consume all the event generated in Hal.

This function is called before calling phhalHw_EventWait() in normal case to consume all the events.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_INVALID_DATA_PARAMS | Parameter structure size is invalid.
  PH_ERR_UNSUPPORTED_COMMAND | Command not supported.
  PH_ERR_INVALID_PARAMETER | Invalid handle for events is provided.

Parameters

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

## § phhalHw_EventWait()

phStatus_t phhalHw_EventWait | ( | void * | pDataParams,
|  | uint32_t | dwEventTimeout
| ) |  |

Used to wait any event generate in Hal.

This is a blocking call that waits for any event generated in Hal. Except in No Rtos case, the tread will be suspended and will be resumed if any event is generated.

Before calling this function, the interrupt have to enabled.

A typical sequence in which this API is called is given below

- BAL initialization (where applicable) - Example - phPlatform_Init();
- Field OFF - Example - phhalHw_FieldOff();
- Consume all the Hal events - phhalHw_EventConsume()
- Set Config to wait for external Rf On. - Example - phhalHw_SetConfig(); for PHHAL_HW_CONFIG_RFON_INTERRUPT
- Event Wait. - phhalHw_EventWait();
- Set Config OFF for external Rf On. - Example - phhalHw_SetConfig(); for PHHAL_HW_CONFIG_RFON_INTERRUPT
- Proceed further according to the Interrupt enabled.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_IO_TIMEOUT | No Event generated
  PH_ERR_ABORTED | Returned when this API exits after phhalHw_AsyncAbort API is called from another thread.
  PH_ERR_INVALID_DATA_PARAMS | Parameter structure size is invalid.
  PH_ERR_UNSUPPORTED_COMMAND | Command not supported.
  PH_ERR_INVALID_PARAMETER | Invalid handle for events is provided.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | dwEventTimeout | Timeout for Event in milliseconds.

## § phhalHw_DeInit()

phStatus_t phhalHw_DeInit | ( | void * | pDataParams | ) |

De-initializes the contactless IC HAL.

Note: This API resets the HAL context data. The Tx and Rx buffers are made invalid The connection to BAL is made invalid All contactless IP interrupts are disabled. No other HAL APIs can be called after de-initializing the HAL till the phhalHw_<IC>_Init() function is called.

This API shall be called during the application termination sequence to de-initialize the HAL.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.

Parameters

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