This component implements tools that are necessary for many different software modules. More...

Functions | |
| phStatus_t | phTools_EncodeParity (uint8_t bOption, uint8_t *pInBuffer, uint16_t wInBufferLength, uint8_t bInBufferBits, uint16_t wOutBufferSize, uint8_t *pOutBuffer, uint16_t *pOutBufferLength, uint8_t *pOutBufferBits) |
| Calculate even or odd parity. More... | |
| phStatus_t | phTools_DecodeParity (uint8_t bOption, uint8_t *pInBuffer, uint16_t wInBufferLength, uint8_t bInBufferBits, uint16_t wOutBufferSize, uint8_t *pOutBuffer, uint16_t *pOutBufferLength, uint8_t *pOutBufferBits) |
| Verify and Remove even or odd parity. More... | |
| phStatus_t | phTools_CalculateCrc5 (uint8_t bOption, uint8_t bPreset, uint8_t bPolynom, uint8_t *pData, uint16_t wDataLength, uint8_t *pCrc) |
| Calculate a CRC 5. More... | |
| phStatus_t | phTools_CalculateCrc8 (uint8_t bOption, uint8_t bPreset, uint8_t bPolynom, uint8_t *pData, uint16_t wDataLength, uint8_t *pCrc) |
| Calculate a CRC 8. More... | |
| phStatus_t | phTools_CalculateCrc16 (uint8_t bOption, uint16_t wPreset, uint16_t wPolynom, uint8_t *pData, uint16_t wDataLength, uint16_t *pCrc) |
| Calculate a CRC 16. More... | |
| phStatus_t | phTools_CalculateCrc32 (uint8_t bOption, uint32_t dwPreset, uint32_t dwPolynom, uint8_t *pData, uint32_t dwDataLength, uint32_t *pCrc) |
| Calculate a CRC 32. More... | |
| phStatus_t | phTools_CalculateLrc (uint8_t *pData, uint16_t wDataLength, uint8_t *pLrc) |
| Calculate the LRC. More... | |
| phStatus_t | phTools_HammingEncode (uint8_t *pData, uint8_t *pEnhancedSubBlock, uint16_t wEnhancedSubBlockSize, uint16_t wEnhancedSubBlockOffset) |
| add Hamming Byte to data More... | |
| phStatus_t | phTools_HammingEncodeMoreBlocks (uint8_t *pData, uint16_t wDataLen, uint8_t *pEnhancedBlocks, uint16_t wEnhancedBlocksSize, uint16_t *pwEnhancedBlocksLen) |
| add Hamming Byte to data with length > 7 bytes More... | |
| phStatus_t | phTools_HammingDecode (uint8_t *pEnhancedSubBlock, uint8_t *pDecodedData, uint16_t wDecodedDataSize, uint16_t wDecodedDataOffset) |
| check Hamming Byte and correct 1 bit error if occured More... | |
| phStatus_t | phTools_HammingDecodeMoreBlocks (uint8_t *pEnhancedBlocks, uint16_t wEnhancedBlocksLen, uint8_t *pDecodedBlocks, uint16_t wDecodedBlocksSize, uint16_t *wDecodedBlocksLen) |
| check Hamming Byte and correct 1 bit error if occured - with data length > 7 More... | |
| phStatus_t | phTools_Sleep (uint32_t dwTimeMilliSeconds) |
| Sleep for certain amount of time. More... | |
ToolsConfigs | |
| #define | PH_TOOLS_CRC16_PRESET_ISO14443A 0x6363U |
| CRC16 Preset for ISO14443-A. | |
| #define | PH_TOOLS_CRC16_PRESET_ISO14443B 0xFFFFU |
| CRC16 Preset for ISO14443-B. | |
| #define | PH_TOOLS_CRC16_PRESET_FELICA 0x0000U |
| CRC16 Preset for Felica. | |
| #define | PH_TOOLS_CRC16_PRESET_ISO15693 0xFFFFU |
| CRC16 Preset for ISO15693. | |
| #define | PH_TOOLS_CRC16_PRESET_CONTACTBASED 0xFFFFU |
| CRC16 Preset for Contactbased Cards. | |
| #define | PH_TOOLS_CRC16_POLY_ISO14443 0x8408U |
| CRC16 Polynom for ISO14443. | |
| #define | PH_TOOLS_CRC16_POLY_ISO15693 0x8408U |
| CRC16 Polynom for ISO15693. | |
| #define | PH_TOOLS_CRC16_POLY_CONTACTBASED 0x8408U |
| CRC16 Polynom for Contactbased Cards. | |
| #define | PH_TOOLS_CRC32_PRESET_ISO14443 0xFFFFFFFFU |
| CRC32 Preset for ISO14443 Enhanced Frame. | |
| #define | PH_TOOLS_CRC32_POLY_ISO14443 0x04C11DB7U |
| CRC32 Polynom for ISO14443 Enhanced Frame. | |
| #define | PH_TOOLS_CRC32_PRESET_DF8 0xFFFFFFFFU |
| CRC32 Preset for DesFire. | |
| #define | PH_TOOLS_CRC32_POLY_DF8 0xEDB88320U |
| CRC32 Polynom for DesFire. | |
| #define | PH_TOOLS_CRC8_PRESET_EPC 0xFFU |
| Preset value for EPC CRC-8 generation. | |
| #define | PH_TOOLS_CRC8_PRESET_UID 0xFDU |
| Preset value for UID CRC-8 generation. | |
| #define | PH_TOOLS_CRC8_POLY_EPCUID 0x1DU |
| Polynomial for EPC/UID CRC-8 generation: x^8 + x^4 + x^3 + x^2 + 1 (MSB first). | |
| #define | PH_TOOLS_CRC16_PRESET_EPCUID 0xFFFFU |
| Preset value for EPC/UID CRC-16 generation. | |
| #define | PH_TOOLS_CRC16_POLY_EPCUID 0x1021U |
| Polynomial for EPC/UID CRC-16 generation: x^16 + x^12 + x^5 + 1 (MSB first). | |
| #define | PH_TOOLS_CRC5_PRESET_I18000P3 0x09U |
| Preset value for ISO18000-3 CRC-5 generation. | |
| #define | PH_TOOLS_CRC5_POLY_I18000P3 0x09U |
| Polynomial for ISO18000-3 CRC-5 generation: x^5 + x^3 + 1 (LSB first). | |
| #define | PH_TOOLS_CRC16_PRESET_I18000P3 0xFFFFU |
| Preset value for ISO18000-3 CRC-16 generation. | |
| #define | PH_TOOLS_CRC16_POLY_I18000P3 0x8408U |
| Polynomial for ISO18000-3 CRC-16 generation: x^16 + x^12 + x^5 + 1 (LSB first). | |
| #define | PH_TOOLS_CRC16_POLY_FELICA 0x1021U |
| Polynomial for Felica CRC-16 generation: x^16 + x^12 + x^5 + 1 (MSB first). | |
| #define | PH_TOOLS_PARITY_OPTION_EVEN 0x00U |
| Encode/Decode even parity bits. | |
| #define | PH_TOOLS_PARITY_OPTION_ODD 0x01U |
| Encode/Decode odd parity bits. | |
| #define | PH_TOOLS_PARITY_OPTION_DONT_CARE 0x02U |
| Decode don't care parity bits. More... | |
| #define | PH_TOOLS_CRC_OPTION_DEFAULT 0x00U |
| Default CRC operation. | |
| #define | PH_TOOLS_CRC_OPTION_OUPUT_INVERTED 0x01U |
| Inverts the bits after calculation. | |
| #define | PH_TOOLS_CRC_OPTION_MSB_FIRST 0x02U |
| Calculates CRC with MSB(it) first. | |
| #define | PH_TOOLS_CRC_OPTION_BITWISE 0x04U |
Bitwise CRC, wDataLength represents the Bitlength. | |
| #define | PH_TOOLS_CRC_OPTION_MASK 0x07U |
| Mask of valid option bits. | |
| #define | PH_TOOLS_CRC32_OPTION_REVERSE_DATA_BYTE 0x08U |
Bitwise CRC, wDataLength represents the Bitlength. | |
| #define | PH_TOOLS_CRC32_OPTION_REVERSE_CRC 0x10U |
Bitwise CRC, wDataLength represents the Bitlength. | |
| #define | PH_TOOLS_CRC32_OPTION_MASK 0x1FU |
| Mask of valid option bits for CRC 32. | |
This component implements tools that are necessary for many different software modules.
| #define PH_TOOLS_PARITY_OPTION_DONT_CARE 0x02U |
Decode don't care parity bits.
(just remove)
| phStatus_t phTools_EncodeParity | ( | uint8_t | bOption, |
| uint8_t * | pInBuffer, | ||
| uint16_t | wInBufferLength, | ||
| uint8_t | bInBufferBits, | ||
| uint16_t | wOutBufferSize, | ||
| uint8_t * | pOutBuffer, | ||
| uint16_t * | pOutBufferLength, | ||
| uint8_t * | pOutBufferBits | ||
| ) |
Calculate even or odd parity.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | bOption | [In] Parity option; e.g. PH_TOOLS_PARITY_OPTION_EVEN. |
| [in] | pInBuffer | [In] Array to input data. |
| [in] | wInBufferLength | [In] Length of input data in bytes. |
| [in] | bInBufferBits | [In] Number of valid bits in last byte of pInBuffer. |
| [in] | wOutBufferSize | [In] Size of the output buffer. |
| [out] | pOutBuffer | [Out] Output buffer. |
| [out] | pOutBufferLength | [Out] Number of valid bytes in pOutBuffer. |
| [out] | pOutBufferBits | [Out] Number of valid bits in last byte of pOutBuffer. |
| phStatus_t phTools_DecodeParity | ( | uint8_t | bOption, |
| uint8_t * | pInBuffer, | ||
| uint16_t | wInBufferLength, | ||
| uint8_t | bInBufferBits, | ||
| uint16_t | wOutBufferSize, | ||
| uint8_t * | pOutBuffer, | ||
| uint16_t * | pOutBufferLength, | ||
| uint8_t * | pOutBufferBits | ||
| ) |
Verify and Remove even or odd parity.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | bOption | [In] Parity option; e.g. PH_TOOLS_PARITY_OPTION_EVEN. |
| [in] | pInBuffer | [In] Array to input data. |
| [in] | wInBufferLength | [In] Length of input data in bytes. |
| [in] | bInBufferBits | [In] Number of valid bits in last byte of pInBuffer. |
| [in] | wOutBufferSize | [In] Size of the output buffer. |
| [out] | pOutBuffer | [Out] Output buffer. |
| [out] | pOutBufferLength | [Out] Number of valid bytes in pOutBuffer. |
| [out] | pOutBufferBits | [Out] Number of valid bits in last byte of pOutBuffer. |
| phStatus_t phTools_CalculateCrc5 | ( | uint8_t | bOption, |
| uint8_t | bPreset, | ||
| uint8_t | bPolynom, | ||
| uint8_t * | pData, | ||
| uint16_t | wDataLength, | ||
| uint8_t * | pCrc | ||
| ) |
Calculate a CRC 5.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | bOption | [In] Specifies whether the output should be inverted or not. |
| [in] | bPreset | [In] Preset used for CRC calculation, e.g. PH_TOOLS_CRC5_PRESET_I18000P3. |
| [in] | bPolynom | [In] Polynom used for reduction, e.g. PH_TOOLS_CRC5_POLY_I18000P3. |
| [in] | pData | [In] Array to input data. |
| [in] | wDataLength | [In] Length of input data. |
| [out] | pCrc | [Out] Resulting CRC. |
| phStatus_t phTools_CalculateCrc8 | ( | uint8_t | bOption, |
| uint8_t | bPreset, | ||
| uint8_t | bPolynom, | ||
| uint8_t * | pData, | ||
| uint16_t | wDataLength, | ||
| uint8_t * | pCrc | ||
| ) |
Calculate a CRC 8.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | bOption | [In] Specifies whether the output should be inverted or not. |
| [in] | bPreset | [In] Preset used for CRC calculation, e.g. PH_TOOLS_CRC8_PRESET_UID. |
| [in] | bPolynom | [In] Polynom used for reduction, e.g. PH_TOOLS_CRC8_POLY_EPCUID. |
| [in] | pData | [In] Array to input data. |
| [in] | wDataLength | [In] Length of input data. |
| [out] | pCrc | [Out] Resulting CRC. |
| phStatus_t phTools_CalculateCrc16 | ( | uint8_t | bOption, |
| uint16_t | wPreset, | ||
| uint16_t | wPolynom, | ||
| uint8_t * | pData, | ||
| uint16_t | wDataLength, | ||
| uint16_t * | pCrc | ||
| ) |
Calculate a CRC 16.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | bOption | [In] Specifies whether the output should be inverted or not. |
| [in] | wPreset | [In] Preset used for CRC calculation, e.g. PH_TOOLS_CRC16_PRESET_ISO14443A. |
| [in] | wPolynom | [In] Polynom used for reduction, e.g. PH_TOOLS_CRC16_POLY_ISO14443. |
| [in] | pData | [In] Array to input data. |
| [in] | wDataLength | [In] Length of input data. |
| [out] | pCrc | [Out] Resulting CRC. |
| phStatus_t phTools_CalculateCrc32 | ( | uint8_t | bOption, |
| uint32_t | dwPreset, | ||
| uint32_t | dwPolynom, | ||
| uint8_t * | pData, | ||
| uint32_t | dwDataLength, | ||
| uint32_t * | pCrc | ||
| ) |
Calculate a CRC 32.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | bOption | [In] Specifies whether the output should be inverted or not. |
| [in] | dwPreset | [In] Preset used for CRC calculation, e.g. PH_TOOLS_CRC32_PRESET_DF8. |
| [in] | dwPolynom | [In] Polynom used for reduction, e.g. PH_TOOLS_CRC32_POLY_DF8. |
| [in] | pData | [In] Array to input data. |
| [in] | dwDataLength | [In] Length of input data. |
| [out] | pCrc | [Out] Resulting CRC. |
| phStatus_t phTools_CalculateLrc | ( | uint8_t * | pData, |
| uint16_t | wDataLength, | ||
| uint8_t * | pLrc | ||
| ) |
Calculate the LRC.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | pData | [In] Array to input data. |
| [in] | wDataLength | [In] Length of input data. |
| [out] | pLrc | [Out] Resulting LRC. |
| phStatus_t phTools_HammingEncode | ( | uint8_t * | pData, |
| uint8_t * | pEnhancedSubBlock, | ||
| uint16_t | wEnhancedSubBlockSize, | ||
| uint16_t | wEnhancedSubBlockOffset | ||
| ) |
add Hamming Byte to data
| PH_ERR_SUCCESS | Operation successful. |
| [in] | pData | [In] Data to be encoded with Hamming (must be 7 bytes) |
| [out] | pEnhancedSubBlock | [Out] Data including the calculated Hamming Byte (8th Byte) |
| [in] | wEnhancedSubBlockSize | [In] Size of the output buffer |
| [in] | wEnhancedSubBlockOffset | [In] Offset where the encoded block should be stored |
| phStatus_t phTools_HammingEncodeMoreBlocks | ( | uint8_t * | pData, |
| uint16_t | wDataLen, | ||
| uint8_t * | pEnhancedBlocks, | ||
| uint16_t | wEnhancedBlocksSize, | ||
| uint16_t * | pwEnhancedBlocksLen | ||
| ) |
add Hamming Byte to data with length > 7 bytes
| PH_ERR_SUCCESS | Operation successful. |
| [in] | pData | [In] Data to be encoded with Hamming |
| [in] | wDataLen | [In] Length of Data |
| [out] | pEnhancedBlocks | [Out] Data including the calculated Hamming Byte (8th Byte) |
| [in] | wEnhancedBlocksSize | [In] Size of pEnhancedBlock |
| [out] | pwEnhancedBlocksLen | [Out] Size of the Blocks encoded |
| phStatus_t phTools_HammingDecode | ( | uint8_t * | pEnhancedSubBlock, |
| uint8_t * | pDecodedData, | ||
| uint16_t | wDecodedDataSize, | ||
| uint16_t | wDecodedDataOffset | ||
| ) |
check Hamming Byte and correct 1 bit error if occured
| PH_ERR_SUCCESS | Operation successful. |
| [in] | pEnhancedSubBlock | [In] Data to be checked for Hamming (must be 8 bytes) |
| [out] | pDecodedData | [Out] Corrected data |
| [in] | wDecodedDataSize | [In] Size of the output buffer |
| [in] | wDecodedDataOffset | [In] Offset where the encoded block should be stored |
| phStatus_t phTools_HammingDecodeMoreBlocks | ( | uint8_t * | pEnhancedBlocks, |
| uint16_t | wEnhancedBlocksLen, | ||
| uint8_t * | pDecodedBlocks, | ||
| uint16_t | wDecodedBlocksSize, | ||
| uint16_t * | wDecodedBlocksLen | ||
| ) |
check Hamming Byte and correct 1 bit error if occured - with data length > 7
| PH_ERR_SUCCESS | Operation successful. |
| [in] | pEnhancedBlocks | [In] Data to be checked for Hamming |
| [in] | wEnhancedBlocksLen | [In] Length of Data |
| [out] | pDecodedBlocks | [Out] (corrected) data without Hamming Byte |
| [in] | wDecodedBlocksSize | [In] Size of pDecodedBlocks |
| [out] | wDecodedBlocksLen | [Out] Legth of the decoded data |
| phStatus_t phTools_Sleep | ( | uint32_t | dwTimeMilliSeconds | ) |
Sleep for certain amount of time.
| PH_ERR_SUCCESS | Operation successful. |
| [in] | dwTimeMilliSeconds | [In] Time in Milliseconds to call Sleep |