mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-25 03:29:58 -07:00
Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
This commit is contained in:
564
lib/ST25RFAL002/include/rfal_nfcDep.h
Executable file → Normal file
564
lib/ST25RFAL002/include/rfal_nfcDep.h
Executable file → Normal file
@@ -20,7 +20,6 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* PROJECT: ST25R391x firmware
|
||||
* Revision:
|
||||
@@ -65,24 +64,24 @@
|
||||
#include "st_errno.h"
|
||||
#include "rfal_rf.h"
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* ENABLE SWITCH
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RFAL_FEATURE_NFC_DEP
|
||||
#define RFAL_FEATURE_NFC_DEP false /*!< NFC-DEP module configuration missing. Disabled by default */
|
||||
#define RFAL_FEATURE_NFC_DEP \
|
||||
false /*!< NFC-DEP module configuration missing. Disabled by default */
|
||||
#endif
|
||||
|
||||
|
||||
/* If module is disabled remove the need for the user to set lengths */
|
||||
#if !RFAL_FEATURE_NFC_DEP
|
||||
#undef RFAL_FEATURE_NFC_DEP_BLOCK_MAX_LEN
|
||||
#undef RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN
|
||||
#undef RFAL_FEATURE_NFC_DEP_BLOCK_MAX_LEN
|
||||
#undef RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN
|
||||
|
||||
#define RFAL_FEATURE_NFC_DEP_BLOCK_MAX_LEN 1U /*!< NFC-DEP Block/Payload length, set to "none" */
|
||||
#define RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN 1U /*!< NFC-DEP PDU length, set to "none" */
|
||||
#define RFAL_FEATURE_NFC_DEP_BLOCK_MAX_LEN 1U /*!< NFC-DEP Block/Payload length, set to "none" */
|
||||
#define RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN 1U /*!< NFC-DEP PDU length, set to "none" */
|
||||
#endif /* !RFAL_FEATURE_NFC_DEP */
|
||||
|
||||
/*
|
||||
@@ -90,86 +89,138 @@
|
||||
* DEFINES
|
||||
******************************************************************************
|
||||
*/
|
||||
#define RFAL_NFCDEP_FRAME_SIZE_MAX_LEN 254U /*!< Maximum Frame Size Digital 2.0 Table 90 */
|
||||
#define RFAL_NFCDEP_DEPREQ_HEADER_LEN 5U /*!< DEP_REQ header length: CMD_TYPE + CMD_CMD + PBF + DID + NAD */
|
||||
#define RFAL_NFCDEP_FRAME_SIZE_MAX_LEN \
|
||||
254U /*!< Maximum Frame Size Digital 2.0 Table 90 */
|
||||
#define RFAL_NFCDEP_DEPREQ_HEADER_LEN \
|
||||
5U /*!< DEP_REQ header length: CMD_TYPE + CMD_CMD + PBF + DID + NAD */
|
||||
|
||||
/*! Length NFCIP DEP REQ or RES header (incl LEN) */
|
||||
#define RFAL_NFCDEP_DEP_HEADER ( RFAL_NFCDEP_LEN_LEN + RFAL_NFCDEP_CMDTYPE_LEN + RFAL_NFCDEP_CMD_LEN + RFAL_NFCDEP_DEP_PFB_LEN )
|
||||
#define RFAL_NFCDEP_HEADER ( RFAL_NFCDEP_CMDTYPE_LEN + RFAL_NFCDEP_CMD_LEN ) /*!< NFCIP header length */
|
||||
#define RFAL_NFCDEP_SB_LEN 1U /*!< SB length on NFCIP fram for NFC-A */
|
||||
#define RFAL_NFCDEP_LEN_LEN 1U /*!< LEN length on NFCIP frame */
|
||||
#define RFAL_NFCDEP_CMDTYPE_LEN 1U /*!< Length of the cmd type (REQ | RES) on NFCIP frame */
|
||||
#define RFAL_NFCDEP_CMD_LEN 1U /*!< Length of the cmd on NFCIP frame */
|
||||
#define RFAL_NFCDEP_DID_LEN 1U /*!< Length of did on NFCIP frame */
|
||||
#define RFAL_NFCDEP_DEP_PFB_LEN 1U /*!< Length of the PFB field on NFCIP frame */
|
||||
#define RFAL_NFCDEP_DEP_HEADER \
|
||||
(RFAL_NFCDEP_LEN_LEN + RFAL_NFCDEP_CMDTYPE_LEN + RFAL_NFCDEP_CMD_LEN + RFAL_NFCDEP_DEP_PFB_LEN)
|
||||
#define RFAL_NFCDEP_HEADER \
|
||||
(RFAL_NFCDEP_CMDTYPE_LEN + RFAL_NFCDEP_CMD_LEN) /*!< NFCIP header length */
|
||||
#define RFAL_NFCDEP_SB_LEN \
|
||||
1U /*!< SB length on NFCIP fram for NFC-A */
|
||||
#define RFAL_NFCDEP_LEN_LEN \
|
||||
1U /*!< LEN length on NFCIP frame */
|
||||
#define RFAL_NFCDEP_CMDTYPE_LEN \
|
||||
1U /*!< Length of the cmd type (REQ | RES) on NFCIP frame */
|
||||
#define RFAL_NFCDEP_CMD_LEN \
|
||||
1U /*!< Length of the cmd on NFCIP frame */
|
||||
#define RFAL_NFCDEP_DID_LEN \
|
||||
1U /*!< Length of did on NFCIP frame */
|
||||
#define RFAL_NFCDEP_DEP_PFB_LEN \
|
||||
1U /*!< Length of the PFB field on NFCIP frame */
|
||||
|
||||
#define RFAL_NFCDEP_DSL_RLS_LEN_NO_DID (RFAL_NFCDEP_LEN_LEN + RFAL_NFCDEP_CMDTYPE_LEN + RFAL_NFCDEP_CMD_LEN) /*!< Length of DSL_REQ and RLS_REQ with no DID */
|
||||
#define RFAL_NFCDEP_DSL_RLS_LEN_DID (RFAL_NFCDEP_DSL_RLS_LEN_NO_DID + RFAL_NFCDEP_DID_LEN) /*!< Length of DSL_REQ and RLS_REQ with DID */
|
||||
#define RFAL_NFCDEP_DSL_RLS_LEN_NO_DID \
|
||||
(RFAL_NFCDEP_LEN_LEN + RFAL_NFCDEP_CMDTYPE_LEN + \
|
||||
RFAL_NFCDEP_CMD_LEN) /*!< Length of DSL_REQ and RLS_REQ with no DID */
|
||||
#define RFAL_NFCDEP_DSL_RLS_LEN_DID \
|
||||
(RFAL_NFCDEP_DSL_RLS_LEN_NO_DID + \
|
||||
RFAL_NFCDEP_DID_LEN) /*!< Length of DSL_REQ and RLS_REQ with DID */
|
||||
|
||||
#define RFAL_NFCDEP_FS_VAL_MIN 64U /*!< Minimum LR value */
|
||||
#define RFAL_NFCDEP_LR_VAL_MASK 0x03U /*!< Bit mask for a LR value */
|
||||
#define RFAL_NFCDEP_PP_LR_MASK 0x30U /*!< Bit mask for LR value in PP byte on a ATR REQ/RES */
|
||||
#define RFAL_NFCDEP_PP_LR_SHIFT 4U /*!< Position of LR value in PP byte on a ATR REQ/RES */
|
||||
#define RFAL_NFCDEP_FS_VAL_MIN \
|
||||
64U /*!< Minimum LR value */
|
||||
#define RFAL_NFCDEP_LR_VAL_MASK \
|
||||
0x03U /*!< Bit mask for a LR value */
|
||||
#define RFAL_NFCDEP_PP_LR_MASK \
|
||||
0x30U /*!< Bit mask for LR value in PP byte on a ATR REQ/RES */
|
||||
#define RFAL_NFCDEP_PP_LR_SHIFT \
|
||||
4U /*!< Position of LR value in PP byte on a ATR REQ/RES */
|
||||
|
||||
#define RFAL_NFCDEP_DID_MAX 14U /*!< Max DID value Digital 14.6.2.3 */
|
||||
#define RFAL_NFCDEP_DID_KEEP 0xFFU /*!< Keep DID value already configured */
|
||||
#define RFAL_NFCDEP_DID_NO 0x00U /*!< No DID shall be used */
|
||||
#define RFAL_NFCDEP_NAD_NO 0x00U /*!< No NAD shall be used */
|
||||
#define RFAL_NFCDEP_DID_MAX \
|
||||
14U /*!< Max DID value Digital 14.6.2.3 */
|
||||
#define RFAL_NFCDEP_DID_KEEP \
|
||||
0xFFU /*!< Keep DID value already configured */
|
||||
#define RFAL_NFCDEP_DID_NO \
|
||||
0x00U /*!< No DID shall be used */
|
||||
#define RFAL_NFCDEP_NAD_NO \
|
||||
0x00U /*!< No NAD shall be used */
|
||||
|
||||
#define RFAL_NFCDEP_OPER_RTOX_REQ_DIS 0x01U /*!< Operation config: RTOX REQ disable */
|
||||
#define RFAL_NFCDEP_OPER_RTOX_REQ_EN 0x00U /*!< Operation config: RTOX REQ enable */
|
||||
#define RFAL_NFCDEP_OPER_RTOX_REQ_DIS \
|
||||
0x01U /*!< Operation config: RTOX REQ disable */
|
||||
#define RFAL_NFCDEP_OPER_RTOX_REQ_EN \
|
||||
0x00U /*!< Operation config: RTOX REQ enable */
|
||||
|
||||
#define RFAL_NFCDEP_OPER_ATN_DIS 0x00U /*!< Operation config: ATN disable */
|
||||
#define RFAL_NFCDEP_OPER_ATN_EN 0x02U /*!< Operation config: ATN enable */
|
||||
#define RFAL_NFCDEP_OPER_ATN_DIS \
|
||||
0x00U /*!< Operation config: ATN disable */
|
||||
#define RFAL_NFCDEP_OPER_ATN_EN \
|
||||
0x02U /*!< Operation config: ATN enable */
|
||||
|
||||
#define RFAL_NFCDEP_OPER_EMPTY_DEP_DIS 0x04U /*!< Operation config: empty DEPs disable */
|
||||
#define RFAL_NFCDEP_OPER_EMPTY_DEP_EN 0x00U /*!< Operation config: empty DEPs enable */
|
||||
#define RFAL_NFCDEP_OPER_EMPTY_DEP_DIS \
|
||||
0x04U /*!< Operation config: empty DEPs disable */
|
||||
#define RFAL_NFCDEP_OPER_EMPTY_DEP_EN \
|
||||
0x00U /*!< Operation config: empty DEPs enable */
|
||||
|
||||
#define RFAL_NFCDEP_OPER_FULL_MI_DIS 0x00U /*!< Operation config: full chaining DEPs disable */
|
||||
#define RFAL_NFCDEP_OPER_FULL_MI_EN 0x08U /*!< Operation config: full chaining DEPs enable */
|
||||
#define RFAL_NFCDEP_OPER_FULL_MI_DIS \
|
||||
0x00U /*!< Operation config: full chaining DEPs disable */
|
||||
#define RFAL_NFCDEP_OPER_FULL_MI_EN \
|
||||
0x08U /*!< Operation config: full chaining DEPs enable */
|
||||
|
||||
#define RFAL_NFCDEP_BRS_MAINTAIN \
|
||||
0xC0U /*!< Value signalling that BR is to be maintained (no PSL) */
|
||||
#define RFAL_NFCDEP_BRS_Dx_MASK \
|
||||
0x07U /*!< Value signalling that BR is to be maintained (no PSL) */
|
||||
#define RFAL_NFCDEP_BRS_DSI_POS \
|
||||
3U /*!< Value signalling that BR is to be maintained (no PSL) */
|
||||
|
||||
#define RFAL_NFCDEP_BRS_MAINTAIN 0xC0U /*!< Value signalling that BR is to be maintained (no PSL) */
|
||||
#define RFAL_NFCDEP_BRS_Dx_MASK 0x07U /*!< Value signalling that BR is to be maintained (no PSL) */
|
||||
#define RFAL_NFCDEP_BRS_DSI_POS 3U /*!< Value signalling that BR is to be maintained (no PSL) */
|
||||
#define RFAL_NFCDEP_WT_DELTA \
|
||||
(16U - RFAL_NFCDEP_WT_DELTA_ADJUST) /*!< NFC-DEP dWRT (adjusted) Digital 2.0 B.10 */
|
||||
#define RFAL_NFCDEP_WT_DELTA_ADJUST \
|
||||
4U /*!< dWRT value adjustment */
|
||||
|
||||
#define RFAL_NFCDEP_WT_DELTA (16U - RFAL_NFCDEP_WT_DELTA_ADJUST) /*!< NFC-DEP dWRT (adjusted) Digital 2.0 B.10 */
|
||||
#define RFAL_NFCDEP_WT_DELTA_ADJUST 4U /*!< dWRT value adjustment */
|
||||
#define RFAL_NFCDEP_ATR_REQ_NFCID3_POS \
|
||||
2U /*!< NFCID3 offset in ATR_REQ frame */
|
||||
#define RFAL_NFCDEP_NFCID3_LEN \
|
||||
10U /*!< NFCID3 Length */
|
||||
|
||||
#define RFAL_NFCDEP_LEN_MIN \
|
||||
3U /*!< Minimum length byte LEN value */
|
||||
#define RFAL_NFCDEP_LEN_MAX \
|
||||
255U /*!< Maximum length byte LEN value */
|
||||
|
||||
#define RFAL_NFCDEP_ATR_REQ_NFCID3_POS 2U /*!< NFCID3 offset in ATR_REQ frame */
|
||||
#define RFAL_NFCDEP_NFCID3_LEN 10U /*!< NFCID3 Length */
|
||||
#define RFAL_NFCDEP_ATRRES_HEADER_LEN \
|
||||
2U /*!< ATR RES Header Len: CmdType: 0xD5 + Cod: 0x01 */
|
||||
#define RFAL_NFCDEP_ATRRES_MIN_LEN \
|
||||
17U /*!< Minimum length for an ATR RES */
|
||||
#define RFAL_NFCDEP_ATRRES_MAX_LEN \
|
||||
64U /*!< Maximum length for an ATR RES Digital 1.0 14.6.1 */
|
||||
#define RFAL_NFCDEP_ATRREQ_MIN_LEN \
|
||||
16U /*!< Minimum length for an ATR REQ */
|
||||
#define RFAL_NFCDEP_ATRREQ_MAX_LEN \
|
||||
RFAL_NFCDEP_ATRRES_MAX_LEN /*!< Maximum length for an ATR REQ Digital 1.0 14.6.1 */
|
||||
|
||||
#define RFAL_NFCDEP_LEN_MIN 3U /*!< Minimum length byte LEN value */
|
||||
#define RFAL_NFCDEP_LEN_MAX 255U /*!< Maximum length byte LEN value */
|
||||
#define RFAL_NFCDEP_GB_MAX_LEN \
|
||||
(RFAL_NFCDEP_ATRREQ_MAX_LEN - \
|
||||
RFAL_NFCDEP_ATRREQ_MIN_LEN) /*!< Maximum length the General Bytes on ATR Digital 1.1 16.6.3 */
|
||||
|
||||
#define RFAL_NFCDEP_ATRRES_HEADER_LEN 2U /*!< ATR RES Header Len: CmdType: 0xD5 + Cod: 0x01 */
|
||||
#define RFAL_NFCDEP_ATRRES_MIN_LEN 17U /*!< Minimum length for an ATR RES */
|
||||
#define RFAL_NFCDEP_ATRRES_MAX_LEN 64U /*!< Maximum length for an ATR RES Digital 1.0 14.6.1 */
|
||||
#define RFAL_NFCDEP_ATRREQ_MIN_LEN 16U /*!< Minimum length for an ATR REQ */
|
||||
#define RFAL_NFCDEP_ATRREQ_MAX_LEN RFAL_NFCDEP_ATRRES_MAX_LEN /*!< Maximum length for an ATR REQ Digital 1.0 14.6.1 */
|
||||
#define RFAL_NFCDEP_WT_INI_DEFAULT \
|
||||
RFAL_NFCDEP_WT_INI_MAX /*!< WT Initiator default value Digital 1.0 14.6.3.8 */
|
||||
#define RFAL_NFCDEP_WT_INI_MIN 0U /*!< WT Initiator minimum value Digital 1.0 14.6.3.8 */
|
||||
#define RFAL_NFCDEP_WT_INI_MAX 14U /*!< WT Initiator maximum value Digital 1.0 14.6.3.8 A.10 */
|
||||
#define RFAL_NFCDEP_RWT_INI_MAX \
|
||||
rfalNfcDepWT2RWT(RFAL_NFCDEP_WT_INI_MAX) /*!< RWT Initiator maximum value */
|
||||
|
||||
#define RFAL_NFCDEP_GB_MAX_LEN (RFAL_NFCDEP_ATRREQ_MAX_LEN - RFAL_NFCDEP_ATRREQ_MIN_LEN) /*!< Maximum length the General Bytes on ATR Digital 1.1 16.6.3 */
|
||||
|
||||
#define RFAL_NFCDEP_WT_INI_DEFAULT RFAL_NFCDEP_WT_INI_MAX /*!< WT Initiator default value Digital 1.0 14.6.3.8 */
|
||||
#define RFAL_NFCDEP_WT_INI_MIN 0U /*!< WT Initiator minimum value Digital 1.0 14.6.3.8 */
|
||||
#define RFAL_NFCDEP_WT_INI_MAX 14U /*!< WT Initiator maximum value Digital 1.0 14.6.3.8 A.10 */
|
||||
#define RFAL_NFCDEP_RWT_INI_MAX rfalNfcDepWT2RWT( RFAL_NFCDEP_WT_INI_MAX ) /*!< RWT Initiator maximum value */
|
||||
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX_D10 8U /*!< WT target max Digital 1.0 14.6.3.8 A.10 */
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX_D11 14U /*!< WT target max Digital 1.1 16.6.3.9 A.9 */
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX_L13 10U /*!< WT target max [LLCP] 1.3 6.2.1 */
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX RFAL_NFCDEP_WT_TRG_MAX_D11 /*!< WT target max Digital x.x | LLCP x.x */
|
||||
#define RFAL_NFCDEP_RWT_TRG_MAX rfalNfcDepWT2RWT( RFAL_NFCDEP_WT_TRG_MAX ) /*!< RWT Initiator maximum value */
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX_D10 8U /*!< WT target max Digital 1.0 14.6.3.8 A.10 */
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX_D11 14U /*!< WT target max Digital 1.1 16.6.3.9 A.9 */
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX_L13 10U /*!< WT target max [LLCP] 1.3 6.2.1 */
|
||||
#define RFAL_NFCDEP_WT_TRG_MAX \
|
||||
RFAL_NFCDEP_WT_TRG_MAX_D11 /*!< WT target max Digital x.x | LLCP x.x */
|
||||
#define RFAL_NFCDEP_RWT_TRG_MAX \
|
||||
rfalNfcDepWT2RWT(RFAL_NFCDEP_WT_TRG_MAX) /*!< RWT Initiator maximum value */
|
||||
|
||||
/*! Maximum Frame Waiting Time = ((256 * 16/fc)*2^FWImax) = ((256*16/fc)*2^14) = (1048576 / 64)/fc = (100000h*64)/fc */
|
||||
#define RFAL_NFCDEP_MAX_FWT ((uint32_t)1U<<20)
|
||||
#define RFAL_NFCDEP_MAX_FWT ((uint32_t)1U << 20)
|
||||
|
||||
#define RFAL_NFCDEP_WT_MASK 0x0FU /*!< Bit mask for the Wait Time value */
|
||||
#define RFAL_NFCDEP_WT_MASK \
|
||||
0x0FU /*!< Bit mask for the Wait Time value */
|
||||
|
||||
#define RFAL_NFCDEP_BR_MASK_106 0x01U /*!< Enable mask bit rate 106 */
|
||||
#define RFAL_NFCDEP_BR_MASK_212 0x02U /*!< Enable mask bit rate 242 */
|
||||
#define RFAL_NFCDEP_BR_MASK_424 0x04U /*!< Enable mask bit rate 424 */
|
||||
#define RFAL_NFCDEP_BR_MASK_106 \
|
||||
0x01U /*!< Enable mask bit rate 106 */
|
||||
#define RFAL_NFCDEP_BR_MASK_212 \
|
||||
0x02U /*!< Enable mask bit rate 242 */
|
||||
#define RFAL_NFCDEP_BR_MASK_424 \
|
||||
0x04U /*!< Enable mask bit rate 424 */
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
@@ -177,25 +228,44 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#define rfalNfcDepWT2RWT( wt ) ( (uint32_t)1U << (((uint32_t)(wt) & RFAL_NFCDEP_WT_MASK) + 12U) ) /*!< Converts WT value to RWT (1/fc) */
|
||||
#define rfalNfcDepWT2RWT(wt) \
|
||||
((uint32_t)1U \
|
||||
<< (((uint32_t)(wt)&RFAL_NFCDEP_WT_MASK) + \
|
||||
12U)) /*!< Converts WT value to RWT (1/fc) */
|
||||
|
||||
/*! Returns the BRS value from the given bit rate */
|
||||
#define rfalNfcDepDx2BRS( br ) ( (((uint8_t)(br) & RFAL_NFCDEP_BRS_Dx_MASK) << RFAL_NFCDEP_BRS_DSI_POS) | ((uint8_t)(br) & RFAL_NFCDEP_BRS_Dx_MASK) )
|
||||
#define rfalNfcDepDx2BRS(br) \
|
||||
((((uint8_t)(br)&RFAL_NFCDEP_BRS_Dx_MASK) << RFAL_NFCDEP_BRS_DSI_POS) | \
|
||||
((uint8_t)(br)&RFAL_NFCDEP_BRS_Dx_MASK))
|
||||
|
||||
#define rfalNfcDepBRS2DRI( brs ) (uint8_t)( (uint8_t)(brs) & RFAL_NFCDEP_BRS_Dx_MASK ) /*!< Returns the DRI value from the given BRS byte */
|
||||
#define rfalNfcDepBRS2DSI( brs ) (uint8_t)( ((uint8_t)(brs) >> RFAL_NFCDEP_BRS_DSI_POS) & RFAL_NFCDEP_BRS_Dx_MASK ) /*!< Returns the DSI value from the given BRS byte */
|
||||
#define rfalNfcDepBRS2DRI(brs) \
|
||||
(uint8_t)(( \
|
||||
uint8_t)(brs)&RFAL_NFCDEP_BRS_Dx_MASK) /*!< Returns the DRI value from the given BRS byte */
|
||||
#define rfalNfcDepBRS2DSI(brs) \
|
||||
(uint8_t)( \
|
||||
((uint8_t)(brs) >> RFAL_NFCDEP_BRS_DSI_POS) & \
|
||||
RFAL_NFCDEP_BRS_Dx_MASK) /*!< Returns the DSI value from the given BRS byte */
|
||||
|
||||
#define rfalNfcDepPP2LR( PPx ) ( ((uint8_t)(PPx) & RFAL_NFCDEP_PP_LR_MASK ) >> RFAL_NFCDEP_PP_LR_SHIFT) /*!< Returns the LR value from the given PPx byte */
|
||||
#define rfalNfcDepLR2PP( LRx ) ( ((uint8_t)(LRx) << RFAL_NFCDEP_PP_LR_SHIFT) & RFAL_NFCDEP_PP_LR_MASK) /*!< Returns the PP byte with the given LRx value */
|
||||
#define rfalNfcDepPP2LR(PPx) \
|
||||
(((uint8_t)(PPx)&RFAL_NFCDEP_PP_LR_MASK) >> \
|
||||
RFAL_NFCDEP_PP_LR_SHIFT) /*!< Returns the LR value from the given PPx byte */
|
||||
#define rfalNfcDepLR2PP(LRx) \
|
||||
(((uint8_t)(LRx) << RFAL_NFCDEP_PP_LR_SHIFT) & \
|
||||
RFAL_NFCDEP_PP_LR_MASK) /*!< Returns the PP byte with the given LRx value */
|
||||
|
||||
/*! Returns the Frame size value from the given LRx value */
|
||||
#define rfalNfcDepLR2FS( LRx ) (uint16_t)(MIN( (RFAL_NFCDEP_FS_VAL_MIN * ((uint16_t)(LRx) + 1U) ), RFAL_NFCDEP_FRAME_SIZE_MAX_LEN ))
|
||||
#define rfalNfcDepLR2FS(LRx) \
|
||||
(uint16_t)( \
|
||||
MIN((RFAL_NFCDEP_FS_VAL_MIN * ((uint16_t)(LRx) + 1U)), RFAL_NFCDEP_FRAME_SIZE_MAX_LEN))
|
||||
|
||||
/*!
|
||||
* Despite DIGITAL 1.0 14.6.2.1 stating that the last two bytes may filled with
|
||||
* any value, some devices (Samsung Google Nexus) only accept when these are 0 */
|
||||
#define rfalNfcDepSetNFCID( dst, src, len ) ST_MEMSET( (dst), 0x00, RFAL_NFCDEP_NFCID3_LEN ); \
|
||||
if( (len) > 0U ) {ST_MEMCPY( (dst), (src), (len) );}
|
||||
* any value, some devices (Samsung Google Nexus) only accept when these are 0 */
|
||||
#define rfalNfcDepSetNFCID(dst, src, len) \
|
||||
ST_MEMSET((dst), 0x00, RFAL_NFCDEP_NFCID3_LEN); \
|
||||
if((len) > 0U) { \
|
||||
ST_MEMCPY((dst), (src), (len)); \
|
||||
}
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
@@ -204,31 +274,31 @@
|
||||
*/
|
||||
|
||||
/*! Enumeration of NFC-DEP bit rate in ATR Digital 1.0 Table 93 and 94 */
|
||||
enum{
|
||||
RFAL_NFCDEP_Bx_NO_HIGH_BR = 0x00, /*!< Peer supports no high bit rates */
|
||||
RFAL_NFCDEP_Bx_08_848 = 0x01, /*!< Peer also supports 848 */
|
||||
RFAL_NFCDEP_Bx_16_1695 = 0x02, /*!< Peer also supports 1695 */
|
||||
RFAL_NFCDEP_Bx_32_3390 = 0x04, /*!< Peer also supports 3390 */
|
||||
RFAL_NFCDEP_Bx_64_6780 = 0x08 /*!< Peer also supports 6780 */
|
||||
enum {
|
||||
RFAL_NFCDEP_Bx_NO_HIGH_BR = 0x00, /*!< Peer supports no high bit rates */
|
||||
RFAL_NFCDEP_Bx_08_848 = 0x01, /*!< Peer also supports 848 */
|
||||
RFAL_NFCDEP_Bx_16_1695 = 0x02, /*!< Peer also supports 1695 */
|
||||
RFAL_NFCDEP_Bx_32_3390 = 0x04, /*!< Peer also supports 3390 */
|
||||
RFAL_NFCDEP_Bx_64_6780 = 0x08 /*!< Peer also supports 6780 */
|
||||
};
|
||||
|
||||
/*! Enumeration of NFC-DEP bit rate Dividor in PSL Digital 1.0 Table 100 */
|
||||
enum{
|
||||
RFAL_NFCDEP_Dx_01_106 = RFAL_BR_106, /*!< Divisor D = 1 : bit rate = 106 */
|
||||
RFAL_NFCDEP_Dx_02_212 = RFAL_BR_212, /*!< Divisor D = 2 : bit rate = 212 */
|
||||
RFAL_NFCDEP_Dx_04_424 = RFAL_BR_424, /*!< Divisor D = 4 : bit rate = 424 */
|
||||
RFAL_NFCDEP_Dx_08_848 = RFAL_BR_848, /*!< Divisor D = 8 : bit rate = 848 */
|
||||
RFAL_NFCDEP_Dx_16_1695 = RFAL_BR_1695, /*!< Divisor D = 16 : bit rate = 1695 */
|
||||
RFAL_NFCDEP_Dx_32_3390 = RFAL_BR_3390, /*!< Divisor D = 32 : bit rate = 3390 */
|
||||
RFAL_NFCDEP_Dx_64_6780 = RFAL_BR_6780 /*!< Divisor D = 64 : bit rate = 6780 */
|
||||
enum {
|
||||
RFAL_NFCDEP_Dx_01_106 = RFAL_BR_106, /*!< Divisor D = 1 : bit rate = 106 */
|
||||
RFAL_NFCDEP_Dx_02_212 = RFAL_BR_212, /*!< Divisor D = 2 : bit rate = 212 */
|
||||
RFAL_NFCDEP_Dx_04_424 = RFAL_BR_424, /*!< Divisor D = 4 : bit rate = 424 */
|
||||
RFAL_NFCDEP_Dx_08_848 = RFAL_BR_848, /*!< Divisor D = 8 : bit rate = 848 */
|
||||
RFAL_NFCDEP_Dx_16_1695 = RFAL_BR_1695, /*!< Divisor D = 16 : bit rate = 1695 */
|
||||
RFAL_NFCDEP_Dx_32_3390 = RFAL_BR_3390, /*!< Divisor D = 32 : bit rate = 3390 */
|
||||
RFAL_NFCDEP_Dx_64_6780 = RFAL_BR_6780 /*!< Divisor D = 64 : bit rate = 6780 */
|
||||
};
|
||||
|
||||
/*! Enumeration of NFC-DEP Length Reduction (LR) Digital 1.0 Table 91 */
|
||||
enum{
|
||||
RFAL_NFCDEP_LR_64 = 0x00, /*!< Maximum payload size is 64 bytes */
|
||||
RFAL_NFCDEP_LR_128 = 0x01, /*!< Maximum payload size is 128 bytes */
|
||||
RFAL_NFCDEP_LR_192 = 0x02, /*!< Maximum payload size is 192 bytes */
|
||||
RFAL_NFCDEP_LR_254 = 0x03 /*!< Maximum payload size is 254 bytes */
|
||||
enum {
|
||||
RFAL_NFCDEP_LR_64 = 0x00, /*!< Maximum payload size is 64 bytes */
|
||||
RFAL_NFCDEP_LR_128 = 0x01, /*!< Maximum payload size is 128 bytes */
|
||||
RFAL_NFCDEP_LR_192 = 0x02, /*!< Maximum payload size is 192 bytes */
|
||||
RFAL_NFCDEP_LR_254 = 0x03 /*!< Maximum payload size is 254 bytes */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -238,123 +308,109 @@ enum{
|
||||
*/
|
||||
|
||||
/*! NFC-DEP callback to check if upper layer has deactivation pending */
|
||||
typedef bool (* rfalNfcDepDeactCallback)(void);
|
||||
|
||||
typedef bool (*rfalNfcDepDeactCallback)(void);
|
||||
|
||||
/*! Enumeration of the nfcip communication modes */
|
||||
typedef enum{
|
||||
RFAL_NFCDEP_COMM_PASSIVE, /*!< Passive communication mode */
|
||||
RFAL_NFCDEP_COMM_ACTIVE /*!< Active communication mode */
|
||||
typedef enum {
|
||||
RFAL_NFCDEP_COMM_PASSIVE, /*!< Passive communication mode */
|
||||
RFAL_NFCDEP_COMM_ACTIVE /*!< Active communication mode */
|
||||
} rfalNfcDepCommMode;
|
||||
|
||||
|
||||
/*! Enumeration of the nfcip roles */
|
||||
typedef enum{
|
||||
RFAL_NFCDEP_ROLE_INITIATOR, /*!< Perform as Initiator */
|
||||
RFAL_NFCDEP_ROLE_TARGET /*!< Perform as Target */
|
||||
typedef enum {
|
||||
RFAL_NFCDEP_ROLE_INITIATOR, /*!< Perform as Initiator */
|
||||
RFAL_NFCDEP_ROLE_TARGET /*!< Perform as Target */
|
||||
} rfalNfcDepRole;
|
||||
|
||||
|
||||
/*! Struct that holds all NFCIP configs */
|
||||
typedef struct{
|
||||
typedef struct {
|
||||
rfalNfcDepRole role; /*!< Current NFCIP role */
|
||||
rfalNfcDepCommMode commMode; /*!< Current NFCIP communication mode */
|
||||
uint8_t oper; /*!< Operation config similar to NCI 1.0 Table 81 */
|
||||
|
||||
rfalNfcDepRole role; /*!< Current NFCIP role */
|
||||
rfalNfcDepCommMode commMode; /*!< Current NFCIP communication mode */
|
||||
uint8_t oper; /*!< Operation config similar to NCI 1.0 Table 81 */
|
||||
|
||||
uint8_t did; /*!< Current Device ID (DID) */
|
||||
uint8_t nad; /*!< Current Node Addressing (NAD) */
|
||||
uint8_t bs; /*!< Bit rate in Sending Direction */
|
||||
uint8_t br; /*!< Bit rate in Receiving Direction */
|
||||
uint8_t nfcid[RFAL_NFCDEP_NFCID3_LEN]; /*!< Pointer to the NFCID to be used */
|
||||
uint8_t nfcidLen; /*!< Length of the given NFCID in nfcid */
|
||||
uint8_t gb[RFAL_NFCDEP_GB_MAX_LEN]; /*!< Pointer General Bytes (GB) to be used */
|
||||
uint8_t gbLen; /*!< Length of the given GB in gb */
|
||||
uint8_t lr; /*!< Length Reduction (LR) to be used */
|
||||
uint8_t to; /*!< Timeout (TO) to be used */
|
||||
uint32_t fwt; /*!< Frame Waiting Time (FWT) to be used */
|
||||
uint32_t dFwt; /*!< Delta Frame Waiting Time (dFWT) to be used */
|
||||
uint8_t did; /*!< Current Device ID (DID) */
|
||||
uint8_t nad; /*!< Current Node Addressing (NAD) */
|
||||
uint8_t bs; /*!< Bit rate in Sending Direction */
|
||||
uint8_t br; /*!< Bit rate in Receiving Direction */
|
||||
uint8_t nfcid[RFAL_NFCDEP_NFCID3_LEN]; /*!< Pointer to the NFCID to be used */
|
||||
uint8_t nfcidLen; /*!< Length of the given NFCID in nfcid */
|
||||
uint8_t gb[RFAL_NFCDEP_GB_MAX_LEN]; /*!< Pointer General Bytes (GB) to be used */
|
||||
uint8_t gbLen; /*!< Length of the given GB in gb */
|
||||
uint8_t lr; /*!< Length Reduction (LR) to be used */
|
||||
uint8_t to; /*!< Timeout (TO) to be used */
|
||||
uint32_t fwt; /*!< Frame Waiting Time (FWT) to be used */
|
||||
uint32_t dFwt; /*!< Delta Frame Waiting Time (dFWT) to be used */
|
||||
} rfalNfcDepConfigs;
|
||||
|
||||
|
||||
/*! ATR_REQ command Digital 1.1 16.6.2 */
|
||||
typedef struct {
|
||||
uint8_t CMD1; /*!< Command format 0xD4 */
|
||||
uint8_t CMD2; /*!< Command Value */
|
||||
uint8_t NFCID3[RFAL_NFCDEP_NFCID3_LEN]; /*!< NFCID3 value */
|
||||
uint8_t DID; /*!< DID */
|
||||
uint8_t BSi; /*!< Sending Bitrate for Initiator */
|
||||
uint8_t BRi; /*!< Receiving Bitrate for Initiator */
|
||||
uint8_t PPi; /*!< Optional Parameters presence indicator */
|
||||
uint8_t GBi[RFAL_NFCDEP_GB_MAX_LEN]; /*!< General Bytes */
|
||||
uint8_t CMD1; /*!< Command format 0xD4 */
|
||||
uint8_t CMD2; /*!< Command Value */
|
||||
uint8_t NFCID3[RFAL_NFCDEP_NFCID3_LEN]; /*!< NFCID3 value */
|
||||
uint8_t DID; /*!< DID */
|
||||
uint8_t BSi; /*!< Sending Bitrate for Initiator */
|
||||
uint8_t BRi; /*!< Receiving Bitrate for Initiator */
|
||||
uint8_t PPi; /*!< Optional Parameters presence indicator */
|
||||
uint8_t GBi[RFAL_NFCDEP_GB_MAX_LEN]; /*!< General Bytes */
|
||||
} rfalNfcDepAtrReq;
|
||||
|
||||
|
||||
/*! ATR_RES response Digital 1.1 16.6.3 */
|
||||
typedef struct {
|
||||
uint8_t CMD1; /*!< Response Byte 0xD5 */
|
||||
uint8_t CMD2; /*!< Command Value */
|
||||
uint8_t NFCID3[RFAL_NFCDEP_NFCID3_LEN]; /*!< NFCID3 value */
|
||||
uint8_t DID; /*!< DID */
|
||||
uint8_t BSt; /*!< Sending Bitrate for Initiator */
|
||||
uint8_t BRt; /*!< Receiving Bitrate for Initiator */
|
||||
uint8_t TO; /*!< Timeout */
|
||||
uint8_t PPt; /*!< Optional Parameters presence indicator */
|
||||
uint8_t GBt[RFAL_NFCDEP_GB_MAX_LEN]; /*!< General Bytes */
|
||||
uint8_t CMD1; /*!< Response Byte 0xD5 */
|
||||
uint8_t CMD2; /*!< Command Value */
|
||||
uint8_t NFCID3[RFAL_NFCDEP_NFCID3_LEN]; /*!< NFCID3 value */
|
||||
uint8_t DID; /*!< DID */
|
||||
uint8_t BSt; /*!< Sending Bitrate for Initiator */
|
||||
uint8_t BRt; /*!< Receiving Bitrate for Initiator */
|
||||
uint8_t TO; /*!< Timeout */
|
||||
uint8_t PPt; /*!< Optional Parameters presence indicator */
|
||||
uint8_t GBt[RFAL_NFCDEP_GB_MAX_LEN]; /*!< General Bytes */
|
||||
} rfalNfcDepAtrRes;
|
||||
|
||||
|
||||
/*! Structure of transmit I-PDU Buffer format from caller */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t prologue[RFAL_NFCDEP_DEPREQ_HEADER_LEN]; /*!< Prologue space for NFC-DEP header*/
|
||||
uint8_t inf[RFAL_FEATURE_NFC_DEP_BLOCK_MAX_LEN]; /*!< INF | Data area of the buffer */
|
||||
typedef struct {
|
||||
uint8_t prologue[RFAL_NFCDEP_DEPREQ_HEADER_LEN]; /*!< Prologue space for NFC-DEP header*/
|
||||
uint8_t inf[RFAL_FEATURE_NFC_DEP_BLOCK_MAX_LEN]; /*!< INF | Data area of the buffer */
|
||||
} rfalNfcDepBufFormat;
|
||||
|
||||
|
||||
/*! Structure of APDU Buffer format from caller */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t prologue[RFAL_NFCDEP_DEPREQ_HEADER_LEN]; /*!< Prologue/SoD buffer */
|
||||
uint8_t pdu[RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN]; /*!< Complete PDU/Payload buffer */
|
||||
typedef struct {
|
||||
uint8_t prologue[RFAL_NFCDEP_DEPREQ_HEADER_LEN]; /*!< Prologue/SoD buffer */
|
||||
uint8_t pdu[RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN]; /*!< Complete PDU/Payload buffer */
|
||||
} rfalNfcDepPduBufFormat;
|
||||
|
||||
|
||||
/*! Activation info as Initiator and Target */
|
||||
typedef union { /* PRQA S 0750 # MISRA 19.2 - Both members of the union will not be used concurrently , device is only initiatior or target a time. No problem can occur. */
|
||||
struct {
|
||||
rfalNfcDepAtrRes ATR_RES; /*!< ATR RES (Initiator mode) */
|
||||
uint8_t ATR_RESLen; /*!< ATR RES length (Initiator mode) */
|
||||
}Target; /*!< Target */
|
||||
rfalNfcDepAtrRes ATR_RES; /*!< ATR RES (Initiator mode) */
|
||||
uint8_t ATR_RESLen; /*!< ATR RES length (Initiator mode) */
|
||||
} Target; /*!< Target */
|
||||
struct {
|
||||
rfalNfcDepAtrReq ATR_REQ; /*!< ATR REQ (Target mode) */
|
||||
uint8_t ATR_REQLen; /*!< ATR REQ length (Target mode) */
|
||||
}Initiator; /*!< Initiator */
|
||||
rfalNfcDepAtrReq ATR_REQ; /*!< ATR REQ (Target mode) */
|
||||
uint8_t ATR_REQLen; /*!< ATR REQ length (Target mode) */
|
||||
} Initiator; /*!< Initiator */
|
||||
} rfalNfcDepActivation;
|
||||
|
||||
|
||||
/*! NFC-DEP device Info */
|
||||
typedef struct {
|
||||
uint8_t GBLen; /*!< General Bytes length */
|
||||
uint8_t WT; /*!< WT to be used (ignored in Listen Mode) */
|
||||
uint32_t FWT; /*!< FWT to be used (1/fc)(ignored Listen Mode) */
|
||||
uint32_t dFWT; /*!< Delta FWT to be used (1/fc) */
|
||||
uint8_t LR; /*!< Length Reduction coding the max payload */
|
||||
uint16_t FS; /*!< Frame Size */
|
||||
rfalBitRate DSI; /*!< Bit Rate coding from Initiator to Target */
|
||||
rfalBitRate DRI; /*!< Bit Rate coding from Target to Initiator */
|
||||
uint8_t DID; /*!< Device ID (RFAL_NFCDEP_DID_NO if no DID) */
|
||||
uint8_t NAD; /*!< Node ADdress (RFAL_NFCDEP_NAD_NO if no NAD)*/
|
||||
uint8_t GBLen; /*!< General Bytes length */
|
||||
uint8_t WT; /*!< WT to be used (ignored in Listen Mode) */
|
||||
uint32_t FWT; /*!< FWT to be used (1/fc)(ignored Listen Mode) */
|
||||
uint32_t dFWT; /*!< Delta FWT to be used (1/fc) */
|
||||
uint8_t LR; /*!< Length Reduction coding the max payload */
|
||||
uint16_t FS; /*!< Frame Size */
|
||||
rfalBitRate DSI; /*!< Bit Rate coding from Initiator to Target */
|
||||
rfalBitRate DRI; /*!< Bit Rate coding from Target to Initiator */
|
||||
uint8_t DID; /*!< Device ID (RFAL_NFCDEP_DID_NO if no DID) */
|
||||
uint8_t NAD; /*!< Node ADdress (RFAL_NFCDEP_NAD_NO if no NAD)*/
|
||||
} rfalNfcDepInfo;
|
||||
|
||||
|
||||
/*! NFC-DEP Device structure */
|
||||
typedef struct {
|
||||
rfalNfcDepActivation activation; /*!< Activation Info */
|
||||
rfalNfcDepInfo info; /*!< NFC-DEP device Info */
|
||||
rfalNfcDepActivation activation; /*!< Activation Info */
|
||||
rfalNfcDepInfo info; /*!< NFC-DEP device Info */
|
||||
} rfalNfcDepDevice;
|
||||
|
||||
|
||||
/*! NFCIP Protocol structure for P2P Target
|
||||
*
|
||||
* operParam : derives from NFC-Forum NCI NFC-DEP Operation Parameter
|
||||
@@ -367,31 +423,28 @@ typedef struct {
|
||||
* ]
|
||||
*
|
||||
*/
|
||||
typedef struct{
|
||||
rfalNfcDepCommMode commMode; /*!< Initiator in Active P2P or Passive P2P*/
|
||||
uint8_t operParam; /*!< NFC-DEP Operation Parameter */
|
||||
uint8_t* nfcid; /*!< Initiator's NFCID2 or NFCID3 */
|
||||
uint8_t nfcidLen; /*!< Initiator's NFCID length (NFCID2/3) */
|
||||
uint8_t DID; /*!< Initiator's Device ID DID */
|
||||
uint8_t NAD; /*!< Initiator's Node ID NAD */
|
||||
uint8_t BS; /*!< Initiator's Bit Rates supported in Tx */
|
||||
uint8_t BR; /*!< Initiator's Bit Rates supported in Rx */
|
||||
uint8_t LR; /*!< Initiator's Length reduction */
|
||||
uint8_t* GB; /*!< Initiator's General Bytes (Gi) */
|
||||
uint8_t GBLen; /*!< Initiator's General Bytes length */
|
||||
typedef struct {
|
||||
rfalNfcDepCommMode commMode; /*!< Initiator in Active P2P or Passive P2P*/
|
||||
uint8_t operParam; /*!< NFC-DEP Operation Parameter */
|
||||
uint8_t* nfcid; /*!< Initiator's NFCID2 or NFCID3 */
|
||||
uint8_t nfcidLen; /*!< Initiator's NFCID length (NFCID2/3) */
|
||||
uint8_t DID; /*!< Initiator's Device ID DID */
|
||||
uint8_t NAD; /*!< Initiator's Node ID NAD */
|
||||
uint8_t BS; /*!< Initiator's Bit Rates supported in Tx */
|
||||
uint8_t BR; /*!< Initiator's Bit Rates supported in Rx */
|
||||
uint8_t LR; /*!< Initiator's Length reduction */
|
||||
uint8_t* GB; /*!< Initiator's General Bytes (Gi) */
|
||||
uint8_t GBLen; /*!< Initiator's General Bytes length */
|
||||
} rfalNfcDepAtrParam;
|
||||
|
||||
|
||||
/*! Structure of parameters to be passed in for nfcDepListenStartActivation */
|
||||
typedef struct
|
||||
{
|
||||
rfalNfcDepBufFormat *rxBuf; /*!< Receive Buffer struct reference */
|
||||
uint16_t *rxLen; /*!< Receive INF data length in bytes */
|
||||
bool *isRxChaining; /*!< Received data is not complete */
|
||||
rfalNfcDepDevice *nfcDepDev; /*!< NFC-DEP device info */
|
||||
typedef struct {
|
||||
rfalNfcDepBufFormat* rxBuf; /*!< Receive Buffer struct reference */
|
||||
uint16_t* rxLen; /*!< Receive INF data length in bytes */
|
||||
bool* isRxChaining; /*!< Received data is not complete */
|
||||
rfalNfcDepDevice* nfcDepDev; /*!< NFC-DEP device info */
|
||||
} rfalNfcDepListenActvParam;
|
||||
|
||||
|
||||
/*! NFCIP Protocol structure for P2P Target
|
||||
*
|
||||
* operParam : derives from NFC-Forum NCI NFC-DEP Operation Parameter
|
||||
@@ -404,57 +457,51 @@ typedef struct
|
||||
* ]
|
||||
*
|
||||
*/
|
||||
typedef struct{
|
||||
rfalNfcDepCommMode commMode; /*!< Target in Active P2P or Passive P2P */
|
||||
uint8_t nfcid3[RFAL_NFCDEP_NFCID3_LEN]; /*!< Target's NFCID3 */
|
||||
uint8_t bst; /*!< Target's Bit Rates supported in Tx */
|
||||
uint8_t brt; /*!< Target's Bit Rates supported in Rx */
|
||||
uint8_t to; /*!< Target's timeout (TO) value */
|
||||
uint8_t ppt; /*!< Target's Presence optional Params(PPt)*/
|
||||
uint8_t GBt[RFAL_NFCDEP_GB_MAX_LEN]; /*!< Target's General Bytes (Gt) */
|
||||
uint8_t GBtLen; /*!< Target's General Bytes length */
|
||||
uint8_t operParam; /*!< NFC-DEP Operation Parameter */
|
||||
typedef struct {
|
||||
rfalNfcDepCommMode commMode; /*!< Target in Active P2P or Passive P2P */
|
||||
uint8_t nfcid3[RFAL_NFCDEP_NFCID3_LEN]; /*!< Target's NFCID3 */
|
||||
uint8_t bst; /*!< Target's Bit Rates supported in Tx */
|
||||
uint8_t brt; /*!< Target's Bit Rates supported in Rx */
|
||||
uint8_t to; /*!< Target's timeout (TO) value */
|
||||
uint8_t ppt; /*!< Target's Presence optional Params(PPt)*/
|
||||
uint8_t GBt[RFAL_NFCDEP_GB_MAX_LEN]; /*!< Target's General Bytes (Gt) */
|
||||
uint8_t GBtLen; /*!< Target's General Bytes length */
|
||||
uint8_t operParam; /*!< NFC-DEP Operation Parameter */
|
||||
} rfalNfcDepTargetParam;
|
||||
|
||||
|
||||
/*! Structure of parameters to be passed in for nfcDepStartIpduTransceive */
|
||||
typedef struct
|
||||
{
|
||||
rfalNfcDepBufFormat *txBuf; /*!< Transmit Buffer struct reference */
|
||||
uint16_t txBufLen; /*!< Transmit Buffer INF field length in bytes */
|
||||
bool isTxChaining; /*!< Transmit data is not complete */
|
||||
rfalNfcDepBufFormat *rxBuf; /*!< Receive Buffer struct reference */
|
||||
uint16_t *rxLen; /*!< Receive INF data length */
|
||||
bool *isRxChaining; /*!< Received data is not complete */
|
||||
uint32_t FWT; /*!< FWT to be used (ignored in Listen Mode) */
|
||||
uint32_t dFWT; /*!< Delta FWT to be used */
|
||||
uint16_t FSx; /*!< Other device Frame Size (FSD or FSC) */
|
||||
uint8_t DID; /*!< Device ID (RFAL_ISODEP_NO_DID if no DID) */
|
||||
typedef struct {
|
||||
rfalNfcDepBufFormat* txBuf; /*!< Transmit Buffer struct reference */
|
||||
uint16_t txBufLen; /*!< Transmit Buffer INF field length in bytes */
|
||||
bool isTxChaining; /*!< Transmit data is not complete */
|
||||
rfalNfcDepBufFormat* rxBuf; /*!< Receive Buffer struct reference */
|
||||
uint16_t* rxLen; /*!< Receive INF data length */
|
||||
bool* isRxChaining; /*!< Received data is not complete */
|
||||
uint32_t FWT; /*!< FWT to be used (ignored in Listen Mode) */
|
||||
uint32_t dFWT; /*!< Delta FWT to be used */
|
||||
uint16_t FSx; /*!< Other device Frame Size (FSD or FSC) */
|
||||
uint8_t DID; /*!< Device ID (RFAL_ISODEP_NO_DID if no DID) */
|
||||
} rfalNfcDepTxRxParam;
|
||||
|
||||
|
||||
/*! Structure of parameters used on NFC DEP PDU Transceive */
|
||||
typedef struct
|
||||
{
|
||||
rfalNfcDepPduBufFormat *txBuf; /*!< Transmit Buffer struct reference */
|
||||
uint16_t txBufLen; /*!< Transmit Buffer INF field length in Bytes*/
|
||||
rfalNfcDepPduBufFormat *rxBuf; /*!< Receive Buffer struct reference in Bytes */
|
||||
uint16_t *rxLen; /*!< Received INF data length in Bytes */
|
||||
rfalNfcDepBufFormat *tmpBuf; /*!< Temp buffer for single PDUs (internal) */
|
||||
uint32_t FWT; /*!< FWT to be used (ignored in Listen Mode) */
|
||||
uint32_t dFWT; /*!< Delta FWT to be used */
|
||||
uint16_t FSx; /*!< Other device Frame Size (FSD or FSC) */
|
||||
uint8_t DID; /*!< Device ID (RFAL_ISODEP_NO_DID if no DID) */
|
||||
typedef struct {
|
||||
rfalNfcDepPduBufFormat* txBuf; /*!< Transmit Buffer struct reference */
|
||||
uint16_t txBufLen; /*!< Transmit Buffer INF field length in Bytes*/
|
||||
rfalNfcDepPduBufFormat* rxBuf; /*!< Receive Buffer struct reference in Bytes */
|
||||
uint16_t* rxLen; /*!< Received INF data length in Bytes */
|
||||
rfalNfcDepBufFormat* tmpBuf; /*!< Temp buffer for single PDUs (internal) */
|
||||
uint32_t FWT; /*!< FWT to be used (ignored in Listen Mode) */
|
||||
uint32_t dFWT; /*!< Delta FWT to be used */
|
||||
uint16_t FSx; /*!< Other device Frame Size (FSD or FSC) */
|
||||
uint8_t DID; /*!< Device ID (RFAL_ISODEP_NO_DID if no DID) */
|
||||
} rfalNfcDepPduTxRxParam;
|
||||
|
||||
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* GLOBAL VARIABLE DECLARATIONS
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* GLOBAL FUNCTION PROTOTYPES
|
||||
@@ -470,8 +517,7 @@ typedef struct
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
void rfalNfcDepInitialize( void );
|
||||
|
||||
void rfalNfcDepInitialize(void);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -484,8 +530,7 @@ void rfalNfcDepInitialize( void );
|
||||
* \param[in] pFunc : method pointer to deactivation flag check
|
||||
******************************************************************************
|
||||
*/
|
||||
void rfalNfcDepSetDeactivatingCallback( rfalNfcDepDeactCallback pFunc );
|
||||
|
||||
void rfalNfcDepSetDeactivatingCallback(rfalNfcDepDeactCallback pFunc);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -498,8 +543,7 @@ void rfalNfcDepSetDeactivatingCallback( rfalNfcDepDeactCallback pFunc );
|
||||
* \return RWT value in 1/fc
|
||||
******************************************************************************
|
||||
*/
|
||||
uint32_t rfalNfcDepCalculateRWT( uint8_t wt );
|
||||
|
||||
uint32_t rfalNfcDepCalculateRWT(uint8_t wt);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -517,8 +561,8 @@ uint32_t rfalNfcDepCalculateRWT( uint8_t wt );
|
||||
* \return ERR_PROTO : Protocol error occurred
|
||||
******************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepATR( const rfalNfcDepAtrParam* param, rfalNfcDepAtrRes *atrRes, uint8_t* atrResLen );
|
||||
|
||||
ReturnCode
|
||||
rfalNfcDepATR(const rfalNfcDepAtrParam* param, rfalNfcDepAtrRes* atrRes, uint8_t* atrResLen);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -537,8 +581,7 @@ ReturnCode rfalNfcDepATR( const rfalNfcDepAtrParam* param, rfalNfcDepAtrRes *atr
|
||||
* \return ERR_PROTO : Protocol error occurred
|
||||
******************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepPSL( uint8_t BRS, uint8_t FSL );
|
||||
|
||||
ReturnCode rfalNfcDepPSL(uint8_t BRS, uint8_t FSL);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -555,8 +598,7 @@ ReturnCode rfalNfcDepPSL( uint8_t BRS, uint8_t FSL );
|
||||
* \return ERR_PROTO : Protocol error occurred
|
||||
******************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepDSL( void );
|
||||
|
||||
ReturnCode rfalNfcDepDSL(void);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -573,8 +615,7 @@ ReturnCode rfalNfcDepDSL( void );
|
||||
* \return ERR_PROTO : Protocol error occurred
|
||||
******************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepRLS( void );
|
||||
|
||||
ReturnCode rfalNfcDepRLS(void);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -600,8 +641,10 @@ ReturnCode rfalNfcDepRLS( void );
|
||||
* \return ERR_NONE : No error, activation successful
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepInitiatorHandleActivation( rfalNfcDepAtrParam* param, rfalBitRate desiredBR, rfalNfcDepDevice* nfcDepDev );
|
||||
|
||||
ReturnCode rfalNfcDepInitiatorHandleActivation(
|
||||
rfalNfcDepAtrParam* param,
|
||||
rfalBitRate desiredBR,
|
||||
rfalNfcDepDevice* nfcDepDev);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -621,8 +664,7 @@ ReturnCode rfalNfcDepInitiatorHandleActivation( rfalNfcDepAtrParam* param, rfalB
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
bool rfalNfcDepIsAtrReq( const uint8_t* buf, uint16_t bufLen, uint8_t* nfcid3 );
|
||||
|
||||
bool rfalNfcDepIsAtrReq(const uint8_t* buf, uint16_t bufLen, uint8_t* nfcid3);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
@@ -635,7 +677,7 @@ bool rfalNfcDepIsAtrReq( const uint8_t* buf, uint16_t bufLen, uint8_t* nfcid3 );
|
||||
* \return false : no ATR has been received
|
||||
******************************************************************************
|
||||
*/
|
||||
bool rfalNfcDepTargetRcvdATR( void );
|
||||
bool rfalNfcDepTargetRcvdATR(void);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -667,8 +709,11 @@ bool rfalNfcDepTargetRcvdATR( void );
|
||||
* \return ERR_LINK_LOSS : Remote Field is turned off
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepListenStartActivation( const rfalNfcDepTargetParam *param, const uint8_t *atrReq, uint16_t atrReqLength, rfalNfcDepListenActvParam rxParam );
|
||||
|
||||
ReturnCode rfalNfcDepListenStartActivation(
|
||||
const rfalNfcDepTargetParam* param,
|
||||
const uint8_t* atrReq,
|
||||
uint16_t atrReqLength,
|
||||
rfalNfcDepListenActvParam rxParam);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -679,7 +724,7 @@ ReturnCode rfalNfcDepListenStartActivation( const rfalNfcDepTargetParam *param,
|
||||
* \return ERR_LINK_LOSS : Remote Field was turned off
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepListenGetActivationStatus( void );
|
||||
ReturnCode rfalNfcDepListenGetActivationStatus(void);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -700,8 +745,7 @@ ReturnCode rfalNfcDepListenGetActivationStatus( void );
|
||||
* \return ERR_NONE : The Transceive request has been started
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepStartTransceive( const rfalNfcDepTxRxParam *param );
|
||||
|
||||
ReturnCode rfalNfcDepStartTransceive(const rfalNfcDepTxRxParam* param);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -730,8 +774,7 @@ ReturnCode rfalNfcDepStartTransceive( const rfalNfcDepTxRxParam *param );
|
||||
* this method to retrieve the remaining blocks
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepGetTransceiveStatus( void );
|
||||
|
||||
ReturnCode rfalNfcDepGetTransceiveStatus(void);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -754,8 +797,7 @@ ReturnCode rfalNfcDepGetTransceiveStatus( void );
|
||||
* \return ERR_NONE : The Transceive request has been started
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepStartPduTransceive( rfalNfcDepPduTxRxParam param );
|
||||
|
||||
ReturnCode rfalNfcDepStartPduTransceive(rfalNfcDepPduTxRxParam param);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -775,7 +817,7 @@ ReturnCode rfalNfcDepStartPduTransceive( rfalNfcDepPduTxRxParam param );
|
||||
* has turned off its field
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalNfcDepGetPduTransceiveStatus( void );
|
||||
ReturnCode rfalNfcDepGetPduTransceiveStatus(void);
|
||||
|
||||
#endif /* RFAL_NFCDEP_H_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user