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:
あく
2022-01-05 19:10:18 +03:00
committed by GitHub
parent c98e54da10
commit 389ff92cc1
899 changed files with 379245 additions and 373421 deletions

195
lib/ST25RFAL002/include/rfal_nfca.h Executable file → Normal file
View File

@@ -56,7 +56,6 @@
*
*/
#ifndef RFAL_NFCA_H
#define RFAL_NFCA_H
@@ -76,25 +75,34 @@
******************************************************************************
*/
#define RFAL_NFCA_CASCADE_1_UID_LEN 4U /*!< UID length of cascade level 1 only tag */
#define RFAL_NFCA_CASCADE_2_UID_LEN 7U /*!< UID length of cascade level 2 only tag */
#define RFAL_NFCA_CASCADE_3_UID_LEN 10U /*!< UID length of cascade level 3 only tag */
#define RFAL_NFCA_CASCADE_1_UID_LEN \
4U /*!< UID length of cascade level 1 only tag */
#define RFAL_NFCA_CASCADE_2_UID_LEN \
7U /*!< UID length of cascade level 2 only tag */
#define RFAL_NFCA_CASCADE_3_UID_LEN \
10U /*!< UID length of cascade level 3 only tag */
#define RFAL_NFCA_SENS_RES_PLATFORM_MASK 0x0FU /*!< SENS_RES (ATQA) platform configuration mask Digital 1.1 Table 10 */
#define RFAL_NFCA_SENS_RES_PLATFORM_T1T 0x0CU /*!< SENS_RES (ATQA) T1T platform configuration Digital 1.1 Table 10 */
#define RFAL_NFCA_SEL_RES_CONF_MASK 0x60U /*!< SEL_RES (SAK) platform configuration mask Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_T2T 0x00U /*!< SEL_RES (SAK) T2T configuration Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_T4T 0x20U /*!< SEL_RES (SAK) T4T configuration Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_NFCDEP 0x40U /*!< SEL_RES (SAK) NFC-DEP configuration Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_T4T_NFCDEP 0x60U /*!< SEL_RES (SAK) T4T and NFC-DEP configuration Digital 1.1 Table 19 */
#define RFAL_NFCA_SENS_RES_PLATFORM_MASK \
0x0FU /*!< SENS_RES (ATQA) platform configuration mask Digital 1.1 Table 10 */
#define RFAL_NFCA_SENS_RES_PLATFORM_T1T \
0x0CU /*!< SENS_RES (ATQA) T1T platform configuration Digital 1.1 Table 10 */
#define RFAL_NFCA_SEL_RES_CONF_MASK \
0x60U /*!< SEL_RES (SAK) platform configuration mask Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_T2T \
0x00U /*!< SEL_RES (SAK) T2T configuration Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_T4T \
0x20U /*!< SEL_RES (SAK) T4T configuration Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_NFCDEP \
0x40U /*!< SEL_RES (SAK) NFC-DEP configuration Digital 1.1 Table 19 */
#define RFAL_NFCA_SEL_RES_CONF_T4T_NFCDEP \
0x60U /*!< SEL_RES (SAK) T4T and NFC-DEP configuration Digital 1.1 Table 19 */
/*! NFC-A minimum FDT(listen) = ((n * 128 + (84)) / fc) with n_min = 9 Digital 1.1 6.10.1
* = (1236)/fc
* Relax with 3etu: (3*128)/fc as with multiple NFC-A cards, response may take longer (JCOP cards)
* = (1236 + 384)/fc = 1620 / fc */
#define RFAL_NFCA_FDTMIN 1620U
#define RFAL_NFCA_FDTMIN 1620U
/*
******************************************************************************
* GLOBAL MACROS
@@ -102,22 +110,33 @@
*/
/*! Checks if device is a T1T given its SENS_RES */
#define rfalNfcaIsSensResT1T( sensRes ) ((((rfalNfcaSensRes*)(sensRes))->platformInfo & RFAL_NFCA_SENS_RES_PLATFORM_MASK) == RFAL_NFCA_SENS_RES_PLATFORM_T1T )
#define rfalNfcaIsSensResT1T(sensRes) \
((((rfalNfcaSensRes*)(sensRes))->platformInfo & RFAL_NFCA_SENS_RES_PLATFORM_MASK) == \
RFAL_NFCA_SENS_RES_PLATFORM_T1T)
/*! Checks if device is a T2T given its SENS_RES */
#define rfalNfcaIsSelResT2T( selRes ) ((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == RFAL_NFCA_SEL_RES_CONF_T2T )
#define rfalNfcaIsSelResT2T(selRes) \
((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == \
RFAL_NFCA_SEL_RES_CONF_T2T)
/*! Checks if device is a T4T given its SENS_RES */
#define rfalNfcaIsSelResT4T( selRes ) ((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == RFAL_NFCA_SEL_RES_CONF_T4T )
#define rfalNfcaIsSelResT4T(selRes) \
((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == \
RFAL_NFCA_SEL_RES_CONF_T4T)
/*! Checks if device supports NFC-DEP protocol given its SENS_RES */
#define rfalNfcaIsSelResNFCDEP( selRes ) ((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == RFAL_NFCA_SEL_RES_CONF_NFCDEP )
#define rfalNfcaIsSelResNFCDEP(selRes) \
((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == \
RFAL_NFCA_SEL_RES_CONF_NFCDEP)
/*! Checks if device supports ISO-DEP and NFC-DEP protocol given its SENS_RES */
#define rfalNfcaIsSelResT4TNFCDEP( selRes ) ((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == RFAL_NFCA_SEL_RES_CONF_T4T_NFCDEP )
#define rfalNfcaIsSelResT4TNFCDEP(selRes) \
((((rfalNfcaSelRes*)(selRes))->sak & RFAL_NFCA_SEL_RES_CONF_MASK) == \
RFAL_NFCA_SEL_RES_CONF_T4T_NFCDEP)
/*! Checks if a NFC-A listener device supports multiple protocols (ISO-DEP and NFC-DEP) */
#define rfalNfcaLisDevIsMultiProto( lisDev ) (((rfalNfcaListenDevice*)(lisDev))->type == RFAL_NFCA_T4T_NFCDEP )
#define rfalNfcaLisDevIsMultiProto(lisDev) \
(((rfalNfcaListenDevice*)(lisDev))->type == RFAL_NFCA_T4T_NFCDEP)
/*
******************************************************************************
@@ -127,67 +146,74 @@
/*! NFC-A Listen device types */
typedef enum {
RFAL_NFCA_T1T = 0x01, /* Device configured for T1T Digital 1.1 Table 9 */
RFAL_NFCA_T2T = 0x00, /* Device configured for T2T Digital 1.1 Table 19 */
RFAL_NFCA_T4T = 0x20, /* Device configured for T4T Digital 1.1 Table 19 */
RFAL_NFCA_NFCDEP = 0x40, /* Device configured for NFC-DEP Digital 1.1 Table 19 */
RFAL_NFCA_T4T_NFCDEP = 0x60 /* Device configured for NFC-DEP and T4T Digital 1.1 Table 19 */
RFAL_NFCA_T1T =
0x01, /* Device configured for T1T Digital 1.1 Table 9 */
RFAL_NFCA_T2T =
0x00, /* Device configured for T2T Digital 1.1 Table 19 */
RFAL_NFCA_T4T =
0x20, /* Device configured for T4T Digital 1.1 Table 19 */
RFAL_NFCA_NFCDEP =
0x40, /* Device configured for NFC-DEP Digital 1.1 Table 19 */
RFAL_NFCA_T4T_NFCDEP =
0x60 /* Device configured for NFC-DEP and T4T Digital 1.1 Table 19 */
} rfalNfcaListenDeviceType;
/*! SENS_RES (ATQA) format Digital 1.1 6.6.3 & Table 7 */
typedef struct
{
uint8_t anticollisionInfo; /*!< SENS_RES Anticollision Information */
uint8_t platformInfo; /*!< SENS_RES Platform Information */
typedef struct {
uint8_t
anticollisionInfo; /*!< SENS_RES Anticollision Information */
uint8_t
platformInfo; /*!< SENS_RES Platform Information */
} rfalNfcaSensRes;
/*! SDD_REQ (Anticollision) format Digital 1.1 6.7.1 & Table 11 */
typedef struct
{
uint8_t selCmd; /*!< SDD_REQ SEL_CMD: cascade Level */
uint8_t selPar; /*!< SDD_REQ SEL_PAR: Byte Count[4b] | Bit Count[4b] (NVB: Number of Valid Bits)*/
typedef struct {
uint8_t
selCmd; /*!< SDD_REQ SEL_CMD: cascade Level */
uint8_t
selPar; /*!< SDD_REQ SEL_PAR: Byte Count[4b] | Bit Count[4b] (NVB: Number of Valid Bits)*/
} rfalNfcaSddReq;
/*! SDD_RES (UID CLn) format Digital 1.1 6.7.2 & Table 15 */
typedef struct
{
uint8_t nfcid1[RFAL_NFCA_CASCADE_1_UID_LEN]; /*!< NFCID1 cascade level NFCID */
uint8_t bcc; /*!< BCC Exclusive-OR over first 4 bytes of SDD_RES */
typedef struct {
uint8_t nfcid1
[RFAL_NFCA_CASCADE_1_UID_LEN]; /*!< NFCID1 cascade level NFCID */
uint8_t bcc; /*!< BCC Exclusive-OR over first 4 bytes of SDD_RES */
} rfalNfcaSddRes;
/*! SEL_REQ (Select) format Digital 1.1 6.8.1 & Table 17 */
typedef struct
{
uint8_t selCmd; /*!< SDD_REQ SEL_CMD: cascade Level */
uint8_t selPar; /*!< SDD_REQ SEL_PAR: Byte Count[4b] | Bit Count[4b] (NVB: Number of Valid Bits)*/
uint8_t nfcid1[RFAL_NFCA_CASCADE_1_UID_LEN]; /*!< NFCID1 data */
uint8_t bcc; /*!< Checksum calculated as exclusive-OR over the 4 bytes of NFCID1 CLn */
typedef struct {
uint8_t
selCmd; /*!< SDD_REQ SEL_CMD: cascade Level */
uint8_t
selPar; /*!< SDD_REQ SEL_PAR: Byte Count[4b] | Bit Count[4b] (NVB: Number of Valid Bits)*/
uint8_t nfcid1
[RFAL_NFCA_CASCADE_1_UID_LEN]; /*!< NFCID1 data */
uint8_t bcc; /*!< Checksum calculated as exclusive-OR over the 4 bytes of NFCID1 CLn */
} rfalNfcaSelReq;
/*! SEL_RES (SAK) format Digital 1.1 6.8.2 & Table 19 */
typedef struct
{
uint8_t sak; /*!< Select Acknowledge */
typedef struct {
uint8_t sak; /*!< Select Acknowledge */
} rfalNfcaSelRes;
/*! NFC-A listener device (PICC) struct */
typedef struct
{
rfalNfcaListenDeviceType type; /*!< NFC-A Listen device type */
rfalNfcaSensRes sensRes; /*!< SENS_RES (ATQA) */
rfalNfcaSelRes selRes; /*!< SEL_RES (SAK) */
uint8_t nfcId1Len; /*!< NFCID1 Length */
uint8_t nfcId1[RFAL_NFCA_CASCADE_3_UID_LEN]; /*!< NFCID1 (UID) */
typedef struct {
rfalNfcaListenDeviceType
type; /*!< NFC-A Listen device type */
rfalNfcaSensRes
sensRes; /*!< SENS_RES (ATQA) */
rfalNfcaSelRes
selRes; /*!< SEL_RES (SAK) */
uint8_t
nfcId1Len; /*!< NFCID1 Length */
uint8_t nfcId1
[RFAL_NFCA_CASCADE_3_UID_LEN]; /*!< NFCID1 (UID) */
#ifdef RFAL_FEATURE_T1T
rfalT1TRidRes ridRes; /*!< RID_RES */
rfalT1TRidRes
ridRes; /*!< RID_RES */
#endif /* RFAL_FEATURE_T1T */
bool isSleep; /*!< Device sleeping flag */
bool isSleep; /*!< Device sleeping flag */
} rfalNfcaListenDevice;
/*
@@ -209,8 +235,7 @@ typedef struct
* \return ERR_NONE : No error
*****************************************************************************
*/
ReturnCode rfalNfcaPollerInitialize( void );
ReturnCode rfalNfcaPollerInitialize(void);
/*!
*****************************************************************************
@@ -234,8 +259,7 @@ ReturnCode rfalNfcaPollerInitialize( void );
* \return ERR_NONE : No error, one or more device in the field
*****************************************************************************
*/
ReturnCode rfalNfcaPollerCheckPresence( rfal14443AShortFrameCmd cmd, rfalNfcaSensRes *sensRes );
ReturnCode rfalNfcaPollerCheckPresence(rfal14443AShortFrameCmd cmd, rfalNfcaSensRes* sensRes);
/*!
*****************************************************************************
@@ -258,8 +282,7 @@ ReturnCode rfalNfcaPollerCheckPresence( rfal14443AShortFrameCmd cmd, rfalNfcaSen
* \return ERR_NONE : No error, SEL_RES received
*****************************************************************************
*/
ReturnCode rfalNfcaPollerSelect( const uint8_t *nfcid1, uint8_t nfcidLen, rfalNfcaSelRes *selRes );
ReturnCode rfalNfcaPollerSelect(const uint8_t* nfcid1, uint8_t nfcidLen, rfalNfcaSelRes* selRes);
/*!
*****************************************************************************
@@ -274,8 +297,7 @@ ReturnCode rfalNfcaPollerSelect( const uint8_t *nfcid1, uint8_t nfcidLen, rfalNf
* \return ERR_NONE : No error
*****************************************************************************
*/
ReturnCode rfalNfcaPollerSleep( void );
ReturnCode rfalNfcaPollerSleep(void);
/*!
*****************************************************************************
@@ -297,8 +319,8 @@ ReturnCode rfalNfcaPollerSleep( void );
* \return ERR_NONE : No error, one or more device in the field
*****************************************************************************
*/
ReturnCode rfalNfcaPollerTechnologyDetection( rfalComplianceMode compMode, rfalNfcaSensRes *sensRes );
ReturnCode
rfalNfcaPollerTechnologyDetection(rfalComplianceMode compMode, rfalNfcaSensRes* sensRes);
/*!
*****************************************************************************
@@ -327,8 +349,12 @@ ReturnCode rfalNfcaPollerTechnologyDetection( rfalComplianceMode compMode, rfalN
* \return ERR_NONE : No error
*****************************************************************************
*/
ReturnCode rfalNfcaPollerSingleCollisionResolution( uint8_t devLimit, bool *collPending, rfalNfcaSelRes *selRes, uint8_t *nfcId1, uint8_t *nfcId1Len );
ReturnCode rfalNfcaPollerSingleCollisionResolution(
uint8_t devLimit,
bool* collPending,
rfalNfcaSelRes* selRes,
uint8_t* nfcId1,
uint8_t* nfcId1Len);
/*!
*****************************************************************************
@@ -358,8 +384,11 @@ ReturnCode rfalNfcaPollerSingleCollisionResolution( uint8_t devLimit, bool *coll
* \return ERR_NONE : No error
*****************************************************************************
*/
ReturnCode rfalNfcaPollerFullCollisionResolution( rfalComplianceMode compMode, uint8_t devLimit, rfalNfcaListenDevice *nfcaDevList, uint8_t *devCnt );
ReturnCode rfalNfcaPollerFullCollisionResolution(
rfalComplianceMode compMode,
uint8_t devLimit,
rfalNfcaListenDevice* nfcaDevList,
uint8_t* devCnt);
/*!
*****************************************************************************
@@ -383,8 +412,10 @@ ReturnCode rfalNfcaPollerFullCollisionResolution( rfalComplianceMode compMode, u
* \return ERR_NONE : No error
*****************************************************************************
*/
ReturnCode rfalNfcaPollerSleepFullCollisionResolution( uint8_t devLimit, rfalNfcaListenDevice *nfcaDevList, uint8_t *devCnt );
ReturnCode rfalNfcaPollerSleepFullCollisionResolution(
uint8_t devLimit,
rfalNfcaListenDevice* nfcaDevList,
uint8_t* devCnt);
/*!
*****************************************************************************
@@ -415,8 +446,11 @@ ReturnCode rfalNfcaPollerSleepFullCollisionResolution( uint8_t devLimit, rfalNfc
* \return ERR_NONE : No error
*****************************************************************************
*/
ReturnCode rfalNfcaPollerStartFullCollisionResolution( rfalComplianceMode compMode, uint8_t devLimit, rfalNfcaListenDevice *nfcaDevList, uint8_t *devCnt );
ReturnCode rfalNfcaPollerStartFullCollisionResolution(
rfalComplianceMode compMode,
uint8_t devLimit,
rfalNfcaListenDevice* nfcaDevList,
uint8_t* devCnt);
/*!
*****************************************************************************
@@ -436,8 +470,7 @@ ReturnCode rfalNfcaPollerStartFullCollisionResolution( rfalComplianceMode compMo
* \return ERR_NONE : No error, activation successful
*****************************************************************************
*/
ReturnCode rfalNfcaPollerGetFullCollisionResolutionStatus( void );
ReturnCode rfalNfcaPollerGetFullCollisionResolutionStatus(void);
/*!
*****************************************************************************
@@ -451,7 +484,7 @@ ReturnCode rfalNfcaPollerGetFullCollisionResolutionStatus( void );
* \return true if data in buf contains a SLP_REQ ; false otherwise
*****************************************************************************
*/
bool rfalNfcaListenerIsSleepReq( const uint8_t *buf, uint16_t bufLen );
bool rfalNfcaListenerIsSleepReq(const uint8_t* buf, uint16_t bufLen);
#endif /* RFAL_NFCA_H */