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:
138
lib/ST25RFAL002/include/rfal_t4t.h
Executable file → Normal file
138
lib/ST25RFAL002/include/rfal_t4t.h
Executable file → Normal file
@@ -52,7 +52,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RFAL_T4T_H
|
||||
#define RFAL_T4T_H
|
||||
|
||||
@@ -72,20 +71,27 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#define RFAL_T4T_MAX_CAPDU_PROLOGUE_LEN 4U /*!< Command-APDU prologue length (CLA INS P1 P2) */
|
||||
#define RFAL_T4T_LE_LEN 1U /*!< Le Expected Response Length (short field coding) */
|
||||
#define RFAL_T4T_LC_LEN 1U /*!< Lc Data field length (short field coding) */
|
||||
#define RFAL_T4T_MAX_RAPDU_SW1SW2_LEN 2U /*!< SW1 SW2 length */
|
||||
#define RFAL_T4T_CLA 0x00U /*!< Class byte (contains 00h because secure message are not used) */
|
||||
#define RFAL_T4T_MAX_CAPDU_PROLOGUE_LEN \
|
||||
4U /*!< Command-APDU prologue length (CLA INS P1 P2) */
|
||||
#define RFAL_T4T_LE_LEN 1U /*!< Le Expected Response Length (short field coding) */
|
||||
#define RFAL_T4T_LC_LEN 1U /*!< Lc Data field length (short field coding) */
|
||||
#define RFAL_T4T_MAX_RAPDU_SW1SW2_LEN \
|
||||
2U /*!< SW1 SW2 length */
|
||||
#define RFAL_T4T_CLA 0x00U /*!< Class byte (contains 00h because secure message are not used) */
|
||||
|
||||
#define RFAL_T4T_ISO7816_P1_SELECT_BY_DF_NAME 0x04U /*!< P1 value for Select by name */
|
||||
#define RFAL_T4T_ISO7816_P1_SELECT_BY_FILEID 0x00U /*!< P1 value for Select by file identifier */
|
||||
#define RFAL_T4T_ISO7816_P2_SELECT_FIRST_OR_ONLY_OCCURENCE 0x00U /*!< b2b1 P2 value for First or only occurence */
|
||||
#define RFAL_T4T_ISO7816_P2_SELECT_RETURN_FCI_TEMPLATE 0x00U /*!< b4b3 P2 value for Return FCI template */
|
||||
#define RFAL_T4T_ISO7816_P2_SELECT_NO_RESPONSE_DATA 0x0CU /*!< b4b3 P2 value for No responce data */
|
||||
|
||||
#define RFAL_T4T_ISO7816_STATUS_COMPLETE 0x9000U /*!< Command completed \ Normal processing - No further qualification*/
|
||||
#define RFAL_T4T_ISO7816_P1_SELECT_BY_DF_NAME \
|
||||
0x04U /*!< P1 value for Select by name */
|
||||
#define RFAL_T4T_ISO7816_P1_SELECT_BY_FILEID \
|
||||
0x00U /*!< P1 value for Select by file identifier */
|
||||
#define RFAL_T4T_ISO7816_P2_SELECT_FIRST_OR_ONLY_OCCURENCE \
|
||||
0x00U /*!< b2b1 P2 value for First or only occurence */
|
||||
#define RFAL_T4T_ISO7816_P2_SELECT_RETURN_FCI_TEMPLATE \
|
||||
0x00U /*!< b4b3 P2 value for Return FCI template */
|
||||
#define RFAL_T4T_ISO7816_P2_SELECT_NO_RESPONSE_DATA \
|
||||
0x0CU /*!< b4b3 P2 value for No responce data */
|
||||
|
||||
#define RFAL_T4T_ISO7816_STATUS_COMPLETE \
|
||||
0x9000U /*!< Command completed \ Normal processing - No further qualification*/
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
@@ -93,47 +99,42 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* GLOBAL TYPES
|
||||
******************************************************************************
|
||||
*/
|
||||
/*! NFC-A T4T Command-APDU structure */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t CLA; /*!< Class byte */
|
||||
uint8_t INS; /*!< Instruction byte */
|
||||
uint8_t P1; /*!< Parameter byte 1 */
|
||||
uint8_t P2; /*!< Parameter byte 2 */
|
||||
uint8_t Lc; /*!< Data field length */
|
||||
bool LcFlag; /*!< Lc flag (append Lc when true) */
|
||||
uint8_t Le; /*!< Expected Response Length */
|
||||
bool LeFlag; /*!< Le flag (append Le when true) */
|
||||
|
||||
rfalIsoDepApduBufFormat *cApduBuf; /*!< Command-APDU buffer (Tx) */
|
||||
uint16_t *cApduLen; /*!< Command-APDU Length */
|
||||
}rfalT4tCApduParam;
|
||||
typedef struct {
|
||||
uint8_t CLA; /*!< Class byte */
|
||||
uint8_t INS; /*!< Instruction byte */
|
||||
uint8_t P1; /*!< Parameter byte 1 */
|
||||
uint8_t P2; /*!< Parameter byte 2 */
|
||||
uint8_t Lc; /*!< Data field length */
|
||||
bool LcFlag; /*!< Lc flag (append Lc when true) */
|
||||
uint8_t Le; /*!< Expected Response Length */
|
||||
bool LeFlag; /*!< Le flag (append Le when true) */
|
||||
|
||||
rfalIsoDepApduBufFormat* cApduBuf; /*!< Command-APDU buffer (Tx) */
|
||||
uint16_t* cApduLen; /*!< Command-APDU Length */
|
||||
} rfalT4tCApduParam;
|
||||
|
||||
/*! NFC-A T4T Response-APDU structure */
|
||||
typedef struct
|
||||
{
|
||||
rfalIsoDepApduBufFormat *rApduBuf; /*!< Response-APDU buffer (Rx) */
|
||||
uint16_t rcvdLen; /*!< Full response length */
|
||||
uint16_t rApduBodyLen; /*!< Response body length */
|
||||
uint16_t statusWord; /*!< R-APDU Status Word SW1|SW2 */
|
||||
}rfalT4tRApduParam;
|
||||
|
||||
|
||||
typedef struct {
|
||||
rfalIsoDepApduBufFormat* rApduBuf; /*!< Response-APDU buffer (Rx) */
|
||||
uint16_t rcvdLen; /*!< Full response length */
|
||||
uint16_t rApduBodyLen; /*!< Response body length */
|
||||
uint16_t statusWord; /*!< R-APDU Status Word SW1|SW2 */
|
||||
} rfalT4tRApduParam;
|
||||
|
||||
/*! NFC-A T4T command set T4T 1.0 & ISO7816-4 2013 Table 4 */
|
||||
typedef enum
|
||||
{
|
||||
RFAL_T4T_INS_SELECT = 0xA4U, /*!< T4T Select */
|
||||
RFAL_T4T_INS_READBINARY = 0xB0U, /*!< T4T ReadBinary */
|
||||
RFAL_T4T_INS_UPDATEBINARY = 0xD6U, /*!< T4T UpdateBinay */
|
||||
RFAL_T4T_INS_READBINARY_ODO = 0xB1U, /*!< T4T ReadBinary using ODO */
|
||||
RFAL_T4T_INS_UPDATEBINARY_ODO = 0xD7U /*!< T4T UpdateBinay using ODO */
|
||||
typedef enum {
|
||||
RFAL_T4T_INS_SELECT = 0xA4U, /*!< T4T Select */
|
||||
RFAL_T4T_INS_READBINARY = 0xB0U, /*!< T4T ReadBinary */
|
||||
RFAL_T4T_INS_UPDATEBINARY = 0xD6U, /*!< T4T UpdateBinay */
|
||||
RFAL_T4T_INS_READBINARY_ODO = 0xB1U, /*!< T4T ReadBinary using ODO */
|
||||
RFAL_T4T_INS_UPDATEBINARY_ODO =
|
||||
0xD7U /*!< T4T UpdateBinay using ODO */
|
||||
} rfalT4tCmds;
|
||||
|
||||
/*
|
||||
@@ -169,8 +170,7 @@ typedef enum
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeCAPDU( const rfalT4tCApduParam *apduParam );
|
||||
|
||||
ReturnCode rfalT4TPollerComposeCAPDU(const rfalT4tCApduParam* apduParam);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -189,7 +189,7 @@ ReturnCode rfalT4TPollerComposeCAPDU( const rfalT4tCApduParam *apduParam );
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerParseRAPDU( rfalT4tRApduParam *apduParam );
|
||||
ReturnCode rfalT4TPollerParseRAPDU(rfalT4tRApduParam* apduParam);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -212,7 +212,11 @@ ReturnCode rfalT4TPollerParseRAPDU( rfalT4tRApduParam *apduParam );
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeSelectAppl( rfalIsoDepApduBufFormat *cApduBuf, const uint8_t* aid, uint8_t aidLen, uint16_t *cApduLen );
|
||||
ReturnCode rfalT4TPollerComposeSelectAppl(
|
||||
rfalIsoDepApduBufFormat* cApduBuf,
|
||||
const uint8_t* aid,
|
||||
uint8_t aidLen,
|
||||
uint16_t* cApduLen);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -235,7 +239,11 @@ ReturnCode rfalT4TPollerComposeSelectAppl( rfalIsoDepApduBufFormat *cApduBuf, co
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeSelectFile( rfalIsoDepApduBufFormat *cApduBuf, const uint8_t* fid, uint8_t fidLen, uint16_t *cApduLen );
|
||||
ReturnCode rfalT4TPollerComposeSelectFile(
|
||||
rfalIsoDepApduBufFormat* cApduBuf,
|
||||
const uint8_t* fid,
|
||||
uint8_t fidLen,
|
||||
uint16_t* cApduLen);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -258,7 +266,11 @@ ReturnCode rfalT4TPollerComposeSelectFile( rfalIsoDepApduBufFormat *cApduBuf, co
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeSelectFileV1Mapping( rfalIsoDepApduBufFormat *cApduBuf, const uint8_t* fid, uint8_t fidLen, uint16_t *cApduLen );
|
||||
ReturnCode rfalT4TPollerComposeSelectFileV1Mapping(
|
||||
rfalIsoDepApduBufFormat* cApduBuf,
|
||||
const uint8_t* fid,
|
||||
uint8_t fidLen,
|
||||
uint16_t* cApduLen);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -281,7 +293,11 @@ ReturnCode rfalT4TPollerComposeSelectFileV1Mapping( rfalIsoDepApduBufFormat *cAp
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeReadData( rfalIsoDepApduBufFormat *cApduBuf, uint16_t offset, uint8_t expLen, uint16_t *cApduLen );
|
||||
ReturnCode rfalT4TPollerComposeReadData(
|
||||
rfalIsoDepApduBufFormat* cApduBuf,
|
||||
uint16_t offset,
|
||||
uint8_t expLen,
|
||||
uint16_t* cApduLen);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -304,7 +320,11 @@ ReturnCode rfalT4TPollerComposeReadData( rfalIsoDepApduBufFormat *cApduBuf, uint
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeReadDataODO( rfalIsoDepApduBufFormat *cApduBuf, uint32_t offset, uint8_t expLen, uint16_t *cApduLen );
|
||||
ReturnCode rfalT4TPollerComposeReadDataODO(
|
||||
rfalIsoDepApduBufFormat* cApduBuf,
|
||||
uint32_t offset,
|
||||
uint8_t expLen,
|
||||
uint16_t* cApduLen);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -328,7 +348,12 @@ ReturnCode rfalT4TPollerComposeReadDataODO( rfalIsoDepApduBufFormat *cApduBuf, u
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeWriteData( rfalIsoDepApduBufFormat *cApduBuf, uint16_t offset, const uint8_t* data, uint8_t dataLen, uint16_t *cApduLen );
|
||||
ReturnCode rfalT4TPollerComposeWriteData(
|
||||
rfalIsoDepApduBufFormat* cApduBuf,
|
||||
uint16_t offset,
|
||||
const uint8_t* data,
|
||||
uint8_t dataLen,
|
||||
uint16_t* cApduLen);
|
||||
|
||||
/*!
|
||||
*****************************************************************************
|
||||
@@ -352,7 +377,12 @@ ReturnCode rfalT4TPollerComposeWriteData( rfalIsoDepApduBufFormat *cApduBuf, uin
|
||||
* \return ERR_NONE : No error
|
||||
*****************************************************************************
|
||||
*/
|
||||
ReturnCode rfalT4TPollerComposeWriteDataODO( rfalIsoDepApduBufFormat *cApduBuf, uint32_t offset, const uint8_t* data, uint8_t dataLen, uint16_t *cApduLen );
|
||||
ReturnCode rfalT4TPollerComposeWriteDataODO(
|
||||
rfalIsoDepApduBufFormat* cApduBuf,
|
||||
uint32_t offset,
|
||||
const uint8_t* data,
|
||||
uint8_t dataLen,
|
||||
uint16_t* cApduLen);
|
||||
|
||||
#endif /* RFAL_T4T_H */
|
||||
|
||||
|
Reference in New Issue
Block a user