Fix comments with #defines which exceed 80 characters
Before:
- #define <directive> <value> /* <comment> */
After:
/* <comment> */
- #define <directive> <calue>
Test: compiles
Change-Id: Id4ea0e820563eb98bc731aee9bfb6599ae7d7af8
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
diff --git a/halimpl/bcm2079x/gki/common/gki.h b/halimpl/bcm2079x/gki/common/gki.h
index b716799..e1121cf 100644
--- a/halimpl/bcm2079x/gki/common/gki.h
+++ b/halimpl/bcm2079x/gki/common/gki.h
@@ -368,7 +368,8 @@
#endif
-#define GKI_PUBLIC_POOL 0 /* General pool accessible to GKI_getbuf() */
+/* General pool accessible to GKI_getbuf() */
+#define GKI_PUBLIC_POOL 0
#define GKI_RESTRICTED_POOL 1 /* Inaccessible pool to GKI_getbuf() */
/***********************************************************************
diff --git a/halimpl/bcm2079x/gki/common/gki_common.h b/halimpl/bcm2079x/gki/common/gki_common.h
index f403fb0..fafed7a 100644
--- a/halimpl/bcm2079x/gki/common/gki_common.h
+++ b/halimpl/bcm2079x/gki/common/gki_common.h
@@ -90,9 +90,12 @@
/* Buffer related defines
*/
#define ALIGN_POOL(pl_size) ( (((pl_size) + 3) / sizeof(uint32_t)) * sizeof(uint32_t))
-#define BUFFER_HDR_SIZE (sizeof(BUFFER_HDR_T)) /* Offset past header */
-#define BUFFER_PADDING_SIZE (sizeof(BUFFER_HDR_T) + sizeof(uint32_t)) /* Header + Magic Number */
-#define MAX_USER_BUF_SIZE ((uint16_t)0xffff - BUFFER_PADDING_SIZE) /* pool size must allow for header */
+/* Offset past header */
+#define BUFFER_HDR_SIZE (sizeof(BUFFER_HDR_T))
+/* Header + Magic Number */
+#define BUFFER_PADDING_SIZE (sizeof(BUFFER_HDR_T) + sizeof(uint32_t))
+/* pool size must allow for header */
+#define MAX_USER_BUF_SIZE ((uint16_t)0xffff - BUFFER_PADDING_SIZE)
#define MAGIC_NO 0xDDBADDBA
#define BUF_STATUS_FREE 0
diff --git a/halimpl/bcm2079x/gki/common/gki_time.c b/halimpl/bcm2079x/gki/common/gki_time.c
index e842795..1924258 100644
--- a/halimpl/bcm2079x/gki/common/gki_time.c
+++ b/halimpl/bcm2079x/gki/common/gki_time.c
@@ -27,8 +27,10 @@
#endif
-#define GKI_NO_NEW_TMRS_STARTED (0x7fffffffL) /* Largest signed positive timer count */
-#define GKI_UNUSED_LIST_ENTRY (0x80000000L) /* Marks an unused timer list entry (initial value) */
+/* Largest signed positive timer count */
+#define GKI_NO_NEW_TMRS_STARTED (0x7fffffffL)
+/* Marks an unused timer list entry (initial value) */
+#define GKI_UNUSED_LIST_ENTRY (0x80000000L)
#define GKI_MAX_INT32 (0x7fffffffL)
/*******************************************************************************
diff --git a/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c b/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c
index f9b565a..65cf8bf 100644
--- a/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c
+++ b/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c
@@ -55,7 +55,8 @@
};
#define NCI_SET_FWFSM_OFFSET_ENABLE 3
-#define NCI_PROP_PARAM_SIZE_XTAL_INDEX 3 /* length of parameters in XTAL_INDEX CMD */
+/* length of parameters in XTAL_INDEX CMD */
+#define NCI_PROP_PARAM_SIZE_XTAL_INDEX 3
#ifndef NCI_PROP_PARAM_MAX_SIZE_XTAL_INDEX
#define NCI_PROP_PARAM_MAX_SIZE_XTAL_INDEX 20
#endif
@@ -74,7 +75,8 @@
NCI_MSG_GET_PATCH_VERSION,
0x00
};
-#define NCI_PATCH_INFO_VERSION_LEN 16 /* Length of patch version string in PATCH_INFO */
+/* Length of patch version string in PATCH_INFO */
+#define NCI_PATCH_INFO_VERSION_LEN 16
/*****************************************************************************
** Extern function prototypes
diff --git a/halimpl/bcm2079x/hal/hal/nfc_hal_prm.c b/halimpl/bcm2079x/hal/hal/nfc_hal_prm.c
index 9181ae5..69347a7 100644
--- a/halimpl/bcm2079x/hal/hal/nfc_hal_prm.c
+++ b/halimpl/bcm2079x/hal/hal/nfc_hal_prm.c
@@ -25,15 +25,19 @@
*****************************************************************************/
/* Internal flags */
-#define NFC_HAL_PRM_FLAGS_USE_PATCHRAM_BUF 0x01 /* Application provided patchram in a single buffer */
-#define NFC_HAL_PRM_FLAGS_RFU 0x02 /* Reserved for future use */
+/* Application provided patchram in a single buffer */
+#define NFC_HAL_PRM_FLAGS_USE_PATCHRAM_BUF 0x01
+/* Reserved for future use */
+#define NFC_HAL_PRM_FLAGS_RFU 0x02
#define NFC_HAL_PRM_FLAGS_SIGNATURE_SENT 0x04 /* Signature sent to NFCC */
#define NFC_HAL_PRM_FLAGS_I2C_FIX_REQUIRED 0x08 /* PreI2C patch required */
-#define NFC_HAL_PRM_FLAGS_BCM20791B3 0x10 /* B3 Patch (no RESET_NTF after patch download) */
+/* B3 Patch (no RESET_NTF after patch download) */
+#define NFC_HAL_PRM_FLAGS_BCM20791B3 0x10
#define NFC_HAL_PRM_FLAGS_RM_RF 0x20 /* Erase Personality data */
/* Secure patch download definitions */
-#define NFC_HAL_PRM_NCD_PATCHFILE_HDR_LEN 7 /* PRJID + MAJORVER + MINORVER + COUNT */
+/* PRJID + MAJORVER + MINORVER + COUNT */
+#define NFC_HAL_PRM_NCD_PATCHFILE_HDR_LEN 7
/* Enumeration of power modes IDs */
#define NFC_HAL_PRM_SPD_POWER_MODE_LPM 0
@@ -43,8 +47,10 @@
const uint8_t NFC_HAL_PRM_BCM20791B3_STR[] = "20791B3";
#define NFC_HAL_PRM_BCM20791B3_STR_LEN (sizeof (NFC_HAL_PRM_BCM20791B3_STR)-1)
-#define NFC_HAL_PRM_SPD_TOUT (6000) /* timeout for SPD events (in ms) */
-#define NFC_HAL_PRM_END_DELAY (250) /* delay before sending any new command (ms)*/
+/* timeout for SPD events (in ms) */
+#define NFC_HAL_PRM_SPD_TOUT (6000)
+/* delay before sending any new command (ms)*/
+#define NFC_HAL_PRM_END_DELAY (250)
#if (NFC_HAL_PRM_DEBUG == TRUE)
#define NFC_HAL_PRM_STATE(str) HAL_TRACE_DEBUG2 ("%s st: %d", str, nfc_hal_cb.prm.state)
diff --git a/halimpl/pn54x/common/phNfcCommon.h b/halimpl/pn54x/common/phNfcCommon.h
index 343d8fb..12e2f4e 100644
--- a/halimpl/pn54x/common/phNfcCommon.h
+++ b/halimpl/pn54x/common/phNfcCommon.h
@@ -82,7 +82,8 @@
#define CLK_SRC_PADDIRECT 3
/*Extern crystal clock source*/
-#define NXP_SYS_CLK_SRC_SEL CLK_SRC_PLL /* Use one of CLK_SRC_<value> */
+/* Use one of CLK_SRC_<value> */
+#define NXP_SYS_CLK_SRC_SEL CLK_SRC_PLL
/*Direct clock*/
/*
@@ -99,7 +100,8 @@
#define CLK_FREQ_38_4MHZ 5
#define CLK_FREQ_52MHZ 6
-#define NXP_SYS_CLK_FREQ_SEL CLK_FREQ_19_2MHZ /* Set to one of CLK_FREQ_<value> */
+/* Set to one of CLK_FREQ_<value> */
+#define NXP_SYS_CLK_FREQ_SEL CLK_FREQ_19_2MHZ
#define CLK_TO_CFG_DEF 1
#define CLK_TO_CFG_MAX 6
diff --git a/halimpl/pn54x/common/phNfcCompId.h b/halimpl/pn54x/common/phNfcCompId.h
index f88fbb4..c06c0da 100644
--- a/halimpl/pn54x/common/phNfcCompId.h
+++ b/halimpl/pn54x/common/phNfcCompId.h
@@ -37,22 +37,29 @@
* for NFCSTATUS_SUCCESS. The enumeration function uses CID_NFC_NONE
* to mark unassigned "References".
*/
-#define CID_NFC_NONE 0x00 /* Unassigned or doesn't apply (see #NFCSTATUS_SUCCESS) */
+/* Unassigned or doesn't apply (see #NFCSTATUS_SUCCESS) */
+#define CID_NFC_NONE 0x00
#define CID_NFC_TML 0x01 /* Transport Mapping Layer */
#define CID_NFC_LLC 0x07 /* Logical Link Control Layer */
-#define CID_NFC_NCI 0x08 /* NFC Controller(NFCC) Interface Layer */
-#define CID_NFC_DNLD 0x09 /* Firmware Download Management Layer */
+/* NFC Controller(NFCC) Interface Layer */
+#define CID_NFC_NCI 0x08
+/* Firmware Download Management Layer */
+#define CID_NFC_DNLD 0x09
#define CID_NFC_HAL 0x10 /* Hardware Abstraction Layer */
-#define CID_NFC_OSAL CID_NFC_NONE /* Operating System Abstraction Layer*/
+/* Operating System Abstraction Layer*/
+#define CID_NFC_OSAL CID_NFC_NONE
#define CID_FRI_NFC_OVR_HAL 0x20 /* NFC-Device, HAL-based */
#define CID_FRI_NFC_NDEF_RECORD 0x22 /* NDEF Record Tools Library. */
#define CID_FRI_NFC_NDEF_MAP 0x23 /* NDEF Mapping. */
#define CID_FRI_NFC_NDEF_REGISTRY 0x24 /* NDEF_REGISTRY. */
-#define CID_FRI_NFC_AUTO_DEV_DIS 0x25 /* Automatic Device Discovery. */
+/* Automatic Device Discovery. */
+#define CID_FRI_NFC_AUTO_DEV_DIS 0x25
#define CID_FRI_NFC_NDEF_SMTCRDFMT 0x26 /* Smart Card Formatting */
#define CID_NFC_LIB 0x30 /* NFC Library Layer*/
-#define CID_MAX_VALUE 0xF0 /* The maximum CID value that is defined. */
-#define CID_FRI_NFC_LLCP 0x40 /* Logical Link Control Protocol */
+/* The maximum CID value that is defined. */
+#define CID_MAX_VALUE 0xF0
+/* Logical Link Control Protocol */
+#define CID_FRI_NFC_LLCP 0x40
#define CID_FRI_NFC_LLCP_TRANSPORT 0x50
#define CID_FRI_NFC_LLCP_MAC 0x60
diff --git a/halimpl/pn54x/common/phNfcTypes.h b/halimpl/pn54x/common/phNfcTypes.h
index 1b93ef1..6ce2f86 100644
--- a/halimpl/pn54x/common/phNfcTypes.h
+++ b/halimpl/pn54x/common/phNfcTypes.h
@@ -36,7 +36,8 @@
#define STATIC static
#define PHNFC_MAX_UID_LENGTH 0x0AU /* Maximum UID length expected */
-#define PHNFC_MAX_ATR_LENGTH 0x30U /* Maximum ATR_RES (General Bytes) length expected */
+/* Maximum ATR_RES (General Bytes) length expected */
+#define PHNFC_MAX_ATR_LENGTH 0x30U
#define PHNFC_NFCID_LENGTH 0x0AU /* Maximum length of NFCID 1.3*/
#define PHNFC_ATQA_LENGTH 0x02U /* ATQA length */
diff --git a/halimpl/pn54x/dnld/phDnldNfc.h b/halimpl/pn54x/dnld/phDnldNfc.h
index 40a0577..7fc0e64 100644
--- a/halimpl/pn54x/dnld/phDnldNfc.h
+++ b/halimpl/pn54x/dnld/phDnldNfc.h
@@ -41,9 +41,11 @@
#define PHDNLDNFC_HWVER_MRA2_1 (0x04U) /* ChipVersion MRA2.1 */
#define PHDNLDNFC_HWVER_MRA2_2 (0x05U) /* ChipVersion MRA2.2 */
-#define PHDNLDNFC_HWVER_PN548AD_MRA1_0 (0x08U) /* PN548AD ChipVersion MRA1.0 */
+/* PN548AD ChipVersion MRA1.0 */
+#define PHDNLDNFC_HWVER_PN548AD_MRA1_0 (0x08U)
-#define PHDNLDNFC_HWVER_PN551_MRA1_0 (0x08U) /* PN551 ChipVersion MRA1.0 */
+/* PN551 ChipVersion MRA1.0 */
+#define PHDNLDNFC_HWVER_PN551_MRA1_0 (0x08U)
/*
* Enum definition contains Download Life Cycle States
*/
diff --git a/halimpl/pn54x/dnld/phDnldNfc_Internal.c b/halimpl/pn54x/dnld/phDnldNfc_Internal.c
index 96c407a..de8a105 100644
--- a/halimpl/pn54x/dnld/phDnldNfc_Internal.c
+++ b/halimpl/pn54x/dnld/phDnldNfc_Internal.c
@@ -25,50 +25,71 @@
#include <phNxpLog.h>
#include <phNxpNciHal_utils.h>
-#define PHDNLDNFC_MIN_PLD_LEN (0x04U) /* Minimum length of payload including 1 byte CmdId */
+/* Minimum length of payload including 1 byte CmdId */
+#define PHDNLDNFC_MIN_PLD_LEN (0x04U)
-#define PHDNLDNFC_FRAME_HDR_OFFSET (0x00) /* Offset of Length byte within the frame */
-#define PHDNLDNFC_FRAMEID_OFFSET (PHDNLDNFC_FRAME_HDR_LEN) /* Offset of FrameId within the frame */
-#define PHDNLDNFC_FRAMESTATUS_OFFSET PHDNLDNFC_FRAMEID_OFFSET /* Offset of status byte within the frame */
-#define PHDNLDNFC_PLD_OFFSET (PHDNLDNFC_MIN_PLD_LEN - 1) /* Offset within frame where payload starts*/
+/* Offset of Length byte within the frame */
+#define PHDNLDNFC_FRAME_HDR_OFFSET (0x00)
+/* Offset of FrameId within the frame */
+#define PHDNLDNFC_FRAMEID_OFFSET (PHDNLDNFC_FRAME_HDR_LEN)
+/* Offset of status byte within the frame */
+#define PHDNLDNFC_FRAMESTATUS_OFFSET PHDNLDNFC_FRAMEID_OFFSET
+/* Offset within frame where payload starts*/
+#define PHDNLDNFC_PLD_OFFSET (PHDNLDNFC_MIN_PLD_LEN - 1)
#define PHDNLDNFC_FRAME_RDDATA_OFFSET ((PHDNLDNFC_FRAME_HDR_LEN) + \
(PHDNLDNFC_MIN_PLD_LEN)) /* recvd frame offset where data starts */
-#define PHDNLDNFC_FRAME_SIGNATURE_SIZE (0xC0U) /* Size of first secure write frame Signature */
-#define PHDNLDNFC_FIRST_FRAME_PLD_SIZE (0xE4U) /* Size of first secure write frame payload */
+/* Size of first secure write frame Signature */
+#define PHDNLDNFC_FRAME_SIGNATURE_SIZE (0xC0U)
+/* Size of first secure write frame payload */
+#define PHDNLDNFC_FIRST_FRAME_PLD_SIZE (0xE4U)
-#define PHDNLDNFC_FIRST_FRAGFRAME_RESP (0x2DU) /* Status response for first fragmented write frame */
-#define PHDNLDNFC_NEXT_FRAGFRAME_RESP (0x2EU) /* Status response for subsequent fragmented write frame */
+/* Status response for first fragmented write frame */
+#define PHDNLDNFC_FIRST_FRAGFRAME_RESP (0x2DU)
+/* Status response for subsequent fragmented write frame */
+#define PHDNLDNFC_NEXT_FRAGFRAME_RESP (0x2EU)
#define PHDNLDNFC_SET_HDR_FRAGBIT(n) ((n) | (1<<10)) /* Header chunk bit set macro */
#define PHDNLDNFC_CLR_HDR_FRAGBIT(n) ((n) & ~(1U<<10)) /* Header chunk bit clear macro */
#define PHDNLDNFC_CHK_HDR_FRAGBIT(n) ((n) & 0x04) /* macro to check if frag bit is set in Hdr */
-#define PHDNLDNFC_RSP_TIMEOUT (2500) /* Timeout value to wait for response from NFCC */
-#define PHDNLDNFC_RETRY_FRAME_WRITE (50) /* Timeout value to wait before resending the last frame */
+/* Timeout value to wait for response from NFCC */
+#define PHDNLDNFC_RSP_TIMEOUT (2500)
+/* Timeout value to wait before resending the last frame */
+#define PHDNLDNFC_RETRY_FRAME_WRITE (50)
-#define PHDNLDNFC_USERDATA_EEPROM_LENSIZE (0x02U) /* size of EEPROM user data length */
-#define PHDNLDNFC_USERDATA_EEPROM_OFFSIZE (0x02U) /* size of EEPROM offset */
+/* size of EEPROM user data length */
+#define PHDNLDNFC_USERDATA_EEPROM_LENSIZE (0x02U)
+/* size of EEPROM offset */
+#define PHDNLDNFC_USERDATA_EEPROM_OFFSIZE (0x02U)
#ifdef NXP_PN547C1_DOWNLOAD
/* EEPROM offset and length value for PN547C1 */
-#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x003CU) /* 16 bits offset indicating user data area start location */
-#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0DC0U) /* 16 bits length of user data area */
+/* 16 bits offset indicating user data area start location */
+#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x003CU)
+/* 16 bits length of user data area */
+#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0DC0U)
#else
#if(NFC_NXP_CHIP_TYPE == PN548C2)
/* EEPROM offset and length value for PN548AD */
-#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x02BCU) /* 16 bits offset indicating user data area start location */
-#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0C00U) /* 16 bits length of user data area */
+/* 16 bits offset indicating user data area start location */
+#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x02BCU)
+/* 16 bits length of user data area */
+#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0C00U)
#elif(NFC_NXP_CHIP_TYPE == PN551)
/* EEPROM offset and length value for PN551 */
-#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x02BCU) /* 16 bits offset indicating user data area start location */
-#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0C00U) /* 16 bits length of user data area */
+/* 16 bits offset indicating user data area start location */
+#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x02BCU)
+/* 16 bits length of user data area */
+#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0C00U)
#else
/* EEPROM offset and length value for PN547C2 */
-#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x023CU) /* 16 bits offset indicating user data area start location */
-#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0C80U) /* 16 bits length of user data area */
+/* 16 bits offset indicating user data area start location */
+#define PHDNLDNFC_USERDATA_EEPROM_OFFSET (0x023CU)
+/* 16 bits length of user data area */
+#define PHDNLDNFC_USERDATA_EEPROM_LEN (0x0C80U)
#endif
#endif
diff --git a/halimpl/pn54x/dnld/phDnldNfc_Internal.h b/halimpl/pn54x/dnld/phDnldNfc_Internal.h
index c6d7834..4a9100c 100644
--- a/halimpl/pn54x/dnld/phDnldNfc_Internal.h
+++ b/halimpl/pn54x/dnld/phDnldNfc_Internal.h
@@ -31,17 +31,24 @@
#define PHDNLDNFC_CMDRESP_MAX_BUFF_SIZE (PHNFC_I2C_FRAGMENT_SIZE)
#endif
-#define PHDNLDNFC_WRITERSP_BUFF_SIZE (0x08U) /* DL Host Short Frame Buffer Size for pipelined WRITE RSP */
+/* DL Host Short Frame Buffer Size for pipelined WRITE RSP */
+#define PHDNLDNFC_WRITERSP_BUFF_SIZE (0x08U)
-#define PHDNLDNFC_FRAME_HDR_LEN (0x02U) /* DL Host Frame Buffer Header Length */
-#define PHDNLDNFC_FRAME_CRC_LEN (PHDNLDNFC_FRAME_HDR_LEN) /* DL Host Frame Buffer CRC Length */
+/* DL Host Frame Buffer Header Length */
+#define PHDNLDNFC_FRAME_HDR_LEN (0x02U)
+/* DL Host Frame Buffer CRC Length */
+#define PHDNLDNFC_FRAME_CRC_LEN (PHDNLDNFC_FRAME_HDR_LEN)
#define PHDNLDNFC_FRAME_ID_LEN (0x01U) /* Length of Cmd Id */
-#define PHDNLDNFC_EEFL_ADDR_SIZE (0x03U) /* size of EEPROM/Flash address */
-#define PHDNLDNFC_DATA_SIZE (PHDNLDNFC_FRAME_HDR_LEN) /* 2 Byte size of data */
+/* size of EEPROM/Flash address */
+#define PHDNLDNFC_EEFL_ADDR_SIZE (0x03U)
+/* 2 Byte size of data */
+#define PHDNLDNFC_DATA_SIZE (PHDNLDNFC_FRAME_HDR_LEN)
-#define PHDNLDNFC_EEPROM_LOG_START_ADDR (0x201F80U) /* Start of EEPROM address for log */
-#define PHDNLDNFC_EEPROM_LOG_END_ADDR (0x201FBFU) /* End of EEPROM address for log */
+/* Start of EEPROM address for log */
+#define PHDNLDNFC_EEPROM_LOG_START_ADDR (0x201F80U)
+/* End of EEPROM address for log */
+#define PHDNLDNFC_EEPROM_LOG_END_ADDR (0x201FBFU)
#define PHDNLDNFC_MAX_LOG_SIZE ((PHDNLDNFC_EEPROM_LOG_END_ADDR - PHDNLDNFC_EEPROM_LOG_START_ADDR) + 1)
diff --git a/halimpl/pn54x/hal/phNxpNciHal_Kovio.c b/halimpl/pn54x/hal/phNxpNciHal_Kovio.c
index 92e573f..a442b47 100644
--- a/halimpl/pn54x/hal/phNxpNciHal_Kovio.c
+++ b/halimpl/pn54x/hal/phNxpNciHal_Kovio.c
@@ -18,7 +18,8 @@
#include <phNxpLog.h>
-#define KOVIO_TIMEOUT 1000 /* Timeout value to wait for RF INTF Activated NTF.*/
+/* Timeout value to wait for RF INTF Activated NTF.*/
+#define KOVIO_TIMEOUT 1000
#define KOVIO_ACT_NTF_TEMP_BUFF_LEN 64 /* length of temp buffer to manipulate
the activated notification to match BCM format*/
#define MAX_WRITE_RETRY 5
diff --git a/halimpl/pn54x/hal/phNxpNciHal_NfcDepSWPrio.c b/halimpl/pn54x/hal/phNxpNciHal_NfcDepSWPrio.c
index 1d67af5..8ad83b1 100644
--- a/halimpl/pn54x/hal/phNxpNciHal_NfcDepSWPrio.c
+++ b/halimpl/pn54x/hal/phNxpNciHal_NfcDepSWPrio.c
@@ -18,7 +18,8 @@
#include <phNxpLog.h>
#include <phNxpNciHal.h>
-#define CUSTOM_POLL_TIMEOUT 160 /* Timeout value to wait for NFC-DEP detection.*/
+/* Timeout value to wait for NFC-DEP detection.*/
+#define CUSTOM_POLL_TIMEOUT 160
#define CLEAN_UP_TIMEOUT 250
#define MAX_WRITE_RETRY 5
diff --git a/halimpl/pn54x/hal/phNxpNciHal_ext.c b/halimpl/pn54x/hal/phNxpNciHal_ext.c
index 4ef55a1..3c6bf55 100644
--- a/halimpl/pn54x/hal/phNxpNciHal_ext.c
+++ b/halimpl/pn54x/hal/phNxpNciHal_ext.c
@@ -22,7 +22,8 @@
#include <phNxpLog.h>
#include <phNxpConfig.h>
-#define HAL_EXTNS_WRITE_RSP_TIMEOUT (1000) /* Timeout value to wait for response from PN548AD */
+/* Timeout value to wait for response from PN548AD */
+#define HAL_EXTNS_WRITE_RSP_TIMEOUT (1000)
#undef P2P_PRIO_LOGIC_HAL_IMP
diff --git a/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c b/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c
index 152c3ab..6f7b975 100644
--- a/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c
+++ b/halimpl/pn54x/self-test/phNxpNciHal_SelfTest.c
@@ -23,7 +23,8 @@
#include <phOsalNfc_Timer.h>
#include <phNxpConfig.h>
-#define HAL_WRITE_RSP_TIMEOUT (2000) /* Timeout value to wait for response from PN54X */
+/* Timeout value to wait for response from PN54X */
+#define HAL_WRITE_RSP_TIMEOUT (2000)
#define HAL_WRITE_MAX_RETRY (10)
/******************* Structures and definitions *******************************/
diff --git a/src/gki/common/gki.h b/src/gki/common/gki.h
index 7877d2f..eb0f9ee 100644
--- a/src/gki/common/gki.h
+++ b/src/gki/common/gki.h
@@ -364,7 +364,8 @@
#endif
-#define GKI_PUBLIC_POOL 0 /* General pool accessible to GKI_getbuf() */
+/* General pool accessible to GKI_getbuf() */
+#define GKI_PUBLIC_POOL 0
#define GKI_RESTRICTED_POOL 1 /* Inaccessible pool to GKI_getbuf() */
/***********************************************************************
diff --git a/src/gki/common/gki_common.h b/src/gki/common/gki_common.h
index f403fb0..fafed7a 100644
--- a/src/gki/common/gki_common.h
+++ b/src/gki/common/gki_common.h
@@ -90,9 +90,12 @@
/* Buffer related defines
*/
#define ALIGN_POOL(pl_size) ( (((pl_size) + 3) / sizeof(uint32_t)) * sizeof(uint32_t))
-#define BUFFER_HDR_SIZE (sizeof(BUFFER_HDR_T)) /* Offset past header */
-#define BUFFER_PADDING_SIZE (sizeof(BUFFER_HDR_T) + sizeof(uint32_t)) /* Header + Magic Number */
-#define MAX_USER_BUF_SIZE ((uint16_t)0xffff - BUFFER_PADDING_SIZE) /* pool size must allow for header */
+/* Offset past header */
+#define BUFFER_HDR_SIZE (sizeof(BUFFER_HDR_T))
+/* Header + Magic Number */
+#define BUFFER_PADDING_SIZE (sizeof(BUFFER_HDR_T) + sizeof(uint32_t))
+/* pool size must allow for header */
+#define MAX_USER_BUF_SIZE ((uint16_t)0xffff - BUFFER_PADDING_SIZE)
#define MAGIC_NO 0xDDBADDBA
#define BUF_STATUS_FREE 0
diff --git a/src/gki/common/gki_time.c b/src/gki/common/gki_time.c
index 752db6d..a53ee80 100644
--- a/src/gki/common/gki_time.c
+++ b/src/gki/common/gki_time.c
@@ -27,8 +27,10 @@
#endif
-#define GKI_NO_NEW_TMRS_STARTED (0x7fffffffL) /* Largest signed positive timer count */
-#define GKI_UNUSED_LIST_ENTRY (0x80000000L) /* Marks an unused timer list entry (initial value) */
+/* Largest signed positive timer count */
+#define GKI_NO_NEW_TMRS_STARTED (0x7fffffffL)
+/* Marks an unused timer list entry (initial value) */
+#define GKI_UNUSED_LIST_ENTRY (0x80000000L)
#define GKI_MAX_INT32 (0x7fffffffL)
/*******************************************************************************
diff --git a/src/hal/include/nci_defs.h b/src/hal/include/nci_defs.h
index 612c89f..0602612 100644
--- a/src/hal/include/nci_defs.h
+++ b/src/hal/include/nci_defs.h
@@ -42,11 +42,14 @@
#define NCI_MAX_CTRL_SIZE 0xFF/* max control message size */
#define NCI_CTRL_INIT_SIZE 32 /* initial NFCC control payload size */
#define NCI_MAX_VSC_SIZE 0xFF
-#define NCI_VSC_MSG_HDR_SIZE 12 /* NCI header (3) + callback function pointer(8; use 8 to be safe) + HCIT (1 byte) */
+/* NCI header (3) + callback function pointer(8; use 8 to be safe) + HCIT (1 byte) */
+#define NCI_VSC_MSG_HDR_SIZE 12
#define NCI_TL_SIZE 2
-#define NCI_ISO_DEP_MAX_INFO 253 /* Max frame size (256) - Prologue (1) - Epilogue (2) in ISO-DEP, CID and NAD are not used*/
-#define NCI_NFC_DEP_MAX_DATA 251 /* Max payload (254) - Protocol Header (3) in NFC-DEP, DID and NAD are not used */
+/* Max frame size (256) - Prologue (1) - Epilogue (2) in ISO-DEP, CID and NAD are not used*/
+#define NCI_ISO_DEP_MAX_INFO 253
+/* Max payload (254) - Protocol Header (3) in NFC-DEP, DID and NAD are not used */
+#define NCI_NFC_DEP_MAX_DATA 251
/* NCI Command and Notification Format:
* 3 byte message header:
@@ -247,7 +250,8 @@
#define NCI_CORE_PARAM_SIZE_INIT_RSP 0x11
#define NCI_CORE_INIT_RSP_OFFSET_NUM_INTF 0x05
-#define NCI_CORE_PARAM_SIZE_SET_CONFIG_RSP 0x02 /* Status (1 octet) and number of params */
+/* Status (1 octet) and number of params */
+#define NCI_CORE_PARAM_SIZE_SET_CONFIG_RSP 0x02
/* octet 0 */
@@ -270,7 +274,8 @@
#define NCI_CORE_PARAM_SIZE_CON_CREATE 0x02 /* handle, num_tlv, (tlv) */
-#define NCI_CORE_PARAM_SIZE_CON_CREATE_RSP 0x04 /* status, size, credits, conn_id */
+/* status, size, credits, conn_id */
+#define NCI_CORE_PARAM_SIZE_CON_CREATE_RSP 0x04
#define NCI_CON_CREATE_TAG_EE_INTF 0x00 /* old */
#define NCI_CON_CREATE_TAG_RF_DISC_ID 0x00
#define NCI_CON_CREATE_TAG_NFCEE_VAL 0x01
@@ -278,20 +283,28 @@
#define NCI_CORE_PARAM_SIZE_CON_CLOSE 0x01 /* Conn ID (1 octet) */
#define NCI_CORE_PARAM_SIZE_CON_CLOSE_RSP 0x01 /* Status (1 octet) */
-#define NCI_CORE_PARAM_SIZE_RF_FIELD_NTF 0x01 /* RF Field Status (1 octet) */
+/* RF Field Status (1 octet) */
+#define NCI_CORE_PARAM_SIZE_RF_FIELD_NTF 0x01
-#define NCI_RESET_TYPE_KEEP_CFG 0x00 /* Keep the NCI configuration (if possible) and perform NCI initialization. */
-#define NCI_RESET_TYPE_RESET_CFG 0x01 /* Reset the NCI configuration, and perform NCI initialization. */
+/* Keep the NCI configuration (if possible) and perform NCI initialization. */
+#define NCI_RESET_TYPE_KEEP_CFG 0x00
+/* Reset the NCI configuration, and perform NCI initialization. */
+#define NCI_RESET_TYPE_RESET_CFG 0x01
-#define NCI_RESET_STATUS_KEPT_CFG 0x00 /* NCI Configuration has been kept */
-#define NCI_RESET_STATUS_RESET_CFG 0x01 /* NCI Configuration has been reset */
+/* NCI Configuration has been kept */
+#define NCI_RESET_STATUS_KEPT_CFG 0x00
+/* NCI Configuration has been reset */
+#define NCI_RESET_STATUS_RESET_CFG 0x01
-#define NCI_RF_STS_NO_REMOTE 0x00 /* No operating field generated by remote device */
-#define NCI_RF_STS_REMOTE 0x01 /* Operating field generated by remote device */
+/* No operating field generated by remote device */
+#define NCI_RF_STS_NO_REMOTE 0x00
+/* Operating field generated by remote device */
+#define NCI_RF_STS_REMOTE 0x01
#define NCI_PARAM_SIZE_DISCOVER_NFCEE 0x01 /* Discovery Action (1 octet) */
-#define NCI_PARAM_SIZE_DISCOVER_NFCEE_RSP 0x02 /* Status (1 octet)Number of NFCEEs (1 octet) */
+/* Status (1 octet)Number of NFCEEs (1 octet) */
+#define NCI_PARAM_SIZE_DISCOVER_NFCEE_RSP 0x02
#define NCI_DISCOVER_ACTION_DISABLE 0
#define NCI_DISCOVER_ACTION_ENABLE 1
@@ -316,11 +329,14 @@
#define NCI_NFCEE_STS_REMOVED 0x02
#define NCI_NUM_NFCEE_STS 3
-#define NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET 0x02 /* Logical Target ID (1 octet)NFCEE Mode (1 octet) */
+/* Logical Target ID (1 octet)NFCEE Mode (1 octet) */
+#define NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET 0x02
#define NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET_RSP 0x01 /* Status (1 octet) */
-#define NCI_NFCEE_MD_DEACTIVATE 0x00 /* Deactivate the connected NFCEE */
-#define NCI_NFCEE_MD_ACTIVATE 0x01 /* Activate the connected NFCEE */
+/* Deactivate the connected NFCEE */
+#define NCI_NFCEE_MD_DEACTIVATE 0x00
+/* Activate the connected NFCEE */
+#define NCI_NFCEE_MD_ACTIVATE 0x01
#define NCI_NUM_NFCEE_MODE 2
/**********************************************
@@ -408,17 +424,23 @@
#define NCI_EE_ACT_TAG_DATA 0xC3 /* hex data for app */
#define NCI_EE_ACT_TAG_DEBUG 0xC4 /* debug trace */
-#define NCI_ROUTE_TAG_TECH 0x00 /* Technology based routing */
-#define NCI_ROUTE_TAG_PROTO 0x01 /* Protocol based routing */
+/* Technology based routing */
+#define NCI_ROUTE_TAG_TECH 0x00
+/* Protocol based routing */
+#define NCI_ROUTE_TAG_PROTO 0x01
#define NCI_ROUTE_TAG_AID 0x02 /* AID routing */
#define NCI_ROUTE_PWR_STATE_ON 0x01 /* The device is on */
-#define NCI_ROUTE_PWR_STATE_SWITCH_OFF 0x02 /* The device is switched off */
-#define NCI_ROUTE_PWR_STATE_BATT_OFF 0x04 /* The device's battery is removed */
+/* The device is switched off */
+#define NCI_ROUTE_PWR_STATE_SWITCH_OFF 0x02
+/* The device's battery is removed */
+#define NCI_ROUTE_PWR_STATE_BATT_OFF 0x04
-#define NCI_NFCEE_TAG_HW_ID 0x00 /* Hardware / Registration Identification */
+/* Hardware / Registration Identification */
+#define NCI_NFCEE_TAG_HW_ID 0x00
#define NCI_NFCEE_TAG_ATR_BYTES 0x01 /* ATR Bytes */
-#define NCI_NFCEE_TAG_T3T_INFO 0x02 /* T3T Command Set Interface Supplementary Info */
+/* T3T Command Set Interface Supplementary Info */
+#define NCI_NFCEE_TAG_T3T_INFO 0x02
#define NCI_NFCEE_TAG_HCI_HOST_ID 0xA0 /* HCI host ID */
#define NCI_DISCOVER_NTF_LAST 0x00
@@ -477,7 +499,8 @@
#define NCI_PARAM_ID_LF_T3T_ID16 0x4F
#define NCI_PARAM_ID_LF_PROTOCOL 0x50
#define NCI_PARAM_ID_LF_T3T_PMM 0x51
-#define NCI_PARAM_ID_LF_T3T_MAX 0x52 /* max num of LF_T3T_ID supported by NFCC (1 for now) */
+/* max num of LF_T3T_ID supported by NFCC (1 for now) */
+#define NCI_PARAM_ID_LF_T3T_MAX 0x52
#define NCI_PARAM_ID_LF_T3T_FLAGS2 0x53
#define NCI_PARAM_ID_LF_CON_BITR_F 0x54
#define NCI_PARAM_ID_FWI 0x58
@@ -496,13 +519,20 @@
/* NCI_PARAM_ID_HOST_LISTEN_MASK (byte1 for DH, byte2 for UICC) */
-#define NCI_LISTEN_MASK_A 0x01 /* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE & 0x0F)) */
-#define NCI_LISTEN_MASK_B 0x02 /* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE & 0x0F)) */
-#define NCI_LISTEN_MASK_F 0x04 /* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE & 0x0F)) */
-#define NCI_LISTEN_MASK_A_ACTIVE 0x08 /* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE & 0x0F)) */
-#define NCI_LISTEN_MASK_B_PRIME 0x10 /* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_B_PRIME & 0x0F)) */
-#define NCI_LISTEN_MASK_F_ACTIVE 0x20 /* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE & 0x0F)) */
-#define NCI_LISTEN_MASK_ISO15693 0x40 /* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_ISO15693 & 0x0F)) */
+/* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE & 0x0F)) */
+#define NCI_LISTEN_MASK_A 0x01
+/* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE & 0x0F)) */
+#define NCI_LISTEN_MASK_B 0x02
+/* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE & 0x0F)) */
+#define NCI_LISTEN_MASK_F 0x04
+/* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE & 0x0F)) */
+#define NCI_LISTEN_MASK_A_ACTIVE 0x08
+/* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_B_PRIME & 0x0F)) */
+#define NCI_LISTEN_MASK_B_PRIME 0x10
+/* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE & 0x0F)) */
+#define NCI_LISTEN_MASK_F_ACTIVE 0x20
+/* (0x01 << (NCI_DISCOVERY_TYPE_LISTEN_ISO15693 & 0x0F)) */
+#define NCI_LISTEN_MASK_ISO15693 0x40
/* Type A Parameters */
#define NCI_PARAM_PLATFORM_T1T 0x0C
diff --git a/src/hal/include/nfc_types.h b/src/hal/include/nfc_types.h
index d4a017c..14e2774 100644
--- a/src/hal/include/nfc_types.h
+++ b/src/hal/include/nfc_types.h
@@ -41,12 +41,18 @@
*****************************************************************************/
/* NFC_HAL_TASK event messages */
-#define NFC_HAL_EVT_TO_NFC_NCI 0x0100 /* NCI message for sending to NFCC */
-#define NFC_HAL_EVT_POST_CORE_RESET 0x0200 /* Request to start NCIT quick timer */
-#define NFC_HAL_EVT_TO_START_QUICK_TIMER 0x0300 /* Request to start chip-specific config */
-#define NFC_HAL_EVT_HCI 0x0400 /* NCI message for hci persistency data */
-#define NFC_HAL_EVT_PRE_DISCOVER 0x0500 /* NCI message to issue prediscover config */
-#define NFC_HAL_EVT_CONTROL_GRANTED 0x0600 /* permission to send commands queued in HAL*/
+/* NCI message for sending to NFCC */
+#define NFC_HAL_EVT_TO_NFC_NCI 0x0100
+/* Request to start NCIT quick timer */
+#define NFC_HAL_EVT_POST_CORE_RESET 0x0200
+/* Request to start chip-specific config */
+#define NFC_HAL_EVT_TO_START_QUICK_TIMER 0x0300
+/* NCI message for hci persistency data */
+#define NFC_HAL_EVT_HCI 0x0400
+/* NCI message to issue prediscover config */
+#define NFC_HAL_EVT_PRE_DISCOVER 0x0500
+/* permission to send commands queued in HAL*/
+#define NFC_HAL_EVT_CONTROL_GRANTED 0x0600
/* NFC_HAL_TASK sub event messages */
#define NFC_HAL_HCI_RSP_NV_READ_EVT (0x01 | NFC_HAL_EVT_HCI)
@@ -55,9 +61,12 @@
/* Event masks for NFC_TASK messages */
-#define NFC_EVT_TO_NFC_NCI 0x4000 /* NCI message for sending to host stack */
-#define NFC_EVT_TO_NFC_ERR 0x4100 /* Error notification to NFC Task */
-#define NFC_EVT_TO_NFC_MSGS 0x4200 /* Messages between NFC and NCI task */
+/* NCI message for sending to host stack */
+#define NFC_EVT_TO_NFC_NCI 0x4000
+/* Error notification to NFC Task */
+#define NFC_EVT_TO_NFC_ERR 0x4100
+/* Messages between NFC and NCI task */
+#define NFC_EVT_TO_NFC_MSGS 0x4200
/*****************************************************************************
** Macros to get and put bytes to and from a stream (Little Endian format).
@@ -132,12 +141,18 @@
** Define trace levels
*****************************************************************************/
-#define BT_TRACE_LEVEL_NONE 0 /* No trace messages to be generated */
-#define BT_TRACE_LEVEL_ERROR 1 /* Error condition trace messages */
-#define BT_TRACE_LEVEL_WARNING 2 /* Warning condition trace messages */
-#define BT_TRACE_LEVEL_API 3 /* API traces */
-#define BT_TRACE_LEVEL_EVENT 4 /* Debug messages for events */
-#define BT_TRACE_LEVEL_DEBUG 5 /* Full debug messages */
+/* No trace messages to be generated */
+#define BT_TRACE_LEVEL_NONE 0
+/* Error condition trace messages */
+#define BT_TRACE_LEVEL_ERROR 1
+/* Warning condition trace messages */
+#define BT_TRACE_LEVEL_WARNING 2
+/* API traces */
+#define BT_TRACE_LEVEL_API 3
+/* Debug messages for events */
+#define BT_TRACE_LEVEL_EVENT 4
+/* Full debug messages */
+#define BT_TRACE_LEVEL_DEBUG 5
#define TRACE_CTRL_GENERAL 0x00000000
diff --git a/src/hal/int/nfc_brcm_defs.h b/src/hal/int/nfc_brcm_defs.h
index 6077469..8007aaf 100644
--- a/src/hal/int/nfc_brcm_defs.h
+++ b/src/hal/int/nfc_brcm_defs.h
@@ -67,7 +67,8 @@
#define NCI_MSG_UICC_READER_ACTION 0x0A
#define NCI_MSG_SET_PPSE_RESPONSE 0x0B
#define NCI_MSG_PRBS_SET 0x0C
-#define NCI_MSG_RESET_ALL_UICC_CFG 0x0D /* reset HCI network/close all pipes (S,D) register */
+/* reset HCI network/close all pipes (S,D) register */
+#define NCI_MSG_RESET_ALL_UICC_CFG 0x0D
#define NCI_MSG_GET_NFCEE_INFO 0x0E
#define NCI_MSG_DISABLE_INIT_CHECK 0x0F
#define NCI_MSG_ANTENNA_SELF_TEST 0x10
@@ -147,12 +148,15 @@
#define NCI_GET_PATCH_VERSION_NVM_OFFSET 37
-#define NCI_NFCC_PIPE_INFO_NV_SIZE 24 /* Static and dynamic pipe id and status for each pipe to uicc0 and uicc1. */
+/* Static and dynamic pipe id and status for each pipe to uicc0 and uicc1. */
+#define NCI_NFCC_PIPE_INFO_NV_SIZE 24
#define NCI_PERSONALITY_SLOT_SIZE 19
#define NCI_DYNAMIC_PIPE_SIZE 8
-#define NCI_SWP_INTERFACE_TYPE 0xFF /* Type of TLV in NCI_MSG_HCI_NETWK */
-#define NCI_HCI_GATE_TYPE 0xFE /* Type of TLV in NCI_MSG_HCI_NETWK */
+/* Type of TLV in NCI_MSG_HCI_NETWK */
+#define NCI_SWP_INTERFACE_TYPE 0xFF
+/* Type of TLV in NCI_MSG_HCI_NETWK */
+#define NCI_HCI_GATE_TYPE 0xFE
/* Secure Patch Download definitions (patch type definitions) */
#define NCI_SPD_TYPE_HEADER 0x00
@@ -184,7 +188,8 @@
#define NCI_INTERFACE_VS_MIFARE 0x80
#define NCI_INTERFACE_VS_CALYPSO_CE 0x81
#define NCI_INTERFACE_VS_T2T_CE 0x82 /* for Card Emulation side */
-#define NCI_INTERFACE_VS_15693 0x83 /* for both Reader/Writer and Card Emulation side */
+/* for both Reader/Writer and Card Emulation side */
+#define NCI_INTERFACE_VS_15693 0x83
#define NCI_INTERFACE_VS_T1T_CE 0x84 /* for Card Emulation side */
/**********************************************
@@ -223,7 +228,8 @@
#define NCI_PARAM_ID_UICC_RDR_PRIORITY 0xBD
#define NCI_PARAM_ID_GUARD_TIME 0xBE
#define NCI_PARAM_ID_STDCONFIG 0xBF /* dont not use this config item */
-#define NCI_PARAM_ID_PROPCFG 0xC0 /* dont not use this config item */
+/* dont not use this config item */
+#define NCI_PARAM_ID_PROPCFG 0xC0
#define NCI_PARAM_ID_MAXTRY2ACTIVATE 0xC1
#define NCI_PARAM_ID_SWPCFG 0xC2
#define NCI_PARAM_ID_CLF_LPM_CFG 0xC3
diff --git a/src/hal/int/nfc_hal_int.h b/src/hal/int/nfc_hal_int.h
index c3bda53..d88e3b9 100644
--- a/src/hal/int/nfc_hal_int.h
+++ b/src/hal/int/nfc_hal_int.h
@@ -66,10 +66,14 @@
#define NFC_HAL_TTYPE_NFCC_ENABLE 2
/* NFC HAL Task Wait Response flag */
-#define NFC_HAL_WAIT_RSP_CMD 0x10 /* wait response on an NCI command */
-#define NFC_HAL_WAIT_RSP_VSC 0x20 /* wait response on an NCI vendor specific command */
-#define NFC_HAL_WAIT_RSP_PROP 0x40 /* wait response on a proprietary command */
-#define NFC_HAL_WAIT_RSP_NONE 0x00 /* not waiting for anything */
+/* wait response on an NCI command */
+#define NFC_HAL_WAIT_RSP_CMD 0x10
+/* wait response on an NCI vendor specific command */
+#define NFC_HAL_WAIT_RSP_VSC 0x20
+/* wait response on a proprietary command */
+#define NFC_HAL_WAIT_RSP_PROP 0x40
+/* not waiting for anything */
+#define NFC_HAL_WAIT_RSP_NONE 0x00
typedef uint8_t tNFC_HAL_WAIT_RSP;
@@ -87,9 +91,12 @@
#define NFC_HAL_HCI_WHITELIST_INDEX 0x03
#define NFC_HAL_HCI_ADMIN_PIPE 0x01
-#define NFC_HAL_HCI_HOST_ID_UICC0 0x02 /* Host ID for UICC 0 */
-#define NFC_HAL_HCI_HOST_ID_UICC1 0x03 /* Host ID for UICC 1 */
-#define NFC_HAL_HCI_HOST_ID_UICC2 0x04 /* Host ID for UICC 2 */
+/* Host ID for UICC 0 */
+#define NFC_HAL_HCI_HOST_ID_UICC0 0x02
+/* Host ID for UICC 1 */
+#define NFC_HAL_HCI_HOST_ID_UICC1 0x03
+/* Host ID for UICC 2 */
+#define NFC_HAL_HCI_HOST_ID_UICC2 0x04
#define NFC_HAL_HCI_COMMAND_TYPE 0x00
#define NFC_HAL_HCI_RESPONSE_TYPE 0x02
@@ -99,10 +106,14 @@
#endif
/* Flag defintions for tNFC_HAL_NVM */
-#define NFC_HAL_NVM_FLAGS_NO_NVM 0x01 /* No NVM available */
-#define NFC_HAL_NVM_FLAGS_LPM_BAD 0x02 /* FPM patch in NVM failed CRC check */
-#define NFC_HAL_NVM_FLAGS_FPM_BAD 0x04 /* LPM patch in NVM failed CRC check */
-#define NFC_HAL_NVM_FLAGS_PATCH_PRESENT 0x08 /* Patch is present in NVM */
+/* No NVM available */
+#define NFC_HAL_NVM_FLAGS_NO_NVM 0x01
+/* FPM patch in NVM failed CRC check */
+#define NFC_HAL_NVM_FLAGS_LPM_BAD 0x02
+/* LPM patch in NVM failed CRC check */
+#define NFC_HAL_NVM_FLAGS_FPM_BAD 0x04
+/* Patch is present in NVM */
+#define NFC_HAL_NVM_FLAGS_PATCH_PRESENT 0x08
/* NFC HAL transport configuration */
typedef struct
@@ -113,9 +124,11 @@
} tNFC_HAL_TRANS_CFG;
#ifdef TESTER
-#define NFC_HAL_TRANS_CFG_QUALIFIER /* For Insight, ncit_cfg is runtime-configurable */
+/* For Insight, ncit_cfg is runtime-configurable */
+#define NFC_HAL_TRANS_CFG_QUALIFIER
#else
-#define NFC_HAL_TRANS_CFG_QUALIFIER const /* For all other platforms, ncit_cfg is constant */
+/* For all other platforms, ncit_cfg is constant */
+#define NFC_HAL_TRANS_CFG_QUALIFIER const
#endif
extern NFC_HAL_TRANS_CFG_QUALIFIER tNFC_HAL_TRANS_CFG nfc_hal_trans_cfg;
diff --git a/src/hal/int/nfc_hal_int_api.h b/src/hal/int/nfc_hal_int_api.h
index 4ce4db5..c12e0b6 100644
--- a/src/hal/int/nfc_hal_int_api.h
+++ b/src/hal/int/nfc_hal_int_api.h
@@ -69,12 +69,17 @@
** Low Power Mode definitions
*****************************************************************************/
-#define NFC_HAL_LP_SNOOZE_MODE_NONE NFC_SNOOZE_MODE_NONE /* Snooze mode disabled */
-#define NFC_HAL_LP_SNOOZE_MODE_UART NFC_SNOOZE_MODE_UART /* Snooze mode for UART */
-#define NFC_HAL_LP_SNOOZE_MODE_SPI_I2C NFC_SNOOZE_MODE_SPI_I2C /* Snooze mode for SPI/I2C */
+/* Snooze mode disabled */
+#define NFC_HAL_LP_SNOOZE_MODE_NONE NFC_SNOOZE_MODE_NONE
+/* Snooze mode for UART */
+#define NFC_HAL_LP_SNOOZE_MODE_UART NFC_SNOOZE_MODE_UART
+/* Snooze mode for SPI/I2C */
+#define NFC_HAL_LP_SNOOZE_MODE_SPI_I2C NFC_SNOOZE_MODE_SPI_I2C
-#define NFC_HAL_LP_ACTIVE_LOW NFC_SNOOZE_ACTIVE_LOW /* high to low voltage is asserting */
-#define NFC_HAL_LP_ACTIVE_HIGH NFC_SNOOZE_ACTIVE_HIGH /* low to high voltage is asserting */
+/* high to low voltage is asserting */
+#define NFC_HAL_LP_ACTIVE_LOW NFC_SNOOZE_ACTIVE_LOW
+/* low to high voltage is asserting */
+#define NFC_HAL_LP_ACTIVE_HIGH NFC_SNOOZE_ACTIVE_HIGH
/*****************************************************************************
** Patch RAM Constants
diff --git a/src/hal/int/nfc_hal_nv_co.h b/src/hal/int/nfc_hal_nv_co.h
index 7c0a31f..917bf4b 100644
--- a/src/hal/int/nfc_hal_nv_co.h
+++ b/src/hal/int/nfc_hal_nv_co.h
@@ -48,10 +48,12 @@
#define NFC_HAL_NV_CO_ENOTEMPTY 0x03
#define NFC_HAL_NV_CO_EOF 0x04
#define NFC_HAL_NV_CO_EODIR 0x05
-#define NFC_HAL_NV_CO_ENOSPACE 0x06 /* Returned in nfa_nv_ci_open if no room */
+/* Returned in nfa_nv_ci_open if no room */
+#define NFC_HAL_NV_CO_ENOSPACE 0x06
#define NFC_HAL_NV_CO_EIS_DIR 0x07
#define NFC_HAL_NV_CO_RESUME 0x08 /* used in nfa_nv_ci_open, on resume */
-#define NFC_HAL_NV_CO_NONE 0x09 /* used in nfa_nv_ci_open, on resume (no file to resume) */
+/* used in nfa_nv_ci_open, on resume (no file to resume) */
+#define NFC_HAL_NV_CO_NONE 0x09
typedef uint8_t tNFC_HAL_NV_CO_STATUS;
diff --git a/src/include/bt_types.h b/src/include/bt_types.h
index 2cdef0e..50f7287 100644
--- a/src/include/bt_types.h
+++ b/src/include/bt_types.h
@@ -30,19 +30,23 @@
#define TRACE_LAYER_HCI 0x00070000
#define TRACE_LAYER_GKI 0x001a0000
#define TRACE_LAYER_NFC 0x00270000
-#define TRACE_LAYER_NCI 0x00280000 /*it's overwritten in nfc_types.h*/
+/*it's overwritten in nfc_types.h*/
+#define TRACE_LAYER_NCI 0x00280000
#define TRACE_LAYER_LLCP 0x00290000
#define TRACE_LAYER_NDEF 0x002a0000
#define TRACE_LAYER_RW 0x002b0000
#define TRACE_LAYER_CE 0x002c0000
#define TRACE_LAYER_P2P 0x002d0000
#define TRACE_LAYER_NFA 0x00300000
-#define TRACE_LAYER_HAL 0x00310000 /*it's overwritten in nfc_types.h*/
+/*it's overwritten in nfc_types.h*/
+#define TRACE_LAYER_HAL 0x00310000
#define TRACE_LAYER_MAX_NUM 0x0032
-#define BT_EVT_TO_NFC_NCI 0x4000 /* NCI Command, Notification or Data*/
+/* NCI Command, Notification or Data*/
+#define BT_EVT_TO_NFC_NCI 0x4000
#define BT_EVT_TO_NFC_NCI_VS 0x4200 /* Vendor specific message */
-#define BT_EVT_TO_NFC_MSGS 0x4300 /* messages between NFC and NCI task */
+/* messages between NFC and NCI task */
+#define BT_EVT_TO_NFC_MSGS 0x4300
/* start timer */
#define BT_EVT_TO_START_TIMER 0x3c00
diff --git a/src/include/gki_target.h b/src/include/gki_target.h
index 21b11f2..9489824 100644
--- a/src/include/gki_target.h
+++ b/src/include/gki_target.h
@@ -218,7 +218,8 @@
/* The number of buffers in buffer pool 4. */
#ifndef GKI_BUF4_MAX
-#define GKI_BUF4_MAX 96 /* (OBX_NUM_SERVERS + OBX_NUM_CLIENTS) */
+/* (OBX_NUM_SERVERS + OBX_NUM_CLIENTS) */
+#define GKI_BUF4_MAX 96
#endif
/* The ID of buffer pool 4. */
diff --git a/src/include/nfc_target.h b/src/include/nfc_target.h
index 086a86b..5260419 100644
--- a/src/include/nfc_target.h
+++ b/src/include/nfc_target.h
@@ -266,7 +266,8 @@
/* RW Type 2 Tag timeout for each API call, in ms */
#ifndef RW_T2T_TOUT_RESP
-#define RW_T2T_TOUT_RESP 150 /* Android requires 150 instead of 100 for presence-check*/
+/* Android requires 150 instead of 100 for presence-check*/
+#define RW_T2T_TOUT_RESP 150
#endif
/* RW Type 2 Tag timeout for each API call, in ms */
@@ -276,7 +277,8 @@
/* RW Type 3 Tag timeout for each API call, in ms */
#ifndef RW_T3T_TOUT_RESP
-#define RW_T3T_TOUT_RESP 100 /* NFC-Android will use 100 instead of 75 for T3t presence-check */
+/* NFC-Android will use 100 instead of 75 for T3t presence-check */
+#define RW_T3T_TOUT_RESP 100
#endif
/* CE Type 3 Tag maximum response timeout index (for check and update, used in SENSF_RES) */
@@ -368,7 +370,8 @@
/* Link Timeout, LTO */
#ifndef LLCP_LTO_VALUE
-#define LLCP_LTO_VALUE 1000 /* Default is 100ms. It should be sufficiently larger than RWT */
+/* Default is 100ms. It should be sufficiently larger than RWT */
+#define LLCP_LTO_VALUE 1000
#endif
/*
@@ -421,7 +424,8 @@
/* Response Waiting Time */
#ifndef LLCP_WAITING_TIME
-#define LLCP_WAITING_TIME 7 /* its scaled value should be less than LTO */
+/* its scaled value should be less than LTO */
+#define LLCP_WAITING_TIME 7
#endif
/* Options Parameters */
@@ -559,7 +563,8 @@
/* Presence check option: 0x01: use sleep/wake for none-NDEF ISO-DEP tags */
#ifndef NFA_DM_PRESENCE_CHECK_OPTION
-#define NFA_DM_PRESENCE_CHECK_OPTION 0x03 /* !!!!! Android needs value 3 */
+/* !!!!! Android needs value 3 */
+#define NFA_DM_PRESENCE_CHECK_OPTION 0x03
#endif
/* Maximum time to wait for presence check response */
@@ -589,7 +594,8 @@
#endif
#ifndef NFA_SNEP_INCLUDED
-#define NFA_SNEP_INCLUDED FALSE /* Android must use FALSE to exclude SNEP */
+/* Android must use FALSE to exclude SNEP */
+#define NFA_SNEP_INCLUDED FALSE
#endif
/* Max acceptable length */
@@ -619,7 +625,8 @@
/* Max number of NFCEE supported */
#ifndef NFA_EE_MAX_EE_SUPPORTED
-#define NFA_EE_MAX_EE_SUPPORTED 4 /* Modified for NFC-A until we add dynamic support */
+/* Modified for NFC-A until we add dynamic support */
+#define NFA_EE_MAX_EE_SUPPORTED 4
#endif
/* Maximum number of AID entries per target_handle */
diff --git a/src/nfa/include/nfa_api.h b/src/nfa/include/nfa_api.h
index 484fad0..981c5d7 100644
--- a/src/nfa/include/nfa_api.h
+++ b/src/nfa/include/nfa_api.h
@@ -108,9 +108,12 @@
/* Another Tag command is already in progress */
#define NFA_STATUS_BUSY NFC_STATUS_BUSY
-#define NFA_STATUS_BAD_LENGTH NFC_STATUS_BAD_LENGTH /* data len exceeds MIU */
-#define NFA_STATUS_BAD_HANDLE NFC_STATUS_BAD_HANDLE /* invalid handle */
-#define NFA_STATUS_CONGESTED NFC_STATUS_CONGESTED /* congested */
+/* data len exceeds MIU */
+#define NFA_STATUS_BAD_LENGTH NFC_STATUS_BAD_LENGTH
+/* invalid handle */
+#define NFA_STATUS_BAD_HANDLE NFC_STATUS_BAD_HANDLE
+/* congested */
+#define NFA_STATUS_CONGESTED NFC_STATUS_CONGESTED
typedef uint8_t tNFA_STATUS;
/* Handle for NFA registrations and connections */
@@ -119,14 +122,22 @@
/* NFA Handle definitions */
/* The upper byte of NFA_HANDLE signifies the handle group */
-#define NFA_HANDLE_GROUP_CONNECTION 0x0100 /* Connection handles */
-#define NFA_HANDLE_GROUP_NDEF_HANDLER 0x0200 /* NDEF Type Handler handles */
-#define NFA_HANDLE_GROUP_CE 0x0300 /* DH Card Emulation handles */
-#define NFA_HANDLE_GROUP_EE 0x0400 /* Handles to identify NFCEE */
-#define NFA_HANDLE_GROUP_P2P 0x0500 /* P2P handles */
-#define NFA_HANDLE_GROUP_SNEP 0x0700 /* SNEP handles */
-#define NFA_HANDLE_GROUP_HCI 0x0800 /* HCI handles */
-#define NFA_HANDLE_GROUP_LOCAL_NDEF 0x0900 /* Local NDEF message handle */
+/* Connection handles */
+#define NFA_HANDLE_GROUP_CONNECTION 0x0100
+/* NDEF Type Handler handles */
+#define NFA_HANDLE_GROUP_NDEF_HANDLER 0x0200
+/* DH Card Emulation handles */
+#define NFA_HANDLE_GROUP_CE 0x0300
+/* Handles to identify NFCEE */
+#define NFA_HANDLE_GROUP_EE 0x0400
+/* P2P handles */
+#define NFA_HANDLE_GROUP_P2P 0x0500
+/* SNEP handles */
+#define NFA_HANDLE_GROUP_SNEP 0x0700
+/* HCI handles */
+#define NFA_HANDLE_GROUP_HCI 0x0800
+/* Local NDEF message handle */
+#define NFA_HANDLE_GROUP_LOCAL_NDEF 0x0900
#define NFA_HANDLE_GROUP_MASK 0xFF00
#define NFA_HANDLE_MASK 0x00FF
@@ -140,9 +151,12 @@
#define NFA_TECHNOLOGY_MASK_ISO15693 0x08 /* Proprietary Technology */
#define NFA_TECHNOLOGY_MASK_B_PRIME 0x10 /* Proprietary Technology */
#define NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
-#define NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40 /* NFC Technology A active mode */
-#define NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80 /* NFC Technology F active mode */
-#define NFA_TECHNOLOGY_MASK_ALL 0xFF /* All supported technologies */
+/* NFC Technology A active mode */
+#define NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40
+/* NFC Technology F active mode */
+#define NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80
+/* All supported technologies */
+#define NFA_TECHNOLOGY_MASK_ALL 0xFF
typedef uint8_t tNFA_TECHNOLOGY_MASK;
/* Definitions for NFC protocol for RW, CE and P2P APIs */
@@ -174,20 +188,32 @@
/* NFA_DM callback events */
-#define NFA_DM_ENABLE_EVT 0 /* Result of NFA_Enable */
-#define NFA_DM_DISABLE_EVT 1 /* Result of NFA_Disable */
-#define NFA_DM_SET_CONFIG_EVT 2 /* Result of NFA_SetConfig */
-#define NFA_DM_GET_CONFIG_EVT 3 /* Result of NFA_GetConfig */
-#define NFA_DM_PWR_MODE_CHANGE_EVT 4 /* Result of NFA_PowerOffSleepMode */
+/* Result of NFA_Enable */
+#define NFA_DM_ENABLE_EVT 0
+/* Result of NFA_Disable */
+#define NFA_DM_DISABLE_EVT 1
+/* Result of NFA_SetConfig */
+#define NFA_DM_SET_CONFIG_EVT 2
+/* Result of NFA_GetConfig */
+#define NFA_DM_GET_CONFIG_EVT 3
+/* Result of NFA_PowerOffSleepMode */
+#define NFA_DM_PWR_MODE_CHANGE_EVT 4
#define NFA_DM_RF_FIELD_EVT 5 /* Status of RF Field */
-#define NFA_DM_NFCC_TIMEOUT_EVT 6 /* NFCC is not responding */
-#define NFA_DM_NFCC_TRANSPORT_ERR_EVT 7 /* NCI Tranport error */
+/* NFCC is not responding */
+#define NFA_DM_NFCC_TIMEOUT_EVT 6
+/* NCI Tranport error */
+#define NFA_DM_NFCC_TRANSPORT_ERR_EVT 7
-#define NFA_T1T_HR_LEN T1T_HR_LEN /* T1T HR length */
-#define NFA_MAX_UID_LEN TAG_MAX_UID_LEN /* Max UID length of T1/T2 */
-#define NFA_T1T_UID_LEN T1T_UID_LEN /* T1T UID length */
-#define NFA_T1T_CMD_UID_LEN T1T_CMD_UID_LEN /* UID len for T1T cmds */
-#define NFA_T2T_UID_LEN T2T_UID_LEN /* T2T UID length */
+/* T1T HR length */
+#define NFA_T1T_HR_LEN T1T_HR_LEN
+/* Max UID length of T1/T2 */
+#define NFA_MAX_UID_LEN TAG_MAX_UID_LEN
+/* T1T UID length */
+#define NFA_T1T_UID_LEN T1T_UID_LEN
+/* UID len for T1T cmds */
+#define NFA_T1T_CMD_UID_LEN T1T_CMD_UID_LEN
+/* T2T UID length */
+#define NFA_T2T_UID_LEN T2T_UID_LEN
/* Tag is read only */
#define NFA_RW_NDEF_FL_READ_ONLY RW_NDEF_FL_READ_ONLY
@@ -271,19 +297,26 @@
/* NFC link/protocol discovery select response */
#define NFA_SELECT_RESULT_EVT 3
#define NFA_DEACTIVATE_FAIL_EVT 4 /* NFA_Deactivate failure */
-#define NFA_ACTIVATED_EVT 5 /* NFC link/protocol activated */
-#define NFA_DEACTIVATED_EVT 6 /* NFC link/protocol deactivated */
+/* NFC link/protocol activated */
+#define NFA_ACTIVATED_EVT 5
+/* NFC link/protocol deactivated */
+#define NFA_DEACTIVATED_EVT 6
#define NFA_TLV_DETECT_EVT 7 /* TLV Detection complete */
-#define NFA_NDEF_DETECT_EVT 8 /* NDEF Detection complete */
+/* NDEF Detection complete */
+#define NFA_NDEF_DETECT_EVT 8
#define NFA_DATA_EVT 9 /* Data message received */
#define NFA_SELECT_CPLT_EVT 10 /* Select completed */
#define NFA_READ_CPLT_EVT 11 /* Read completed */
#define NFA_WRITE_CPLT_EVT 12 /* Write completed */
#define NFA_LLCP_ACTIVATED_EVT 13 /* LLCP link is activated */
-#define NFA_LLCP_DEACTIVATED_EVT 14 /* LLCP link is deactivated */
-#define NFA_PRESENCE_CHECK_EVT 15 /* Response to NFA_RwPresenceCheck */
-#define NFA_FORMAT_CPLT_EVT 16 /* Tag Formating completed */
-#define NFA_I93_CMD_CPLT_EVT 17 /* ISO 15693 command completed */
+/* LLCP link is deactivated */
+#define NFA_LLCP_DEACTIVATED_EVT 14
+/* Response to NFA_RwPresenceCheck */
+#define NFA_PRESENCE_CHECK_EVT 15
+/* Tag Formating completed */
+#define NFA_FORMAT_CPLT_EVT 16
+/* ISO 15693 command completed */
+#define NFA_I93_CMD_CPLT_EVT 17
#define NFA_SET_TAG_RO_EVT 18 /* Tag set as Read only */
/* Result for NFA_RequestExclusiveRfControl */
#define NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT 19
@@ -293,9 +326,12 @@
#define NFA_CE_REGISTERED_EVT 21
/* DH Card emulation: AID or System code dereg'd */
#define NFA_CE_DEREGISTERED_EVT 22
-#define NFA_CE_DATA_EVT 23 /* DH Card emulation: data received event */
-#define NFA_CE_ACTIVATED_EVT 24 /* DH Card emulation: activation event */
-#define NFA_CE_DEACTIVATED_EVT 25 /* DH Card emulation: deactivation event */
+/* DH Card emulation: data received event */
+#define NFA_CE_DATA_EVT 23
+/* DH Card emulation: activation event */
+#define NFA_CE_ACTIVATED_EVT 24
+/* DH Card emulation: deactivation event */
+#define NFA_CE_DEACTIVATED_EVT 25
/* DH Card emulation: local NDEF configured */
#define NFA_CE_LOCAL_TAG_CONFIGURED_EVT 26
/* DH Card emulation: NDEF write started */
@@ -303,19 +339,26 @@
/* DH Card emulation: NDEF write completed */
#define NFA_CE_NDEF_WRITE_CPLT_EVT 28
#define NFA_CE_UICC_LISTEN_CONFIGURED_EVT 29 /* UICC Listen configured */
-#define NFA_RF_DISCOVERY_STARTED_EVT 30 /* RF Discovery started event */
-#define NFA_RF_DISCOVERY_STOPPED_EVT 31 /* RF Discovery stopped event */
+/* RF Discovery started event */
+#define NFA_RF_DISCOVERY_STARTED_EVT 30
+/* RF Discovery stopped event */
+#define NFA_RF_DISCOVERY_STOPPED_EVT 31
/* status of updating RF communication paramters */
#define NFA_UPDATE_RF_PARAM_RESULT_EVT 32
-#define NFA_RW_INTF_ERROR_EVT 34 /* RF Interface error event */
+/* RF Interface error event */
+#define NFA_RW_INTF_ERROR_EVT 34
/* status of setting P2P listen technologies */
#define NFA_SET_P2P_LISTEN_TECH_EVT 33
/* First packet received over LLCP link */
#define NFA_LLCP_FIRST_PACKET_RECEIVED_EVT 35
-#define NFA_LISTEN_ENABLED_EVT 36 /* Listening enabled event */
-#define NFA_LISTEN_DISABLED_EVT 37 /* Listening disabled event */
-#define NFA_P2P_PAUSED_EVT 38 /* P2P services paused event */
-#define NFA_P2P_RESUMED_EVT 39 /* P2P services resumed event */
+/* Listening enabled event */
+#define NFA_LISTEN_ENABLED_EVT 36
+/* Listening disabled event */
+#define NFA_LISTEN_DISABLED_EVT 37
+/* P2P services paused event */
+#define NFA_P2P_PAUSED_EVT 38
+/* P2P services resumed event */
+#define NFA_P2P_RESUMED_EVT 39
/* NFC deactivation type */
#define NFA_DEACTIVATE_TYPE_IDLE NFC_DEACTIVATE_TYPE_IDLE
diff --git a/src/nfa/include/nfa_ee_api.h b/src/nfa/include/nfa_ee_api.h
index 3ee6697..808f0ad 100644
--- a/src/nfa/include/nfa_ee_api.h
+++ b/src/nfa/include/nfa_ee_api.h
@@ -32,7 +32,8 @@
/*****************************************************************************
** Constants and data types
*****************************************************************************/
-#define NFA_MAX_AID_LEN NFC_MAX_AID_LEN /* 16 per ISO 7816 specification */
+/* 16 per ISO 7816 specification */
+#define NFA_MAX_AID_LEN NFC_MAX_AID_LEN
#define NFA_EE_HANDLE_DH (NFA_HANDLE_GROUP_EE|NFC_DH_ID)
/* NFA EE callback events */
@@ -61,17 +62,26 @@
typedef uint8_t tNFA_EE_EVT;
/* tNFA_NFCEE_INTERFACE values */
-#define NFA_EE_INTERFACE_APDU NFC_NFCEE_INTERFACE_APDU /* APDU Interface */
-#define NFA_EE_INTERFACE_HCI_ACCESS NFC_NFCEE_INTERFACE_HCI_ACCESS /* HCI Access Interface*/
-#define NFA_EE_INTERFACE_T3T NFC_NFCEE_INTERFACE_T3T /* T3T Command Interface*/
-#define NFA_EE_INTERFACE_TRANSPARENT NFC_NFCEE_INTERFACE_TRANSPARENT /* Transparent Interface*/
-#define NFA_EE_INTERFACE_PROPRIETARY NFC_NFCEE_INTERFACE_PROPRIETARY /* Proprietary */
+/* APDU Interface */
+#define NFA_EE_INTERFACE_APDU NFC_NFCEE_INTERFACE_APDU
+/* HCI Access Interface*/
+#define NFA_EE_INTERFACE_HCI_ACCESS NFC_NFCEE_INTERFACE_HCI_ACCESS
+/* T3T Command Interface*/
+#define NFA_EE_INTERFACE_T3T NFC_NFCEE_INTERFACE_T3T
+/* Transparent Interface*/
+#define NFA_EE_INTERFACE_TRANSPARENT NFC_NFCEE_INTERFACE_TRANSPARENT
+/* Proprietary */
+#define NFA_EE_INTERFACE_PROPRIETARY NFC_NFCEE_INTERFACE_PROPRIETARY
typedef uint8_t tNFA_EE_INTERFACE;
-#define NFA_EE_TAG_HW_ID NFC_NFCEE_TAG_HW_ID /* HW/Registration ID */
-#define NFA_EE_TAG_ATR_BYTES NFC_NFCEE_TAG_ATR_BYTES /* ATR Bytes */
-#define NFA_EE_TAG_T3T_INFO NFC_NFCEE_TAG_T3T_INFO /* T3T Supplement. Info */
-#define NFA_EE_TAG_HCI_HOST_ID NFC_NFCEE_TAG_HCI_HOST_ID /* Broadcom Proprietary */
+/* HW/Registration ID */
+#define NFA_EE_TAG_HW_ID NFC_NFCEE_TAG_HW_ID
+/* ATR Bytes */
+#define NFA_EE_TAG_ATR_BYTES NFC_NFCEE_TAG_ATR_BYTES
+/* T3T Supplement. Info */
+#define NFA_EE_TAG_T3T_INFO NFC_NFCEE_TAG_T3T_INFO
+/* Broadcom Proprietary */
+#define NFA_EE_TAG_HCI_HOST_ID NFC_NFCEE_TAG_HCI_HOST_ID
typedef uint8_t tNFA_EE_TAG;
/* for NFA_EeModeSet () */
@@ -79,17 +89,25 @@
#define NFA_EE_MD_DEACTIVATE NFC_MODE_DEACTIVATE
typedef uint8_t tNFA_EE_MD;
-#define NFA_EE_PWR_STATE_ON 0x01 /* The device is on */
-#define NFA_EE_PWR_STATE_SWITCH_OFF 0x02 /* The device is switched off */
-#define NFA_EE_PWR_STATE_BATT_OFF 0x04 /* The device's battery is removed */
-#define NFA_EE_PWR_STATE_NONE 0 /* used to remove a particular technology or protocol based routing cfg of a handle from the routing table. */
+/* The device is on */
+#define NFA_EE_PWR_STATE_ON 0x01
+/* The device is switched off */
+#define NFA_EE_PWR_STATE_SWITCH_OFF 0x02
+/* The device's battery is removed */
+#define NFA_EE_PWR_STATE_BATT_OFF 0x04
+/* used to remove a particular technology or protocol based routing cfg of a handle from the routing table. */
+#define NFA_EE_PWR_STATE_NONE 0
typedef uint8_t tNFA_EE_PWR_STATE;
-#define NFA_EE_STATUS_INACTIVE NFC_NFCEE_STATUS_INACTIVE /* NFCEE connected and inactive */
-#define NFA_EE_STATUS_ACTIVE NFC_NFCEE_STATUS_ACTIVE /* NFCEE connected and active */
-#define NFA_EE_STATUS_REMOVED NFC_NFCEE_STATUS_REMOVED /* NFCEE removed */
-#define NFA_EE_STATUS_PENDING 0x10 /* waiting for response from NFCC */
+/* NFCEE connected and inactive */
+#define NFA_EE_STATUS_INACTIVE NFC_NFCEE_STATUS_INACTIVE
+/* NFCEE connected and active */
+#define NFA_EE_STATUS_ACTIVE NFC_NFCEE_STATUS_ACTIVE
+/* NFCEE removed */
+#define NFA_EE_STATUS_REMOVED NFC_NFCEE_STATUS_REMOVED
+/* waiting for response from NFCC */
+#define NFA_EE_STATUS_PENDING 0x10
#define NFA_EE_STATUS_ACTIVATING (NFA_EE_STATUS_PENDING+NFC_NFCEE_STATUS_ACTIVE)
#define NFA_EE_STATUS_DEACTIVATING (NFA_EE_STATUS_PENDING+NFC_NFCEE_STATUS_INACTIVE)
typedef uint8_t tNFA_EE_STATUS;
@@ -130,10 +148,14 @@
tNFA_EE_INTERFACE ee_interface; /* NFCEE interface associated with this connection */
} tNFA_EE_CONNECT;
-#define NFA_EE_TRGR_SELECT NFC_EE_TRIG_SELECT /* ISO 7816-4 SELECT command */
-#define NFA_EE_TRGR_RF_PROTOCOL NFC_EE_TRIG_RF_PROTOCOL /* RF Protocol changed */
-#define NFA_EE_TRGR_RF_TECHNOLOGY NFC_EE_TRIG_RF_TECHNOLOGY/* RF Technology changed */
-#define NFA_EE_TRGR_APP_INIT NFC_EE_TRIG_APP_INIT /* Application initiation */
+/* ISO 7816-4 SELECT command */
+#define NFA_EE_TRGR_SELECT NFC_EE_TRIG_SELECT
+/* RF Protocol changed */
+#define NFA_EE_TRGR_RF_PROTOCOL NFC_EE_TRIG_RF_PROTOCOL
+/* RF Technology changed */
+#define NFA_EE_TRGR_RF_TECHNOLOGY NFC_EE_TRIG_RF_TECHNOLOGY
+/* Application initiation */
+#define NFA_EE_TRGR_APP_INIT NFC_EE_TRIG_APP_INIT
typedef tNFC_EE_TRIGGER tNFA_EE_TRIGGER;
/* Union of NFCEE action parameter depending on the associated trigger */
diff --git a/src/nfa/include/nfa_hci_api.h b/src/nfa/include/nfa_hci_api.h
index 8dfc415..6a9bb47 100644
--- a/src/nfa/include/nfa_hci_api.h
+++ b/src/nfa/include/nfa_hci_api.h
@@ -40,8 +40,10 @@
/* NFA HCI callback events */
#define NFA_HCI_REGISTER_EVT 0x00 /* Application registered */
-#define NFA_HCI_DEREGISTER_EVT 0x01 /* Application deregistered */
-#define NFA_HCI_GET_GATE_PIPE_LIST_EVT 0x02 /* Retrieved gates,pipes assoc. to application */
+/* Application deregistered */
+#define NFA_HCI_DEREGISTER_EVT 0x01
+/* Retrieved gates,pipes assoc. to application */
+#define NFA_HCI_GET_GATE_PIPE_LIST_EVT 0x02
#define NFA_HCI_ALLOCATE_GATE_EVT 0x03 /* A generic gate allocated to the application */
#define NFA_HCI_DEALLOCATE_GATE_EVT 0x04 /* A generic gate is released */
#define NFA_HCI_CREATE_PIPE_EVT 0x05 /* Pipe is created */
@@ -49,27 +51,45 @@
#define NFA_HCI_CLOSE_PIPE_EVT 0x07 /* Pipe is closed / could not close */
#define NFA_HCI_DELETE_PIPE_EVT 0x08 /* Pipe is deleted */
#define NFA_HCI_HOST_LIST_EVT 0x09 /* Received list of Host from Host controller */
-#define NFA_HCI_INIT_EVT 0x0A /* HCI subsytem initialized */
-#define NFA_HCI_EXIT_EVT 0x0B /* HCI subsytem exited */
-#define NFA_HCI_RSP_RCVD_EVT 0x0C /* Response recvd to cmd sent on app owned pipe */
-#define NFA_HCI_RSP_SENT_EVT 0x0D /* Response sent on app owned pipe */
-#define NFA_HCI_CMD_SENT_EVT 0x0E /* Command sent on app owned pipe */
-#define NFA_HCI_EVENT_SENT_EVT 0x0F /* Event sent on app owned pipe */
-#define NFA_HCI_CMD_RCVD_EVT 0x10 /* Command received on app owned pipe */
-#define NFA_HCI_EVENT_RCVD_EVT 0x11 /* Event received on app owned pipe */
-#define NFA_HCI_GET_REG_CMD_EVT 0x12 /* Registry read command sent */
-#define NFA_HCI_SET_REG_CMD_EVT 0x13 /* Registry write command sent */
-#define NFA_HCI_GET_REG_RSP_EVT 0x14 /* Received response to read registry command */
-#define NFA_HCI_SET_REG_RSP_EVT 0x15 /* Received response to write registry command */
-#define NFA_HCI_ADD_STATIC_PIPE_EVT 0x16 /* A static pipe is added */
+/* HCI subsytem initialized */
+#define NFA_HCI_INIT_EVT 0x0A
+/* HCI subsytem exited */
+#define NFA_HCI_EXIT_EVT 0x0B
+/* Response recvd to cmd sent on app owned pipe */
+#define NFA_HCI_RSP_RCVD_EVT 0x0C
+/* Response sent on app owned pipe */
+#define NFA_HCI_RSP_SENT_EVT 0x0D
+/* Command sent on app owned pipe */
+#define NFA_HCI_CMD_SENT_EVT 0x0E
+/* Event sent on app owned pipe */
+#define NFA_HCI_EVENT_SENT_EVT 0x0F
+/* Command received on app owned pipe */
+#define NFA_HCI_CMD_RCVD_EVT 0x10
+/* Event received on app owned pipe */
+#define NFA_HCI_EVENT_RCVD_EVT 0x11
+/* Registry read command sent */
+#define NFA_HCI_GET_REG_CMD_EVT 0x12
+/* Registry write command sent */
+#define NFA_HCI_SET_REG_CMD_EVT 0x13
+/* Received response to read registry command */
+#define NFA_HCI_GET_REG_RSP_EVT 0x14
+/* Received response to write registry command */
+#define NFA_HCI_SET_REG_RSP_EVT 0x15
+/* A static pipe is added */
+#define NFA_HCI_ADD_STATIC_PIPE_EVT 0x16
typedef uint8_t tNFA_HCI_EVT;
-#define NFA_MAX_HCI_APP_NAME_LEN 0x10 /* Max application name length */
-#define NFA_MAX_HCI_CMD_LEN 255 /* Max HCI command length */
-#define NFA_MAX_HCI_RSP_LEN 255 /* Max HCI event length */
-#define NFA_MAX_HCI_EVENT_LEN 260 /* Max HCI event length */
-#define NFA_MAX_HCI_DATA_LEN 260 /* Max HCI data length */
+/* Max application name length */
+#define NFA_MAX_HCI_APP_NAME_LEN 0x10
+/* Max HCI command length */
+#define NFA_MAX_HCI_CMD_LEN 255
+/* Max HCI event length */
+#define NFA_MAX_HCI_RSP_LEN 255
+/* Max HCI event length */
+#define NFA_MAX_HCI_EVENT_LEN 260
+/* Max HCI data length */
+#define NFA_MAX_HCI_DATA_LEN 260
/* NFA HCI PIPE states */
#define NFA_HCI_PIPE_CLOSED 0x00 /* Pipe is closed */
diff --git a/src/nfa/include/nfa_nv_co.h b/src/nfa/include/nfa_nv_co.h
index 6ab050b..07fb5e7 100644
--- a/src/nfa/include/nfa_nv_co.h
+++ b/src/nfa/include/nfa_nv_co.h
@@ -49,7 +49,8 @@
#define NFA_NV_CO_ENOSPACE 0x06 /* Returned in nfa_nv_ci_open if no room */
#define NFA_NV_CO_EIS_DIR 0x07
#define NFA_NV_CO_RESUME 0x08 /* used in nfa_nv_ci_open, on resume */
-#define NFA_NV_CO_NONE 0x09 /* used in nfa_nv_ci_open, on resume (no file to resume) */
+/* used in nfa_nv_ci_open, on resume (no file to resume) */
+#define NFA_NV_CO_NONE 0x09
typedef uint8_t tNFA_NV_CO_STATUS;
diff --git a/src/nfa/include/nfa_p2p_api.h b/src/nfa/include/nfa_p2p_api.h
index 158da86..c454f1d 100644
--- a/src/nfa/include/nfa_p2p_api.h
+++ b/src/nfa/include/nfa_p2p_api.h
@@ -44,16 +44,25 @@
#define NFA_P2P_DISC_REASON_NO_INFORMATION 0x80 /* Without information */
/* NFA P2P callback events */
-#define NFA_P2P_REG_SERVER_EVT 0x00 /* Server is registered */
-#define NFA_P2P_REG_CLIENT_EVT 0x01 /* Client is registered */
-#define NFA_P2P_ACTIVATED_EVT 0x02 /* LLCP Link has been activated */
+/* Server is registered */
+#define NFA_P2P_REG_SERVER_EVT 0x00
+/* Client is registered */
+#define NFA_P2P_REG_CLIENT_EVT 0x01
+/* LLCP Link has been activated */
+#define NFA_P2P_ACTIVATED_EVT 0x02
#define NFA_P2P_DEACTIVATED_EVT 0x03 /* LLCP Link has been deactivated */
-#define NFA_P2P_CONN_REQ_EVT 0x04 /* Data link connection request from peer */
-#define NFA_P2P_CONNECTED_EVT 0x05 /* Data link connection has been established */
-#define NFA_P2P_DISC_EVT 0x06 /* Data link connection has been disconnected */
-#define NFA_P2P_DATA_EVT 0x07 /* Data received from peer */
-#define NFA_P2P_CONGEST_EVT 0x08 /* Status indication of outgoing data */
-#define NFA_P2P_LINK_INFO_EVT 0x09 /* link MIU and Well-Known Service list */
+/* Data link connection request from peer */
+#define NFA_P2P_CONN_REQ_EVT 0x04
+/* Data link connection has been established */
+#define NFA_P2P_CONNECTED_EVT 0x05
+/* Data link connection has been disconnected */
+#define NFA_P2P_DISC_EVT 0x06
+/* Data received from peer */
+#define NFA_P2P_DATA_EVT 0x07
+/* Status indication of outgoing data */
+#define NFA_P2P_CONGEST_EVT 0x08
+/* link MIU and Well-Known Service list */
+#define NFA_P2P_LINK_INFO_EVT 0x09
#define NFA_P2P_SDP_EVT 0x0A /* Remote SAP of SDP result */
typedef uint8_t tNFA_P2P_EVT;
diff --git a/src/nfa/include/nfa_snep_api.h b/src/nfa/include/nfa_snep_api.h
index 5bb51cd..dc80697 100644
--- a/src/nfa/include/nfa_snep_api.h
+++ b/src/nfa/include/nfa_snep_api.h
@@ -33,41 +33,65 @@
*****************************************************************************/
#define NFA_SNEP_VERSION 0x10 /* SNEP Version 1.0 */
-#define NFA_SNEP_REQ_CODE_CONTINUE 0x00 /* send remaining fragments */
-#define NFA_SNEP_REQ_CODE_GET 0x01 /* return an NDEF message */
-#define NFA_SNEP_REQ_CODE_PUT 0x02 /* accept an NDEF message */
-#define NFA_SNEP_REQ_CODE_REJECT 0x7F /* do not send remaining fragments */
+/* send remaining fragments */
+#define NFA_SNEP_REQ_CODE_CONTINUE 0x00
+/* return an NDEF message */
+#define NFA_SNEP_REQ_CODE_GET 0x01
+/* accept an NDEF message */
+#define NFA_SNEP_REQ_CODE_PUT 0x02
+/* do not send remaining fragments */
+#define NFA_SNEP_REQ_CODE_REJECT 0x7F
#define tNFA_SNEP_REQ_CODE uint8_t
-#define NFA_SNEP_RESP_CODE_CONTINUE 0x80 /* continue send remaining fragments */
-#define NFA_SNEP_RESP_CODE_SUCCESS 0x81 /* the operation succeeded */
-#define NFA_SNEP_RESP_CODE_NOT_FOUND 0xC0 /* resource not found */
-#define NFA_SNEP_RESP_CODE_EXCESS_DATA 0xC1 /* resource exceeds data size limit */
-#define NFA_SNEP_RESP_CODE_BAD_REQ 0xC2 /* malformed request not understood */
-#define NFA_SNEP_RESP_CODE_NOT_IMPLM 0xE0 /* unsupported functionality requested */
-#define NFA_SNEP_RESP_CODE_UNSUPP_VER 0xE1 /* unsupported protocol version */
-#define NFA_SNEP_RESP_CODE_REJECT 0xFF /* do not send remaining fragments */
+/* continue send remaining fragments */
+#define NFA_SNEP_RESP_CODE_CONTINUE 0x80
+/* the operation succeeded */
+#define NFA_SNEP_RESP_CODE_SUCCESS 0x81
+/* resource not found */
+#define NFA_SNEP_RESP_CODE_NOT_FOUND 0xC0
+/* resource exceeds data size limit */
+#define NFA_SNEP_RESP_CODE_EXCESS_DATA 0xC1
+/* malformed request not understood */
+#define NFA_SNEP_RESP_CODE_BAD_REQ 0xC2
+/* unsupported functionality requested */
+#define NFA_SNEP_RESP_CODE_NOT_IMPLM 0xE0
+/* unsupported protocol version */
+#define NFA_SNEP_RESP_CODE_UNSUPP_VER 0xE1
+/* do not send remaining fragments */
+#define NFA_SNEP_RESP_CODE_REJECT 0xFF
#define tNFA_SNEP_RESP_CODE uint8_t
/* NFA SNEP callback events */
-#define NFA_SNEP_REG_EVT 0x00 /* Server/client Registeration Status */
-#define NFA_SNEP_ACTIVATED_EVT 0x01 /* LLCP link has been activated, client only */
-#define NFA_SNEP_DEACTIVATED_EVT 0x02 /* LLCP link has been deactivated, client only */
-#define NFA_SNEP_CONNECTED_EVT 0x03 /* Data link has been created */
-#define NFA_SNEP_GET_REQ_EVT 0x04 /* GET request from client */
-#define NFA_SNEP_PUT_REQ_EVT 0x05 /* PUT request from client */
-#define NFA_SNEP_GET_RESP_EVT 0x06 /* GET response from server */
-#define NFA_SNEP_PUT_RESP_EVT 0x07 /* PUT response from server */
-#define NFA_SNEP_DISC_EVT 0x08 /* Failed to connect or disconnected */
+/* Server/client Registeration Status */
+#define NFA_SNEP_REG_EVT 0x00
+/* LLCP link has been activated, client only */
+#define NFA_SNEP_ACTIVATED_EVT 0x01
+/* LLCP link has been deactivated, client only */
+#define NFA_SNEP_DEACTIVATED_EVT 0x02
+/* Data link has been created */
+#define NFA_SNEP_CONNECTED_EVT 0x03
+/* GET request from client */
+#define NFA_SNEP_GET_REQ_EVT 0x04
+/* PUT request from client */
+#define NFA_SNEP_PUT_REQ_EVT 0x05
+/* GET response from server */
+#define NFA_SNEP_GET_RESP_EVT 0x06
+/* PUT response from server */
+#define NFA_SNEP_PUT_RESP_EVT 0x07
+/* Failed to connect or disconnected */
+#define NFA_SNEP_DISC_EVT 0x08
#define NFA_SNEP_ALLOC_BUFF_EVT 0x09 /* Request to allocate a buffer for NDEF*/
#define NFA_SNEP_FREE_BUFF_EVT 0x0A /* Request to deallocate buffer for NDEF*/
-#define NFA_SNEP_GET_RESP_CMPL_EVT 0x0B /* GET response sent to client */
+/* GET response sent to client */
+#define NFA_SNEP_GET_RESP_CMPL_EVT 0x0B
-#define NFA_SNEP_DEFAULT_SERVER_STARTED_EVT 0x0C /* SNEP default server is started */
-#define NFA_SNEP_DEFAULT_SERVER_STOPPED_EVT 0x0D /* SNEP default server is stopped */
+/* SNEP default server is started */
+#define NFA_SNEP_DEFAULT_SERVER_STARTED_EVT 0x0C
+/* SNEP default server is stopped */
+#define NFA_SNEP_DEFAULT_SERVER_STOPPED_EVT 0x0D
typedef uint8_t tNFA_SNEP_EVT;
diff --git a/src/nfa/int/nfa_ce_int.h b/src/nfa/int/nfa_ce_int.h
index fd60a27..3613232 100644
--- a/src/nfa/int/nfa_ce_int.h
+++ b/src/nfa/int/nfa_ce_int.h
@@ -125,18 +125,26 @@
/****************************************************************************
** LISTEN_INFO definitions
*****************************************************************************/
-#define NFA_CE_LISTEN_INFO_IDX_NDEF 0 /* Entry 0 is reserved for local NDEF tag */
+/* Entry 0 is reserved for local NDEF tag */
+#define NFA_CE_LISTEN_INFO_IDX_NDEF 0
#define NFA_CE_LISTEN_INFO_IDX_INVALID (NFA_CE_LISTEN_INFO_MAX)
/* Flags for listen request */
-#define NFA_CE_LISTEN_INFO_IN_USE 0x00000001 /* LISTEN_INFO entry is in use */
-#define NFC_CE_LISTEN_INFO_READONLY_NDEF 0x00000010 /* NDEF is read-only */
-#define NFA_CE_LISTEN_INFO_T4T_ACTIVATE_PND 0x00000040 /* App has not been notified of ACTIVATE_EVT yet for this T4T AID */
-#define NFA_CE_LISTEN_INFO_T4T_AID 0x00000080 /* This is a listen_info for T4T AID */
-#define NFA_CE_LISTEN_INFO_START_NTF_PND 0x00000100 /* App has not been notified of LISTEN_START yet */
-#define NFA_CE_LISTEN_INFO_FELICA 0x00000200 /* This is a listen_info for non-NDEF Felica */
-#define NFA_CE_LISTEN_INFO_UICC 0x00000400 /* This is a listen_info for UICC */
+/* LISTEN_INFO entry is in use */
+#define NFA_CE_LISTEN_INFO_IN_USE 0x00000001
+/* NDEF is read-only */
+#define NFC_CE_LISTEN_INFO_READONLY_NDEF 0x00000010
+/* App has not been notified of ACTIVATE_EVT yet for this T4T AID */
+#define NFA_CE_LISTEN_INFO_T4T_ACTIVATE_PND 0x00000040
+/* This is a listen_info for T4T AID */
+#define NFA_CE_LISTEN_INFO_T4T_AID 0x00000080
+/* App has not been notified of LISTEN_START yet */
+#define NFA_CE_LISTEN_INFO_START_NTF_PND 0x00000100
+/* This is a listen_info for non-NDEF Felica */
+#define NFA_CE_LISTEN_INFO_FELICA 0x00000200
+/* This is a listen_info for UICC */
+#define NFA_CE_LISTEN_INFO_UICC 0x00000400
/* Structure for listen look up table */
@@ -162,8 +170,10 @@
/****************************************************************************/
/* Internal flags for nfa_ce */
-#define NFA_CE_FLAGS_APP_INIT_DEACTIVATION 0x00000001 /* Deactivation locally initiated by application */
-#define NFA_CE_FLAGS_LISTEN_ACTIVE_SLEEP 0x00000002 /* Tag is in listen active or sleep state */
+/* Deactivation locally initiated by application */
+#define NFA_CE_FLAGS_APP_INIT_DEACTIVATION 0x00000001
+/* Tag is in listen active or sleep state */
+#define NFA_CE_FLAGS_LISTEN_ACTIVE_SLEEP 0x00000002
typedef uint32_t tNFA_CE_FLAGS;
/* NFA_CE control block */
diff --git a/src/nfa/int/nfa_dm_int.h b/src/nfa/int/nfa_dm_int.h
index e1e44b7..70c3089 100644
--- a/src/nfa/int/nfa_dm_int.h
+++ b/src/nfa/int/nfa_dm_int.h
@@ -295,7 +295,8 @@
#define NFA_DM_DISC_MASK_P_KOVIO 0x00000400
#define NFA_DM_DISC_MASK_PAA_NFC_DEP 0x00000800
#define NFA_DM_DISC_MASK_PFA_NFC_DEP 0x00001000
-#define NFA_DM_DISC_MASK_P_LEGACY 0x00002000 /* Legacy/proprietary/non-NFC Forum protocol (e.g Shanghai transit card) */
+/* Legacy/proprietary/non-NFC Forum protocol (e.g Shanghai transit card) */
+#define NFA_DM_DISC_MASK_P_LEGACY 0x00002000
#define NFA_DM_DISC_MASK_POLL 0x0000FFFF
#define NFA_DM_DISC_MASK_LA_T1T 0x00010000
@@ -326,13 +327,20 @@
typedef void (tNFA_DISCOVER_CBACK) (tNFA_DM_RF_DISC_EVT event, tNFC_DISCOVER *p_data);
/* DM RF discovery action flags */
-#define NFA_DM_DISC_FLAGS_ENABLED 0x0001 /* RF discovery process has been started */
-#define NFA_DM_DISC_FLAGS_STOPPING 0x0002 /* Stop RF discovery is pending */
-#define NFA_DM_DISC_FLAGS_DISABLING 0x0004 /* Disable NFA is pending */
-#define NFA_DM_DISC_FLAGS_CHECKING 0x0008 /* Sleep wakeup in progress */
-#define NFA_DM_DISC_FLAGS_NOTIFY 0x0010 /* Notify sub-module that discovery is starting */
-#define NFA_DM_DISC_FLAGS_W4_RSP 0x0020 /* command has been sent to NFCC in the state */
-#define NFA_DM_DISC_FLAGS_W4_NTF 0x0040 /* wait for NTF before changing discovery state */
+/* RF discovery process has been started */
+#define NFA_DM_DISC_FLAGS_ENABLED 0x0001
+/* Stop RF discovery is pending */
+#define NFA_DM_DISC_FLAGS_STOPPING 0x0002
+/* Disable NFA is pending */
+#define NFA_DM_DISC_FLAGS_DISABLING 0x0004
+/* Sleep wakeup in progress */
+#define NFA_DM_DISC_FLAGS_CHECKING 0x0008
+/* Notify sub-module that discovery is starting */
+#define NFA_DM_DISC_FLAGS_NOTIFY 0x0010
+/* command has been sent to NFCC in the state */
+#define NFA_DM_DISC_FLAGS_W4_RSP 0x0020
+/* wait for NTF before changing discovery state */
+#define NFA_DM_DISC_FLAGS_W4_NTF 0x0040
typedef uint16_t tNFA_DM_DISC_FLAGS;
@@ -348,9 +356,11 @@
tNFA_DM_DISC_TECH_PROTO_MASK selected_disc_mask; /* technology and protocol waiting for activation */
} tNFA_DM_DISC_ENTRY;
-#define NFA_DM_DISC_NUM_ENTRIES 8 /* polling, raw listen, P2P listen, NDEF CE, 2xVSE, 2xUICC */
+/* polling, raw listen, P2P listen, NDEF CE, 2xVSE, 2xUICC */
+#define NFA_DM_DISC_NUM_ENTRIES 8
-#define NFA_DM_MAX_DISC_PARAMS 16 /* max discovery technology parameters */
+/* max discovery technology parameters */
+#define NFA_DM_MAX_DISC_PARAMS 16
/* index of listen mode routing table for technologies */
enum {
@@ -362,7 +372,8 @@
/* SLP_REQ (HLTA) command */
#define SLP_REQ_CMD 0x5000
-#define NFA_DM_MAX_TECH_ROUTE 4 /* NFA_EE_MAX_TECH_ROUTE. only A, B, F, Bprime are supported by UICC now */
+/* NFA_EE_MAX_TECH_ROUTE. only A, B, F, Bprime are supported by UICC now */
+#define NFA_DM_MAX_TECH_ROUTE 4
/* timeout for waiting deactivation NTF,
** possible delay to send deactivate CMD if all credit wasn't returned
@@ -401,7 +412,8 @@
} tNFA_DM_DISC_CB;
/* NDEF Type Handler Definitions */
-#define NFA_NDEF_DEFAULT_HANDLER_IDX 0 /* Default handler entry in ndef_handler table */
+/* Default handler entry in ndef_handler table */
+#define NFA_NDEF_DEFAULT_HANDLER_IDX 0
#define NFA_PARAM_ID_INVALID 0xFF
@@ -409,20 +421,34 @@
#define NFA_DM_SETCONFIG_PENDING_MAX 32
/* NFA_DM flags */
-#define NFA_DM_FLAGS_DM_IS_ACTIVE 0x00000001 /* DM is enabled */
-#define NFA_DM_FLAGS_EXCL_RF_ACTIVE 0x00000002 /* Exclusive RF mode is active */
-#define NFA_DM_FLAGS_POLLING_ENABLED 0x00000004 /* Polling is enabled (while not in exclusive RF mode */
-#define NFA_DM_FLAGS_SEND_POLL_STOP_EVT 0x00000008 /* send poll stop event */
-#define NFA_DM_FLAGS_AUTO_READING_NDEF 0x00000010 /* auto reading of NDEF in progress */
-#define NFA_DM_FLAGS_ENABLE_EVT_PEND 0x00000020 /* NFA_DM_ENABLE_EVT is not reported yet */
-#define NFA_DM_FLAGS_SEND_DEACTIVATED_EVT 0x00000040 /* Send NFA_DEACTIVATED_EVT when deactivated */
-#define NFA_DM_FLAGS_NFCC_IS_RESTORING 0x00000100 /* NFCC is restoring after back to full power mode */
-#define NFA_DM_FLAGS_SETTING_PWR_MODE 0x00000200 /* NFCC power mode is updating */
-#define NFA_DM_FLAGS_DM_DISABLING_NFC 0x00000400 /* NFA DM is disabling NFC */
-#define NFA_DM_FLAGS_RAW_FRAME 0x00000800 /* NFA_SendRawFrame() is called since RF activation */
-#define NFA_DM_FLAGS_LISTEN_DISABLED 0x00001000 /* NFA_DisableListening() is called and engaged */
-#define NFA_DM_FLAGS_P2P_PAUSED 0x00002000 /* NFA_PauseP2p() is called and engaged */
-#define NFA_DM_FLAGS_POWER_OFF_SLEEP 0x00008000 /* Power Off Sleep */
+/* DM is enabled */
+#define NFA_DM_FLAGS_DM_IS_ACTIVE 0x00000001
+/* Exclusive RF mode is active */
+#define NFA_DM_FLAGS_EXCL_RF_ACTIVE 0x00000002
+/* Polling is enabled (while not in exclusive RF mode */
+#define NFA_DM_FLAGS_POLLING_ENABLED 0x00000004
+/* send poll stop event */
+#define NFA_DM_FLAGS_SEND_POLL_STOP_EVT 0x00000008
+/* auto reading of NDEF in progress */
+#define NFA_DM_FLAGS_AUTO_READING_NDEF 0x00000010
+/* NFA_DM_ENABLE_EVT is not reported yet */
+#define NFA_DM_FLAGS_ENABLE_EVT_PEND 0x00000020
+/* Send NFA_DEACTIVATED_EVT when deactivated */
+#define NFA_DM_FLAGS_SEND_DEACTIVATED_EVT 0x00000040
+/* NFCC is restoring after back to full power mode */
+#define NFA_DM_FLAGS_NFCC_IS_RESTORING 0x00000100
+/* NFCC power mode is updating */
+#define NFA_DM_FLAGS_SETTING_PWR_MODE 0x00000200
+/* NFA DM is disabling NFC */
+#define NFA_DM_FLAGS_DM_DISABLING_NFC 0x00000400
+/* NFA_SendRawFrame() is called since RF activation */
+#define NFA_DM_FLAGS_RAW_FRAME 0x00000800
+/* NFA_DisableListening() is called and engaged */
+#define NFA_DM_FLAGS_LISTEN_DISABLED 0x00001000
+/* NFA_PauseP2p() is called and engaged */
+#define NFA_DM_FLAGS_P2P_PAUSED 0x00002000
+/* Power Off Sleep */
+#define NFA_DM_FLAGS_POWER_OFF_SLEEP 0x00008000
/* stored parameters */
typedef struct
{
diff --git a/src/nfa/int/nfa_dta_int.h b/src/nfa/int/nfa_dta_int.h
index 64a989c..5cb1de7 100644
--- a/src/nfa/int/nfa_dta_int.h
+++ b/src/nfa/int/nfa_dta_int.h
@@ -50,16 +50,21 @@
#define NFA_DTA_DISCOVER_PARAMS_MAX 6
-#define NDEF_WKT_TEXT_HDR_LEN 7 /* Header length for long NDEF text message */
-#define NFA_DTA_T3T_WRITE_NDEF_SIZE 192 /* Size of NDEF message for T3T write-tests ([DTA] $5.5.6) */
-#define NFA_DTA_T3T_LISTEN_SYSTEMCODE 0xBABE /* System code to use for T3T Listen mode tests */
+/* Header length for long NDEF text message */
+#define NDEF_WKT_TEXT_HDR_LEN 7
+/* Size of NDEF message for T3T write-tests ([DTA] $5.5.6) */
+#define NFA_DTA_T3T_WRITE_NDEF_SIZE 192
+/* System code to use for T3T Listen mode tests */
+#define NFA_DTA_T3T_LISTEN_SYSTEMCODE 0xBABE
-#define NFA_PROTOCOL_RANK_INVALID 0xFF /* Maximum protocol preference rank */
+/* Maximum protocol preference rank */
+#define NFA_PROTOCOL_RANK_INVALID 0xFF
#define NFA_DTA_SCRATCH_BUF_SIZE T3T_MSG_BLOCKSIZE
#ifndef NFA_DTA_DEFAULT_CO_OUT_DSAP
-#define NFA_DTA_DEFAULT_CO_OUT_DSAP 0x12 /* Default SAP[LT,CO-OUT-DEST] if SDP was not performed to get SAP from the LT */
+/* Default SAP[LT,CO-OUT-DEST] if SDP was not performed to get SAP from the LT */
+#define NFA_DTA_DEFAULT_CO_OUT_DSAP 0x12
#endif
/*****************************************************************************
@@ -239,10 +244,14 @@
/* dta control block flags */
#define NFA_DTA_FL_ENABLED 0x00000001 /* DTA is enabled */
-#define NFA_DTA_FL_AUTOSTART 0x00000002 /* Automatically start discovery when NFC is enabled */
-#define NFA_DTA_FL_STOPPING 0x00000004 /* DTA is stopping (NFA_DtaStop called) */
-#define NFA_DTA_FL_DISABLING 0x00000008 /* DTA is being disabled (NFA_DtaDisable called) */
-#define NFA_DTA_FL_T4T_DESELECT_DEACT 0x00000010 /* T4T/NFCDEP is deactivating to IDLE (need to DESELECT first) */
+/* Automatically start discovery when NFC is enabled */
+#define NFA_DTA_FL_AUTOSTART 0x00000002
+/* DTA is stopping (NFA_DtaStop called) */
+#define NFA_DTA_FL_STOPPING 0x00000004
+/* DTA is being disabled (NFA_DtaDisable called) */
+#define NFA_DTA_FL_DISABLING 0x00000008
+/* T4T/NFCDEP is deactivating to IDLE (need to DESELECT first) */
+#define NFA_DTA_FL_T4T_DESELECT_DEACT 0x00000010
/* DTA control block */
typedef struct {
@@ -299,8 +308,10 @@
uint16_t llcp_co_out_remote_miu; /* MIU of LT-CO-OUT-DEST */
uint8_t llcp_co_out_remote_rw; /* RW of LT-CO-OUT-DEST */
-#define NFA_DTA_LLCP_FLAGS_CO_OUT_CONNECTING 0x01 /* establishing outbound on connection-oriented */
-#define NFA_DTA_LLCP_FLAGS_CO_OUT_CONNECTED 0x02 /* established outbound on connection-oriented */
+/* establishing outbound on connection-oriented */
+#define NFA_DTA_LLCP_FLAGS_CO_OUT_CONNECTING 0x01
+/* established outbound on connection-oriented */
+#define NFA_DTA_LLCP_FLAGS_CO_OUT_CONNECTED 0x02
uint8_t llcp_flags; /* internal flags for LLCP echo test */
uint8_t llcp_sdp_tid_cl; /* SDP transaction ID for outbound connectionless */
diff --git a/src/nfa/int/nfa_ee_int.h b/src/nfa/int/nfa_ee_int.h
index 606ecdd..da102f5 100644
--- a/src/nfa/int/nfa_ee_int.h
+++ b/src/nfa/int/nfa_ee_int.h
@@ -32,13 +32,17 @@
** Constants and data types
*****************************************************************************/
#define NFA_EE_DEBUG BT_TRACE_VERBOSE
-#define NFA_EE_NUM_ECBS (NFA_EE_MAX_EE_SUPPORTED+1) /* the number of tNFA_EE_ECBs (for NFCEEs and DH) */
-#define NFA_EE_CB_4_DH NFA_EE_MAX_EE_SUPPORTED /* The index for DH in nfa_ee_cb.ee_cb[] */
+/* the number of tNFA_EE_ECBs (for NFCEEs and DH) */
+#define NFA_EE_NUM_ECBS (NFA_EE_MAX_EE_SUPPORTED+1)
+/* The index for DH in nfa_ee_cb.ee_cb[] */
+#define NFA_EE_CB_4_DH NFA_EE_MAX_EE_SUPPORTED
#define NFA_EE_INVALID 0xFF
-#define NFA_EE_MAX_TECH_ROUTE 4 /* only A, B, F, Bprime are supported by UICC now */
+/* only A, B, F, Bprime are supported by UICC now */
+#define NFA_EE_MAX_TECH_ROUTE 4
#ifndef NFA_EE_AID_CFG_TAG_NAME
-#define NFA_EE_AID_CFG_TAG_NAME 0x4F /* AID */
+/* AID */
+#define NFA_EE_AID_CFG_TAG_NAME 0x4F
#endif
/* NFA EE events */
@@ -76,7 +80,8 @@
typedef uint16_t tNFA_EE_INT_EVT;
-#define NFA_EE_AE_ROUTE 0x80 /* for listen mode routing table*/
+/* for listen mode routing table*/
+#define NFA_EE_AE_ROUTE 0x80
#define NFA_EE_AE_VS 0x40
@@ -110,19 +115,29 @@
/* NFA EE control block flags:
* use to indicate an API function has changed the configuration of the associated NFCEE
* The flags are cleared when the routing table/VS is updated */
-#define NFA_EE_ECB_FLAGS_TECH 0x02 /* technology routing changed */
-#define NFA_EE_ECB_FLAGS_PROTO 0x04 /* protocol routing changed */
-#define NFA_EE_ECB_FLAGS_AID 0x08 /* AID routing changed */
-#define NFA_EE_ECB_FLAGS_VS 0x10 /* VS changed */
-#define NFA_EE_ECB_FLAGS_RESTORE 0x20 /* Restore related */
-#define NFA_EE_ECB_FLAGS_ROUTING 0x0E /* routing flags changed */
-#define NFA_EE_ECB_FLAGS_DISC_REQ 0x40 /* NFCEE Discover Request NTF is set */
-#define NFA_EE_ECB_FLAGS_ORDER 0x80 /* DISC_REQ N reported before DISC N */
+/* technology routing changed */
+#define NFA_EE_ECB_FLAGS_TECH 0x02
+/* protocol routing changed */
+#define NFA_EE_ECB_FLAGS_PROTO 0x04
+/* AID routing changed */
+#define NFA_EE_ECB_FLAGS_AID 0x08
+/* VS changed */
+#define NFA_EE_ECB_FLAGS_VS 0x10
+/* Restore related */
+#define NFA_EE_ECB_FLAGS_RESTORE 0x20
+/* routing flags changed */
+#define NFA_EE_ECB_FLAGS_ROUTING 0x0E
+/* NFCEE Discover Request NTF is set */
+#define NFA_EE_ECB_FLAGS_DISC_REQ 0x40
+/* DISC_REQ N reported before DISC N */
+#define NFA_EE_ECB_FLAGS_ORDER 0x80
typedef uint8_t tNFA_EE_ECB_FLAGS;
/* part of tNFA_EE_STATUS; for internal use only */
-#define NFA_EE_STATUS_RESTORING 0x20 /* waiting for restore to full power mode to complete */
-#define NFA_EE_STATUS_INT_MASK 0x20 /* this bit is in ee_status for internal use only */
+/* waiting for restore to full power mode to complete */
+#define NFA_EE_STATUS_RESTORING 0x20
+/* this bit is in ee_status for internal use only */
+#define NFA_EE_STATUS_INT_MASK 0x20
/* NFA-EE information for a particular NFCEE Entity (including DH) */
typedef struct
@@ -373,7 +388,8 @@
** control block
*****************************************************************************/
#define NFA_EE_CFGED_UPDATE_NOW 0x80
-#define NFA_EE_CFGED_OFF_ROUTING 0x40 /* either switch off or battery off is configured */
+/* either switch off or battery off is configured */
+#define NFA_EE_CFGED_OFF_ROUTING 0x40
/* the following status are the definition used in ee_cfg_sts */
#define NFA_EE_STS_CHANGED_ROUTING 0x01
@@ -383,21 +399,29 @@
#define NFA_EE_STS_PREV 0xf0
-#define NFA_EE_WAIT_UPDATE 0x10 /* need to report NFA_EE_UPDATED_EVT */
-#define NFA_EE_WAIT_UPDATE_RSP 0x20 /* waiting for the rsp of set routing commands */
+/* need to report NFA_EE_UPDATED_EVT */
+#define NFA_EE_WAIT_UPDATE 0x10
+/* waiting for the rsp of set routing commands */
+#define NFA_EE_WAIT_UPDATE_RSP 0x20
#define NFA_EE_WAIT_UPDATE_ALL 0xF0
typedef uint8_t tNFA_EE_WAIT;
-#define NFA_EE_FLAG_WAIT_HCI 0x01 /* set this bit when waiting for HCI to finish the initialization process in NFA_EE_EM_STATE_RESTORING */
-#define NFA_EE_FLAG_NOTIFY_HCI 0x02 /* set this bit when EE needs to notify the p_enable_cback at the end of NFCEE discover process in NFA_EE_EM_STATE_RESTORING */
-#define NFA_EE_FLAG_WAIT_DISCONN 0x04 /* set this bit when gracefully disable with outstanding NCI connections */
+/* set this bit when waiting for HCI to finish the initialization process in NFA_EE_EM_STATE_RESTORING */
+#define NFA_EE_FLAG_WAIT_HCI 0x01
+/* set this bit when EE needs to notify the p_enable_cback at the end of NFCEE discover process in NFA_EE_EM_STATE_RESTORING */
+#define NFA_EE_FLAG_NOTIFY_HCI 0x02
+/* set this bit when gracefully disable with outstanding NCI connections */
+#define NFA_EE_FLAG_WAIT_DISCONN 0x04
typedef uint8_t tNFA_EE_FLAGS;
-#define NFA_EE_DISC_STS_ON 0x00 /* NFCEE DISCOVER in progress */
-#define NFA_EE_DISC_STS_OFF 0x01 /* disable NFCEE DISCOVER */
-#define NFA_EE_DISC_STS_REQ 0x02 /* received NFCEE DISCOVER REQ NTF */
+/* NFCEE DISCOVER in progress */
+#define NFA_EE_DISC_STS_ON 0x00
+/* disable NFCEE DISCOVER */
+#define NFA_EE_DISC_STS_OFF 0x01
+/* received NFCEE DISCOVER REQ NTF */
+#define NFA_EE_DISC_STS_REQ 0x02
typedef uint8_t tNFA_EE_DISC_STS;
typedef void (tNFA_EE_ENABLE_DONE_CBACK)(tNFA_EE_DISC_STS status);
diff --git a/src/nfa/int/nfa_hci_int.h b/src/nfa/int/nfa_hci_int.h
index d000356..4d4c197 100644
--- a/src/nfa/int/nfa_hci_int.h
+++ b/src/nfa/int/nfa_hci_int.h
@@ -36,27 +36,40 @@
#define NFA_HCI_HOST_ID_UICC0 0x02 /* Host ID for UICC 0 */
-#define NFA_HCI_LAST_HOST_SPECIFIC_GATE 0xEF /* Lost host specific gate */
+/* Lost host specific gate */
+#define NFA_HCI_LAST_HOST_SPECIFIC_GATE 0xEF
#define NFA_HCI_SESSION_ID_LEN 8 /* HCI Session ID length */
-#define NFA_MAX_PIPES_IN_GENERIC_GATE 0x0F /* Maximum pipes that can be created on a generic pipe */
+/* Maximum pipes that can be created on a generic pipe */
+#define NFA_MAX_PIPES_IN_GENERIC_GATE 0x0F
-#define NFA_HCI_VERSION_SW 0x090000 /* HCI SW Version number */
-#define NFA_HCI_VERSION_HW 0x000000 /* HCI HW Version number */
+/* HCI SW Version number */
+#define NFA_HCI_VERSION_SW 0x090000
+/* HCI HW Version number */
+#define NFA_HCI_VERSION_HW 0x000000
#define NFA_HCI_VENDOR_NAME "HCI" /* Vendor Name */
-#define NFA_HCI_MODEL_ID 00 /* Model ID */
-#define NFA_HCI_VERSION 90 /* HCI Version */
+/* Model ID */
+#define NFA_HCI_MODEL_ID 00
+/* HCI Version */
+#define NFA_HCI_VERSION 90
/* NFA HCI states */
#define NFA_HCI_STATE_DISABLED 0x00 /* HCI is disabled */
-#define NFA_HCI_STATE_STARTUP 0x01 /* HCI performing Initialization sequence */
-#define NFA_HCI_STATE_WAIT_NETWK_ENABLE 0x02 /* HCI is waiting for initialization of other host in the network */
-#define NFA_HCI_STATE_IDLE 0x03 /* HCI is waiting to handle api commands */
-#define NFA_HCI_STATE_WAIT_RSP 0x04 /* HCI is waiting for response to command sent */
-#define NFA_HCI_STATE_REMOVE_GATE 0x05 /* Removing all pipes prior to removing the gate */
-#define NFA_HCI_STATE_APP_DEREGISTER 0x06 /* Removing all pipes and gates prior to deregistering the app */
+/* HCI performing Initialization sequence */
+#define NFA_HCI_STATE_STARTUP 0x01
+/* HCI is waiting for initialization of other host in the network */
+#define NFA_HCI_STATE_WAIT_NETWK_ENABLE 0x02
+/* HCI is waiting to handle api commands */
+#define NFA_HCI_STATE_IDLE 0x03
+/* HCI is waiting for response to command sent */
+#define NFA_HCI_STATE_WAIT_RSP 0x04
+/* Removing all pipes prior to removing the gate */
+#define NFA_HCI_STATE_REMOVE_GATE 0x05
+/* Removing all pipes and gates prior to deregistering the app */
+#define NFA_HCI_STATE_APP_DEREGISTER 0x06
#define NFA_HCI_STATE_RESTORE 0x07 /* HCI restore */
-#define NFA_HCI_STATE_RESTORE_NETWK_ENABLE 0x08 /* HCI is waiting for initialization of other host in the network after restore */
+/* HCI is waiting for initialization of other host in the network after restore */
+#define NFA_HCI_STATE_RESTORE_NETWK_ENABLE 0x08
typedef uint8_t tNFA_HCI_STATE;
@@ -360,7 +373,8 @@
} tNFA_ID_MGMT_GATE_INFO;
/* Internal flags */
-#define NFA_HCI_FL_DISABLING 0x01 /* sub system is being disabled */
+/* sub system is being disabled */
+#define NFA_HCI_FL_DISABLING 0x01
#define NFA_HCI_FL_NV_CHANGED 0x02 /* NV Ram changed */
diff --git a/src/nfa/int/nfa_p2p_int.h b/src/nfa/int/nfa_p2p_int.h
index 1d6df8e..5a203c7 100644
--- a/src/nfa/int/nfa_p2p_int.h
+++ b/src/nfa/int/nfa_p2p_int.h
@@ -204,12 +204,16 @@
/*****************************************************************************
** control block
*****************************************************************************/
-#define NFA_P2P_HANDLE_FLAG_CONN 0x80 /* Bit flag for connection handle */
+/* Bit flag for connection handle */
+#define NFA_P2P_HANDLE_FLAG_CONN 0x80
/* NFA P2P Connection block */
-#define NFA_P2P_CONN_FLAG_IN_USE 0x01 /* Connection control block is used */
-#define NFA_P2P_CONN_FLAG_REMOTE_RW_ZERO 0x02 /* Remote set RW to 0 (flow off) */
-#define NFA_P2P_CONN_FLAG_CONGESTED 0x04 /* data link connection is congested */
+/* Connection control block is used */
+#define NFA_P2P_CONN_FLAG_IN_USE 0x01
+/* Remote set RW to 0 (flow off) */
+#define NFA_P2P_CONN_FLAG_REMOTE_RW_ZERO 0x02
+/* data link connection is congested */
+#define NFA_P2P_CONN_FLAG_CONGESTED 0x04
typedef struct
{
@@ -221,9 +225,12 @@
} tNFA_P2P_CONN_CB;
/* NFA P2P SAP control block */
-#define NFA_P2P_SAP_FLAG_SERVER 0x01 /* registered server */
-#define NFA_P2P_SAP_FLAG_CLIENT 0x02 /* registered client */
-#define NFA_P2P_SAP_FLAG_LLINK_CONGESTED 0x04 /* logical link connection is congested */
+/* registered server */
+#define NFA_P2P_SAP_FLAG_SERVER 0x01
+/* registered client */
+#define NFA_P2P_SAP_FLAG_CLIENT 0x02
+/* logical link connection is congested */
+#define NFA_P2P_SAP_FLAG_LLINK_CONGESTED 0x04
typedef struct
{
diff --git a/src/nfa/int/nfa_rw_int.h b/src/nfa/int/nfa_rw_int.h
index 8ecfda8..fc1ff15 100644
--- a/src/nfa/int/nfa_rw_int.h
+++ b/src/nfa/int/nfa_rw_int.h
@@ -42,9 +42,12 @@
/* TLV detection status */
#define NFA_RW_TLV_DETECT_ST_OP_NOT_STARTED 0x00 /* No Tlv detected */
-#define NFA_RW_TLV_DETECT_ST_LOCK_TLV_OP_COMPLETE 0x01 /* Lock control tlv detected */
-#define NFA_RW_TLV_DETECT_ST_MEM_TLV_OP_COMPLETE 0x02 /* Memory control tlv detected */
-#define NFA_RW_TLV_DETECT_ST_COMPLETE 0x03 /* Both Lock and Memory control Tlvs are detected */
+/* Lock control tlv detected */
+#define NFA_RW_TLV_DETECT_ST_LOCK_TLV_OP_COMPLETE 0x01
+/* Memory control tlv detected */
+#define NFA_RW_TLV_DETECT_ST_MEM_TLV_OP_COMPLETE 0x02
+/* Both Lock and Memory control Tlvs are detected */
+#define NFA_RW_TLV_DETECT_ST_COMPLETE 0x03
typedef uint8_t tNFA_RW_TLV_ST;
@@ -271,13 +274,20 @@
typedef uint8_t tNFA_RW_NDEF_ST;
/* flags for RW control block */
-#define NFA_RW_FL_NOT_EXCL_RF_MODE 0x01 /* Activation while not in exclusive RF mode */
-#define NFA_RW_FL_AUTO_PRESENCE_CHECK_BUSY 0x02 /* Waiting for response from tag for auto-presence check */
-#define NFA_RW_FL_TAG_IS_READONLY 0x04 /* Read only tag */
-#define NFA_RW_FL_ACTIVATION_NTF_PENDING 0x08 /* Busy retrieving additional tag information */
-#define NFA_RW_FL_API_BUSY 0x10 /* Tag operation is in progress */
-#define NFA_RW_FL_ACTIVATED 0x20 /* Tag is been activated */
-#define NFA_RW_FL_NDEF_OK 0x40 /* NDEF DETECTed OK */
+/* Activation while not in exclusive RF mode */
+#define NFA_RW_FL_NOT_EXCL_RF_MODE 0x01
+/* Waiting for response from tag for auto-presence check */
+#define NFA_RW_FL_AUTO_PRESENCE_CHECK_BUSY 0x02
+/* Read only tag */
+#define NFA_RW_FL_TAG_IS_READONLY 0x04
+/* Busy retrieving additional tag information */
+#define NFA_RW_FL_ACTIVATION_NTF_PENDING 0x08
+/* Tag operation is in progress */
+#define NFA_RW_FL_API_BUSY 0x10
+/* Tag is been activated */
+#define NFA_RW_FL_ACTIVATED 0x20
+/* NDEF DETECTed OK */
+#define NFA_RW_FL_NDEF_OK 0x40
/* NFA RW control block */
typedef struct
diff --git a/src/nfa/int/nfa_snep_int.h b/src/nfa/int/nfa_snep_int.h
index 75312fd..8d89db1 100644
--- a/src/nfa/int/nfa_snep_int.h
+++ b/src/nfa/int/nfa_snep_int.h
@@ -34,7 +34,8 @@
*****************************************************************************/
#define NFA_SNEP_DEFAULT_SERVER_SAP 0x04 /* SNEP default server SAP */
#define NFA_SNEP_HEADER_SIZE 6 /* SNEP header size */
-#define NFA_SNEP_ACCEPT_LEN_SIZE 4 /* SNEP Acceptable Length size */
+/* SNEP Acceptable Length size */
+#define NFA_SNEP_ACCEPT_LEN_SIZE 4
#define NFA_SNEP_CLIENT_TIMEOUT 1000 /* ms, waiting for response */
/* NFA SNEP events */
@@ -167,13 +168,18 @@
*****************************************************************************/
/* NFA SNEP service control block */
-#define NFA_SNEP_FLAG_ANY 0x00 /* ignore flags while searching */
+/* ignore flags while searching */
+#define NFA_SNEP_FLAG_ANY 0x00
#define NFA_SNEP_FLAG_SERVER 0x01 /* server */
#define NFA_SNEP_FLAG_CLIENT 0x02 /* client */
-#define NFA_SNEP_FLAG_CONNECTING 0x04 /* waiting for connection confirm */
-#define NFA_SNEP_FLAG_CONNECTED 0x08 /* data link connected */
-#define NFA_SNEP_FLAG_W4_RESP_CONTINUE 0x10 /* Waiting for continue response */
-#define NFA_SNEP_FLAG_W4_REQ_CONTINUE 0x20 /* Waiting for continue request */
+/* waiting for connection confirm */
+#define NFA_SNEP_FLAG_CONNECTING 0x04
+/* data link connected */
+#define NFA_SNEP_FLAG_CONNECTED 0x08
+/* Waiting for continue response */
+#define NFA_SNEP_FLAG_W4_RESP_CONTINUE 0x10
+/* Waiting for continue request */
+#define NFA_SNEP_FLAG_W4_REQ_CONTINUE 0x20
typedef struct
{
diff --git a/src/nfc/include/ce_api.h b/src/nfc/include/ce_api.h
index 7ceeac5..fa126e8 100644
--- a/src/nfc/include/ce_api.h
+++ b/src/nfc/include/ce_api.h
@@ -89,8 +89,10 @@
/* T4T definitions */
typedef uint8_t tCE_T4T_AID_HANDLE; /* Handle for AID registration */
-#define CE_T4T_AID_HANDLE_INVALID 0xFF /* Invalid tCE_T4T_AID_HANDLE */
-#define CE_T4T_WILDCARD_AID_HANDLE (CE_T4T_MAX_REG_AID) /* reserved handle for wildcard aid */
+/* Invalid tCE_T4T_AID_HANDLE */
+#define CE_T4T_AID_HANDLE_INVALID 0xFF
+/* reserved handle for wildcard aid */
+#define CE_T4T_WILDCARD_AID_HANDLE (CE_T4T_MAX_REG_AID)
/*******************************************************************************
**
diff --git a/src/nfc/include/llcp_api.h b/src/nfc/include/llcp_api.h
index a154ee4..f28e08d 100644
--- a/src/nfc/include/llcp_api.h
+++ b/src/nfc/include/llcp_api.h
@@ -31,15 +31,19 @@
/*****************************************************************************
** Constants
*****************************************************************************/
-#define LLCP_STATUS_SUCCESS 0 /* Successfully done */
-#define LLCP_STATUS_FAIL 1 /* Failed without specific reason */
-#define LLCP_STATUS_CONGESTED 2 /* Data link is congested */
+/* Successfully done */
+#define LLCP_STATUS_SUCCESS 0
+/* Failed without specific reason */
+#define LLCP_STATUS_FAIL 1
+/* Data link is congested */
+#define LLCP_STATUS_CONGESTED 2
typedef uint8_t tLLCP_STATUS;
#define LLCP_MIN_OFFSET (NCI_MSG_OFFSET_SIZE + NCI_DATA_HDR_SIZE + LLCP_PDU_HEADER_SIZE + LLCP_SEQUENCE_SIZE)
-#define LLCP_INVALID_SAP 0xFF /* indication of failure to allocate data link resource */
+/* indication of failure to allocate data link resource */
+#define LLCP_INVALID_SAP 0xFF
/*****************************************************************************
** Type Definitions
@@ -66,22 +70,35 @@
/* Link Management Callback Events */
-#define LLCP_LINK_ACTIVATION_FAILED_EVT 0x00 /* Fail to activate link */
-#define LLCP_LINK_ACTIVATION_COMPLETE_EVT 0x01 /* LLCP Link is activated */
-#define LLCP_LINK_DEACTIVATED_EVT 0x02 /* LLCP Link is deactivated */
-#define LLCP_LINK_FIRST_PACKET_RECEIVED_EVT 0x03 /* First LLCP packet received from remote */
+/* Fail to activate link */
+#define LLCP_LINK_ACTIVATION_FAILED_EVT 0x00
+/* LLCP Link is activated */
+#define LLCP_LINK_ACTIVATION_COMPLETE_EVT 0x01
+/* LLCP Link is deactivated */
+#define LLCP_LINK_DEACTIVATED_EVT 0x02
+/* First LLCP packet received from remote */
+#define LLCP_LINK_FIRST_PACKET_RECEIVED_EVT 0x03
/* Link Management Callback Reasons */
-#define LLCP_LINK_SUCCESS 0x00 /* Success */
-#define LLCP_LINK_VERSION_FAILED 0x01 /* Failed to agree version */
-#define LLCP_LINK_BAD_GEN_BYTES 0x02 /* Failed to parse received general bytes */
-#define LLCP_LINK_INTERNAL_ERROR 0x03 /* internal error */
-#define LLCP_LINK_LOCAL_INITIATED 0x04 /* Link has been deactivated by local */
-#define LLCP_LINK_REMOTE_INITIATED 0x05 /* Link has been deactivated by remote */
-#define LLCP_LINK_TIMEOUT 0x06 /* Link has been deactivated by timeout */
-#define LLCP_LINK_FRAME_ERROR 0x07 /* Link has been deactivated by frame error */
-#define LLCP_LINK_RF_LINK_LOSS_NO_RX_LLC 0x08 /* RF link loss without any rx LLC PDU */
+/* Success */
+#define LLCP_LINK_SUCCESS 0x00
+/* Failed to agree version */
+#define LLCP_LINK_VERSION_FAILED 0x01
+/* Failed to parse received general bytes */
+#define LLCP_LINK_BAD_GEN_BYTES 0x02
+/* internal error */
+#define LLCP_LINK_INTERNAL_ERROR 0x03
+/* Link has been deactivated by local */
+#define LLCP_LINK_LOCAL_INITIATED 0x04
+/* Link has been deactivated by remote */
+#define LLCP_LINK_REMOTE_INITIATED 0x05
+/* Link has been deactivated by timeout */
+#define LLCP_LINK_TIMEOUT 0x06
+/* Link has been deactivated by frame error */
+#define LLCP_LINK_FRAME_ERROR 0x07
+/* RF link loss without any rx LLC PDU */
+#define LLCP_LINK_RF_LINK_LOSS_NO_RX_LLC 0x08
#define LLCP_LINK_RF_TRANSMISSION_ERR NFC_STATUS_RF_TRANSMISSION_ERR
#define LLCP_LINK_RF_PROTOCOL_ERR NFC_STATUS_RF_PROTOCOL_ERR
#define LLCP_LINK_RF_TIMEOUT NFC_STATUS_TIMEOUT
@@ -95,14 +112,22 @@
/* Service Access Point (SAP) Callback Events */
-#define LLCP_SAP_EVT_DATA_IND 0x00 /* Received data on SAP */
-#define LLCP_SAP_EVT_CONNECT_IND 0x01 /* Connection request from peer */
-#define LLCP_SAP_EVT_CONNECT_RESP 0x02 /* Connection accepted by peer */
-#define LLCP_SAP_EVT_DISCONNECT_IND 0x03 /* Received disconnect request */
-#define LLCP_SAP_EVT_DISCONNECT_RESP 0x04 /* Received disconnect response */
-#define LLCP_SAP_EVT_CONGEST 0x05 /* congested status is changed */
-#define LLCP_SAP_EVT_LINK_STATUS 0x06 /* Change of LLCP Link status */
-#define LLCP_SAP_EVT_TX_COMPLETE 0x07 /* tx queue is empty and all PDU is acked */
+/* Received data on SAP */
+#define LLCP_SAP_EVT_DATA_IND 0x00
+/* Connection request from peer */
+#define LLCP_SAP_EVT_CONNECT_IND 0x01
+/* Connection accepted by peer */
+#define LLCP_SAP_EVT_CONNECT_RESP 0x02
+/* Received disconnect request */
+#define LLCP_SAP_EVT_DISCONNECT_IND 0x03
+/* Received disconnect response */
+#define LLCP_SAP_EVT_DISCONNECT_RESP 0x04
+/* congested status is changed */
+#define LLCP_SAP_EVT_CONGEST 0x05
+/* Change of LLCP Link status */
+#define LLCP_SAP_EVT_LINK_STATUS 0x06
+/* tx queue is empty and all PDU is acked */
+#define LLCP_SAP_EVT_TX_COMPLETE 0x07
#define LLCP_LINK_TYPE_LOGICAL_DATA_LINK 0x01
#define LLCP_LINK_TYPE_DATA_LINK_CONNECTION 0x02
diff --git a/src/nfc/include/llcp_defs.h b/src/nfc/include/llcp_defs.h
index 7ebb99f..7abab26 100644
--- a/src/nfc/include/llcp_defs.h
+++ b/src/nfc/include/llcp_defs.h
@@ -124,20 +124,25 @@
#define LLCP_WKS_MASK_LM 0x0001 /* Link Management */
#define LLCP_WKS_MASK_SDP 0x0002 /* Service Discovery "urn:nfc:sn:sdp" */
#define LLCP_WKS_MASK_IP 0x0004 /* IP over LLCP Binding "urn:nfc:sn:ip" */
-#define LLCP_WKS_MASK_OBEX 0x0008 /* OBEX over LLCP Binding "urn:nfc:sn:obex" */
-#define LLCP_WKS_MASK_SNEP 0x0010 /* Simple NDEP Exchange Protocol "urn:nfc:sn:snep" */
+/* OBEX over LLCP Binding "urn:nfc:sn:obex" */
+#define LLCP_WKS_MASK_OBEX 0x0008
+/* Simple NDEP Exchange Protocol "urn:nfc:sn:snep" */
+#define LLCP_WKS_MASK_SNEP 0x0010
/* Well-Known Service Access Points */
#define LLCP_SAP_LM 0x00 /* Link Management */
#define LLCP_SAP_SDP 0x01 /* Service Discovery "urn:nfc:sn:sdp" */
#define LLCP_SAP_IP 0x02 /* IP over LLCP Binding "urn:nfc:sn:ip" */
-#define LLCP_SAP_OBEX 0x03 /* OBEX over LLCP Binding "urn:nfc:sn:obex" */
-#define LLCP_SAP_SNEP 0x04 /* Simple NDEP Exchange Protocol "urn:nfc:sn:snep" */
+/* OBEX over LLCP Binding "urn:nfc:sn:obex" */
+#define LLCP_SAP_OBEX 0x03
+/* Simple NDEP Exchange Protocol "urn:nfc:sn:snep" */
+#define LLCP_SAP_SNEP 0x04
/* Link Timeout, LTO */
#define LLCP_LTO_TYPE 0x04
#define LLCP_LTO_LEN 0x01
-#define LLCP_DEFAULT_LTO_IN_MS 100 /* default 100ms. It should be sufficiently larget than RWT */
+/* default 100ms. It should be sufficiently larget than RWT */
+#define LLCP_DEFAULT_LTO_IN_MS 100
#define LLCP_LTO_UNIT 10 /* 10 ms */
#define LLCP_MAX_LTO_IN_MS 2550 /* 2550 ms; 8bits * 10ms */
@@ -156,7 +161,8 @@
/* Service Discovery Request, SDREQ */
#define LLCP_SDREQ_TYPE 0x08
-#define LLCP_SDREQ_MIN_LEN 0x03 /* type(1 byte), length(1 byte), TID(1 byte) */
+/* type(1 byte), length(1 byte), TID(1 byte) */
+#define LLCP_SDREQ_MIN_LEN 0x03
/* Service Discovery Response, SDRES */
#define LLCP_SDRES_TYPE 0x09
@@ -184,8 +190,10 @@
#define LLCP_UPPER_BOUND_LOCAL_SAP 0x3F
/* Max Payload */
-#define LLCP_NCI_MAX_PAYL_SIZE 254 /* Maximum Payload size, Length Reduction LRi/LRt */
-#define LLCP_NFC_DEP_HEADER_SIZE 3 /* Data exchange protocol header, 3 bytes */
+/* Maximum Payload size, Length Reduction LRi/LRt */
+#define LLCP_NCI_MAX_PAYL_SIZE 254
+/* Data exchange protocol header, 3 bytes */
+#define LLCP_NFC_DEP_HEADER_SIZE 3
#define LLCP_MAX_PAYLOAD_SIZE (LLCP_NCI_MAX_PAYL_SIZE - LLCP_NFC_DEP_HEADER_SIZE)
#define LLCP_MAX_GEN_BYTES 48
diff --git a/src/nfc/include/ndef_utils.h b/src/nfc/include/ndef_utils.h
index c18b30e..9819ce1 100644
--- a/src/nfc/include/ndef_utils.h
+++ b/src/nfc/include/ndef_utils.h
@@ -35,8 +35,10 @@
#define NDEF_SR_MASK 0x10 /* Short Record */
#define NDEF_IL_MASK 0x08 /* ID Length */
#define NDEF_TNF_MASK 0x07 /* Type Name Format */
-#define NDEF_RTD_VALID_START 0x20 /* First valid ASCII as per RTD specification */
-#define NDEF_RTD_VALID_END 0x7E /* Last valid ASCII as per RTD specification */
+/* First valid ASCII as per RTD specification */
+#define NDEF_RTD_VALID_START 0x20
+/* Last valid ASCII as per RTD specification */
+#define NDEF_RTD_VALID_END 0x7E
/* NDEF Type Name Format */
#define NDEF_TNF_EMPTY 0 /* Empty (type/id/payload len =0) */
diff --git a/src/nfc/include/nfc_api.h b/src/nfc/include/nfc_api.h
index 4faead8..bafc548 100644
--- a/src/nfc/include/nfc_api.h
+++ b/src/nfc/include/nfc_api.h
@@ -35,44 +35,79 @@
#include "vendor_cfg.h"
/* NFC application return status codes */
-#define NFC_STATUS_OK NCI_STATUS_OK /* Command succeeded */
-#define NFC_STATUS_REJECTED NCI_STATUS_REJECTED /* Command is rejected. */
-#define NFC_STATUS_MSG_CORRUPTED NCI_STATUS_MESSAGE_CORRUPTED /* Message is corrupted */
-#define NFC_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL /* buffer full */
-#define NFC_STATUS_FAILED NCI_STATUS_FAILED /* failed */
-#define NFC_STATUS_NOT_INITIALIZED NCI_STATUS_NOT_INITIALIZED /* not initialized */
-#define NFC_STATUS_SYNTAX_ERROR NCI_STATUS_SYNTAX_ERROR /* Syntax error */
-#define NFC_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR /* Semantic error */
-#define NFC_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID /* Unknown NCI Group ID */
-#define NFC_STATUS_UNKNOWN_OID NCI_STATUS_UNKNOWN_OID /* Unknown NCI Opcode */
-#define NFC_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM /* Invalid Parameter */
-#define NFC_STATUS_MSG_SIZE_TOO_BIG NCI_STATUS_MSG_SIZE_TOO_BIG /* Message size too big */
-#define NFC_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED /* Already started */
-#define NFC_STATUS_ACTIVATION_FAILED NCI_STATUS_ACTIVATION_FAILED /* Activation Failed */
-#define NFC_STATUS_TEAR_DOWN NCI_STATUS_TEAR_DOWN /* Tear Down Error */
-#define NFC_STATUS_RF_TRANSMISSION_ERR NCI_STATUS_RF_TRANSMISSION_ERR /* RF transmission error*/
-#define NFC_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR /* RF protocol error */
-#define NFC_STATUS_TIMEOUT NCI_STATUS_TIMEOUT /* RF Timeout */
-#define NFC_STATUS_EE_INTF_ACTIVE_FAIL NCI_STATUS_EE_INTF_ACTIVE_FAIL /* EE Intf activate err */
-#define NFC_STATUS_EE_TRANSMISSION_ERR NCI_STATUS_EE_TRANSMISSION_ERR /* EE transmission error*/
-#define NFC_STATUS_EE_PROTOCOL_ERR NCI_STATUS_EE_PROTOCOL_ERR /* EE protocol error */
-#define NFC_STATUS_EE_TIMEOUT NCI_STATUS_EE_TIMEOUT /* EE Timeout */
+/* Command succeeded */
+#define NFC_STATUS_OK NCI_STATUS_OK
+/* Command is rejected. */
+#define NFC_STATUS_REJECTED NCI_STATUS_REJECTED
+/* Message is corrupted */
+#define NFC_STATUS_MSG_CORRUPTED NCI_STATUS_MESSAGE_CORRUPTED
+/* buffer full */
+#define NFC_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL
+/* failed */
+#define NFC_STATUS_FAILED NCI_STATUS_FAILED
+/* not initialized */
+#define NFC_STATUS_NOT_INITIALIZED NCI_STATUS_NOT_INITIALIZED
+/* Syntax error */
+#define NFC_STATUS_SYNTAX_ERROR NCI_STATUS_SYNTAX_ERROR
+/* Semantic error */
+#define NFC_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR
+/* Unknown NCI Group ID */
+#define NFC_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID
+/* Unknown NCI Opcode */
+#define NFC_STATUS_UNKNOWN_OID NCI_STATUS_UNKNOWN_OID
+/* Invalid Parameter */
+#define NFC_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM
+/* Message size too big */
+#define NFC_STATUS_MSG_SIZE_TOO_BIG NCI_STATUS_MSG_SIZE_TOO_BIG
+/* Already started */
+#define NFC_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED
+/* Activation Failed */
+#define NFC_STATUS_ACTIVATION_FAILED NCI_STATUS_ACTIVATION_FAILED
+/* Tear Down Error */
+#define NFC_STATUS_TEAR_DOWN NCI_STATUS_TEAR_DOWN
+/* RF transmission error*/
+#define NFC_STATUS_RF_TRANSMISSION_ERR NCI_STATUS_RF_TRANSMISSION_ERR
+/* RF protocol error */
+#define NFC_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR
+/* RF Timeout */
+#define NFC_STATUS_TIMEOUT NCI_STATUS_TIMEOUT
+/* EE Intf activate err */
+#define NFC_STATUS_EE_INTF_ACTIVE_FAIL NCI_STATUS_EE_INTF_ACTIVE_FAIL
+/* EE transmission error*/
+#define NFC_STATUS_EE_TRANSMISSION_ERR NCI_STATUS_EE_TRANSMISSION_ERR
+/* EE protocol error */
+#define NFC_STATUS_EE_PROTOCOL_ERR NCI_STATUS_EE_PROTOCOL_ERR
+/* EE Timeout */
+#define NFC_STATUS_EE_TIMEOUT NCI_STATUS_EE_TIMEOUT
/* 0xE0 ~0xFF are proprietary status codes */
-#define NFC_STATUS_CMD_STARTED 0xE3/* Command started successfully */
-#define NFC_STATUS_HW_TIMEOUT 0xE4/* NFCC Timeout in responding to an NCI command */
-#define NFC_STATUS_CONTINUE 0xE5/* More (same) event to follow */
-#define NFC_STATUS_REFUSED 0xE6/* API is called to perform illegal function */
-#define NFC_STATUS_BAD_RESP 0xE7/* Wrong format of R-APDU, CC file or NDEF file */
-#define NFC_STATUS_CMD_NOT_CMPLTD 0xE8/* 7816 Status Word is not command complete(0x9000) */
-#define NFC_STATUS_NO_BUFFERS 0xE9/* Out of GKI buffers */
-#define NFC_STATUS_WRONG_PROTOCOL 0xEA/* Protocol mismatch between API and activated one */
-#define NFC_STATUS_BUSY 0xEB/* Another Tag command is already in progress */
+/* Command started successfully */
+#define NFC_STATUS_CMD_STARTED 0xE3
+/* NFCC Timeout in responding to an NCI command */
+#define NFC_STATUS_HW_TIMEOUT 0xE4
+/* More (same) event to follow */
+#define NFC_STATUS_CONTINUE 0xE5
+/* API is called to perform illegal function */
+#define NFC_STATUS_REFUSED 0xE6
+/* Wrong format of R-APDU, CC file or NDEF file */
+#define NFC_STATUS_BAD_RESP 0xE7
+/* 7816 Status Word is not command complete(0x9000) */
+#define NFC_STATUS_CMD_NOT_CMPLTD 0xE8
+/* Out of GKI buffers */
+#define NFC_STATUS_NO_BUFFERS 0xE9
+/* Protocol mismatch between API and activated one */
+#define NFC_STATUS_WRONG_PROTOCOL 0xEA
+/* Another Tag command is already in progress */
+#define NFC_STATUS_BUSY 0xEB
-#define NFC_STATUS_LINK_LOSS 0xFC /* Link Loss */
-#define NFC_STATUS_BAD_LENGTH 0xFD /* data len exceeds MIU */
-#define NFC_STATUS_BAD_HANDLE 0xFE /* invalid handle */
-#define NFC_STATUS_CONGESTED 0xFF /* congested */
+/* Link Loss */
+#define NFC_STATUS_LINK_LOSS 0xFC
+/* data len exceeds MIU */
+#define NFC_STATUS_BAD_LENGTH 0xFD
+/* invalid handle */
+#define NFC_STATUS_BAD_HANDLE 0xFE
+/* congested */
+#define NFC_STATUS_CONGESTED 0xFF
typedef uint8_t tNFC_STATUS;
@@ -136,15 +171,19 @@
#define NFC_PARAM_ID_RF_EE_ACTION NCI_PARAM_ID_RF_EE_ACTION
#define NFC_PARAM_ID_ISO_DEP_OP NCI_PARAM_ID_ISO_DEP_OP
-#define NFC_ROUTE_TAG_TECH NCI_ROUTE_TAG_TECH /* Technology based routing */
-#define NFC_ROUTE_TAG_PROTO NCI_ROUTE_TAG_PROTO /* Protocol based routing */
+/* Technology based routing */
+#define NFC_ROUTE_TAG_TECH NCI_ROUTE_TAG_TECH
+/* Protocol based routing */
+#define NFC_ROUTE_TAG_PROTO NCI_ROUTE_TAG_PROTO
#define NFC_ROUTE_TAG_AID NCI_ROUTE_TAG_AID /* AID routing */
-#define NFC_ROUTE_TLV_ENTRY_SIZE 4 /* tag, len, 2 byte value for technology/protocol based routing */
+/* tag, len, 2 byte value for technology/protocol based routing */
+#define NFC_ROUTE_TLV_ENTRY_SIZE 4
/* For routing */
#define NFC_DH_ID NCI_DH_ID /* for DH */
/* To identify the loopback test */
-#define NFC_TEST_ID NCI_TEST_ID /* use a proprietary range */
+/* use a proprietary range */
+#define NFC_TEST_ID NCI_TEST_ID
typedef uint8_t tNFC_PMID;
#define NFC_TL_SIZE 2
@@ -263,9 +302,12 @@
uint8_t info[NFC_MAX_EE_INFO];
} tNFC_NFCEE_TLV;
-#define NFC_NFCEE_STATUS_INACTIVE NCI_NFCEE_STS_CONN_INACTIVE/* NFCEE connected and inactive */
-#define NFC_NFCEE_STATUS_ACTIVE NCI_NFCEE_STS_CONN_ACTIVE /* NFCEE connected and active */
-#define NFC_NFCEE_STATUS_REMOVED NCI_NFCEE_STS_REMOVED /* NFCEE removed */
+/* NFCEE connected and inactive */
+#define NFC_NFCEE_STATUS_INACTIVE NCI_NFCEE_STS_CONN_INACTIVE
+/* NFCEE connected and active */
+#define NFC_NFCEE_STATUS_ACTIVE NCI_NFCEE_STS_CONN_ACTIVE
+/* NFCEE removed */
+#define NFC_NFCEE_STATUS_REMOVED NCI_NFCEE_STS_REMOVED
/* the data type associated with NFC_NFCEE_INFO_REVT */
typedef struct
{
@@ -326,8 +368,10 @@
} tNFC_DATA_CEVT;
/* RF Field Status */
-#define NFC_RF_STS_NO_REMOTE NCI_RF_STS_NO_REMOTE /* No field generated by remote device */
-#define NFC_RF_STS_REMOTE NCI_RF_STS_REMOTE /* field generated by remote device */
+/* No field generated by remote device */
+#define NFC_RF_STS_NO_REMOTE NCI_RF_STS_NO_REMOTE
+/* field generated by remote device */
+#define NFC_RF_STS_REMOTE NCI_RF_STS_REMOTE
typedef uint8_t tNFC_RF_STS;
/* RF Field Technologies */
@@ -340,11 +384,16 @@
/* Supported Protocols */
#define NFC_PROTOCOL_UNKNOWN NCI_PROTOCOL_UNKNOWN /* Unknown */
-#define NFC_PROTOCOL_T1T NCI_PROTOCOL_T1T /* Type1Tag - NFC-A */
-#define NFC_PROTOCOL_T2T NCI_PROTOCOL_T2T /* Type2Tag - NFC-A */
-#define NFC_PROTOCOL_T3T NCI_PROTOCOL_T3T /* Type3Tag - NFC-F */
-#define NFC_PROTOCOL_ISO_DEP NCI_PROTOCOL_ISO_DEP /* Type 4A,4B - NFC-A or NFC-B */
-#define NFC_PROTOCOL_NFC_DEP NCI_PROTOCOL_NFC_DEP /* NFCDEP/LLCP - NFC-A or NFC-F */
+/* Type1Tag - NFC-A */
+#define NFC_PROTOCOL_T1T NCI_PROTOCOL_T1T
+/* Type2Tag - NFC-A */
+#define NFC_PROTOCOL_T2T NCI_PROTOCOL_T2T
+/* Type3Tag - NFC-F */
+#define NFC_PROTOCOL_T3T NCI_PROTOCOL_T3T
+/* Type 4A,4B - NFC-A or NFC-B */
+#define NFC_PROTOCOL_ISO_DEP NCI_PROTOCOL_ISO_DEP
+/* NFCDEP/LLCP - NFC-A or NFC-F */
+#define NFC_PROTOCOL_NFC_DEP NCI_PROTOCOL_NFC_DEP
#define NFC_PROTOCOL_MIFARE NCI_PROTOCOL_MIFARE
#define NFC_PROTOCOL_B_PRIME NCI_PROTOCOL_B_PRIME
#define NFC_PROTOCOL_15693 NCI_PROTOCOL_15693
@@ -437,10 +486,14 @@
uint8_t data[NFC_MAX_APP_DATA_LEN]; /* application data */
} tNFC_APP_INIT;
-#define NFC_EE_TRIG_SELECT NCI_EE_TRIG_7816_SELECT /* ISO 7816-4 SELECT command */
-#define NFC_EE_TRIG_RF_PROTOCOL NCI_EE_TRIG_RF_PROTOCOL /* RF Protocol changed */
-#define NFC_EE_TRIG_RF_TECHNOLOGY NCI_EE_TRIG_RF_TECHNOLOGY/* RF Technology changed */
-#define NFC_EE_TRIG_APP_INIT NCI_EE_TRIG_APP_INIT /* Application initiation */
+/* ISO 7816-4 SELECT command */
+#define NFC_EE_TRIG_SELECT NCI_EE_TRIG_7816_SELECT
+/* RF Protocol changed */
+#define NFC_EE_TRIG_RF_PROTOCOL NCI_EE_TRIG_RF_PROTOCOL
+/* RF Technology changed */
+#define NFC_EE_TRIG_RF_TECHNOLOGY NCI_EE_TRIG_RF_TECHNOLOGY
+/* Application initiation */
+#define NFC_EE_TRIG_APP_INIT NCI_EE_TRIG_APP_INIT
typedef uint8_t tNFC_EE_TRIGGER;
typedef struct
{
@@ -476,7 +529,8 @@
#ifndef NFC_MAX_EE_DISC_ENTRIES
#define NFC_MAX_EE_DISC_ENTRIES 6
#endif
-#define NFC_EE_DISCOVER_ENTRY_LEN 5 /* T, L, V(NFCEE ID, TechnMode, Protocol) */
+/* T, L, V(NFCEE ID, TechnMode, Protocol) */
+#define NFC_EE_DISCOVER_ENTRY_LEN 5
#define NFC_EE_DISCOVER_INFO_LEN 3 /* NFCEE ID, TechnMode, Protocol */
/* the data type associated with NFC_EE_DISCOVER_REQ_REVT */
typedef struct
@@ -820,7 +874,8 @@
typedef void (tNFC_CONN_CBACK) (uint8_t conn_id, tNFC_CONN_EVT event, tNFC_CONN *p_data);
#define NFC_MAX_CONN_ID 15
#define NFC_ILLEGAL_CONN_ID 0xFF
-#define NFC_RF_CONN_ID 0 /* the static connection ID for RF traffic */
+/* the static connection ID for RF traffic */
+#define NFC_RF_CONN_ID 0
diff --git a/src/nfc/include/rw_api.h b/src/nfc/include/rw_api.h
index 4c66f33..02a1269 100644
--- a/src/nfc/include/rw_api.h
+++ b/src/nfc/include/rw_api.h
@@ -128,14 +128,22 @@
typedef uint8_t tRW_EVENT;
-#define RW_NDEF_FL_READ_ONLY 0x01 /* Tag is read only */
-#define RW_NDEF_FL_FORMATED 0x02 /* Tag formated for NDEF */
-#define RW_NDEF_FL_SUPPORTED 0x04 /* NDEF supported by the tag */
-#define RW_NDEF_FL_UNKNOWN 0x08 /* Unable to find if tag is ndef capable/formated/read only */
-#define RW_NDEF_FL_FORMATABLE 0x10 /* Tag supports format operation */
-#define RW_NDEF_FL_SOFT_LOCKABLE 0x20 /* Tag can be soft locked */
-#define RW_NDEF_FL_HARD_LOCKABLE 0x40 /* Tag can be hard locked */
-#define RW_NDEF_FL_OTP 0x80 /* Tag is one time programmable */
+/* Tag is read only */
+#define RW_NDEF_FL_READ_ONLY 0x01
+/* Tag formated for NDEF */
+#define RW_NDEF_FL_FORMATED 0x02
+/* NDEF supported by the tag */
+#define RW_NDEF_FL_SUPPORTED 0x04
+/* Unable to find if tag is ndef capable/formated/read only */
+#define RW_NDEF_FL_UNKNOWN 0x08
+/* Tag supports format operation */
+#define RW_NDEF_FL_FORMATABLE 0x10
+/* Tag can be soft locked */
+#define RW_NDEF_FL_SOFT_LOCKABLE 0x20
+/* Tag can be hard locked */
+#define RW_NDEF_FL_HARD_LOCKABLE 0x40
+/* Tag is one time programmable */
+#define RW_NDEF_FL_OTP 0x80
typedef uint8_t tRW_NDEF_FLAG;
diff --git a/src/nfc/include/tags_defs.h b/src/nfc/include/tags_defs.h
index d48be1c..926a9bb 100644
--- a/src/nfc/include/tags_defs.h
+++ b/src/nfc/include/tags_defs.h
@@ -28,107 +28,183 @@
#define TAGS_DEFS_H
/* Manufacturer ID */
-#define TAG_BRCM_MID 0x2E /* BROADCOM CORPORATION */
-#define TAG_MIFARE_MID 0x04 /* MIFARE */
-#define TAG_KOVIO_MID 0x37 /* KOVIO */
-#define TAG_INFINEON_MID 0x05 /* Infineon Technologies */
+/* BROADCOM CORPORATION */
+#define TAG_BRCM_MID 0x2E
+/* MIFARE */
+#define TAG_MIFARE_MID 0x04
+/* KOVIO */
+#define TAG_KOVIO_MID 0x37
+/* Infineon Technologies */
+#define TAG_INFINEON_MID 0x05
/* TLV types present in Type1 and Type 2 Tags */
-#define TAG_NULL_TLV 0 /* May be used for padding. SHALL ignore this */
-#define TAG_LOCK_CTRL_TLV 1 /* Defines details of the lock bytes */
-#define TAG_MEM_CTRL_TLV 2 /* Identifies reserved memory areas */
-#define TAG_NDEF_TLV 3 /* Contains the NDEF message */
-#define TAG_PROPRIETARY_TLV 0xFD /* Tag proprietary information */
-#define TAG_TERMINATOR_TLV 0xFE /* Last TLV block in the data area */
-#define TAG_BITS_PER_BYTE 0x08 /* Number of bits in every tag byte */
-#define TAG_MAX_UID_LEN 0x0A /* Max UID Len of type 1 and type 2 tag */
+/* May be used for padding. SHALL ignore this */
+#define TAG_NULL_TLV 0
+/* Defines details of the lock bytes */
+#define TAG_LOCK_CTRL_TLV 1
+/* Identifies reserved memory areas */
+#define TAG_MEM_CTRL_TLV 2
+/* Contains the NDEF message */
+#define TAG_NDEF_TLV 3
+/* Tag proprietary information */
+#define TAG_PROPRIETARY_TLV 0xFD
+/* Last TLV block in the data area */
+#define TAG_TERMINATOR_TLV 0xFE
+/* Number of bits in every tag byte */
+#define TAG_BITS_PER_BYTE 0x08
+/* Max UID Len of type 1 and type 2 tag */
+#define TAG_MAX_UID_LEN 0x0A
-#define TAG_LONG_NDEF_LEN_FIELD_BYTE0 0xFF /* Byte 0 Length field to indicate LNDEF */
-#define TAG_DEFAULT_TLV_LEN 3 /* Tlv len for LOCK_CTRL/MEM TLV per spec */
+/* Byte 0 Length field to indicate LNDEF */
+#define TAG_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
+/* Tlv len for LOCK_CTRL/MEM TLV per spec */
+#define TAG_DEFAULT_TLV_LEN 3
/* Type 1 Tag related definitions */
-#define T1T_STATIC_BLOCKS 0x0F /* block 0 to Block E */
-#define T1T_BLOCK_SIZE 0x08 /* T1T Block size in bytes */
+/* block 0 to Block E */
+#define T1T_STATIC_BLOCKS 0x0F
+/* T1T Block size in bytes */
+#define T1T_BLOCK_SIZE 0x08
#define T1T_STATIC_SIZE T1T_STATIC_BLOCKS * T1T_BLOCK_SIZE /* Static Tag size */
-#define T1T_SEGMENT_SIZE 0x80 /* Size of Type 1 Tag segment in bytes */
-#define T1T_MAX_SEGMENTS 0x10 /* Maximum segment supported by Type 1 Tag */
-#define T1T_BLOCKS_PER_SEGMENT 0x10 /* Number of blocks present in a segment */
-#define T1T_OTP_LOCK_RES_BYTES 0x10 /* No.of default OTP,staticlocks,res bytes in tag */
+/* Size of Type 1 Tag segment in bytes */
+#define T1T_SEGMENT_SIZE 0x80
+/* Maximum segment supported by Type 1 Tag */
+#define T1T_MAX_SEGMENTS 0x10
+/* Number of blocks present in a segment */
+#define T1T_BLOCKS_PER_SEGMENT 0x10
+/* No.of default OTP,staticlocks,res bytes in tag */
+#define T1T_OTP_LOCK_RES_BYTES 0x10
-#define T1T_STATIC_HR0 0x11 /* HRO value to indicate static Tag */
-#define T1T_DYNAMIC_HR0 0x12 /* 0x1y, as long as (y!=1) */
-#define T1T_NDEF_SUPPORTED 0x10 /* HR0 value is 0x1y, indicates NDEF supported */
-#define T1T_HR1 0x00 /* should be ignored */
-#define T1T_UID_BLOCK 0x00 /* UID block */
-#define T1T_RES_BLOCK 0x0D /* Reserved block */
-#define T1T_LOCK_BLOCK 0x0E /* Static lock block */
-#define T1T_MID_OFFSET 0x06 /* Manufacturer ID offset */
-#define T1T_STATIC_RES_OFFSET 0x68 /* Reserved bytes offset */
-#define T1T_LOCK_0_OFFSET 0x70 /* Static lock offset */
-#define T1T_LOCK_1_OFFSET 0x71 /* Static lock offset */
-#define T1T_DYNAMIC_LOCK_OFFSET 0x78 /* Block F - typically used for dynamic locks */
+/* HRO value to indicate static Tag */
+#define T1T_STATIC_HR0 0x11
+/* 0x1y, as long as (y!=1) */
+#define T1T_DYNAMIC_HR0 0x12
+/* HR0 value is 0x1y, indicates NDEF supported */
+#define T1T_NDEF_SUPPORTED 0x10
+/* should be ignored */
+#define T1T_HR1 0x00
+/* UID block */
+#define T1T_UID_BLOCK 0x00
+/* Reserved block */
+#define T1T_RES_BLOCK 0x0D
+/* Static lock block */
+#define T1T_LOCK_BLOCK 0x0E
+/* Manufacturer ID offset */
+#define T1T_MID_OFFSET 0x06
+/* Reserved bytes offset */
+#define T1T_STATIC_RES_OFFSET 0x68
+/* Static lock offset */
+#define T1T_LOCK_0_OFFSET 0x70
+/* Static lock offset */
+#define T1T_LOCK_1_OFFSET 0x71
+/* Block F - typically used for dynamic locks */
+#define T1T_DYNAMIC_LOCK_OFFSET 0x78
#define T1T_DYNAMIC_LOCK_BYTES 0x08
-#define T1T_RES_BYTE_LEN 1 /* the len of reserved byte in T1T block 0 */
+/* the len of reserved byte in T1T block 0 */
+#define T1T_RES_BYTE_LEN 1
/* Capability Container definitions */
-#define T1T_CC_BLOCK 1 /* Capability container block */
-#define T1T_CC_LEN 4 /* the len of CC used in T1T tag */
+/* Capability container block */
+#define T1T_CC_BLOCK 1
+/* the len of CC used in T1T tag */
+#define T1T_CC_LEN 4
/* CC offset */
-#define T1T_CC_NMN_OFFSET 0x00 /* Offset for NDEF magic number in CC */
-#define T1T_CC_VNO_OFFSET 0x01 /* Offset for Version number in CC */
-#define T1T_CC_TMS_OFFSET 0x02 /* Offset for Tag memory size in CC */
-#define T1T_CC_RWA_OFFSET 0x03 /* Offset for Read/Write access in CC */
-#define T1T_CC_NMN_BYTE 0x08 /* NDEF Magic Number byte number */
-#define T1T_CC_VNO_BYTE 0x09 /* Version Number byte number */
-#define T1T_CC_TMS_BYTE 0x0A /* Tag Memory Size byte number */
-#define T1T_CC_RWA_BYTE 0x0B /* Read Write Access byte number */
-#define T1T_CC_NMN 0xE1 /* NDEF Magic Number */
-#define T1T_CC_LEGACY_VNO 0x10 /* Supported Legacy Version */
-#define T1T_CC_VNO 0x11 /* Version Number */
-#define T1T_CC_TMS_STATIC 0x0E /* TMS static memory - (8 * (n+1)). */
-#define T1T_CC_RWA_RW 0x00 /* RWA - Read/write allowed */
-#define T1T_CC_RWA_RO 0x0F /* RWA - Read only */
+/* Offset for NDEF magic number in CC */
+#define T1T_CC_NMN_OFFSET 0x00
+/* Offset for Version number in CC */
+#define T1T_CC_VNO_OFFSET 0x01
+/* Offset for Tag memory size in CC */
+#define T1T_CC_TMS_OFFSET 0x02
+/* Offset for Read/Write access in CC */
+#define T1T_CC_RWA_OFFSET 0x03
+/* NDEF Magic Number byte number */
+#define T1T_CC_NMN_BYTE 0x08
+/* Version Number byte number */
+#define T1T_CC_VNO_BYTE 0x09
+/* Tag Memory Size byte number */
+#define T1T_CC_TMS_BYTE 0x0A
+/* Read Write Access byte number */
+#define T1T_CC_RWA_BYTE 0x0B
+/* NDEF Magic Number */
+#define T1T_CC_NMN 0xE1
+/* Supported Legacy Version */
+#define T1T_CC_LEGACY_VNO 0x10
+/* Version Number */
+#define T1T_CC_VNO 0x11
+/* TMS static memory - (8 * (n+1)). */
+#define T1T_CC_TMS_STATIC 0x0E
+/* RWA - Read/write allowed */
+#define T1T_CC_RWA_RW 0x00
+/* RWA - Read only */
+#define T1T_CC_RWA_RO 0x0F
-#define T1T_TAG_NULL 0 /* May be used for padding. SHALL ignore this */
-#define T1T_TAG_LOCK_CTRL 1 /* Defines details of the lock bytes */
-#define T1T_TAG_MEM_CTRL 2 /* Identifies reserved memory areas */
-#define T1T_TAG_NDEF 3 /* Contains the NDEF message */
-#define T1T_TAG_PROPRIETARY 0xFD /* Tag proprietary information */
-#define T1T_TAG_TERMINATOR 0xFE /* Last TLV block in the data area */
+/* May be used for padding. SHALL ignore this */
+#define T1T_TAG_NULL 0
+/* Defines details of the lock bytes */
+#define T1T_TAG_LOCK_CTRL 1
+/* Identifies reserved memory areas */
+#define T1T_TAG_MEM_CTRL 2
+/* Contains the NDEF message */
+#define T1T_TAG_NDEF 3
+/* Tag proprietary information */
+#define T1T_TAG_PROPRIETARY 0xFD
+/* Last TLV block in the data area */
+#define T1T_TAG_TERMINATOR 0xFE
-#define T1T_DEFAULT_TLV_LEN 3 /* Tlv len for LOCK_CTRL/MEM TLV per spec */
-#define T1T_TLV_TYPE_LEN 1 /* Tlv type identifier len */
-#define T1T_DEFAULT_TLV_LEN_FIELD_LEN 1 /* Length field size of lock/mem tlv */
+/* Tlv len for LOCK_CTRL/MEM TLV per spec */
+#define T1T_DEFAULT_TLV_LEN 3
+/* Tlv type identifier len */
+#define T1T_TLV_TYPE_LEN 1
+/* Length field size of lock/mem tlv */
+#define T1T_DEFAULT_TLV_LEN_FIELD_LEN 1
-#define T1T_HR_LEN 2 /* the len of HR used in Type 1 Tag */
-#define T1T_CMD_UID_LEN 4 /* the len of UID used in Type 1 Tag Commands */
-#define T1T_UID_LEN 7 /* the len of UID used in Type 1 Tag */
+/* the len of HR used in Type 1 Tag */
+#define T1T_HR_LEN 2
+/* the len of UID used in Type 1 Tag Commands */
+#define T1T_CMD_UID_LEN 4
+/* the len of UID used in Type 1 Tag */
+#define T1T_UID_LEN 7
#define T1T_ADD_LEN 1
-#define T1T_SHORT_NDEF_LEN_FIELD_LEN 1 /* Length Field size of short NDEF Message */
-#define T1T_LONG_NDEF_LEN_FIELD_LEN 3 /* Length Field size of Long NDEF Message */
-#define T1T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF /* Byte 0 in Length field to indicate LNDEF*/
-#define T1T_LONG_NDEF_MIN_LEN 0x00FF /* Min. len of NDEF to qualify as LNDEF */
+/* Length Field size of short NDEF Message */
+#define T1T_SHORT_NDEF_LEN_FIELD_LEN 1
+/* Length Field size of Long NDEF Message */
+#define T1T_LONG_NDEF_LEN_FIELD_LEN 3
+/* Byte 0 in Length field to indicate LNDEF*/
+#define T1T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
+/* Min. len of NDEF to qualify as LNDEF */
+#define T1T_LONG_NDEF_MIN_LEN 0x00FF
/* Type 1 Tag Commands (7 bits) */
-#define T1T_CMD_RID 0x78 /* read id */
-#define T1T_CMD_RALL 0x00 /* read all bytes */
-#define T1T_CMD_READ 0x01 /* read (1 byte) */
-#define T1T_CMD_WRITE_E 0x53 /* write with erase (1 byte) */
-#define T1T_CMD_WRITE_NE 0x1A /* write no erase (1 byte) */
+/* read id */
+#define T1T_CMD_RID 0x78
+/* read all bytes */
+#define T1T_CMD_RALL 0x00
+/* read (1 byte) */
+#define T1T_CMD_READ 0x01
+/* write with erase (1 byte) */
+#define T1T_CMD_WRITE_E 0x53
+/* write no erase (1 byte) */
+#define T1T_CMD_WRITE_NE 0x1A
/* dynamic memory only */
-#define T1T_CMD_RSEG 0x10 /* read segment */
-#define T1T_CMD_READ8 0x02 /* read (8 byte) */
-#define T1T_CMD_WRITE_E8 0x54 /* write with erase (8 byte) */
-#define T1T_CMD_WRITE_NE8 0x1B /* write no erase (8 byte) */
+/* read segment */
+#define T1T_CMD_RSEG 0x10
+/* read (8 byte) */
+#define T1T_CMD_READ8 0x02
+/* write with erase (8 byte) */
+#define T1T_CMD_WRITE_E8 0x54
+/* write no erase (8 byte) */
+#define T1T_CMD_WRITE_NE8 0x1B
/* Lock */
-#define T1T_NUM_STATIC_LOCK_BYTES 2 /* Number of static lock bytes in tag */
-#define T1T_BYTES_LOCKED_BY_STATIC_LOCK_BIT 4 /* Bytes locked by one static lock bit */
+/* Number of static lock bytes in tag */
+#define T1T_NUM_STATIC_LOCK_BYTES 2
+/* Bytes locked by one static lock bit */
+#define T1T_BYTES_LOCKED_BY_STATIC_LOCK_BIT 4
/* Type 2 Tag related definitions */
@@ -147,14 +223,17 @@
#define T2T_BCC0_LEN 1 /* the len of BCC0 of T2T tag */
#define T2T_BLOCK1_UID_LEN 4 /* the len of UID in Block 1 of T2T tag */
#define T2T_BCC1_LEN 1 /* the len of BCC0 of T2T tag */
-#define T2T_SNO_LEN 4 /* the len of Serial number used in T2T tag */
+/* the len of Serial number used in T2T tag */
+#define T2T_SNO_LEN 4
#define T2T_INTERNAL_BYTES_LEN 2 /* the len of internal used in T2T tag */
-#define T2T_STATIC_LOCK_LEN 2 /* the len of static lock used in T2T tag */
+/* the len of static lock used in T2T tag */
+#define T2T_STATIC_LOCK_LEN 2
/* Static Lock Bytes */
#define T2T_STATIC_LOCK0 0x0A /* Static Lock 0 offset */
#define T2T_STATIC_LOCK1 0x0B /* Static Lock 1 offset */
-#define T2T_CC_LEN 4 /* the len of CC used in T2T tag */
+/* the len of CC used in T2T tag */
+#define T2T_CC_LEN 4
/* Capability Container definitions */
#define T2T_CC_BLOCK 0x03 /* Capability container block */
@@ -172,8 +251,10 @@
#define T2T_CC3_RWA_RW 0x00 /* RWA - Read/write allowed */
#define T2T_CC3_RWA_RO 0x0F /* RWA - Read only */
-#define T2T_TMS_TAG_FACTOR 0x08 /* Factor to multiply to get tag data size from TMS */
-#define T2T_DEFAULT_LOCK_BLPB 0x08 /* Bytes locked per lock bit of default locks */
+/* Factor to multiply to get tag data size from TMS */
+#define T2T_TMS_TAG_FACTOR 0x08
+/* Bytes locked per lock bit of default locks */
+#define T2T_DEFAULT_LOCK_BLPB 0x08
/* Type 2 Tag Commands */
#define T2T_CMD_READ 0x30 /* read 4 blocks (16 bytes) */
@@ -191,7 +272,8 @@
/* Type 2 TLV definitions */
-#define T2T_TLV_TYPE_NULL 0 /* May be used for padding. SHALL ignore this */
+/* May be used for padding. SHALL ignore this */
+#define T2T_TLV_TYPE_NULL 0
#define T2T_TLV_TYPE_LOCK_CTRL 1 /* Defines details of the lock bytes */
#define T2T_TLV_TYPE_MEM_CTRL 2 /* Identifies reserved memory areas */
#define T2T_TLV_TYPE_NDEF 3 /* Contains the NDEF message */
@@ -199,22 +281,32 @@
#define T2T_TLV_TYPE_TERMINATOR 0xFE /* Last TLV block in the data area */
-#define T2T_TLEN_LOCK_CTRL_TLV 3 /* Tag len for LOCK_CTRL TLV per spec */
+/* Tag len for LOCK_CTRL TLV per spec */
+#define T2T_TLEN_LOCK_CTRL_TLV 3
#define T2T_TLEN_MEM_CTRL_TLV 3 /* Tag len for MEM_CTRL TLV per spec */
-#define T2T_MAX_SECTOR 2 /* Maximum number of sectors supported */
+/* Maximum number of sectors supported */
+#define T2T_MAX_SECTOR 2
-#define T2T_TLV_TYPE_LEN 1 /* Tlv type identifier len */
+/* Tlv type identifier len */
+#define T2T_TLV_TYPE_LEN 1
-#define T2T_DEFAULT_TLV_LEN 3 /* Tlv len for LOCK_CTRL/MEM TLV per spec */
-#define T2T_SHORT_NDEF_LEN_FIELD_LEN 1 /* Length Field size of short NDEF Message */
-#define T2T_LONG_NDEF_LEN_FIELD_LEN 3 /* Length Field size of Long NDEF Message */
-#define T2T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF /* Byte 0 in Length field to indicate LNDEF*/
-#define T2T_LONG_NDEF_MIN_LEN 0x00FF /* Min. len of NDEF to qualify as LNDEF */
+/* Tlv len for LOCK_CTRL/MEM TLV per spec */
+#define T2T_DEFAULT_TLV_LEN 3
+/* Length Field size of short NDEF Message */
+#define T2T_SHORT_NDEF_LEN_FIELD_LEN 1
+/* Length Field size of Long NDEF Message */
+#define T2T_LONG_NDEF_LEN_FIELD_LEN 3
+/* Byte 0 in Length field to indicate LNDEF*/
+#define T2T_LONG_NDEF_LEN_FIELD_BYTE0 0xFF
+/* Min. len of NDEF to qualify as LNDEF */
+#define T2T_LONG_NDEF_MIN_LEN 0x00FF
/* Lock */
-#define T2T_NUM_STATIC_LOCK_BYTES 2 /* Number of static lock bytes in tag */
-#define T2T_BYTES_LOCKED_BY_STATIC_LOCK_BIT 4 /* Bytes locked by one static lock bit */
+/* Number of static lock bytes in tag */
+#define T2T_NUM_STATIC_LOCK_BYTES 2
+/* Bytes locked by one static lock bit */
+#define T2T_BYTES_LOCKED_BY_STATIC_LOCK_BIT 4
#define T2T_CC2_TMS_MUL 0x06
#define T2T_CC2_TMS_MULC 0x12
@@ -225,9 +317,11 @@
*/
#define T3T_SYSTEM_CODE_NDEF 0x12FC /* System Code for NDEF tags */
-#define T3T_SYSTEM_CODE_FELICA_LITE 0x88B4 /* System Code for felica-lite tags */
+/* System Code for felica-lite tags */
+#define T3T_SYSTEM_CODE_FELICA_LITE 0x88B4
#define T3T_MAX_SYSTEM_CODES 16
-#define T3T_FELICALITE_NMAXB 13 /* Maximum number of blocks for NDEF message for Felica Lite tags */
+/* Maximum number of blocks for NDEF message for Felica Lite tags */
+#define T3T_FELICALITE_NMAXB 13
/* Block descriptor, used to describe a block to check/update */
typedef struct
@@ -239,7 +333,8 @@
/* Poll RC (request code) definitions */
#define T3T_POLL_RC_NONE 0 /* No RD requested in SENSF_RES */
#define T3T_POLL_RC_SC 1 /* System code requested in SENSF_RES */
-#define T3T_POLL_RC_COMM 2 /* Avanced protocol features requested in SENSF_RES */
+/* Avanced protocol features requested in SENSF_RES */
+#define T3T_POLL_RC_COMM 2
typedef uint8_t tT3T_POLL_RC;
/* Definitions for constructing t3t command messages */
@@ -260,43 +355,67 @@
#define T3T_MSG_OPC_REQ_SYSTEMCODE_CMD 0x0C
#define T3T_MSG_OPC_REQ_SYSTEMCODE_RSP 0x0D
-#define T3T_MSG_NDEF_SC_RO 0x000B /* Service code: read-only NDEF */
-#define T3T_MSG_NDEF_SC_RW 0x0009 /* Service code: read/write NDEF */
+/* Service code: read-only NDEF */
+#define T3T_MSG_NDEF_SC_RO 0x000B
+/* Service code: read/write NDEF */
+#define T3T_MSG_NDEF_SC_RW 0x0009
#define T3T_MSG_NDEF_VERSION 0x10 /* NDEF Mapping Version 1.0 */
#define T3T_MSG_NDEF_WRITEF_OFF 0x00
#define T3T_MSG_NDEF_WRITEF_ON 0x0F
#define T3T_MSG_NDEF_RWFLAG_RO 0x00
#define T3T_MSG_NDEF_RWFLAG_RW 0x01
-#define T3T_MSG_NDEF_ATTR_INFO_SIZE 14 /* Size of NDEF attribute info block (minus checksum) */
+/* Size of NDEF attribute info block (minus checksum) */
+#define T3T_MSG_NDEF_ATTR_INFO_SIZE 14
-#define T3T_MSG_OFFSET_IDM 1 /* offset of Manufacturer ID in UPDATE/CHECK messages */
-#define T3T_MSG_OFFSET_NUM_SERVICES 9 /* offset of Number of Services parameter in UPDATE/CHECK messages */
-#define T3T_MSG_OFFSET_SERVICE_CODE_LIST 10 /* offset of Service Code List parameter in UPDATE/CHECK messages */
-#define T3T_MSG_MASK_TWO_BYTE_BLOCK_DESC_FORMAT 0x80 /* len flag for Block List Element */
-#define T3T_MSG_SERVICE_LIST_MASK 0x0F /* service code list mask */
+/* offset of Manufacturer ID in UPDATE/CHECK messages */
+#define T3T_MSG_OFFSET_IDM 1
+/* offset of Number of Services parameter in UPDATE/CHECK messages */
+#define T3T_MSG_OFFSET_NUM_SERVICES 9
+/* offset of Service Code List parameter in UPDATE/CHECK messages */
+#define T3T_MSG_OFFSET_SERVICE_CODE_LIST 10
+/* len flag for Block List Element */
+#define T3T_MSG_MASK_TWO_BYTE_BLOCK_DESC_FORMAT 0x80
+/* service code list mask */
+#define T3T_MSG_SERVICE_LIST_MASK 0x0F
#define T3T_MSG_SERVICE_LIST_MAX 16
-#define T3T_MSG_NUM_SERVICES_UPDATE_MAX 12 /* Max Number of Services per UPDATE command */
-#define T3T_MSG_NUM_SERVICES_CHECK_MAX 15 /* Max Number of Services per CHECK command */
-#define T3T_MSG_NUM_BLOCKS_UPDATE_MAX 13 /* Max Number of Blocks per UPDATE command */
-#define T3T_MSG_NUM_BLOCKS_CHECK_MAX 15 /* Max Number of Blocks per CHECK command */
+/* Max Number of Services per UPDATE command */
+#define T3T_MSG_NUM_SERVICES_UPDATE_MAX 12
+/* Max Number of Services per CHECK command */
+#define T3T_MSG_NUM_SERVICES_CHECK_MAX 15
+/* Max Number of Blocks per UPDATE command */
+#define T3T_MSG_NUM_BLOCKS_UPDATE_MAX 13
+/* Max Number of Blocks per CHECK command */
+#define T3T_MSG_NUM_BLOCKS_CHECK_MAX 15
-#define T3T_MSG_BLOCKSIZE 16 /* Data block size for UPDATE and CHECK commands */
+/* Data block size for UPDATE and CHECK commands */
+#define T3T_MSG_BLOCKSIZE 16
/* Common header definitions for T3t commands */
-#define T3T_MSG_CMD_COMMON_HDR_LEN 11 /* Common header: SoD + cmdcode + NFCID2 + num_services */
+/* Common header: SoD + cmdcode + NFCID2 + num_services */
+#define T3T_MSG_CMD_COMMON_HDR_LEN 11
/* Common header definition for T3t responses */
-#define T3T_MSG_RSP_COMMON_HDR_LEN 11 /* Common header: rspcode + NFCID2 + StatusFlag1 + StatusFlag2 */
-#define T3T_MSG_RSP_CHECK_HDR_LEN (T3T_MSG_RSP_COMMON_HDR_LEN + 1) /* Common header + NumBlocks */
-#define T3T_MSG_RSP_OFFSET_RSPCODE 0 /* Offset for Response code */
-#define T3T_MSG_RSP_OFFSET_IDM 1 /* Offset for Manufacturer ID */
-#define T3T_MSG_RSP_OFFSET_STATUS1 9 /* Offset for Status Flag1 */
-#define T3T_MSG_RSP_OFFSET_NUMBLOCKS 11 /* Offset for NumberOfBlocks (in CHECK response) */
-#define T3T_MSG_RSP_OFFSET_CHECK_DATA 12 /* Offset for Block Data (in CHECK response) */
-#define T3T_MSG_RSP_OFFSET_POLL_PMM 9 /* Offset for PMm (in POLL response) */
-#define T3T_MSG_RSP_OFFSET_POLL_RD 17 /* Offset for RD (in POLL response) */
-#define T3T_MSG_RSP_OFFSET_NUMSYS 9 /* Offset for Number of Systems */
+/* Common header: rspcode + NFCID2 + StatusFlag1 + StatusFlag2 */
+#define T3T_MSG_RSP_COMMON_HDR_LEN 11
+/* Common header + NumBlocks */
+#define T3T_MSG_RSP_CHECK_HDR_LEN (T3T_MSG_RSP_COMMON_HDR_LEN + 1)
+/* Offset for Response code */
+#define T3T_MSG_RSP_OFFSET_RSPCODE 0
+/* Offset for Manufacturer ID */
+#define T3T_MSG_RSP_OFFSET_IDM 1
+/* Offset for Status Flag1 */
+#define T3T_MSG_RSP_OFFSET_STATUS1 9
+/* Offset for NumberOfBlocks (in CHECK response) */
+#define T3T_MSG_RSP_OFFSET_NUMBLOCKS 11
+/* Offset for Block Data (in CHECK response) */
+#define T3T_MSG_RSP_OFFSET_CHECK_DATA 12
+/* Offset for PMm (in POLL response) */
+#define T3T_MSG_RSP_OFFSET_POLL_PMM 9
+/* Offset for RD (in POLL response) */
+#define T3T_MSG_RSP_OFFSET_POLL_RD 17
+/* Offset for Number of Systems */
+#define T3T_MSG_RSP_OFFSET_NUMSYS 9
#define T3T_MSG_RSP_STATUS_OK 0x00
#define T3T_MSG_RSP_STATUS_ERROR 0x01
@@ -305,15 +424,21 @@
#define T3T_MSG_RSP_STATUS2_ERROR_EXCESSIVE_WRITES 0x71
#define T3T_MSG_RSP_STATUS2_ERROR_PROCESSING 0xFF
-#define T3T_NFC_F_MAX_PAYLOAD_LEN 0xFE /* Maximum payload lenght for NFC-F messages (including SoD) */
+/* Maximum payload lenght for NFC-F messages (including SoD) */
+#define T3T_NFC_F_MAX_PAYLOAD_LEN 0xFE
/* Felica Lite defintions */
-#define T3T_MSG_FELICALITE_BLOCK_ID_MC 0x88 /* Block ID for MC (memory configuration) */
+/* Block ID for MC (memory configuration) */
+#define T3T_MSG_FELICALITE_BLOCK_ID_MC 0x88
-#define T3T_MSG_FELICALITE_MC_OFFSET_MC_SP 0x00 /* Memory Configuration Block offset: MC_SP (Memory Configuration for scratch pad) */
-#define T3T_MSG_FELICALITE_MC_OFFSET_MC_ALL 0x02 /* Memory Configuration Block offset: MC_ALL (Memory Configuration for system block) */
-#define T3T_MSG_FELICALITE_MC_OFFSET_SYS_OP 0x03 /* Memory Configuration Block offset: SYS_OP (System Option) */
-#define T3T_MSG_FELICALITE_MC_OFFSET_RF_PRM 0x04 /* Memory Configuration Block offset: RF_PRM (Memory Configuration for RF Parameter) */
+/* Memory Configuration Block offset: MC_SP (Memory Configuration for scratch pad) */
+#define T3T_MSG_FELICALITE_MC_OFFSET_MC_SP 0x00
+/* Memory Configuration Block offset: MC_ALL (Memory Configuration for system block) */
+#define T3T_MSG_FELICALITE_MC_OFFSET_MC_ALL 0x02
+/* Memory Configuration Block offset: SYS_OP (System Option) */
+#define T3T_MSG_FELICALITE_MC_OFFSET_SYS_OP 0x03
+/* Memory Configuration Block offset: RF_PRM (Memory Configuration for RF Parameter) */
+#define T3T_MSG_FELICALITE_MC_OFFSET_RF_PRM 0x04
@@ -346,8 +471,10 @@
#define T4T_CMD_P2_FIRST_OR_ONLY_00H 0x00
#define T4T_CMD_P2_FIRST_OR_ONLY_0CH 0x0C
-#define T4T_MAX_LENGTH_LE 0xFF /* Max number of bytes to be read from file in ReadBinary Command */
-#define T4T_MAX_LENGTH_LC 0xFF /* Max number of bytes written to NDEF file in UpdateBinary Command */
+/* Max number of bytes to be read from file in ReadBinary Command */
+#define T4T_MAX_LENGTH_LE 0xFF
+/* Max number of bytes written to NDEF file in UpdateBinary Command */
+#define T4T_MAX_LENGTH_LC 0xFF
#define T4T_RSP_STATUS_WORDS_SIZE 0x02
@@ -359,10 +486,13 @@
#define T4T_RSP_INSTR_NOT_SUPPORTED 0x6D00
#define T4T_RSP_CMD_NOT_ALLOWED 0x6986
-#define T4T_V10_NDEF_TAG_AID_LEN 0x07 /* V1.0 Type 4 Tag Applicaiton ID length */
-#define T4T_V20_NDEF_TAG_AID_LEN 0x07 /* V2.0 Type 4 Tag Applicaiton ID length */
+/* V1.0 Type 4 Tag Applicaiton ID length */
+#define T4T_V10_NDEF_TAG_AID_LEN 0x07
+/* V2.0 Type 4 Tag Applicaiton ID length */
+#define T4T_V20_NDEF_TAG_AID_LEN 0x07
-#define T4T_MIN_MLE 0x000F /* Min of Max R-APDU data size */
+/* Min of Max R-APDU data size */
+#define T4T_MIN_MLE 0x000F
#define T4T_FILE_ID_SIZE 0x02
#define T4T_CC_FILE_ID 0xE103
@@ -370,17 +500,24 @@
#define T4T_VERSION_OFFSET_IN_CC 0x02
#define T4T_FC_TLV_OFFSET_IN_CC 0x07
-#define T4T_FC_WRITE_ACCESS_OFFSET_IN_TLV 0x07 /* Offset of Write access byte from type field in CC */
+/* Offset of Write access byte from type field in CC */
+#define T4T_FC_WRITE_ACCESS_OFFSET_IN_TLV 0x07
#define T4T_NDEF_FILE_CONTROL_TYPE 0x04 /* NDEF File Control Type */
-#define T4T_PROP_FILE_CONTROL_TYPE 0x05 /* Proprietary File Control Type */
+/* Proprietary File Control Type */
+#define T4T_PROP_FILE_CONTROL_TYPE 0x05
-#define T4T_FILE_CONTROL_TLV_SIZE 0x08 /* size of T(1),L(1),V(6) for file control */
-#define T4T_FILE_CONTROL_LENGTH 0x06 /* size of V(6) for file control */
+/* size of T(1),L(1),V(6) for file control */
+#define T4T_FILE_CONTROL_TLV_SIZE 0x08
+/* size of V(6) for file control */
+#define T4T_FILE_CONTROL_LENGTH 0x06
-#define T4T_FC_READ_ACCESS 0x00 /* read access granted without any security */
-#define T4T_FC_WRITE_ACCESS 0x00 /* write access granted without any security */
-#define T4T_FC_NO_WRITE_ACCESS 0xFF /* no write access granted at all (read-only) */
+/* read access granted without any security */
+#define T4T_FC_READ_ACCESS 0x00
+/* write access granted without any security */
+#define T4T_FC_WRITE_ACCESS 0x00
+/* no write access granted at all (read-only) */
+#define T4T_FC_NO_WRITE_ACCESS 0xFF
#define T4T_FILE_LENGTH_SIZE 0x02
#define T4T_ADDI_FRAME_RESP 0xAFU
@@ -402,36 +539,51 @@
/* Request flags 1 to 4 definition */
#define I93_FLAG_SUB_CARRIER_MASK 0x01 /* Sub_carrier_flag */
-#define I93_FLAG_SUB_CARRIER_SINGLE 0x00 /* A single sub-carrier frequency shall be used by VICC */
-#define I93_FLAG_SUB_CARRIER_DOUBLE 0x01 /* Two sub-carriers shall be used by VICC */
+/* A single sub-carrier frequency shall be used by VICC */
+#define I93_FLAG_SUB_CARRIER_SINGLE 0x00
+/* Two sub-carriers shall be used by VICC */
+#define I93_FLAG_SUB_CARRIER_DOUBLE 0x01
#define I93_FLAG_DATA_RATE_MASK 0x02 /* Data_rate_flag */
-#define I93_FLAG_DATA_RATE_LOW 0x00 /* Low data rate shall be used */
-#define I93_FLAG_DATA_RATE_HIGH 0x02 /* High data rate shall be used */
+/* Low data rate shall be used */
+#define I93_FLAG_DATA_RATE_LOW 0x00
+/* High data rate shall be used */
+#define I93_FLAG_DATA_RATE_HIGH 0x02
#define I93_FLAG_INVENTORY_MASK 0x04 /* Inventory_flag */
-#define I93_FLAG_INVENTORY_UNSET 0x00 /* Flags 5 to 8 meaning is according to table 4 */
-#define I93_FLAG_INVENTORY_SET 0x04 /* Flags 5 to 8 meaning is according to table 5 */
+/* Flags 5 to 8 meaning is according to table 4 */
+#define I93_FLAG_INVENTORY_UNSET 0x00
+/* Flags 5 to 8 meaning is according to table 5 */
+#define I93_FLAG_INVENTORY_SET 0x04
-#define I93_FLAG_PROT_EXT_MASK 0x08 /* Protocol_Extension_flag */
-#define I93_FLAG_PROT_EXT_NO 0x00 /* No protocol format extension */
-#define I93_FLAG_PROT_EXT_YES 0x08 /* Protocol format is extended. Reserved for future use */
+/* Protocol_Extension_flag */
+#define I93_FLAG_PROT_EXT_MASK 0x08
+/* No protocol format extension */
+#define I93_FLAG_PROT_EXT_NO 0x00
+/* Protocol format is extended. Reserved for future use */
+#define I93_FLAG_PROT_EXT_YES 0x08
/* Request flags 5 to 6 definition when inventory flag is not set */
#define I93_FLAG_SELECT_MASK 0x10 /* Select_flag */
-#define I93_FLAG_SELECT_UNSET 0x00 /* Request shall be executed by any VICC according to the setting of Address_flag */
-#define I93_FLAG_SELECT_SET 0x10 /* Request shall be executed only by VICC in selected state */
+/* Request shall be executed by any VICC according to the setting of Address_flag */
+#define I93_FLAG_SELECT_UNSET 0x00
+/* Request shall be executed only by VICC in selected state */
+#define I93_FLAG_SELECT_SET 0x10
/* The Address_flag shall be set to 0 and the UID field shall bot be included in the request */
#define I93_FLAG_ADDRESS_MASK 0x20 /* Address_flag */
-#define I93_FLAG_ADDRESS_UNSET 0x00 /* Request is not addressed. UID field is not included. It shall be executed by any VICC */
-#define I93_FLAG_ADDRESS_SET 0x20 /* Request is addressed. UID field is included. It shall be executed only by VICC */
+/* Request is not addressed. UID field is not included. It shall be executed by any VICC */
+#define I93_FLAG_ADDRESS_UNSET 0x00
+/* Request is addressed. UID field is included. It shall be executed only by VICC */
+#define I93_FLAG_ADDRESS_SET 0x20
/* whose UID matches the UID specified in the request */
/* Request flags 5 to 6 definition when inventory flag is set */
#define I93_FLAG_AFI_MASK 0x10 /* AFI_flag */
-#define I93_FLAG_AFI_NOT_PRESENT 0x00 /* AFI field is not present */
-#define I93_FLAG_AFI_PRESENT 0x10 /* AFI field is present */
+/* AFI field is not present */
+#define I93_FLAG_AFI_NOT_PRESENT 0x00
+/* AFI field is present */
+#define I93_FLAG_AFI_PRESENT 0x10
#define I93_FLAG_SLOT_MASK 0x20 /* Nb_slots_flag */
#define I93_FLAG_SLOT_16 0x00 /* 16 slots */
@@ -440,30 +592,47 @@
/* Request flags 6 to 8 definition when inventory flag is set or not set */
#define I93_FLAG_OPTION_MASK 0x40 /* Option_flag */
-#define I93_FLAG_OPTION_UNSET 0x00 /* Meaning is defined by the command description. */
+/* Meaning is defined by the command description. */
+#define I93_FLAG_OPTION_UNSET 0x00
/* It shall be set to 0 if not otherwise defined by command */
-#define I93_FLAG_OPTION_SET 0x40 /* Meaning is defined by the command description. */
+/* Meaning is defined by the command description. */
+#define I93_FLAG_OPTION_SET 0x40
/* Response flags */
#define I93_FLAG_ERROR_MASK 0x01 /* Error_flag */
-#define I93_FLAG_ERORR_NOT_DETECTED 0x00 /* No error */
-#define I93_FLAG_ERROR_DETECTED 0x01 /* Error detected, Error code is in the "Error" field */
+/* No error */
+#define I93_FLAG_ERORR_NOT_DETECTED 0x00
+/* Error detected, Error code is in the "Error" field */
+#define I93_FLAG_ERROR_DETECTED 0x01
/* Response error code */
-#define I93_ERROR_CODE_NOT_SUPPORTED 0x01 /* The command is not supported, i.e. the request code is not recognized */
-#define I93_ERROR_CODE_NOT_RECOGNIZED 0x02 /* The command is not recognized, for example: a format error occured */
-#define I93_ERROR_CODE_OPTION_NOT_SUPPORTED 0x03 /* The command option is not supported */
-#define I93_ERROR_CODE_NO_INFO 0x0F /* Error with no information given or a specific error code is not supported */
-#define I93_ERROR_CODE_BLOCK_NOT_AVAILABLE 0x10 /* The specific block is not available (doesn't exist) */
-#define I93_ERROR_CODE_BLOCK_ALREADY_LOCKED 0x11 /* The specific block is already locked and thus cannot be locked again */
-#define I93_ERROR_CODE_BLOCK_LOCKED 0x12 /* The specific block is locked and its content cannot be changed */
-#define I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE 0x13 /* The specific block is was not successfully programmed */
-#define I93_ERROR_CODE_BLOCK_FAIL_TO_LOCK 0x14 /* The specific block is was not successfully locked */
+/* The command is not supported, i.e. the request code is not recognized */
+#define I93_ERROR_CODE_NOT_SUPPORTED 0x01
+/* The command is not recognized, for example: a format error occured */
+#define I93_ERROR_CODE_NOT_RECOGNIZED 0x02
+/* The command option is not supported */
+#define I93_ERROR_CODE_OPTION_NOT_SUPPORTED 0x03
+/* Error with no information given or a specific error code is not supported */
+#define I93_ERROR_CODE_NO_INFO 0x0F
+/* The specific block is not available (doesn't exist) */
+#define I93_ERROR_CODE_BLOCK_NOT_AVAILABLE 0x10
+/* The specific block is already locked and thus cannot be locked again */
+#define I93_ERROR_CODE_BLOCK_ALREADY_LOCKED 0x11
+/* The specific block is locked and its content cannot be changed */
+#define I93_ERROR_CODE_BLOCK_LOCKED 0x12
+/* The specific block is was not successfully programmed */
+#define I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE 0x13
+/* The specific block is was not successfully locked */
+#define I93_ERROR_CODE_BLOCK_FAIL_TO_LOCK 0x14
-#define I93_UID_BYTE_LEN 8 /* UID length in bytes */
-#define I93_DFS_UNSUPPORTED 0x00 /* Data Storage Format is not supported */
-#define I93_BLOCK_UNLOCKED 0x00 /* Block is not locked */
-#define I93_BLOCK_LOCKED 0x01 /* Block is locked */
+/* UID length in bytes */
+#define I93_UID_BYTE_LEN 8
+/* Data Storage Format is not supported */
+#define I93_DFS_UNSUPPORTED 0x00
+/* Block is not locked */
+#define I93_BLOCK_UNLOCKED 0x00
+/* Block is locked */
+#define I93_BLOCK_LOCKED 0x01
/* ISO 15693 Mandatory commands */
#define I93_CMD_INVENTORY 0x01 /* Inventory */
@@ -481,30 +650,46 @@
#define I93_CMD_LOCK_AFI 0x28 /* Lock AFI */
#define I93_CMD_WRITE_DSFID 0x29 /* Write DSFID */
#define I93_CMD_LOCK_DSFID 0x2A /* Lock DSFID */
-#define I93_CMD_GET_SYS_INFO 0x2B /* Get system information */
-#define I93_CMD_GET_MULTI_BLK_SEC 0x2C /* Get multiple block security status */
+/* Get system information */
+#define I93_CMD_GET_SYS_INFO 0x2B
+/* Get multiple block security status */
+#define I93_CMD_GET_MULTI_BLK_SEC 0x2C
/* Information flags definition */
-#define I93_INFO_FLAG_DSFID 0x01 /* DSFID is supported and DSFID field is present */
-#define I93_INFO_FLAG_AFI 0x02 /* AFI is supported and AFI field is present */
-#define I93_INFO_FLAG_MEM_SIZE 0x04 /* VICC memory size field is present */
-#define I93_INFO_FLAG_IC_REF 0x08 /* IC reference field is present */
+/* DSFID is supported and DSFID field is present */
+#define I93_INFO_FLAG_DSFID 0x01
+/* AFI is supported and AFI field is present */
+#define I93_INFO_FLAG_AFI 0x02
+/* VICC memory size field is present */
+#define I93_INFO_FLAG_MEM_SIZE 0x04
+/* IC reference field is present */
+#define I93_INFO_FLAG_IC_REF 0x08
-#define I93_MAX_BLOCK_LENGH 32 /* Max block size in bytes */
-#define I93_MAX_NUM_BLOCK 256 /* Max number of blocks */
+/* Max block size in bytes */
+#define I93_MAX_BLOCK_LENGH 32
+/* Max number of blocks */
+#define I93_MAX_NUM_BLOCK 256
/* ICODE Capability Container(CC) definition */
#define I93_ICODE_CC_MAGIC_NUMER 0xE1 /* magic number in CC[0] */
#define I93_ICODE_CC_MAJOR_VER_MASK 0xC0 /* major version in CC[1] */
#define I93_ICODE_CC_MINOR_VER_MASK 0x30 /* minor version in CC[1] */
-#define I93_ICODE_CC_READ_ACCESS_MASK 0x0C /* read access condition in CC[1] */
-#define I93_ICODE_CC_READ_ACCESS_GRANTED 0x00 /* read access granted without security */
-#define I93_ICODE_CC_WRITE_ACCESS_MASK 0x03 /* write access condition in CC[1] */
-#define I93_ICODE_CC_WRITE_ACCESS_GRANTED 0x00 /* write access granted without security */
-#define I93_ICODE_CC_READ_ONLY 0x03 /* write access not granted at all */
-#define I93_ICODE_CC_MBREAD_MASK 0x01 /* read multi block supported in CC[3] */
-#define I93_ICODE_CC_IPREAD_MASK 0x02 /* inventory page read supported in CC[3] */
-#define I93_STM_CC_OVERFLOW_MASK 0x04 /* More than 2040 bytes are supported in CC[3] */
+/* read access condition in CC[1] */
+#define I93_ICODE_CC_READ_ACCESS_MASK 0x0C
+/* read access granted without security */
+#define I93_ICODE_CC_READ_ACCESS_GRANTED 0x00
+/* write access condition in CC[1] */
+#define I93_ICODE_CC_WRITE_ACCESS_MASK 0x03
+/* write access granted without security */
+#define I93_ICODE_CC_WRITE_ACCESS_GRANTED 0x00
+/* write access not granted at all */
+#define I93_ICODE_CC_READ_ONLY 0x03
+/* read multi block supported in CC[3] */
+#define I93_ICODE_CC_MBREAD_MASK 0x01
+/* inventory page read supported in CC[3] */
+#define I93_ICODE_CC_IPREAD_MASK 0x02
+/* More than 2040 bytes are supported in CC[3] */
+#define I93_STM_CC_OVERFLOW_MASK 0x04
/* ICODE TLV type */
#define I93_ICODE_TLV_TYPE_NULL 0x00 /* NULL TLV */
@@ -521,37 +706,57 @@
#define I93_UID_IC_MFG_CODE_TI 0x07
/* NXP, UID Coding of ICODE type (UID Bit 48-41) */
-#define I93_UID_ICODE_SLI 0x01 /* ICODE SLI, SLIX */
-#define I93_UID_ICODE_SLI_S 0x02 /* ICODE SLI-S, SLIX-S */
-#define I93_UID_ICODE_SLI_L 0x03 /* ICODE SLI-L, SLIX-L */
+/* ICODE SLI, SLIX */
+#define I93_UID_ICODE_SLI 0x01
+/* ICODE SLI-S, SLIX-S */
+#define I93_UID_ICODE_SLI_S 0x02
+/* ICODE SLI-L, SLIX-L */
+#define I93_UID_ICODE_SLI_L 0x03
-#define I93_IC_REF_ICODE_SLI_L 0x03 /* IC Reference for ICODE SLI-L */
-#define I93_ICODE_IC_REF_MBREAD_MASK 0x02 /* read multi block supported check bit */
+/* IC Reference for ICODE SLI-L */
+#define I93_IC_REF_ICODE_SLI_L 0x03
+/* read multi block supported check bit */
+#define I93_ICODE_IC_REF_MBREAD_MASK 0x02
/* TI, UID Coding of product version (UID Bit 48-42) */
-#define I93_UID_TAG_IT_HF_I_PRODUCT_ID_MASK 0xFE /* upper 7 bits */
-#define I93_UID_TAG_IT_HF_I_PLUS_INLAY 0x00 /* Tag-it HF-I Plus Inlay */
-#define I93_UID_TAG_IT_HF_I_PLUS_CHIP 0x80 /* Tag-it HF-I Plus Chip */
-#define I93_UID_TAG_IT_HF_I_STD_CHIP_INLAY 0xC0 /* Tag-it HF-I Standard Chip/Inlyas */
-#define I93_UID_TAG_IT_HF_I_PRO_CHIP_INLAY 0xC4 /* Tag-it HF-I Pro Chip/Inlyas */
+/* upper 7 bits */
+#define I93_UID_TAG_IT_HF_I_PRODUCT_ID_MASK 0xFE
+/* Tag-it HF-I Plus Inlay */
+#define I93_UID_TAG_IT_HF_I_PLUS_INLAY 0x00
+/* Tag-it HF-I Plus Chip */
+#define I93_UID_TAG_IT_HF_I_PLUS_CHIP 0x80
+/* Tag-it HF-I Standard Chip/Inlyas */
+#define I93_UID_TAG_IT_HF_I_STD_CHIP_INLAY 0xC0
+/* Tag-it HF-I Pro Chip/Inlyas */
+#define I93_UID_TAG_IT_HF_I_PRO_CHIP_INLAY 0xC4
#define I93_TAG_IT_HF_I_STD_CHIP_INLAY_NUM_TOTAL_BLK 11
#define I93_TAG_IT_HF_I_PRO_CHIP_INLAY_NUM_TOTAL_BLK 12
#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_BLK_SIZE 4
#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_NUM_USER_BLK 8
-#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_AFI_LOCATION 40 /* LSB in Block 0x0A */
+/* LSB in Block 0x0A */
+#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_AFI_LOCATION 40
/* STM, product version (IC manufacturer code) */
-#define I93_IC_REF_STM_MASK 0xFC /* IC Reference mask for STM */
-#define I93_IC_REF_STM_LRI1K 0x40 /* IC Reference for LRI1K: 010000xx(b), blockSize: 4, numberBlocks: 0x20 */
-#define I93_IC_REF_STM_LRI2K 0x20 /* IC Reference for LRI2K: 001000xx(b), blockSize: 4, numberBlocks: 0x40 */
-#define I93_IC_REF_STM_LRIS2K 0x28 /* IC Reference for LRIS2K: 001010xx(b), blockSize: 4, numberBlocks: 0x40 */
-#define I93_IC_REF_STM_LRIS64K 0x44 /* IC Reference for LRIS64K: 010001xx(b), blockSize: 4, numberBlocks: 0x800 */
-#define I93_IC_REF_STM_M24LR64_R 0x2C /* IC Reference for M24LR64-R: 001011xx(b), blockSize: 4, numberBlocks: 0x800 */
-#define I93_IC_REF_STM_M24LR04E_R 0x5A /* IC Reference for M24LR04E-R: 01011010(b), blockSize: 4, numberBlocks: 0x80 */
-#define I93_IC_REF_STM_M24LR16E_R 0x4E /* IC Reference for M24LR16E-R: 01001110(b), blockSize: 4, numberBlocks: 0x200 */
-#define I93_IC_REF_STM_M24LR64E_R 0x5E /* IC Reference for M24LR64E-R: 01011110(b), blockSize: 4, numberBlocks: 0x800 */
+/* IC Reference mask for STM */
+#define I93_IC_REF_STM_MASK 0xFC
+/* IC Reference for LRI1K: 010000xx(b), blockSize: 4, numberBlocks: 0x20 */
+#define I93_IC_REF_STM_LRI1K 0x40
+/* IC Reference for LRI2K: 001000xx(b), blockSize: 4, numberBlocks: 0x40 */
+#define I93_IC_REF_STM_LRI2K 0x20
+/* IC Reference for LRIS2K: 001010xx(b), blockSize: 4, numberBlocks: 0x40 */
+#define I93_IC_REF_STM_LRIS2K 0x28
+/* IC Reference for LRIS64K: 010001xx(b), blockSize: 4, numberBlocks: 0x800 */
+#define I93_IC_REF_STM_LRIS64K 0x44
+/* IC Reference for M24LR64-R: 001011xx(b), blockSize: 4, numberBlocks: 0x800 */
+#define I93_IC_REF_STM_M24LR64_R 0x2C
+/* IC Reference for M24LR04E-R: 01011010(b), blockSize: 4, numberBlocks: 0x80 */
+#define I93_IC_REF_STM_M24LR04E_R 0x5A
+/* IC Reference for M24LR16E-R: 01001110(b), blockSize: 4, numberBlocks: 0x200 */
+#define I93_IC_REF_STM_M24LR16E_R 0x4E
+/* IC Reference for M24LR64E-R: 01011110(b), blockSize: 4, numberBlocks: 0x800 */
+#define I93_IC_REF_STM_M24LR64E_R 0x5E
#define I93_STM_BLOCKS_PER_SECTOR 32
#define I93_STM_MAX_BLOCKS_PER_READ 32
diff --git a/src/nfc/int/ce_int.h b/src/nfc/int/ce_int.h
index c2fa2c8..193c178 100644
--- a/src/nfc/int/ce_int.h
+++ b/src/nfc/int/ce_int.h
@@ -37,7 +37,8 @@
#define CE_MAX_SUP_PROTO NCI_PROTOCOL_MIFARE
#endif
-#define CE_MAX_BYTE_PER_PAGE 7 /* 2^8=256. CB use uint8_t for BytesPerPage, so max is 7 */
+/* 2^8=256. CB use uint8_t for BytesPerPage, so max is 7 */
+#define CE_MAX_BYTE_PER_PAGE 7
/* CE Type 3 Tag structures */
@@ -96,13 +97,20 @@
uint16_t max_file_size; /* size of storage + 2 bytes for NLEN */
uint8_t *p_scratch_buf; /* temp storage of NDEF message for update */
-#define CE_T4T_STATUS_T4T_APP_SELECTED 0x01 /* T4T CE App is selected */
-#define CE_T4T_STATUS_REG_AID_SELECTED 0x02 /* Registered AID is selected */
-#define CE_T4T_STATUS_CC_FILE_SELECTED 0x04 /* CC file is selected */
-#define CE_T4T_STATUS_NDEF_SELECTED 0x08 /* NDEF file is selected */
-#define CE_T4T_STATUS_NDEF_FILE_READ_ONLY 0x10 /* NDEF is read-only */
-#define CE_T4T_STATUS_NDEF_FILE_UPDATING 0x20 /* NDEF is updating */
-#define CE_T4T_STATUS_WILDCARD_AID_SELECTED 0x40 /* Wildcard AID selected */
+/* T4T CE App is selected */
+#define CE_T4T_STATUS_T4T_APP_SELECTED 0x01
+/* Registered AID is selected */
+#define CE_T4T_STATUS_REG_AID_SELECTED 0x02
+/* CC file is selected */
+#define CE_T4T_STATUS_CC_FILE_SELECTED 0x04
+/* NDEF file is selected */
+#define CE_T4T_STATUS_NDEF_SELECTED 0x08
+/* NDEF is read-only */
+#define CE_T4T_STATUS_NDEF_FILE_READ_ONLY 0x10
+/* NDEF is updating */
+#define CE_T4T_STATUS_NDEF_FILE_UPDATING 0x20
+/* Wildcard AID selected */
+#define CE_T4T_STATUS_WILDCARD_AID_SELECTED 0x40
uint8_t status;
diff --git a/src/nfc/int/llcp_int.h b/src/nfc/int/llcp_int.h
index c9683f8..3119d8a 100644
--- a/src/nfc/int/llcp_int.h
+++ b/src/nfc/int/llcp_int.h
@@ -50,7 +50,8 @@
/*
** LLCP internal flags
*/
-#define LLCP_LINK_FLAGS_RX_ANY_LLC_PDU 0x01 /* Received any LLC PDU in activated state */
+/* Received any LLC PDU in activated state */
+#define LLCP_LINK_FLAGS_RX_ANY_LLC_PDU 0x01
/*
** LLCP link control block
@@ -160,9 +161,12 @@
** LLCP data link connection control block
*/
-#define LLCP_DATA_LINK_FLAG_PENDING_DISC 0x01 /* send DISC when tx queue is empty */
-#define LLCP_DATA_LINK_FLAG_PENDING_RR_RNR 0x02 /* send RR/RNR with valid sequence */
-#define LLCP_DATA_LINK_FLAG_NOTIFY_TX_DONE 0x04 /* notify upper later when tx complete */
+/* send DISC when tx queue is empty */
+#define LLCP_DATA_LINK_FLAG_PENDING_DISC 0x01
+/* send RR/RNR with valid sequence */
+#define LLCP_DATA_LINK_FLAG_PENDING_RR_RNR 0x02
+/* notify upper later when tx complete */
+#define LLCP_DATA_LINK_FLAG_NOTIFY_TX_DONE 0x04
typedef struct
diff --git a/src/nfc/int/nfc_int.h b/src/nfc/int/nfc_int.h
index 95fa5c3..3184dd9 100644
--- a/src/nfc/int/nfc_int.h
+++ b/src/nfc/int/nfc_int.h
@@ -61,8 +61,10 @@
#define NFC_TTYPE_RW_T4T_RESPONSE 107
#define NFC_TTYPE_RW_I93_RESPONSE 108
#define NFC_TTYPE_CE_T4T_UPDATE 109
-#define NFC_TTYPE_P2P_PRIO_RESPONSE 110 /* added for p2p prio logic timer */
-#define NFC_TTYPE_P2P_PRIO_LOGIC_CLEANUP 111 /* added for p2p prio logic clenaup */
+/* added for p2p prio logic timer */
+#define NFC_TTYPE_P2P_PRIO_RESPONSE 110
+/* added for p2p prio logic clenaup */
+#define NFC_TTYPE_P2P_PRIO_LOGIC_CLEANUP 111
#define NFC_TTYPE_VS_BASE 200
@@ -90,19 +92,28 @@
};
/* NFC control block flags */
-#define NFC_FL_DEACTIVATING 0x0001 /* NFC_Deactivate () is called and the NCI cmd is not sent */
-#define NFC_FL_RESTARTING 0x0002 /* restarting NFCC after PowerOffSleep */
-#define NFC_FL_POWER_OFF_SLEEP 0x0004 /* enterning power off sleep mode */
-#define NFC_FL_POWER_CYCLE_NFCC 0x0008 /* Power cycle NFCC */
-#define NFC_FL_CONTROL_REQUESTED 0x0010 /* HAL requested control on NCI command window */
-#define NFC_FL_CONTROL_GRANTED 0x0020 /* NCI command window is on the HAL side */
-#define NFC_FL_DISCOVER_PENDING 0x0040 /* NCI command window is on the HAL side */
-#define NFC_FL_HAL_REQUESTED 0x0080 /* NFC_FL_CONTROL_REQUESTED on HAL request */
+/* NFC_Deactivate () is called and the NCI cmd is not sent */
+#define NFC_FL_DEACTIVATING 0x0001
+/* restarting NFCC after PowerOffSleep */
+#define NFC_FL_RESTARTING 0x0002
+/* enterning power off sleep mode */
+#define NFC_FL_POWER_OFF_SLEEP 0x0004
+/* Power cycle NFCC */
+#define NFC_FL_POWER_CYCLE_NFCC 0x0008
+/* HAL requested control on NCI command window */
+#define NFC_FL_CONTROL_REQUESTED 0x0010
+/* NCI command window is on the HAL side */
+#define NFC_FL_CONTROL_GRANTED 0x0020
+/* NCI command window is on the HAL side */
+#define NFC_FL_DISCOVER_PENDING 0x0040
+/* NFC_FL_CONTROL_REQUESTED on HAL request */
+#define NFC_FL_HAL_REQUESTED 0x0080
#define NFC_PEND_CONN_ID 0xFE
#define NFC_CONN_ID_INT_MASK 0xF0
#define NFC_CONN_ID_ID_MASK NCI_CID_MASK
-#define NFC_CONN_NO_FC 0xFF /* set num_buff to this for no flow control */
+/* set num_buff to this for no flow control */
+#define NFC_CONN_NO_FC 0xFF
#define NFC_NCI_CONN_NO_FC 0xFF
#if (NFC_RW_ONLY == FALSE)
@@ -140,7 +151,8 @@
uint8_t status; /* tHAL_NFC_STATUS */
} tNFC_HAL_EVT_MSG;
-#define NFC_RECEIVE_MSGS_OFFSET (10) /* callback function pointer(8; use 8 to be safe + NFC_SAVED_CMD_SIZE(2) */
+/* callback function pointer(8; use 8 to be safe + NFC_SAVED_CMD_SIZE(2) */
+#define NFC_RECEIVE_MSGS_OFFSET (10)
/* NFCC power state change pending callback */
typedef void (tNFC_PWR_ST_CBACK) (void);
diff --git a/src/nfc/int/rw_int.h b/src/nfc/int/rw_int.h
index 9dfdc7d..3515796 100644
--- a/src/nfc/int/rw_int.h
+++ b/src/nfc/int/rw_int.h
@@ -32,68 +32,113 @@
#include "rw_api.h"
/* Proprietary definitions for HR0 and HR1 */
-#define RW_T1T_HR0_HI_NIB 0xF0 /* HI NIB Tag */
-#define RW_T1T_IS_JEWEL64 0x20 /* Jewel 64 Tag */
-#define RW_T1T_IS_JEWEL 0x00 /* Jewel Tag */
-#define RW_T1T_IS_TOPAZ 0x10 /* TOPAZ Tag */
-#define RW_T1T_IS_TOPAZ96 0x11 /* TOPAZ96 Tag */
-#define RW_T1T_IS_TOPAZ512 0x12 /* TOPAZ512 Tag */
-#define RW_T1T_HR1_MIN 0x49 /* Supports dynamic commands on static tag if HR1 > 0x49 */
+/* HI NIB Tag */
+#define RW_T1T_HR0_HI_NIB 0xF0
+/* Jewel 64 Tag */
+#define RW_T1T_IS_JEWEL64 0x20
+/* Jewel Tag */
+#define RW_T1T_IS_JEWEL 0x00
+/* TOPAZ Tag */
+#define RW_T1T_IS_TOPAZ 0x10
+/* TOPAZ96 Tag */
+#define RW_T1T_IS_TOPAZ96 0x11
+/* TOPAZ512 Tag */
+#define RW_T1T_IS_TOPAZ512 0x12
+/* Supports dynamic commands on static tag if HR1 > 0x49 */
+#define RW_T1T_HR1_MIN 0x49
-#define RW_T1T_MAX_MEM_TLVS 0x05 /* Maximum supported Memory control TLVS in the tag */
-#define RW_T1T_MAX_LOCK_TLVS 0x05 /* Maximum supported Lock control TLVS in the tag */
-#define RW_T1T_MAX_LOCK_BYTES 0x1E /* Maximum supported dynamic lock bytes */
+/* Maximum supported Memory control TLVS in the tag */
+#define RW_T1T_MAX_MEM_TLVS 0x05
+/* Maximum supported Lock control TLVS in the tag */
+#define RW_T1T_MAX_LOCK_TLVS 0x05
+/* Maximum supported dynamic lock bytes */
+#define RW_T1T_MAX_LOCK_BYTES 0x1E
/* State of the Tag as interpreted by RW */
-#define RW_T1_TAG_ATTRB_UNKNOWN 0x00 /* TAG State is unknown to RW */
-#define RW_T1_TAG_ATTRB_INITIALIZED 0x01 /* TAG is in INITIALIZED state */
-#define RW_T1_TAG_ATTRB_INITIALIZED_NDEF 0x02 /* TAG is in INITIALIZED state and has NDEF tlv with len=0 */
-#define RW_T1_TAG_ATTRB_READ_ONLY 0x03 /* TAG is in READ ONLY state */
-#define RW_T1_TAG_ATTRB_READ_WRITE 0x04 /* TAG is in READ WRITE state */
+/* TAG State is unknown to RW */
+#define RW_T1_TAG_ATTRB_UNKNOWN 0x00
+/* TAG is in INITIALIZED state */
+#define RW_T1_TAG_ATTRB_INITIALIZED 0x01
+/* TAG is in INITIALIZED state and has NDEF tlv with len=0 */
+#define RW_T1_TAG_ATTRB_INITIALIZED_NDEF 0x02
+/* TAG is in READ ONLY state */
+#define RW_T1_TAG_ATTRB_READ_ONLY 0x03
+/* TAG is in READ WRITE state */
+#define RW_T1_TAG_ATTRB_READ_WRITE 0x04
-#define RW_T1T_LOCK_NOT_UPDATED 0x00 /* Lock not yet set as part of SET TAG RO op */
-#define RW_T1T_LOCK_UPDATE_INITIATED 0x01 /* Sent command to set the Lock bytes */
-#define RW_T1T_LOCK_UPDATED 0x02 /* Lock bytes are set */
+/* Lock not yet set as part of SET TAG RO op */
+#define RW_T1T_LOCK_NOT_UPDATED 0x00
+/* Sent command to set the Lock bytes */
+#define RW_T1T_LOCK_UPDATE_INITIATED 0x01
+/* Lock bytes are set */
+#define RW_T1T_LOCK_UPDATED 0x02
typedef uint8_t tRW_T1T_LOCK_STATUS;
/* States */
-#define RW_T1T_STATE_NOT_ACTIVATED 0x00 /* Tag not activated and or response not received for RID */
-#define RW_T1T_STATE_IDLE 0x01 /* T1 Tag activated and ready to perform rw operation on Tag*/
-#define RW_T1T_STATE_READ 0x02 /* waiting rsp for read command sent to tag */
-#define RW_T1T_STATE_WRITE 0x03 /* waiting rsp for write command sent to tag */
-#define RW_T1T_STATE_TLV_DETECT 0x04 /* performing TLV detection procedure */
-#define RW_T1T_STATE_READ_NDEF 0x05 /* performing read NDEF procedure */
-#define RW_T1T_STATE_WRITE_NDEF 0x06 /* performing update NDEF procedure */
-#define RW_T1T_STATE_SET_TAG_RO 0x07 /* Setting Tag as read only tag */
-#define RW_T1T_STATE_CHECK_PRESENCE 0x08 /* Check if Tag is still present */
-#define RW_T1T_STATE_FORMAT_TAG 0x09 /* Format T1 Tag */
+/* Tag not activated and or response not received for RID */
+#define RW_T1T_STATE_NOT_ACTIVATED 0x00
+/* T1 Tag activated and ready to perform rw operation on Tag*/
+#define RW_T1T_STATE_IDLE 0x01
+/* waiting rsp for read command sent to tag */
+#define RW_T1T_STATE_READ 0x02
+/* waiting rsp for write command sent to tag */
+#define RW_T1T_STATE_WRITE 0x03
+/* performing TLV detection procedure */
+#define RW_T1T_STATE_TLV_DETECT 0x04
+/* performing read NDEF procedure */
+#define RW_T1T_STATE_READ_NDEF 0x05
+/* performing update NDEF procedure */
+#define RW_T1T_STATE_WRITE_NDEF 0x06
+/* Setting Tag as read only tag */
+#define RW_T1T_STATE_SET_TAG_RO 0x07
+/* Check if Tag is still present */
+#define RW_T1T_STATE_CHECK_PRESENCE 0x08
+/* Format T1 Tag */
+#define RW_T1T_STATE_FORMAT_TAG 0x09
/* Sub states */
-#define RW_T1T_SUBSTATE_NONE 0x00 /* Default substate */
+/* Default substate */
+#define RW_T1T_SUBSTATE_NONE 0x00
/* Sub states in RW_T1T_STATE_TLV_DETECT state */
-#define RW_T1T_SUBSTATE_WAIT_TLV_DETECT 0x01 /* waiting for the detection of a tlv in a tag */
-#define RW_T1T_SUBSTATE_WAIT_FIND_LEN_FIELD_LEN 0x02 /* waiting for finding the len field is 1 or 3 bytes long */
-#define RW_T1T_SUBSTATE_WAIT_READ_TLV_LEN0 0x03 /* waiting for extracting len field value */
-#define RW_T1T_SUBSTATE_WAIT_READ_TLV_LEN1 0x04 /* waiting for extracting len field value */
-#define RW_T1T_SUBSTATE_WAIT_READ_TLV_VALUE 0x05 /* waiting for extracting value field in the TLV */
-#define RW_T1T_SUBSTATE_WAIT_READ_LOCKS 0x06 /* waiting for reading dynamic locks in the TLV */
+/* waiting for the detection of a tlv in a tag */
+#define RW_T1T_SUBSTATE_WAIT_TLV_DETECT 0x01
+/* waiting for finding the len field is 1 or 3 bytes long */
+#define RW_T1T_SUBSTATE_WAIT_FIND_LEN_FIELD_LEN 0x02
+/* waiting for extracting len field value */
+#define RW_T1T_SUBSTATE_WAIT_READ_TLV_LEN0 0x03
+/* waiting for extracting len field value */
+#define RW_T1T_SUBSTATE_WAIT_READ_TLV_LEN1 0x04
+/* waiting for extracting value field in the TLV */
+#define RW_T1T_SUBSTATE_WAIT_READ_TLV_VALUE 0x05
+/* waiting for reading dynamic locks in the TLV */
+#define RW_T1T_SUBSTATE_WAIT_READ_LOCKS 0x06
/* Sub states in RW_T1T_STATE_WRITE_NDEF state */
-#define RW_T1T_SUBSTATE_WAIT_READ_NDEF_BLOCK 0x07 /* waiting for response of reading a block that will be partially updated */
-#define RW_T1T_SUBSTATE_WAIT_INVALIDATE_NDEF 0x08 /* waiting for response of invalidating NDEF Msg */
-#define RW_T1T_SUBSTATE_WAIT_NDEF_WRITE 0x09 /* waiting for response of writing a part of NDEF Msg */
-#define RW_T1T_SUBSTATE_WAIT_NDEF_UPDATED 0x0A /* waiting for response of writing last part of NDEF Msg */
-#define RW_T1T_SUBSTATE_WAIT_VALIDATE_NDEF 0x0B /* waiting for response of validating NDEF Msg */
+/* waiting for response of reading a block that will be partially updated */
+#define RW_T1T_SUBSTATE_WAIT_READ_NDEF_BLOCK 0x07
+/* waiting for response of invalidating NDEF Msg */
+#define RW_T1T_SUBSTATE_WAIT_INVALIDATE_NDEF 0x08
+/* waiting for response of writing a part of NDEF Msg */
+#define RW_T1T_SUBSTATE_WAIT_NDEF_WRITE 0x09
+/* waiting for response of writing last part of NDEF Msg */
+#define RW_T1T_SUBSTATE_WAIT_NDEF_UPDATED 0x0A
+/* waiting for response of validating NDEF Msg */
+#define RW_T1T_SUBSTATE_WAIT_VALIDATE_NDEF 0x0B
/* Sub states in RW_T1T_STATE_SET_TAG_RO state */
-#define RW_T1T_SUBSTATE_WAIT_SET_CC_RWA_RO 0x0C /* waiting for response of setting CC-RWA to read only */
-#define RW_T1T_SUBSTATE_WAIT_SET_ST_LOCK_BITS 0x0D /* waiting for response of setting all static lock bits */
-#define RW_T1T_SUBSTATE_WAIT_SET_DYN_LOCK_BITS 0x0E /* waiting for response of setting all dynamic lock bits */
+/* waiting for response of setting CC-RWA to read only */
+#define RW_T1T_SUBSTATE_WAIT_SET_CC_RWA_RO 0x0C
+/* waiting for response of setting all static lock bits */
+#define RW_T1T_SUBSTATE_WAIT_SET_ST_LOCK_BITS 0x0D
+/* waiting for response of setting all dynamic lock bits */
+#define RW_T1T_SUBSTATE_WAIT_SET_DYN_LOCK_BITS 0x0E
/* Sub states in RW_T1T_STATE_FORMAT_TAG state */
-#define RW_T1T_SUBSTATE_WAIT_SET_CC 0x0F /* waiting for response to format/set capability container */
-#define RW_T1T_SUBSTATE_WAIT_SET_NULL_NDEF 0x10 /* waiting for response to format/set NULL NDEF */
+/* waiting for response to format/set capability container */
+#define RW_T1T_SUBSTATE_WAIT_SET_CC 0x0F
+/* waiting for response to format/set NULL NDEF */
+#define RW_T1T_SUBSTATE_WAIT_SET_NULL_NDEF 0x10
typedef struct
@@ -127,9 +172,11 @@
} tRW_T1T_PREV_CMD_RSP_INFO;
#if (RW_NDEF_INCLUDED == TRUE)
-#define T1T_BUFFER_SIZE T1T_STATIC_SIZE /* Buffer 0-E block, for easier tlv operation */
+/* Buffer 0-E block, for easier tlv operation */
+#define T1T_BUFFER_SIZE T1T_STATIC_SIZE
#else
-#define T1T_BUFFER_SIZE T1T_UID_LEN /* Buffer UID */
+/* Buffer UID */
+#define T1T_BUFFER_SIZE T1T_UID_LEN
#endif
/* RW Type 1 Tag control blocks */
@@ -178,9 +225,12 @@
} tRW_T1T_CB;
/* Mifare Ultalight/ Ultralight Family blank tag version block settings */
-#define T2T_MIFARE_VERSION_BLOCK 0x04 /* Block where version number of the tag is stored */
-#define T2T_MIFARE_ULTRALIGHT_VER_NO 0xFFFF /* Blank Ultralight tag - Block 4 (byte 0, byte 1) */
-#define T2T_MIFARE_ULTRALIGHT_FAMILY_VER_NO 0x0200 /* Blank Ultralight family tag - Block 4 (byte 0, byte 1) */
+/* Block where version number of the tag is stored */
+#define T2T_MIFARE_VERSION_BLOCK 0x04
+/* Blank Ultralight tag - Block 4 (byte 0, byte 1) */
+#define T2T_MIFARE_ULTRALIGHT_VER_NO 0xFFFF
+/* Blank Ultralight family tag - Block 4 (byte 0, byte 1) */
+#define T2T_MIFARE_ULTRALIGHT_FAMILY_VER_NO 0x0200
/* Infineon my-d move / my-d blank tag uid block settings */
#define T2T_INFINEON_VERSION_BLOCK 0x00
@@ -195,35 +245,54 @@
#define T2T_NDEF_DETECTED 0x01
#define T2T_NDEF_READ 0x02
-#define T2T_MAX_NDEF_OFFSET 128 /* Max offset of an NDEF message in a T2 tag */
+/* Max offset of an NDEF message in a T2 tag */
+#define T2T_MAX_NDEF_OFFSET 128
#define T2T_MAX_RESERVED_BYTES_IN_TAG 0x64
#define T2T_MAX_LOCK_BYTES_IN_TAG 0x64
-#define RW_T2T_MAX_MEM_TLVS 0x05 /* Maximum supported Memory control TLVS in the tag */
-#define RW_T2T_MAX_LOCK_TLVS 0x05 /* Maximum supported Lock control TLVS in the tag */
-#define RW_T2T_MAX_LOCK_BYTES 0x1E /* Maximum supported dynamic lock bytes */
+/* Maximum supported Memory control TLVS in the tag */
+#define RW_T2T_MAX_MEM_TLVS 0x05
+/* Maximum supported Lock control TLVS in the tag */
+#define RW_T2T_MAX_LOCK_TLVS 0x05
+/* Maximum supported dynamic lock bytes */
+#define RW_T2T_MAX_LOCK_BYTES 0x1E
#define RW_T2T_SEGMENT_BYTES 128
#define RW_T2T_SEGMENT_SIZE 16
-#define RW_T2T_LOCK_NOT_UPDATED 0x00 /* Lock not yet set as part of SET TAG RO op */
-#define RW_T2T_LOCK_UPDATE_INITIATED 0x01 /* Sent command to set the Lock bytes */
-#define RW_T2T_LOCK_UPDATED 0x02 /* Lock bytes are set */
+/* Lock not yet set as part of SET TAG RO op */
+#define RW_T2T_LOCK_NOT_UPDATED 0x00
+/* Sent command to set the Lock bytes */
+#define RW_T2T_LOCK_UPDATE_INITIATED 0x01
+/* Lock bytes are set */
+#define RW_T2T_LOCK_UPDATED 0x02
typedef uint8_t tRW_T2T_LOCK_STATUS;
/* States */
-#define RW_T2T_STATE_NOT_ACTIVATED 0x00 /* Tag not activated */
-#define RW_T2T_STATE_IDLE 0x01 /* T1 Tag activated and ready to perform rw operation on Tag*/
-#define RW_T2T_STATE_READ 0x02 /* waiting response for read command sent to tag */
-#define RW_T2T_STATE_WRITE 0x03 /* waiting response for write command sent to tag */
-#define RW_T2T_STATE_SELECT_SECTOR 0x04 /* Waiting response for sector select command */
-#define RW_T2T_STATE_DETECT_TLV 0x05 /* Detecting Lock/Memory/NDEF/Proprietary TLV in the Tag */
-#define RW_T2T_STATE_READ_NDEF 0x06 /* Performing NDEF Read procedure */
-#define RW_T2T_STATE_WRITE_NDEF 0x07 /* Performing NDEF Write procedure */
-#define RW_T2T_STATE_SET_TAG_RO 0x08 /* Setting Tag as Read only tag */
-#define RW_T2T_STATE_CHECK_PRESENCE 0x09 /* Check if Tag is still present */
-#define RW_T2T_STATE_FORMAT_TAG 0x0A /* Format the tag */
-#define RW_T2T_STATE_HALT 0x0B /* Tag is in HALT State */
+/* Tag not activated */
+#define RW_T2T_STATE_NOT_ACTIVATED 0x00
+/* T1 Tag activated and ready to perform rw operation on Tag*/
+#define RW_T2T_STATE_IDLE 0x01
+/* waiting response for read command sent to tag */
+#define RW_T2T_STATE_READ 0x02
+/* waiting response for write command sent to tag */
+#define RW_T2T_STATE_WRITE 0x03
+/* Waiting response for sector select command */
+#define RW_T2T_STATE_SELECT_SECTOR 0x04
+/* Detecting Lock/Memory/NDEF/Proprietary TLV in the Tag */
+#define RW_T2T_STATE_DETECT_TLV 0x05
+/* Performing NDEF Read procedure */
+#define RW_T2T_STATE_READ_NDEF 0x06
+/* Performing NDEF Write procedure */
+#define RW_T2T_STATE_WRITE_NDEF 0x07
+/* Setting Tag as Read only tag */
+#define RW_T2T_STATE_SET_TAG_RO 0x08
+/* Check if Tag is still present */
+#define RW_T2T_STATE_CHECK_PRESENCE 0x09
+/* Format the tag */
+#define RW_T2T_STATE_FORMAT_TAG 0x0A
+/* Tag is in HALT State */
+#define RW_T2T_STATE_HALT 0x0B
/* rw_t2t_read/rw_t2t_write takes care of sector change if the block to read/write is in a different sector
* Next Substate should be assigned to control variable 'substate' before calling these function for State Machine to
@@ -233,41 +302,66 @@
#define RW_T2T_SUBSTATE_NONE 0x00
/* Sub states in RW_T2T_STATE_SELECT_SECTOR state */
-#define RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR_SUPPORT 0x01 /* waiting for response of sector select CMD 1 */
-#define RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR 0x02 /* waiting for response of sector select CMD 2 */
+/* waiting for response of sector select CMD 1 */
+#define RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR_SUPPORT 0x01
+/* waiting for response of sector select CMD 2 */
+#define RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR 0x02
/* Sub states in RW_T1T_STATE_DETECT_XXX state */
-#define RW_T2T_SUBSTATE_WAIT_READ_CC 0x03 /* waiting for the detection of a tlv in a tag */
-#define RW_T2T_SUBSTATE_WAIT_TLV_DETECT 0x04 /* waiting for the detection of a tlv in a tag */
-#define RW_T2T_SUBSTATE_WAIT_FIND_LEN_FIELD_LEN 0x05 /* waiting for finding the len field is 1 or 3 bytes long */
-#define RW_T2T_SUBSTATE_WAIT_READ_TLV_LEN0 0x06 /* waiting for extracting len field value */
-#define RW_T2T_SUBSTATE_WAIT_READ_TLV_LEN1 0x07 /* waiting for extracting len field value */
-#define RW_T2T_SUBSTATE_WAIT_READ_TLV_VALUE 0x08 /* waiting for extracting value field in the TLV */
-#define RW_T2T_SUBSTATE_WAIT_READ_LOCKS 0x09 /* waiting for reading dynamic locks in the TLV */
+/* waiting for the detection of a tlv in a tag */
+#define RW_T2T_SUBSTATE_WAIT_READ_CC 0x03
+/* waiting for the detection of a tlv in a tag */
+#define RW_T2T_SUBSTATE_WAIT_TLV_DETECT 0x04
+/* waiting for finding the len field is 1 or 3 bytes long */
+#define RW_T2T_SUBSTATE_WAIT_FIND_LEN_FIELD_LEN 0x05
+/* waiting for extracting len field value */
+#define RW_T2T_SUBSTATE_WAIT_READ_TLV_LEN0 0x06
+/* waiting for extracting len field value */
+#define RW_T2T_SUBSTATE_WAIT_READ_TLV_LEN1 0x07
+/* waiting for extracting value field in the TLV */
+#define RW_T2T_SUBSTATE_WAIT_READ_TLV_VALUE 0x08
+/* waiting for reading dynamic locks in the TLV */
+#define RW_T2T_SUBSTATE_WAIT_READ_LOCKS 0x09
/* Sub states in RW_T2T_STATE_WRITE_NDEF state */
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_FIRST_BLOCK 0x0A /* waiting for rsp to reading the block where NDEF starts */
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_LAST_BLOCK 0x0B /* waiting for rsp to reading block where new NDEF Msg ends */
-#define RW_T2T_SUBSTATE_WAIT_READ_TERM_TLV_BLOCK 0x0C /* waiting for rsp to reading block where Trm tlv gets added*/
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_NEXT_BLOCK 0x0D /* waiting for rsp to reading block where nxt NDEF write */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_NEXT_BLOCK 0x0E /* waiting for rsp to writting NDEF block */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LAST_BLOCK 0x0F /* waiting for rsp to last NDEF block write cmd */
-#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_LEN_BLOCK 0x10 /* waiting for rsp to reading NDEF len field block */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LEN_BLOCK 0x11 /* waiting for rsp of updating first NDEF len field block */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LEN_NEXT_BLOCK 0x12 /* waiting for rsp of updating next NDEF len field block */
-#define RW_T2T_SUBSTATE_WAIT_WRITE_TERM_TLV_CMPLT 0x13 /* waiting for rsp to writing to Terminator tlv */
+/* waiting for rsp to reading the block where NDEF starts */
+#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_FIRST_BLOCK 0x0A
+/* waiting for rsp to reading block where new NDEF Msg ends */
+#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_LAST_BLOCK 0x0B
+/* waiting for rsp to reading block where Trm tlv gets added*/
+#define RW_T2T_SUBSTATE_WAIT_READ_TERM_TLV_BLOCK 0x0C
+/* waiting for rsp to reading block where nxt NDEF write */
+#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_NEXT_BLOCK 0x0D
+/* waiting for rsp to writting NDEF block */
+#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_NEXT_BLOCK 0x0E
+/* waiting for rsp to last NDEF block write cmd */
+#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LAST_BLOCK 0x0F
+/* waiting for rsp to reading NDEF len field block */
+#define RW_T2T_SUBSTATE_WAIT_READ_NDEF_LEN_BLOCK 0x10
+/* waiting for rsp of updating first NDEF len field block */
+#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LEN_BLOCK 0x11
+/* waiting for rsp of updating next NDEF len field block */
+#define RW_T2T_SUBSTATE_WAIT_WRITE_NDEF_LEN_NEXT_BLOCK 0x12
+/* waiting for rsp to writing to Terminator tlv */
+#define RW_T2T_SUBSTATE_WAIT_WRITE_TERM_TLV_CMPLT 0x13
/* Sub states in RW_T2T_STATE_FORMAT_TAG state */
#define RW_T2T_SUBSTATE_WAIT_READ_VERSION_INFO 0x14
-#define RW_T2T_SUBSTATE_WAIT_SET_CC 0x15 /* waiting for response to format/set capability container */
+/* waiting for response to format/set capability container */
+#define RW_T2T_SUBSTATE_WAIT_SET_CC 0x15
#define RW_T2T_SUBSTATE_WAIT_SET_LOCK_TLV 0x16
-#define RW_T2T_SUBSTATE_WAIT_SET_NULL_NDEF 0x17 /* waiting for response to format/set NULL NDEF */
+/* waiting for response to format/set NULL NDEF */
+#define RW_T2T_SUBSTATE_WAIT_SET_NULL_NDEF 0x17
/* Sub states in RW_T2T_STATE_SET_TAG_RO state */
-#define RW_T2T_SUBSTATE_WAIT_SET_CC_RO 0x19 /* waiting for response to set CC3 to RO */
-#define RW_T2T_SUBSTATE_WAIT_READ_DYN_LOCK_BYTE_BLOCK 0x1A /* waiting for response to read dynamic lock bytes block */
-#define RW_T2T_SUBSTATE_WAIT_SET_DYN_LOCK_BITS 0x1B /* waiting for response to set dynamic lock bits */
-#define RW_T2T_SUBSTATE_WAIT_SET_ST_LOCK_BITS 0x1C /* waiting for response to set static lock bits */
+/* waiting for response to set CC3 to RO */
+#define RW_T2T_SUBSTATE_WAIT_SET_CC_RO 0x19
+/* waiting for response to read dynamic lock bytes block */
+#define RW_T2T_SUBSTATE_WAIT_READ_DYN_LOCK_BYTE_BLOCK 0x1A
+/* waiting for response to set dynamic lock bits */
+#define RW_T2T_SUBSTATE_WAIT_SET_DYN_LOCK_BITS 0x1B
+/* waiting for response to set static lock bits */
+#define RW_T2T_SUBSTATE_WAIT_SET_ST_LOCK_BITS 0x1C
typedef struct
{
@@ -366,12 +460,18 @@
} tRW_T3T_DETECT;
/* RW_T3T control block flags */
-#define RW_T3T_FL_IS_FINAL_NDEF_SEGMENT 0x01 /* The final command for completing the NDEF read/write */
-#define RW_T3T_FL_W4_PRESENCE_CHECK_POLL_RSP 0x02 /* Waiting for POLL response for presence check */
-#define RW_T3T_FL_W4_GET_SC_POLL_RSP 0x04 /* Waiting for POLL response for RW_T3tGetSystemCodes */
-#define RW_T3T_FL_W4_NDEF_DETECT_POLL_RSP 0x08 /* Waiting for POLL response for RW_T3tDetectNDef */
-#define RW_T3T_FL_W4_FMT_FELICA_LITE_POLL_RSP 0x10 /* Waiting for POLL response for RW_T3tFormat */
-#define RW_T3T_FL_W4_SRO_FELICA_LITE_POLL_RSP 0x20 /* Waiting for POLL response for RW_T3tSetReadOnly */
+/* The final command for completing the NDEF read/write */
+#define RW_T3T_FL_IS_FINAL_NDEF_SEGMENT 0x01
+/* Waiting for POLL response for presence check */
+#define RW_T3T_FL_W4_PRESENCE_CHECK_POLL_RSP 0x02
+/* Waiting for POLL response for RW_T3tGetSystemCodes */
+#define RW_T3T_FL_W4_GET_SC_POLL_RSP 0x04
+/* Waiting for POLL response for RW_T3tDetectNDef */
+#define RW_T3T_FL_W4_NDEF_DETECT_POLL_RSP 0x08
+/* Waiting for POLL response for RW_T3tFormat */
+#define RW_T3T_FL_W4_FMT_FELICA_LITE_POLL_RSP 0x10
+/* Waiting for POLL response for RW_T3tSetReadOnly */
+#define RW_T3T_FL_W4_SRO_FELICA_LITE_POLL_RSP 0x20
typedef struct
{
@@ -457,8 +557,10 @@
tRW_T4T_CC cc_file; /* Capability Container File */
-#define RW_T4T_NDEF_STATUS_NDEF_DETECTED 0x01 /* NDEF has been detected */
-#define RW_T4T_NDEF_STATUS_NDEF_READ_ONLY 0x02 /* NDEF file is read-only */
+/* NDEF has been detected */
+#define RW_T4T_NDEF_STATUS_NDEF_DETECTED 0x01
+/* NDEF file is read-only */
+#define RW_T4T_NDEF_STATUS_NDEF_READ_ONLY 0x02
uint8_t ndef_status; /* bitmap for NDEF status */
uint8_t channel; /* channel id: used for read-binary */
@@ -488,17 +590,27 @@
typedef uint8_t tRW_I93_RW_STATE;
typedef uint8_t tRW_I93_RW_SUBSTATE;
-#define RW_I93_FLAG_READ_ONLY 0x01 /* tag is read-only */
-#define RW_I93_FLAG_READ_MULTI_BLOCK 0x02 /* tag supports read multi block */
-#define RW_I93_FLAG_RESET_DSFID 0x04 /* need to reset DSFID for formatting */
-#define RW_I93_FLAG_RESET_AFI 0x08 /* need to reset AFI for formatting */
-#define RW_I93_FLAG_16BIT_NUM_BLOCK 0x10 /* use 2 bytes for number of blocks */
+/* tag is read-only */
+#define RW_I93_FLAG_READ_ONLY 0x01
+/* tag supports read multi block */
+#define RW_I93_FLAG_READ_MULTI_BLOCK 0x02
+/* need to reset DSFID for formatting */
+#define RW_I93_FLAG_RESET_DSFID 0x04
+/* need to reset AFI for formatting */
+#define RW_I93_FLAG_RESET_AFI 0x08
+/* use 2 bytes for number of blocks */
+#define RW_I93_FLAG_16BIT_NUM_BLOCK 0x10
-#define RW_I93_TLV_DETECT_STATE_TYPE 0x01 /* searching for type */
-#define RW_I93_TLV_DETECT_STATE_LENGTH_1 0x02 /* searching for the first byte of length */
-#define RW_I93_TLV_DETECT_STATE_LENGTH_2 0x03 /* searching for the second byte of length */
-#define RW_I93_TLV_DETECT_STATE_LENGTH_3 0x04 /* searching for the third byte of length */
-#define RW_I93_TLV_DETECT_STATE_VALUE 0x05 /* reading value field */
+/* searching for type */
+#define RW_I93_TLV_DETECT_STATE_TYPE 0x01
+/* searching for the first byte of length */
+#define RW_I93_TLV_DETECT_STATE_LENGTH_1 0x02
+/* searching for the second byte of length */
+#define RW_I93_TLV_DETECT_STATE_LENGTH_2 0x03
+/* searching for the third byte of length */
+#define RW_I93_TLV_DETECT_STATE_LENGTH_3 0x04
+/* reading value field */
+#define RW_I93_TLV_DETECT_STATE_VALUE 0x05
enum
{
diff --git a/src/nfc/tags/rw_i93.c b/src/nfc/tags/rw_i93.c
index 133ca4e..b4df165 100644
--- a/src/nfc/tags/rw_i93.c
+++ b/src/nfc/tags/rw_i93.c
@@ -35,11 +35,16 @@
#include "rw_api.h"
#include "rw_int.h"
-#define RW_I93_TOUT_RESP 1000 /* Response timeout */
-#define RW_I93_TOUT_STAY_QUIET 200 /* stay quiet timeout */
-#define RW_I93_READ_MULTI_BLOCK_SIZE 128 /* max reading data if read multi block is supported */
-#define RW_I93_FORMAT_DATA_LEN 8 /* CC, zero length NDEF, Terminator TLV */
-#define RW_I93_GET_MULTI_BLOCK_SEC_SIZE 253 /* max getting lock status if get multi block sec is supported */
+/* Response timeout */
+#define RW_I93_TOUT_RESP 1000
+/* stay quiet timeout */
+#define RW_I93_TOUT_STAY_QUIET 200
+/* max reading data if read multi block is supported */
+#define RW_I93_READ_MULTI_BLOCK_SIZE 128
+/* CC, zero length NDEF, Terminator TLV */
+#define RW_I93_FORMAT_DATA_LEN 8
+/* max getting lock status if get multi block sec is supported */
+#define RW_I93_GET_MULTI_BLOCK_SEC_SIZE 253
/* main state */
enum
diff --git a/src/nfc/tags/rw_t3t.c b/src/nfc/tags/rw_t3t.c
index efc9dbd..cdf805a 100644
--- a/src/nfc/tags/rw_t3t.c
+++ b/src/nfc/tags/rw_t3t.c
@@ -38,11 +38,14 @@
/* Definitions for constructing t3t command messages */
#define RW_T3T_FL_PADDING 0x01 /* Padding needed for last NDEF block */
-#define RW_T3T_MAX_NDEF_BLOCKS_PER_UPDATE_1_BYTE_FORMAT (13) /* Maximum number of NDEF blocks updates that can fit into one command (when all block-numbers are < 256) */
-#define RW_T3T_MAX_NDEF_BLOCKS_PER_UPDATE_2_BYTE_FORMAT (12) /* Maximum number of NDEF blocks updates that can fit into one command (when all block-numbers are >= 256) */
+/* Maximum number of NDEF blocks updates that can fit into one command (when all block-numbers are < 256) */
+#define RW_T3T_MAX_NDEF_BLOCKS_PER_UPDATE_1_BYTE_FORMAT (13)
+/* Maximum number of NDEF blocks updates that can fit into one command (when all block-numbers are >= 256) */
+#define RW_T3T_MAX_NDEF_BLOCKS_PER_UPDATE_2_BYTE_FORMAT (12)
/* Definitions for SENSF_RES */
-#define RW_T3T_SENSF_RES_RD_OFFSET 17 /* Offset of RD in SENSF_RES from NCI_POLL NTF (includes 1 byte SENSF_RES length) */
+/* Offset of RD in SENSF_RES from NCI_POLL NTF (includes 1 byte SENSF_RES length) */
+#define RW_T3T_SENSF_RES_RD_OFFSET 17
#define RW_T3T_SENSF_RES_RD_LEN 2 /* Size of RD in SENSF_RES */
/* Timeout definitions for commands */
@@ -128,8 +131,10 @@
/* Default NDEF attribute information block (used when formatting Felica-Lite tags) */
-#define RW_T3T_DEFAULT_FELICALITE_NBR 4 /* NBr (max block reads per cmd)*/
-#define RW_T3T_DEFAULT_FELICALITE_NBW 1 /* NBw (max block write per cmd)*/
+/* NBr (max block reads per cmd)*/
+#define RW_T3T_DEFAULT_FELICALITE_NBR 4
+/* NBw (max block write per cmd)*/
+#define RW_T3T_DEFAULT_FELICALITE_NBW 1
#define RW_T3T_DEFAULT_FELICALITE_NMAXB (T3T_FELICALITE_NMAXB)
#define RW_T3T_DEFAULT_FELICALITE_ATTRIB_INFO_CHECKSUM ((T3T_MSG_NDEF_VERSION + \
RW_T3T_DEFAULT_FELICALITE_NBR + \
diff --git a/src/nfc/tags/rw_t4t.c b/src/nfc/tags/rw_t4t.c
index 2e222a9..754343b 100644
--- a/src/nfc/tags/rw_t4t.c
+++ b/src/nfc/tags/rw_t4t.c
@@ -38,26 +38,43 @@
#include "gki.h"
/* main state */
-#define RW_T4T_STATE_NOT_ACTIVATED 0x00 /* T4T is not activated */
-#define RW_T4T_STATE_IDLE 0x01 /* waiting for upper layer API */
-#define RW_T4T_STATE_DETECT_NDEF 0x02 /* performing NDEF detection precedure */
-#define RW_T4T_STATE_READ_NDEF 0x03 /* performing read NDEF procedure */
-#define RW_T4T_STATE_UPDATE_NDEF 0x04 /* performing update NDEF procedure */
-#define RW_T4T_STATE_PRESENCE_CHECK 0x05 /* checking presence of tag */
-#define RW_T4T_STATE_SET_READ_ONLY 0x06 /* convert tag to read only */
+/* T4T is not activated */
+#define RW_T4T_STATE_NOT_ACTIVATED 0x00
+/* waiting for upper layer API */
+#define RW_T4T_STATE_IDLE 0x01
+/* performing NDEF detection precedure */
+#define RW_T4T_STATE_DETECT_NDEF 0x02
+/* performing read NDEF procedure */
+#define RW_T4T_STATE_READ_NDEF 0x03
+/* performing update NDEF procedure */
+#define RW_T4T_STATE_UPDATE_NDEF 0x04
+/* checking presence of tag */
+#define RW_T4T_STATE_PRESENCE_CHECK 0x05
+/* convert tag to read only */
+#define RW_T4T_STATE_SET_READ_ONLY 0x06
-#define RW_T4T_STATE_NDEF_FORMAT 0x07 /* performing NDEF format */
+/* performing NDEF format */
+#define RW_T4T_STATE_NDEF_FORMAT 0x07
/* sub state */
-#define RW_T4T_SUBSTATE_WAIT_SELECT_APP 0x00 /* waiting for response of selecting AID */
-#define RW_T4T_SUBSTATE_WAIT_SELECT_CC 0x01 /* waiting for response of selecting CC */
-#define RW_T4T_SUBSTATE_WAIT_CC_FILE 0x02 /* waiting for response of reading CC */
-#define RW_T4T_SUBSTATE_WAIT_SELECT_NDEF_FILE 0x03 /* waiting for response of selecting NDEF */
-#define RW_T4T_SUBSTATE_WAIT_READ_NLEN 0x04 /* waiting for response of reading NLEN */
-#define RW_T4T_SUBSTATE_WAIT_READ_RESP 0x05 /* waiting for response of reading file */
-#define RW_T4T_SUBSTATE_WAIT_UPDATE_RESP 0x06 /* waiting for response of updating file */
-#define RW_T4T_SUBSTATE_WAIT_UPDATE_NLEN 0x07 /* waiting for response of updating NLEN */
-#define RW_T4T_SUBSTATE_WAIT_UPDATE_CC 0x08 /* waiting for response of updating CC */
+/* waiting for response of selecting AID */
+#define RW_T4T_SUBSTATE_WAIT_SELECT_APP 0x00
+/* waiting for response of selecting CC */
+#define RW_T4T_SUBSTATE_WAIT_SELECT_CC 0x01
+/* waiting for response of reading CC */
+#define RW_T4T_SUBSTATE_WAIT_CC_FILE 0x02
+/* waiting for response of selecting NDEF */
+#define RW_T4T_SUBSTATE_WAIT_SELECT_NDEF_FILE 0x03
+/* waiting for response of reading NLEN */
+#define RW_T4T_SUBSTATE_WAIT_READ_NLEN 0x04
+/* waiting for response of reading file */
+#define RW_T4T_SUBSTATE_WAIT_READ_RESP 0x05
+/* waiting for response of updating file */
+#define RW_T4T_SUBSTATE_WAIT_UPDATE_RESP 0x06
+/* waiting for response of updating NLEN */
+#define RW_T4T_SUBSTATE_WAIT_UPDATE_NLEN 0x07
+/* waiting for response of updating CC */
+#define RW_T4T_SUBSTATE_WAIT_UPDATE_CC 0x08
#define RW_T4T_SUBSTATE_WAIT_GET_HW_VERSION 0x09
#define RW_T4T_SUBSTATE_WAIT_GET_SW_VERSION 0x0A