From b1cb2ca532d0084d470b8fef87d801b0a8427319 Mon Sep 17 00:00:00 2001 From: Lee Sangsoo Date: Tue, 4 Sep 2012 12:45:57 +0900 Subject: [PATCH] code update Change-Id: Ic45e989a56e15698b37c35b04fb42758008f9319 --- CMakeLists.txt | 4 +- Linux_x86/phDal4Nfc.c | 2 + Linux_x86/phDal4Nfc_i2c.c | 10 +- Linux_x86/phDal4Nfc_uart.c | 5 +- Linux_x86/phOsalNfc.c | 394 +++++---- inc/phNfcConfig.h | 1022 ++++++++++----------- inc/phNfcTypes.h | 1966 ++++++++++++++++++++--------------------- packaging/nfc-plugin-nxp.spec | 4 +- src/cutils/log.h | 18 + src/phDal4Nfc.h | 17 +- src/phDnldNfc.c | 5 +- src/phFriNfc_NdefMap.c | 7 +- src/phHal4Nfc.c | 15 +- src/phHciNfc_DevMgmt.c | 3 +- src/phHciNfc_Generic.h | 4 +- src/phLibNfc.c | 7 +- src/phLlcNfc_Interface.c | 19 +- src/phOsalNfc.h | 6 +- src/utils/Log.h | 18 + 19 files changed, 1774 insertions(+), 1752 deletions(-) mode change 100755 => 100644 inc/phNfcConfig.h mode change 100755 => 100644 inc/phNfcTypes.h create mode 100644 src/cutils/log.h create mode 100644 src/utils/Log.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 69e3300..56ee8bb 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ MESSAGE("build nfc-plugin-nxp") include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Linux_x86) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/utils) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/cutils) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/Linux_x86 SRCS) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src/oem SRCS) @@ -54,8 +56,6 @@ ADD_DEFINITIONS("-DPHPN54X -DNXP_MESSAGING -DINCLUDE_DALINIT_DEINIT -DNFC_CUSTOM ADD_DEFINITIONS("-DG_IDLE_ADD_MSGQ") ADD_DEFINITIONS("-DUPDATE_NFC_ACTIVE") #ADD_DEFINITIONS("-DNFC_CUSTOM_CONFIG_INCLUDE") -ADD_DEFINITIONS("-DPH_FRINFC_MAP_ISO15693_DISABLED") -ADD_DEFINITIONS("-DPH_FRINFC_FMT_ISO15693_DISABLED") # this for debug # PHDBG_TRACES must define to use PHDBG_TRACES_LEVEL_0 to 2 diff --git a/Linux_x86/phDal4Nfc.c b/Linux_x86/phDal4Nfc.c index 4355e27..c89a2cf 100755 --- a/Linux_x86/phDal4Nfc.c +++ b/Linux_x86/phDal4Nfc.c @@ -34,6 +34,8 @@ #include #ifdef ANDROID #include +#include +#include // for property_get #else #include #endif diff --git a/Linux_x86/phDal4Nfc_i2c.c b/Linux_x86/phDal4Nfc_i2c.c index 3fe5ef2..6a350d9 100644 --- a/Linux_x86/phDal4Nfc_i2c.c +++ b/Linux_x86/phDal4Nfc_i2c.c @@ -23,9 +23,9 @@ * */ - -//#include - +#define LOG_TAG "NFC_i2c" +#include +//#include #include #include #include @@ -45,10 +45,6 @@ //#include #include "pn544.h" -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "NFC_i2c" typedef struct { diff --git a/Linux_x86/phDal4Nfc_uart.c b/Linux_x86/phDal4Nfc_uart.c index efa524e..97011ba 100755 --- a/Linux_x86/phDal4Nfc_uart.c +++ b/Linux_x86/phDal4Nfc_uart.c @@ -26,7 +26,10 @@ * $Revision: 1.0 $ * */ + #define LOG_TAG "NFC_uart" +#include +//#include #include #include #include @@ -43,6 +46,7 @@ #include #if defined(ANDROID) #include +//#include // for property_get #endif typedef struct @@ -292,7 +296,6 @@ PURPOSE: Reads nNbBytesToRead bytes and writes them in pBuffer. Returns the number of bytes really read or -1 in case of error. -----------------------------------------------------------------------------*/ - int phDal4Nfc_uart_read(uint8_t * pBuffer, int nNbBytesToRead) { int ret; diff --git a/Linux_x86/phOsalNfc.c b/Linux_x86/phOsalNfc.c index f646b4f..75eebf0 100644 --- a/Linux_x86/phOsalNfc.c +++ b/Linux_x86/phOsalNfc.c @@ -1,183 +1,213 @@ -/* - * Copyright (C) 2010 NXP Semiconductors +/* + * Copyright (C) 2010 NXP Semiconductors * Copyright (C) 2012 Samsung Elevtronics Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file phOsalNfc.c - * \brief OSAL Implementation for linux - * - * Project: Trusted NFC Linux Light - * - * $Date: 03 aug 2009 - * $Author: Jérémie Corbier - * $Revision: 1.0 - * - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef ANDROID -#define LOG_TAG "NFC-HCI" - -//#include -extern int nDeferedCallMessageQueueId; -phOsalNfc_Exception_t phOsalNfc_Exception; -#elif defined(SLP_DEBUG) -#define LOG_TAG "NFC_HCI" - -#include -#endif - -#ifdef DEBUG -#define MAX_PRINT_BUFSIZE (0x450U) -char phOsalNfc_DbgTraceBuffer[MAX_PRINT_BUFSIZE]; -#endif - -/*! - * \brief Allocates memory. - * This function attempts to allocate \a size bytes on the heap and - * returns a pointer to the allocated block. - * - * \param size size of the memory block to be allocated on the heap. - * - * \return pointer to allocated memory block or NULL in case of error. - */ -void *phOsalNfc_GetMemory(uint32_t size) -{ - void *pMem = (void *)malloc(size); - return pMem; -} - -/*! - * \brief Frees allocated memory block. - * This function deallocates memory region pointed to by \a pMem. - * - * \param pMem pointer to memory block to be freed. - */ -void phOsalNfc_FreeMemory(void *pMem) -{ - if(NULL != pMem) - free(pMem); -} - -void phOsalNfc_DbgString(const char *pString) -{ -#ifdef DEBUG - if(pString != NULL) -#if !defined(ANDROID) && !defined(SLP_DEBUG) - printf(pString); -#else - LOGD("%s", pString); -#endif -#endif -} - -void phOsalNfc_DbgTrace(uint8_t data[], uint32_t size) -{ -#ifdef DEBUG - uint32_t i; -#if defined(ANDROID) || defined(SLP_DEBUG) - char buf[10]; -#endif - - if(size == 0) - return; - -#if !defined(ANDROID) && !defined(SLP_DEBUG) - for(i = 0; i < size; i++) - { - if((i % 10) == 0) - printf("\n\t\t\t"); - printf("%02X ", data[i]); - } - printf("\n\tBlock size is: %d\n", size); -#else - phOsalNfc_DbgTraceBuffer[0] = '\0'; - for(i = 0; i < size; i++) - { - if((i % 10) == 0) - { - LOGD("%s", phOsalNfc_DbgTraceBuffer); - phOsalNfc_DbgTraceBuffer[0] = '\0'; - } - - snprintf(buf, 10, "%02X ", data[i]); - strncat(phOsalNfc_DbgTraceBuffer, buf, 10); - } - LOGD("%s", phOsalNfc_DbgTraceBuffer); - LOGD("Block size is: %d", size); -#endif -#endif -} - -/*! - * \brief Raises exception. - * This function raises an exception of type \a eExceptionType with - * reason \a reason to stack clients. - * - * \param eExceptionType exception type. - * \param reason reason for this exception. - * - * \note Clients willing to catch exceptions are to handle the SIGABRT signal. - * On Linux, exception type and reason are passed to the signal handler as - * a pointer to a phOsalNfc_Exception_t structure. - * As sigqueue is not available in Android, exception information are - * stored in the phOsalNfc_Exception global. - */ -void phOsalNfc_RaiseException(phOsalNfc_ExceptionType_t eExceptionType, uint16_t reason) -{ - LOGD("phOsalNfc_RaiseException() called"); - - if(eExceptionType == phOsalNfc_e_UnrecovFirmwareErr) - { - // LOGE("HCI Timeout - Exception raised"); - // LOGE("Force restart of NFC Service"); - abort(); - } - } - -/*! - * \brief display data bytes. - * This function displays data bytes for debug purpose - * \param[in] pString pointer to string to be displayed. - * \param[in] length number of bytes to be displayed. - * \param[in] pBuffer pointer to data bytes to be displayed. - * -*/ -void phOsalNfc_PrintData(const char *pString, uint32_t length, uint8_t *pBuffer) -{ - char print_buffer[512]; // Max length 512 for the download mode - int i; - - if(NULL!=pString && length > 1 && length < 34) - { - print_buffer[0] = '\0'; - for (i = 0; i < length; i++) { - snprintf(&print_buffer[i*5], 6, " 0x%02X", pBuffer[i]); -} - LOGD("> NFC I2C %s: %s", pString,print_buffer); - } -} - + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * \file phOsalNfc.c + * \brief OSAL Implementation for linux + * + * Project: Trusted NFC Linux Light + * + * $Date: 03 aug 2009 + * $Author: Jérémie Corbier + * $Revision: 1.0 + * + */ + +#include +#include +#include +#include +#include + +#include + +//#ifdef ANDROID +#define LOG_TAG "NFC-HCI" + +#include + +phOsalNfc_Exception_t phOsalNfc_Exception; +//#endif + +#ifdef DEBUG +#define MAX_PRINT_BUFSIZE (0x450U) +char phOsalNfc_DbgTraceBuffer[MAX_PRINT_BUFSIZE]; +#endif + +/*! + * \brief Allocates memory. + * This function attempts to allocate \a size bytes on the heap and + * returns a pointer to the allocated block. + * + * \param size size of the memory block to be allocated on the heap. + * + * \return pointer to allocated memory block or NULL in case of error. + */ +void *phOsalNfc_GetMemory(uint32_t size) +{ + void *pMem = (void *)malloc(size); + return pMem; +} + +/*! + * \brief Frees allocated memory block. + * This function deallocates memory region pointed to by \a pMem. + * + * \param pMem pointer to memory block to be freed. + */ +void phOsalNfc_FreeMemory(void *pMem) +{ + if(NULL != pMem) + free(pMem); +} + +void phOsalNfc_DbgString(const char *pString) +{ +#ifdef DEBUG + if(pString != NULL) +#ifndef ANDROID + printf(pString); +#else + LOGD("%s", pString); +#endif +#endif +} + +void phOsalNfc_DbgTrace(uint8_t data[], uint32_t size) +{ +#ifdef DEBUG + uint32_t i; +#ifdef ANDROID + char buf[10]; +#endif + + if(size == 0) + return; + +#ifndef ANDROID + for(i = 0; i < size; i++) + { + if((i % 10) == 0) + printf("\n\t\t\t"); + printf("%02X ", data[i]); + } + printf("\n\tBlock size is: %d\n", size); +#else + phOsalNfc_DbgTraceBuffer[0] = '\0'; + for(i = 0; i < size; i++) + { + if((i % 10) == 0) + { + LOGD("%s", phOsalNfc_DbgTraceBuffer); + phOsalNfc_DbgTraceBuffer[0] = '\0'; + } + + snprintf(buf, 10, "%02X ", data[i]); + strncat(phOsalNfc_DbgTraceBuffer, buf, 10); + } + LOGD("%s", phOsalNfc_DbgTraceBuffer); + LOGD("Block size is: %d", size); +#endif +#endif +} + +/*! + * \brief Raises exception. + * This function raises an exception of type \a eExceptionType with + * reason \a reason to stack clients. + * + * \param eExceptionType exception type. + * \param reason reason for this exception. + * + * \note Clients willing to catch exceptions are to handle the SIGABRT signal. + * On Linux, exception type and reason are passed to the signal handler as + * a pointer to a phOsalNfc_Exception_t structure. + * As sigqueue is not available in Android, exception information are + * stored in the phOsalNfc_Exception global. + */ +void phOsalNfc_RaiseException(phOsalNfc_ExceptionType_t eExceptionType, uint16_t reason) +{ + LOGD("phOsalNfc_RaiseException() called"); + + if(eExceptionType == phOsalNfc_e_UnrecovFirmwareErr) + { + LOGE("HCI Timeout - Exception raised"); + LOGE("Force restart of NFC Service"); + abort(); + } +} + +/*! + * \brief display data bytes. + * This function displays data bytes for debug purpose + * \param[in] pString pointer to string to be displayed. + * \param[in] length number of bytes to be displayed. + * \param[in] pBuffer pointer to data bytes to be displayed. + * + */ +void phOsalNfc_PrintData(const char *pString, uint32_t length, uint8_t *pBuffer, + int verbosity) +{ + char print_buffer[length * 3 + 1]; + unsigned int i; + + if (pString == NULL) { + pString = ""; + } + print_buffer[0] = '\0'; + for (i = 0; i < length; i++) { + snprintf(&print_buffer[i*3], 4, " %02X", pBuffer[i]); + } + + char llc[40] = ""; + + if (verbosity >= 2) { + uint8_t llc_header = 0; + if (!strcmp(pString, "SEND") && length >= 2) { + llc_header = pBuffer[1]; + } else if (!strcmp(pString, "RECV") && length >= 2) { + llc_header = pBuffer[0]; + } + + if ((llc_header & 0xC0) == 0x80) { + // I + uint8_t ns = (llc_header & 0x38) >> 3; + uint8_t nr = llc_header & 0x07; + snprintf(&llc[0], sizeof(llc), "I %d (%d)", ns, nr); + } else if ((llc_header & 0xE0) == 0xC0) { + // S + uint8_t t = (llc_header & 0x18) >> 3; + uint8_t nr = llc_header & 0x07; + char *type; + switch (t) { + case 0x00: type = "RR "; break; + case 0x01: type = "REJ"; break; + case 0x02: type = "RNR"; break; + case 0x03: type = "SREJ"; break; + default: type = "???"; break; + } + snprintf(&llc[0], sizeof(llc), "S %s (%d)", type, nr); + } else if ((llc_header & 0xE0) == 0xE0) { + // U + snprintf(&llc[0], sizeof(llc), "U"); + } else if (length > 1) { + snprintf(&llc[0], sizeof(llc), "???"); + } + } + + LOGD("> %s:%s\t%s", pString, print_buffer, llc); +} diff --git a/inc/phNfcConfig.h b/inc/phNfcConfig.h old mode 100755 new mode 100644 index 26386f7..f9b5587 --- a/inc/phNfcConfig.h +++ b/inc/phNfcConfig.h @@ -1,542 +1,542 @@ -/* - * Copyright (C) 2010 NXP Semiconductors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/** -* \file phNfcConfig.h -* \brief HAL Configurations -* -* -* \note This is the configuration header file of the HAL 4.0.All configurable parameters of the HAL 4.0 -* are provided in this file -* -* Project: NFC-FRI-1.1 / HAL4.0 -* -* $Date: Thu Sep 9 14:56:35 2010 $ -* $Author: ing04880 $ -* $Revision: 1.39 $ -* $Aliases: $ -* -*/ - - -/*@{*/ -#ifndef PHNFC_CONFIG_H -#define PHNFC_CONFIG_H -/*@}*/ - - -/** -* \name Hal -* -* File: \ref phNfcConfig.h -* -*/ - -/*@{*/ -#define PH_NFC_CONFIG_FILEREVISION "$Revision: 1.39 $" /**< \ingroup grp_file_attributes */ -#define PH_NFC_CONFIG_FILEALIASES "$Aliases: $" /**< \ingroup grp_file_attributes */ -/*@}*/ - - -/* -----------------Include files ---------------------------------------*/ - -#ifdef NFC_CUSTOM_CONFIG_INCLUDE -#include -#endif - -/* ---------------- Macros ----------------------------------------------*/ - - - -/* - ***************************************************************** - ********************** DEFAULT MACROS ************************** - ***************************************************************** - */ - - -/**< External Clock Request Configuration for the NFC Device, - 0x00U No Clock Request, - 0x01U Clock Request through CLKREQ pin (GPIO pin 2), - 0x02U Clock Request through NXP_EVT_CLK_REQUEST Event, - */ -#ifndef NXP_DEFAULT_CLK_REQUEST -#define NXP_DEFAULT_CLK_REQUEST 0x00U -#endif - -/**< External Input Clock Setting for the NFC Device, - 0x00U No Input Clock Required (Use the Xtal), - 0x01U 13 MHZ, - 0x02U 19.2 MHZ, - 0x03U 26 MHZ, - 0x04U 38.4 MHZ, - 0x05U Custom (Set the Custome Clock Registry), - */ - -#ifndef NXP_DEFAULT_INPUT_CLK -#define NXP_DEFAULT_INPUT_CLK 0x00U -#endif - -/**< UICC Power Request configuration for the NFC Device, - 0x00U No Power Request, - 0x01U Power Request through CLKREQ pin (GPIO pin 2), - 0x02U Power Request through PWR_REQUEST (GPIO Pin 3), - */ - -#ifndef NXP_UICC_PWR_REQUEST -#define NXP_UICC_PWR_REQUEST 0x00U -#endif - -/**< TX LDO Configuration - 0x00 00b 3.0 V, - 0x01 01b 3.0 V, - 0x02 10b 2.7 V, - 0x03 11b 3.3 V, - */ - -#ifndef NXP_DEFAULT_TX_LDO -#define NXP_DEFAULT_TX_LDO 0x00U -#endif - -/**< UICC Bit Rate Configuration - 0x02 212Kbits/Sec - 0x04 424Kbits/Sec - 0x08 828Kbits/Sec - */ - -#ifndef NXP_UICC_BIT_RATE -#define NXP_UICC_BIT_RATE 0x08U -#endif - - -/**< Indicates PN544 Power Modes Configuration for the NFC Device, +/* + * Copyright (C) 2010 NXP Semiconductors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** +* \file phNfcConfig.h +* \brief HAL Configurations +* +* +* \note This is the configuration header file of the HAL 4.0.All configurable parameters of the HAL 4.0 +* are provided in this file +* +* Project: NFC-FRI-1.1 / HAL4.0 +* +* $Date: Thu Sep 9 14:56:35 2010 $ +* $Author: ing04880 $ +* $Revision: 1.39 $ +* $Aliases: $ +* +*/ + + +/*@{*/ +#ifndef PHNFC_CONFIG_H +#define PHNFC_CONFIG_H +/*@}*/ + + +/** +* \name Hal +* +* File: \ref phNfcConfig.h +* +*/ + +/*@{*/ +#define PH_NFC_CONFIG_FILEREVISION "$Revision: 1.39 $" /**< \ingroup grp_file_attributes */ +#define PH_NFC_CONFIG_FILEALIASES "$Aliases: $" /**< \ingroup grp_file_attributes */ +/*@}*/ + + +/* -----------------Include files ---------------------------------------*/ + +#ifdef NFC_CUSTOM_CONFIG_INCLUDE +#include +#endif + +/* ---------------- Macros ----------------------------------------------*/ + + + +/* + ***************************************************************** + ********************** DEFAULT MACROS ************************** + ***************************************************************** + */ + + +/**< External Clock Request Configuration for the NFC Device, + 0x00U No Clock Request, + 0x01U Clock Request through CLKREQ pin (GPIO pin 2), + 0x02U Clock Request through NXP_EVT_CLK_REQUEST Event, + */ +#ifndef NXP_DEFAULT_CLK_REQUEST +#define NXP_DEFAULT_CLK_REQUEST 0x00U +#endif + +/**< External Input Clock Setting for the NFC Device, + 0x00U No Input Clock Required (Use the Xtal), + 0x01U 13 MHZ, + 0x02U 19.2 MHZ, + 0x03U 26 MHZ, + 0x04U 38.4 MHZ, + 0x05U Custom (Set the Custome Clock Registry), + */ + +#ifndef NXP_DEFAULT_INPUT_CLK +#define NXP_DEFAULT_INPUT_CLK 0x00U +#endif + +/**< UICC Power Request configuration for the NFC Device, + 0x00U No Power Request, + 0x01U Power Request through CLKREQ pin (GPIO pin 2), + 0x02U Power Request through PWR_REQUEST (GPIO Pin 3), + */ + +#ifndef NXP_UICC_PWR_REQUEST +#define NXP_UICC_PWR_REQUEST 0x00U +#endif + +/**< TX LDO Configuration + 0x00 00b 3.0 V, + 0x01 01b 3.0 V, + 0x02 10b 2.7 V, + 0x03 11b 3.3 V, + */ + +#ifndef NXP_DEFAULT_TX_LDO +#define NXP_DEFAULT_TX_LDO 0x00U +#endif + +/**< UICC Bit Rate Configuration + 0x02 212Kbits/Sec + 0x04 424Kbits/Sec + 0x08 828Kbits/Sec + */ + +#ifndef NXP_UICC_BIT_RATE +#define NXP_UICC_BIT_RATE 0x08U +#endif + + +/**< Indicates PN544 Power Modes Configuration for the NFC Device, 0x00U -> PN544 stays in active bat mode - (except when generating RF field) + (except when generating RF field) 0x01U -> PN544 goes in standby when possible otherwise - stays in active bat mode + stays in active bat mode 0x02U -> PN544 goes in idle mode as soon as it can - (otherwise it is in active bat except when generating RF field) + (otherwise it is in active bat except when generating RF field) 0x03U -> PN544 goes in standby when possible otherwise goes in idle mode as soon as it can (otherwise it is in active bat except when - generating RF field) - */ - -#ifndef NXP_SYSTEM_PWR_STATUS -#define NXP_SYSTEM_PWR_STATUS 0x01U -#endif - -/**< Default Session ID for Initialisation */ -#ifndef DEFAULT_SESSION + generating RF field) + */ + +#ifndef NXP_SYSTEM_PWR_STATUS +#define NXP_SYSTEM_PWR_STATUS 0x01U +#endif + +/**< Default Session ID for Initialisation */ +#ifndef DEFAULT_SESSION #define DEFAULT_SESSION "android8" -#endif - - -/* The Other Integration Configuration Values */ - -/**< Max number of remote devices supported */ - -#ifndef MAX_REMOTE_DEVICES +#endif + + +/* The Other Integration Configuration Values */ + +/**< Max number of remote devices supported */ + +#ifndef MAX_REMOTE_DEVICES #define MAX_REMOTE_DEVICES 0x0A -#endif - -/**< System Event Notification - 0x01 Overcurrent - 0x02 PMUVCC Switch - 0x04 External RF Field - 0x08 Memory Violation - 0x10 Temperature Overheat - */ - -#ifndef NXP_SYSTEM_EVT_INFO -#define NXP_SYSTEM_EVT_INFO 0x3DU -#endif - - -#ifndef NFC_DEV_HWCONF_DEFAULT -#define NFC_DEV_HWCONF_DEFAULT 0xBCU -#endif - - -#ifndef NXP_ISO_XCHG_TIMEOUT -#define NXP_ISO_XCHG_TIMEOUT 0x1AU -#endif - -#ifndef NXP_MIFARE_XCHG_TIMEOUT +#endif + +/**< System Event Notification + 0x01 Overcurrent + 0x02 PMUVCC Switch + 0x04 External RF Field + 0x08 Memory Violation + 0x10 Temperature Overheat + */ + +#ifndef NXP_SYSTEM_EVT_INFO +#define NXP_SYSTEM_EVT_INFO 0x3DU +#endif + + +#ifndef NFC_DEV_HWCONF_DEFAULT +#define NFC_DEV_HWCONF_DEFAULT 0xBCU +#endif + + +#ifndef NXP_ISO_XCHG_TIMEOUT +#define NXP_ISO_XCHG_TIMEOUT 0x1AU +#endif + +#ifndef NXP_MIFARE_XCHG_TIMEOUT #define NXP_MIFARE_XCHG_TIMEOUT 0x0BU -#endif - -#ifndef NXP_FELICA_XCHG_TIMEOUT -#define NXP_FELICA_XCHG_TIMEOUT 0xFFU -#endif - - -#ifndef NXP_NFCIP_PSL_BRS_DEFAULT -#define NXP_NFCIP_PSL_BRS_DEFAULT 0x00U -#endif - - - -/**< ID For Invalid Timer */ -#ifndef NXP_INVALID_TIMER_ID -#define NXP_INVALID_TIMER_ID 0xFFFFFFFFU -#endif - -/**< Presence check interval in milliseconds */ -#ifndef PRESENCE_CHECK_INTERVAL -#define PRESENCE_CHECK_INTERVAL 500U +#endif + +#ifndef NXP_FELICA_XCHG_TIMEOUT +#define NXP_FELICA_XCHG_TIMEOUT 0xFFU +#endif + + +#ifndef NXP_NFCIP_PSL_BRS_DEFAULT +#define NXP_NFCIP_PSL_BRS_DEFAULT 0x00U +#endif + + + +/**< ID For Invalid Timer */ +#ifndef NXP_INVALID_TIMER_ID +#define NXP_INVALID_TIMER_ID 0xFFFFFFFFU +#endif + +/**< Presence check interval in milliseconds */ +#ifndef PRESENCE_CHECK_INTERVAL +#define PRESENCE_CHECK_INTERVAL 500U #endif - + /** Resolution value for the timer, here the - timer resolution is 500 milliseconds */ -#ifndef TIMER_RESOLUTION -#define TIMER_RESOLUTION 500U + timer resolution is 500 milliseconds */ +#ifndef TIMER_RESOLUTION +#define TIMER_RESOLUTION 500U #endif - -/* Kindly note that the below Timeout values should be - * in Multiples of the value provided to TIMER_RESOLUTION - */ - + +/* Kindly note that the below Timeout values should be + * in Multiples of the value provided to TIMER_RESOLUTION + */ + /**< Defines guard time out value for LLC timer, - 1000 is in milliseconds */ -#ifndef LINK_GUARD_TIMEOUT -#define LINK_GUARD_TIMEOUT 1000U + 1000 is in milliseconds */ +#ifndef LINK_GUARD_TIMEOUT +#define LINK_GUARD_TIMEOUT 1000U #endif - - + + /**< Defines connection time out value for LLC timer, - 1000 is in milliseconds */ -#ifndef LINK_CONNECTION_TIMEOUT -#define LINK_CONNECTION_TIMEOUT 1000U + 1000 is in milliseconds */ +#ifndef LINK_CONNECTION_TIMEOUT +#define LINK_CONNECTION_TIMEOUT 1000U #endif /**< Defines ACK time out value for LLC timer, 150 is in milliseconds */ #ifndef LINK_ACK_TIMEOUT #define LINK_ACK_TIMEOUT 1U -#endif - - -/**< Defines Firmware Download Completion Timeout value , - 120000 is in milliseconds */ - - -#ifndef NXP_DNLD_COMPLETE_TIMEOUT +#endif + + +/**< Defines Firmware Download Completion Timeout value , + 120000 is in milliseconds */ + + +#ifndef NXP_DNLD_COMPLETE_TIMEOUT #define NXP_DNLD_COMPLETE_TIMEOUT 60000U -#endif - - +#endif + + /**< Define to configure the Active Mode Polling Guard Time-out - */ - -#ifndef DEV_MGMT_ACT_GRD_TO_DEFAULT -#define DEV_MGMT_ACT_GRD_TO_DEFAULT 0x20U -#endif - -/**< NFCIP Active Mode Default Configuration (when acting as Target) - 0x01 106 kbps - 0x02 212 kbps - 0x04 424 kbps - */ - -#ifndef NXP_NFCIP_ACTIVE_DEFAULT -#define NXP_NFCIP_ACTIVE_DEFAULT 0x01U -#endif - - - - -#ifndef NXP_NFC_HCI_TIMER -#define NXP_NFC_HCI_TIMER 1 -#define NXP_NFC_HCI_TIMEOUT 6000 -#endif - - -/* - ***************************************************************** - DO NOT MODIFY THE BELOW MACROS UNLESS OTHERWISE MENTIONED - ***************************************************************** - */ - - - -#ifndef HOST_CE_A_SAK_DEFAULT -#define HOST_CE_A_SAK_DEFAULT 0x20U + */ + +#ifndef DEV_MGMT_ACT_GRD_TO_DEFAULT +#define DEV_MGMT_ACT_GRD_TO_DEFAULT 0x20U +#endif + +/**< NFCIP Active Mode Default Configuration (when acting as Target) + 0x01 106 kbps + 0x02 212 kbps + 0x04 424 kbps + */ + +#ifndef NXP_NFCIP_ACTIVE_DEFAULT +#define NXP_NFCIP_ACTIVE_DEFAULT 0x01U +#endif + + + + +#ifndef NXP_NFC_HCI_TIMER +#define NXP_NFC_HCI_TIMER 1 +#define NXP_NFC_HCI_TIMEOUT 6000 +#endif + + +/* + ***************************************************************** + DO NOT MODIFY THE BELOW MACROS UNLESS OTHERWISE MENTIONED + ***************************************************************** + */ + + + +#ifndef HOST_CE_A_SAK_DEFAULT +#define HOST_CE_A_SAK_DEFAULT 0x20U #endif - -#ifndef NXP_CE_A_ATQA_HIGH -#define NXP_CE_A_ATQA_HIGH 0x00U -#endif - -#ifndef NXP_CE_A_ATQA_LOW -#define NXP_CE_A_ATQA_LOW 0x04U -#endif - - -#ifndef NXP_UICC_CE_RIGHTS -#define NXP_UICC_CE_RIGHTS 0x0FU + +#ifndef NXP_CE_A_ATQA_HIGH +#define NXP_CE_A_ATQA_HIGH 0x00U +#endif + +#ifndef NXP_CE_A_ATQA_LOW +#define NXP_CE_A_ATQA_LOW 0x04U +#endif + + +#ifndef NXP_UICC_CE_RIGHTS +#define NXP_UICC_CE_RIGHTS 0x0FU #endif - -#ifndef NXP_UICC_RD_RIGHTS -#define NXP_UICC_RD_RIGHTS 0x00U + +#ifndef NXP_UICC_RD_RIGHTS +#define NXP_UICC_RD_RIGHTS 0x00U #endif - - -/* - ***************************************************************** - DO NOT DISABLE/ENABLE BELOW MACROS UNLESS OTHERWISE MENTIONED - ***************************************************************** - */ - -#define ES_HW_VER 32 + + +/* + ***************************************************************** + DO NOT DISABLE/ENABLE BELOW MACROS UNLESS OTHERWISE MENTIONED + ***************************************************************** + */ + +#define ES_HW_VER 32 -/* - ***************************************************************** - *************** FEATURE SPECIFIC MACROS ************************* - ***************************************************************** - */ - - - -/**< Macro to Enable SMX Feature During - * Initialisation */ - -#if !defined(NXP_SMX) +/* + ***************************************************************** + *************** FEATURE SPECIFIC MACROS ************************* + ***************************************************************** + */ + + + +/**< Macro to Enable SMX Feature During + * Initialisation */ + +#if !defined(NXP_SMX) #define NXP_SMX 1 -#endif - -#if (NXP_SMX == 1) +#endif + +#if (NXP_SMX == 1) #define NXP_HAL_ENABLE_SMX -#endif - -/**< Macro to Enable the Host Session - * Initialisation */ -#define ESTABLISH_SESSION - -/**< Macro to Enable the Peer to Peer Feature */ -#define ENABLE_P2P - +#endif + +/**< Macro to Enable the Host Session + * Initialisation */ +#define ESTABLISH_SESSION + +/**< Macro to Enable the Peer to Peer Feature */ +#define ENABLE_P2P + #define DEFAULT_NFCIP_INITIATOR_MODE_SUPPORT 0x3FU #define DEFAULT_NFCIP_TARGET_MODE_SUPPORT 0x0FU - -/**< Macro to Enable the ISO14443-B Feature */ -#define TYPE_B - -/**< Macro to Enable the Felica Feature */ -#define TYPE_FELICA - -/**< Macro to Enable the JEWEL Feature */ -#define TYPE_JEWEL - -/**< Macro to Enable the ISO15693 Feature */ -#define TYPE_ISO15693 - -/*< Macro to Verify the Poll Parameters Set */ -/* #define ENABLE_VERIFY_PARAM */ - -/**< Macro to Enable ISO 18092 Protocol compliancy - * SAK to be merged with the TYPE A Card RF Feature :3.1*/ -#define TGT_MERGE_SAK - - -/**< Macro to Configure the default power status - * to allow the PN544 to enter into the Standby */ -#define CFG_PWR_STATUS - - -/**< Macro to Enable the SWP Protocol - * to detect UICC During Initialisation */ -#define ENABLE_UICC - -/**< Macro to Enable the RAW Mode of Transaction - * for the ISO-14443-3A Compliant Targets */ -#define ENABLE_MIFARE_RAW - -/**< Macro to Enable the HOST List - * to allow the UICC Communication */ -#define HOST_WHITELIST - -/**< Support reconnecting to a different handle on the same tag */ -#define RECONNECT_SUPPORT - -/**< Macro to Enable the Card Emulation Feature */ -/* #define HOST_EMULATION */ - -#define NXP_HAL_VERIFY_EEPROM_CRC 0x01U - -/**< Macro to Enable the Download Mode Feature */ -#define FW_DOWNLOAD - -/**< Macro to Enable the Firmware Download Timer */ -/* 0x01U to use overall timeout */ -/* 0x02U to use per frame timeout */ -#define FW_DOWNLOAD_TIMER 0x02U - -/**< Macro to Verify the Firmware Download */ -/* #define FW_DOWNLOAD_VERIFY */ - -#ifndef FW_DOWNLOAD_VERIFY -#define NXP_FW_INTEGRITY_CHK 1 -#endif - -/* To specify the Maximum TX/RX Len */ -#define NXP_FW_MAX_TX_RX_LEN 0x200 - -#define UICC_CONNECTIVITY_PATCH - -/* Work around to Delay the initiator activation */ -/* #define NXP_NFCIP_ACTIVATE_DELAY */ - -/* Work around to Release the Discovered Target */ -#define SW_RELEASE_TARGET - -/* Macro to Allow the HCI Release in any state */ -#define NXP_HCI_SHUTDOWN_OVERRIDE - - -/* Macro to Enable The P2P Transaction Timers */ -#define P2P_TGT_TRANSACT_TIMER - -#if (ES_HW_VER == 32) -/* Macro to Configure the Target Disable Register */ -#define NFCIP_TGT_DISABLE_CFG - -#endif - -/*< Macro to Disable the Felica Mapping */ -/* #define DISABLE_FELICA_MAPPING */ - -/*< Macro to Disable the Felica Mapping */ -/* #define DISABLE_JEWEL_MAPPING */ - -/**< Macro to enable LLC timer */ -#define LLC_TIMER_ENABLE - -/**< Macro to enable HCI Response timer */ + +/**< Macro to Enable the ISO14443-B Feature */ +#define TYPE_B + +/**< Macro to Enable the Felica Feature */ +#define TYPE_FELICA + +/**< Macro to Enable the JEWEL Feature */ +#define TYPE_JEWEL + +/**< Macro to Enable the ISO15693 Feature */ +#define TYPE_ISO15693 + +/*< Macro to Verify the Poll Parameters Set */ +/* #define ENABLE_VERIFY_PARAM */ + +/**< Macro to Enable ISO 18092 Protocol compliancy + * SAK to be merged with the TYPE A Card RF Feature :3.1*/ +#define TGT_MERGE_SAK + + +/**< Macro to Configure the default power status + * to allow the PN544 to enter into the Standby */ +#define CFG_PWR_STATUS + + +/**< Macro to Enable the SWP Protocol + * to detect UICC During Initialisation */ +#define ENABLE_UICC + +/**< Macro to Enable the RAW Mode of Transaction + * for the ISO-14443-3A Compliant Targets */ +#define ENABLE_MIFARE_RAW + +/**< Macro to Enable the HOST List + * to allow the UICC Communication */ +#define HOST_WHITELIST + +/**< Support reconnecting to a different handle on the same tag */ +#define RECONNECT_SUPPORT + +/**< Macro to Enable the Card Emulation Feature */ +/* #define HOST_EMULATION */ + +#define NXP_HAL_VERIFY_EEPROM_CRC 0x01U + +/**< Macro to Enable the Download Mode Feature */ +#define FW_DOWNLOAD + +/**< Macro to Enable the Firmware Download Timer */ +/* 0x01U to use overall timeout */ +/* 0x02U to use per frame timeout */ +#define FW_DOWNLOAD_TIMER 0x02U + +/**< Macro to Verify the Firmware Download */ +/* #define FW_DOWNLOAD_VERIFY */ + +#ifndef FW_DOWNLOAD_VERIFY +#define NXP_FW_INTEGRITY_CHK 1 +#endif + +/* To specify the Maximum TX/RX Len */ +#define NXP_FW_MAX_TX_RX_LEN 0x200 + +#define UICC_CONNECTIVITY_PATCH + +/* Work around to Delay the initiator activation */ +/* #define NXP_NFCIP_ACTIVATE_DELAY */ + +/* Work around to Release the Discovered Target */ +#define SW_RELEASE_TARGET + +/* Macro to Allow the HCI Release in any state */ +#define NXP_HCI_SHUTDOWN_OVERRIDE + + +/* Macro to Enable The P2P Transaction Timers */ +#define P2P_TGT_TRANSACT_TIMER + +#if (ES_HW_VER == 32) +/* Macro to Configure the Target Disable Register */ +#define NFCIP_TGT_DISABLE_CFG + +#endif + +/*< Macro to Disable the Felica Mapping */ +/* #define DISABLE_FELICA_MAPPING */ + +/*< Macro to Disable the Felica Mapping */ +/* #define DISABLE_JEWEL_MAPPING */ + +/**< Macro to enable LLC timer */ +#define LLC_TIMER_ENABLE + +/**< Macro to enable HCI Response timer */ #define NXP_NFC_HCI_TIMER 1 - -/* A Workaround to Delay and obtain the UICC Status Information */ -/* #define UICC_STATUS_DELAY */ - -#ifdef UICC_STATUS_DELAY -#define UICC_STATUS_DELAY_COUNT 0x00100000 -#endif - -/**< Macro to delay the LLC RESET response callback, - Value is in milli-seconds */ -#define LLC_RESET_DELAY 10 - -/* Macro to Enable the workaround for Tuning of - * RF for TYPE B and F - */ -/* #define SW_TYPE_RF_TUNING_BF */ - -/* Workaround to update the Active Guard Timeout */ -/* #define MAX_ACTIVATE_TIMEOUT */ - -/* #define ONE_BYTE_LEN */ - -#define NFC_RF_NOISE_SW - -/**< Define to configure the PMOS Modulation Index value - */ - -#ifndef NFC_DEV_PMOS_MOD_DEFAULT -/* 0x3F -> 6%, 0x3A -> 10%, 0x3C -> 10%, 0x35 -> 15.8%, 0x28 -> 25.8% */ -#define NFC_DEV_PMOS_MOD_DEFAULT 0x3CU -#endif - - -#ifndef SW_TYPE_RF_TUNING_BF -#define SW_TYPE_RF_TUNING_BF 0x80U -#endif - - -/* Reset the Default values of Host Link Timers */ -/* Macro to Enable the Host Side Link Timeout Configuration - * 0x00 ----> Default Pre-defined Configuration; - * 0x01 ----> Update only the Host Link Guard Timeout Configuration; - * 0x03 ----> Update Both the Host Link Guard Timeout - and ACK Timeout Configuration; - */ - -#ifndef HOST_LINK_TIMEOUT -#define HOST_LINK_TIMEOUT 0x00U -#endif - - -#ifndef NXP_NFC_LINK_GRD_CFG_DEFAULT -#define NXP_NFC_LINK_GRD_CFG_DEFAULT 0x0032U -#endif - -#ifndef NXP_NFC_LINK_ACK_CFG_DEFAULT -#define NXP_NFC_LINK_ACK_CFG_DEFAULT 0x0005U -#endif - -/* Macro to Enable the Interface Character Timeout Configuration - * 0x00 ----> Default Pre-defined Configuration; - * 0x01 ----> Update the IFC Timeout Default Configuration; - */ - -#ifndef NXP_NFC_IFC_TIMEOUT -#define NXP_NFC_IFC_TIMEOUT 0x00 -#endif - - -#ifndef NXP_NFC_IFC_CONFIG_DEFAULT -#define NXP_NFC_IFC_CONFIG_DEFAULT 0x203AU -#endif - -#ifndef NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT -#define NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT 0x00 -#endif - -/* - ***************************************************************** - *********** MACROS ENABLE EEPROM REGISTER WRITE **************** - ***************************************************************** - */ - - -/* Enable this to Disable the WI Notification */ -/* #define DISABLE_WI_NOTIFICATION */ - -/* Macro to Enable the Configuration of Initiator - * speed during Discovery configuration - */ -#define INITIATOR_SPEED - - -/**/ -/* #define UICC_SESSION_RESET */ - -/* Macro to Enable the Configuration of UICC - * Timer and Bitrate during Initialisation - */ - - - - -/* -----------------Structures and Enumerations -------------------------*/ - - - - -/* -----------------Exported Functions----------------------------------*/ - - -#endif /*PHNFC_CONFIG_H*/ - + +/* A Workaround to Delay and obtain the UICC Status Information */ +/* #define UICC_STATUS_DELAY */ + +#ifdef UICC_STATUS_DELAY +#define UICC_STATUS_DELAY_COUNT 0x00100000 +#endif + +/**< Macro to delay the LLC RESET response callback, + Value is in milli-seconds */ +#define LLC_RESET_DELAY 10 + +/* Macro to Enable the workaround for Tuning of + * RF for TYPE B and F + */ +/* #define SW_TYPE_RF_TUNING_BF */ + +/* Workaround to update the Active Guard Timeout */ +/* #define MAX_ACTIVATE_TIMEOUT */ + +/* #define ONE_BYTE_LEN */ + +#define NFC_RF_NOISE_SW + +/**< Define to configure the PMOS Modulation Index value + */ + +#ifndef NFC_DEV_PMOS_MOD_DEFAULT +/* 0x3F -> 6%, 0x3A -> 10%, 0x3C -> 10%, 0x35 -> 15.8%, 0x28 -> 25.8% */ +#define NFC_DEV_PMOS_MOD_DEFAULT 0x3CU +#endif + + +#ifndef SW_TYPE_RF_TUNING_BF +#define SW_TYPE_RF_TUNING_BF 0x80U +#endif + + +/* Reset the Default values of Host Link Timers */ +/* Macro to Enable the Host Side Link Timeout Configuration + * 0x00 ----> Default Pre-defined Configuration; + * 0x01 ----> Update only the Host Link Guard Timeout Configuration; + * 0x03 ----> Update Both the Host Link Guard Timeout + and ACK Timeout Configuration; + */ + +#ifndef HOST_LINK_TIMEOUT +#define HOST_LINK_TIMEOUT 0x00U +#endif + + +#ifndef NXP_NFC_LINK_GRD_CFG_DEFAULT +#define NXP_NFC_LINK_GRD_CFG_DEFAULT 0x0032U +#endif + +#ifndef NXP_NFC_LINK_ACK_CFG_DEFAULT +#define NXP_NFC_LINK_ACK_CFG_DEFAULT 0x0005U +#endif + +/* Macro to Enable the Interface Character Timeout Configuration + * 0x00 ----> Default Pre-defined Configuration; + * 0x01 ----> Update the IFC Timeout Default Configuration; + */ + +#ifndef NXP_NFC_IFC_TIMEOUT +#define NXP_NFC_IFC_TIMEOUT 0x00 +#endif + + +#ifndef NXP_NFC_IFC_CONFIG_DEFAULT +#define NXP_NFC_IFC_CONFIG_DEFAULT 0x203AU +#endif + +#ifndef NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT +#define NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT 0x00 +#endif + +/* + ***************************************************************** + *********** MACROS ENABLE EEPROM REGISTER WRITE **************** + ***************************************************************** + */ + + +/* Enable this to Disable the WI Notification */ +/* #define DISABLE_WI_NOTIFICATION */ + +/* Macro to Enable the Configuration of Initiator + * speed during Discovery configuration + */ +#define INITIATOR_SPEED + + +/**/ +/* #define UICC_SESSION_RESET */ + +/* Macro to Enable the Configuration of UICC + * Timer and Bitrate during Initialisation + */ + + + + +/* -----------------Structures and Enumerations -------------------------*/ + + + + +/* -----------------Exported Functions----------------------------------*/ + + +#endif /*PHNFC_CONFIG_H*/ + diff --git a/inc/phNfcTypes.h b/inc/phNfcTypes.h old mode 100755 new mode 100644 index fe83f3b..93145cb --- a/inc/phNfcTypes.h +++ b/inc/phNfcTypes.h @@ -1,1124 +1,1108 @@ -/* - * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * \file phNfcTypes.h - * \brief Basic type definitions. - * - * Project: NFC MW / HAL - * - * $Date: Thu Jun 25 21:24:53 2009 $ - * $Author: ing04880 $ - * $Revision: 1.13 $ - * $Aliases: NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $ - * - */ - -#ifndef PHNFCTYPES /* */ -#define PHNFCTYPES /* */ - -/** - * \name NFC Types - * - * File: \ref phNfcTypes.h - * - */ -/*@{*/ -#define PHNFCTYPES_FILEREVISION "$Revision: 1.13 $" /**< \ingroup grp_file_attributes */ -#define PHNFCTYPES_FILEALIASES "$Aliases: NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */ -/*@}*/ - -#ifndef _WIN32 -#include -#else -#include -#include -#define snprintf _snprintf - -#ifndef linux -/** - * \name Basic Type Definitions - * - * Constant-length-type definition ('C99). - * - */ -/*@{*/ -#ifndef __int8_t_defined /* */ -#define __int8_t_defined /* */ -typedef signed char int8_t; /**< \ingroup grp_nfc_common - 8 bit signed integer */ -#endif - -#ifndef __int16_t_defined /* */ -#define __int16_t_defined /* */ -typedef signed short int16_t; /**< \ingroup grp_nfc_common - 16 bit signed integer */ -#endif - -#ifndef __stdint_h -#ifndef __int32_t_defined /* */ -#define __int32_t_defined /* */ -typedef signed long int32_t; /**< \ingroup grp_nfc_common - 32 bit signed integer */ -#endif -#endif - -#ifndef __uint8_t_defined /* */ -#define __uint8_t_defined /* */ -typedef unsigned char uint8_t; /**< \ingroup grp_nfc_common - 8 bit unsigned integer */ -#endif - -#ifndef __uint16_t_defined /* */ -#define __uint16_t_defined /* */ -typedef unsigned short uint16_t; /**< \ingroup grp_nfc_common - 16 bit unsigned integer */ -#endif - -#ifndef __stdint_h -#ifndef __uint32_t_defined /* */ -#define __uint32_t_defined /* */ -typedef unsigned long uint32_t; /**< \ingroup grp_nfc_common - 32 bit unsigned integer */ -#endif -#endif - -#endif /* linux */ - -#endif /* _WIN32 */ - -#ifndef TRUE -#define TRUE (0x01) /**< \ingroup grp_nfc_common - Logical True Value */ -#endif - -#ifndef FALSE -#define FALSE (0x00) /**< \ingroup grp_nfc_common - Logical False Value */ -#endif - -typedef uint8_t utf8_t; /**< \ingroup grp_nfc_common - UTF8 Character String */ - -typedef uint8_t bool_t; /**< \ingroup grp_nfc_common - boolean data type */ - -typedef uint16_t NFCSTATUS; /**< \ingroup grp_nfc_common +/* + * Copyright (C) 2010 NXP Semiconductors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * \file phNfcTypes.h + * \brief Basic type definitions. + * + * Project: NFC MW / HAL + * + * $Date: Thu Jun 25 21:24:53 2009 $ + * $Author: ing04880 $ + * $Revision: 1.13 $ + * $Aliases: NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $ + * + */ + +#ifndef PHNFCTYPES /* */ +#define PHNFCTYPES /* */ + +/** + * \name NFC Types + * + * File: \ref phNfcTypes.h + * + */ +/*@{*/ +#define PHNFCTYPES_FILEREVISION "$Revision: 1.13 $" /**< \ingroup grp_file_attributes */ +#define PHNFCTYPES_FILEALIASES "$Aliases: NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */ +/*@}*/ + +#ifndef _WIN32 +#include +#else +#include +#include +#define snprintf _snprintf + +#ifndef linux +/** + * \name Basic Type Definitions + * + * Constant-length-type definition ('C99). + * + */ +/*@{*/ +#ifndef __int8_t_defined /* */ +#define __int8_t_defined /* */ +typedef signed char int8_t; /**< \ingroup grp_nfc_common + 8 bit signed integer */ +#endif + +#ifndef __int16_t_defined /* */ +#define __int16_t_defined /* */ +typedef signed short int16_t; /**< \ingroup grp_nfc_common + 16 bit signed integer */ +#endif + +#ifndef __stdint_h +#ifndef __int32_t_defined /* */ +#define __int32_t_defined /* */ +typedef signed long int32_t; /**< \ingroup grp_nfc_common + 32 bit signed integer */ +#endif +#endif + +#ifndef __uint8_t_defined /* */ +#define __uint8_t_defined /* */ +typedef unsigned char uint8_t; /**< \ingroup grp_nfc_common + 8 bit unsigned integer */ +#endif + +#ifndef __uint16_t_defined /* */ +#define __uint16_t_defined /* */ +typedef unsigned short uint16_t; /**< \ingroup grp_nfc_common + 16 bit unsigned integer */ +#endif + +#ifndef __stdint_h +#ifndef __uint32_t_defined /* */ +#define __uint32_t_defined /* */ +typedef unsigned long uint32_t; /**< \ingroup grp_nfc_common + 32 bit unsigned integer */ +#endif +#endif + +#endif /* linux */ + +#endif /* _WIN32 */ + +#ifndef TRUE +#define TRUE (0x01) /**< \ingroup grp_nfc_common + Logical True Value */ +#endif + +#ifndef FALSE +#define FALSE (0x00) /**< \ingroup grp_nfc_common + Logical False Value */ +#endif + +typedef uint8_t utf8_t; /**< \ingroup grp_nfc_common + UTF8 Character String */ + +typedef uint8_t bool_t; /**< \ingroup grp_nfc_common + boolean data type */ + +typedef uint16_t NFCSTATUS; /**< \ingroup grp_nfc_common NFC return values - \ref phNfcStatus.h for different status - values */ - -#ifndef NULL -#define NULL ((void *)0) -#endif - -/* This Macro to be used to resolve Unused and unreference + \ref phNfcStatus.h for different status + values */ + +#ifndef NULL +#define NULL ((void *)0) +#endif + +/* This Macro to be used to resolve Unused and unreference * compiler warnings. - */ - -#define PHNFC_UNUSED_VARIABLE(x) for((x)=(x);(x)!=(x);) - -/*@}*/ - -/** - * - * \name HAL Overall Definitions - * - * Definitions applicable to a variety of purposes and functions/features. - * - */ - /*@{*/ - -#define PHHAL_COMMON_MAX_STRING_LENGTH 0x40U /**< \ingroup grp_hal_common - Maximum vendor name length in bytes. */ -#define PHHAL_UNKNOWN_DEVICE_TYPE 0x00U /**< \ingroup grp_hal_common - Unknown device type. */ -#define PHHAL_SERIAL_DEVICE 0x01U /**< \ingroup grp_hal_common - Serial device type. */ -#define PHHAL_USB_DEVICE 0x02U /**< \ingroup grp_hal_common - USB device type. */ -#define PHHAL_I2C_DEVICE 0x03U /**< \ingroup grp_hal_common - I2C device type. */ -#define PHHAL_SPI_DEVICE 0x04U /**< \ingroup grp_hal_common - SPI device type. */ -#define PHHAL_PARALLEL_DEVICE 0x05U /**< \ingroup grp_hal_common - Parallel device type. */ -#define PHHAL_NFCID_LENGTH 0x0AU /**< \ingroup grp_hal_common - Maximum length of NFCID 1..3. */ - -#define PHHAL_MAX_DATASIZE 0xFBU /* 256 * Maximum Data size sent - * by the HAL - */ - -#define PHHAL_ATQA_LENGTH 0x02U /**< ATQA length */ -#define PHHAL_MAX_UID_LENGTH 0x0AU /**< Maximum UID length expected */ + */ + +#define PHNFC_UNUSED_VARIABLE(x) for((x)=(x);(x)!=(x);) + +/*@}*/ + +/** + * + * \name HAL Overall Definitions + * + * Definitions applicable to a variety of purposes and functions/features. + * + */ + /*@{*/ + +#define PHHAL_COMMON_MAX_STRING_LENGTH 0x40U /**< \ingroup grp_hal_common + Maximum vendor name length in bytes. */ +#define PHHAL_UNKNOWN_DEVICE_TYPE 0x00U /**< \ingroup grp_hal_common + Unknown device type. */ +#define PHHAL_SERIAL_DEVICE 0x01U /**< \ingroup grp_hal_common + Serial device type. */ +#define PHHAL_USB_DEVICE 0x02U /**< \ingroup grp_hal_common + USB device type. */ +#define PHHAL_I2C_DEVICE 0x03U /**< \ingroup grp_hal_common + I2C device type. */ +#define PHHAL_SPI_DEVICE 0x04U /**< \ingroup grp_hal_common + SPI device type. */ +#define PHHAL_PARALLEL_DEVICE 0x05U /**< \ingroup grp_hal_common + Parallel device type. */ +#define PHHAL_NFCID_LENGTH 0x0AU /**< \ingroup grp_hal_common + Maximum length of NFCID 1..3. */ + +#define PHHAL_MAX_DATASIZE 0xFBU /* 256 * Maximum Data size sent + * by the HAL + */ + +#define PHHAL_ATQA_LENGTH 0x02U /**< ATQA length */ +#define PHHAL_MAX_UID_LENGTH 0x0AU /**< Maximum UID length expected */ #define PHHAL_MAX_ATR_LENGTH 0x30U /**< Maximum ATR_RES (General Bytes) - * length expected */ - -#define PHHAL_ATQB_LENGTH 0x0BU /**< ATQB length */ - -#define PHHAL_PUPI_LENGTH 0x04U /**< PUPI length */ -#define PHHAL_APP_DATA_B_LENGTH 0x04U /**< Application Data length for Type B */ -#define PHHAL_PROT_INFO_B_LENGTH 0x03U /**< Protocol info length for Type B */ -#define PHHAL_FEL_SYS_CODE_LEN 0x02U /**< Felica System Code Length */ -#define PHHAL_FEL_ID_LEN 0x08U /**< Felica current ID Length */ -#define PHHAL_FEL_PM_LEN 0x08U /**< Felica current PM Length */ -#define PHHAL_15693_UID_LENGTH 0x08U /**< Length of the Inventory bytes for - ISO15693 Tag */ - -#define VENDOR_NAME_LEN 0x14U + * length expected */ + +#define PHHAL_ATQB_LENGTH 0x0BU /**< ATQB length */ + +#define PHHAL_PUPI_LENGTH 0x04U /**< PUPI length */ +#define PHHAL_APP_DATA_B_LENGTH 0x04U /**< Application Data length for Type B */ +#define PHHAL_PROT_INFO_B_LENGTH 0x03U /**< Protocol info length for Type B */ +#define PHHAL_FEL_SYS_CODE_LEN 0x02U /**< Felica System Code Length */ +#define PHHAL_FEL_ID_LEN 0x08U /**< Felica current ID Length */ +#define PHHAL_FEL_PM_LEN 0x08U /**< Felica current PM Length */ +#define PHHAL_15693_UID_LENGTH 0x08U /**< Length of the Inventory bytes for + ISO15693 Tag */ + +#define VENDOR_NAME_LEN 0x14U #define MAX_TRANSFER_UNIT 0x21U -#define SESSIONID_SIZE 0x08U -#define MAX_AID_LEN 0x10U -#define MAX_UICC_PARAM_LEN 0xFFU - -#define MIFARE_BITMASK 0x08U -#define ISO_14443_BITMASK 0x20U -#define ISO_14443_DETECTED 0x20U -#define NFCIP_BITMASK 0x40U -#define NFCIP_DETECTED 0x40U - -#define MAX_TARGET_SUPPORTED MAX_REMOTE_DEVICES - -#define NFC_HW_PN65N 0x10U - -#define NXP_NFCIP_NFCID2_ID 0x01FEU - -#define NXP_FULL_VERSION_LEN 0x0BU - - -/*@}*/ - - -/** - * \name NFC specific Type Definitions - * - */ -/*@{*/ - -/** - * Data Buffer Structure to hold the Data Buffer - * +#define SESSIONID_SIZE 0x08U +#define MAX_AID_LEN 0x10U +#define MAX_UICC_PARAM_LEN 0xFFU + +#define MIFARE_BITMASK 0x08U +#define ISO_14443_BITMASK 0x20U +#define ISO_14443_DETECTED 0x20U +#define NFCIP_BITMASK 0x40U +#define NFCIP_DETECTED 0x40U + +#define MAX_TARGET_SUPPORTED MAX_REMOTE_DEVICES + +#define NFC_HW_PN65N 0x10U + +#define NXP_NFCIP_NFCID2_ID 0x01FEU + +#define NXP_FULL_VERSION_LEN 0x0BU + + +/*@}*/ + + +/** + * \name NFC specific Type Definitions + * + */ +/*@{*/ + +/** + * Data Buffer Structure to hold the Data Buffer + * * This structure holds the Data in the Buffer of the specified - * size. + * size. * - */ -typedef struct phNfc_sData_t -{ - uint8_t *buffer; - uint32_t length; -} phNfc_sData_t; - - -/** - *\brief Possible Hardware Configuration exposed to upper layer. - * Typically this should be port name (Ex:"COM1","COM2") to which PN544 is connected. - */ -typedef enum -{ - ENUM_LINK_TYPE_UART, - ENUM_LINK_TYPE_I2C, - ENUM_LINK_TYPE_USB, - ENUM_LINK_TYPE_TCP, - - ENUM_LINK_TYPE_NB, -} phLibNfc_eConfigLinkType; - -/** - * \brief Possible Hardware Configuration exposed to upper layer. - * Typically this should be at least the communication link (Ex:"COM1","COM2") - * the controller is connected to. + */ +typedef struct phNfc_sData_t +{ + uint8_t *buffer; + uint32_t length; +} phNfc_sData_t; + +/** + * \brief Possible Hardware Configuration exposed to upper layer. + * Typically this should be at least the communication link (Ex:"COM1","COM2") + * the controller is connected to. */ -typedef struct phLibNfc_sConfig_t -{ - /** Device node of the controller */ - const char* deviceNode; - /** The client ID (thread ID or message queue ID) */ - unsigned int nClientId; -} phLibNfc_sConfig_t, *pphLibNfc_sConfig_t; - - -/*! - * NFC Message structure contains message specific details like - * message type, message specific data block details, etc. - */ -typedef struct phLibNfc_Message_t -{ - uint32_t eMsgType;/**< Type of the message to be posted*/ - void * pMsgData;/**< Pointer to message specific data block in case any*/ - uint32_t Size;/**< Size of the datablock*/ -} phLibNfc_Message_t,*pphLibNfc_Message_t; - - -#ifdef WIN32 -#define PH_LIBNFC_MESSAGE_BASE (WM_USER+0x3FF) -#endif -/** - * Deferred message. This message type will be posted to the client application thread - * to notify that a deferred call must be invoked. - */ -#define PH_LIBNFC_DEFERREDCALL_MSG (0x311) - -/** - *\brief Deferred call declaration. +typedef struct phLibNfc_sConfig_t +{ + /** Device node of the controller */ + const char* deviceNode; + /** The client ID (thread ID or message queue ID) */ + unsigned int nClientId; +} phLibNfc_sConfig_t, *pphLibNfc_sConfig_t; + + +/*! + * NFC Message structure contains message specific details like + * message type, message specific data block details, etc. + */ +typedef struct phLibNfc_Message_t +{ + uint32_t eMsgType;/**< Type of the message to be posted*/ + void * pMsgData;/**< Pointer to message specific data block in case any*/ + uint32_t Size;/**< Size of the datablock*/ +} phLibNfc_Message_t,*pphLibNfc_Message_t; + + +#ifdef WIN32 +#define PH_LIBNFC_MESSAGE_BASE (WM_USER+0x3FF) +#endif +/** + * Deferred message. This message type will be posted to the client application thread + * to notify that a deferred call must be invoked. + */ +#define PH_LIBNFC_DEFERREDCALL_MSG (0x311) + +/** + *\brief Deferred call declaration. * This type of API is called from ClientApplication ( main thread) to notify - * specific callback. - */ -typedef void (*pphLibNfc_DeferredCallback_t) (void*); -/** - *\brief Deferred parameter declaration. + * specific callback. + */ +typedef void (*pphLibNfc_DeferredCallback_t) (void*); +/** + *\brief Deferred parameter declaration. * This type of data is passed as parameter from ClientApplication (main thread) to the - * callback. - */ -typedef void *pphLibNfc_DeferredParameter_t; -/** - *\brief Deferred message specific info declaration. + * callback. + */ +typedef void *pphLibNfc_DeferredParameter_t; +/** + *\brief Deferred message specific info declaration. * This type of information is packed as message data when \ref PH_LIBNFC_DEFERREDCALL_MSG - * type message is posted to message handler thread. + * type message is posted to message handler thread. */ -typedef struct phLibNfc_DeferredCall_t -{ - pphLibNfc_DeferredCallback_t pCallback;/**< pointer to Deferred callback */ - pphLibNfc_DeferredParameter_t pParameter;/**< pointer to Deferred parameter */ -} phLibNfc_DeferredCall_t; - - -/** \ingroup grp_hal_common - * - * \brief Protocol Support Information - * - * The Supported Protocols Structure holds all protocol supported by the current NFC - * device. - * - * \note All members of this structure are output parameters [out]. - * - */ -typedef struct phNfc_sSupProtocol_t -{ +typedef struct phLibNfc_DeferredCall_t +{ + pphLibNfc_DeferredCallback_t pCallback;/**< pointer to Deferred callback */ + pphLibNfc_DeferredParameter_t pParameter;/**< pointer to Deferred parameter */ +} phLibNfc_DeferredCall_t; + + +/** \ingroup grp_hal_common + * + * \brief Protocol Support Information + * + * The Supported Protocols Structure holds all protocol supported by the current NFC + * device. + * + * \note All members of this structure are output parameters [out]. + * + */ +typedef struct phNfc_sSupProtocol_t +{ unsigned int MifareUL : 1; /**< Protocol Mifare Ultra Light or - any NFC Forum Type-2 tags */ - unsigned int MifareStd : 1; /**< Protocol Mifare Standard. */ - unsigned int ISO14443_4A : 1; /**< Protocol ISO14443-4 Type A. */ - unsigned int ISO14443_4B : 1; /**< Protocol ISO14443-4 Type B. */ - unsigned int ISO15693 : 1; /**< Protocol ISO15693 HiTag. */ - unsigned int Felica : 1; /**< Protocol Felica. */ - unsigned int NFC : 1; /**< Protocol NFC. */ - unsigned int Jewel : 1; /**< Protocol Innovision Jewel Tag. */ - /*** TODO: Add SWP, ETSI HCI to this list **/ -} phNfc_sSupProtocol_t; - - -/** \ingroup grp_hal_common - * - * - * \brief Information related to the NFC Device - * - * The Device Information Structure holds information + any NFC Forum Type-2 tags */ + unsigned int MifareStd : 1; /**< Protocol Mifare Standard. */ + unsigned int ISO14443_4A : 1; /**< Protocol ISO14443-4 Type A. */ + unsigned int ISO14443_4B : 1; /**< Protocol ISO14443-4 Type B. */ + unsigned int ISO15693 : 1; /**< Protocol ISO15693 HiTag. */ + unsigned int Felica : 1; /**< Protocol Felica. */ + unsigned int NFC : 1; /**< Protocol NFC. */ + unsigned int Jewel : 1; /**< Protocol Innovision Jewel Tag. */ + /*** TODO: Add SWP, ETSI HCI to this list **/ +} phNfc_sSupProtocol_t; + + +/** \ingroup grp_hal_common + * + * + * \brief Information related to the NFC Device + * + * The Device Information Structure holds information * related to the NFC IC read during initialization time. - * It allows the caller firware, hardware version, the model id, + * It allows the caller firware, hardware version, the model id, * HCI verison supported and vendor name. Refer to the NFC Device - * User Manual on how to interpret each of the values. In addition + * User Manual on how to interpret each of the values. In addition * it also contains capabilities of the NFC Device such as the - * protocols supported in Reader and emulation mode - * - */ -typedef struct phNfc_sDeviceCapabilities_t -{ - /* */ - uint32_t hal_version; /**< \ingroup grp_hal_common - HAL 4.0 Version Information. */ - uint32_t fw_version; /**< \ingroup grp_hal_common - Firmware Version Info. */ - uint32_t hw_version; /**< \ingroup grp_hal_common - Hardware Version Info. */ - uint8_t model_id; /**< \ingroup grp_hal_common - IC Variant . */ - uint8_t hci_version; /**< \ingroup grp_hal_common - ETSI HCI Version Supported */ - utf8_t vendor_name[VENDOR_NAME_LEN]; /**< \ingroup grp_hal_common - Vendor name (Null terminated string)*/ - uint8_t full_version[NXP_FULL_VERSION_LEN]; - + * protocols supported in Reader and emulation mode + * + */ +typedef struct phNfc_sDeviceCapabilities_t +{ + /* */ + uint32_t hal_version; /**< \ingroup grp_hal_common + HAL 4.0 Version Information. */ + uint32_t fw_version; /**< \ingroup grp_hal_common + Firmware Version Info. */ + uint32_t hw_version; /**< \ingroup grp_hal_common + Hardware Version Info. */ + uint8_t model_id; /**< \ingroup grp_hal_common + IC Variant . */ + uint8_t hci_version; /**< \ingroup grp_hal_common + ETSI HCI Version Supported */ + utf8_t vendor_name[VENDOR_NAME_LEN]; /**< \ingroup grp_hal_common + Vendor name (Null terminated string)*/ + uint8_t full_version[NXP_FULL_VERSION_LEN]; + phNfc_sSupProtocol_t ReaderSupProtocol; /**< Supported protocols - (Bitmapped) in Reader mode. */ - phNfc_sSupProtocol_t EmulationSupProtocol; /**< Supported protocols + (Bitmapped) in Reader mode. */ + phNfc_sSupProtocol_t EmulationSupProtocol; /**< Supported protocols (Bitmapped) in Emulation - mode. */ - char firmware_update_info; /** */ -} phNfc_sDeviceCapabilities_t; - - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** \ingroup grp_hal_common - * - * \brief Enumerated MIFARE Commands - * - * The Mifare Command List Enumerator lists all available Mifare native commands. - * - * \note None. - * - */ -typedef enum phNfc_eMifareCmdList_t -{ - phNfc_eMifareRaw = 0x00U, /**< This command performs raw transcations . + mode. */ + char firmware_update_info; /** */ +} phNfc_sDeviceCapabilities_t; + + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + + +/** \ingroup grp_hal_common + * + * \brief Enumerated MIFARE Commands + * + * The Mifare Command List Enumerator lists all available Mifare native commands. + * + * \note None. + * + */ +typedef enum phNfc_eMifareCmdList_t +{ + phNfc_eMifareRaw = 0x00U, /**< This command performs raw transcations . Format of the phLibNfc_sTransceiveInfo_t content in this case shall be as below: - • cmd: filed shall set to phHal_eMifareRaw . - • addr : doesn't carry any significance. - • sSendData : Shall contain formatted raw buffer + • cmd: filed shall set to phHal_eMifareRaw . + • addr : doesn't carry any significance. + • sSendData : Shall contain formatted raw buffer based on MIFARE commands type used. Formatted buffer shall follow below - formating scheme. + formating scheme. - CmdType+ Block No + CommandSpecific data + 2 byte CRC + CmdType+ Block No + CommandSpecific data + 2 byte CRC Ex: With Write 4 byte command on block 8 looks as " 0xA2,0x08,0x01,0x02,0x03,0x04,CRC1,CRC2 Note : For MIFARE Std card we recommend use MIFARE - commands directly. - */ - phNfc_eMifareAuthentA = 0x60U, /**< Mifare Standard:\n - This command performs an authentication with KEY A for a sector.\n + commands directly. + */ + phNfc_eMifareAuthentA = 0x60U, /**< Mifare Standard:\n + This command performs an authentication with KEY A for a sector.\n Format of the phLibNfc_sTransceiveInfo_t content in this case is : - • cmd: field shall set to phHal_eMifareAuthentA . - • addr : indicates MIFARE block address. - Ex: 0x08 indicates block 8 needs to be authenticated. - • sSendData : Shall contain authentication key values. + • cmd: field shall set to phHal_eMifareAuthentA . + • addr : indicates MIFARE block address. + Ex: 0x08 indicates block 8 needs to be authenticated. + • sSendData : Shall contain authentication key values. sSendData ,buffer shall contain authentication key values 01 02 03 04 05 06 authenticates block 08 with the key 0x01[..]06. If this command fails, then user needs to reactivate the remote Mifare card. - */ - phNfc_eMifareAuthentB = 0x61U, /**< Mifare Standard:\n - This command performs an authentication with KEY B for a sector.\n + */ + phNfc_eMifareAuthentB = 0x61U, /**< Mifare Standard:\n + This command performs an authentication with KEY B for a sector.\n Format of the phLibNfc_sTransceiveInfo_t content in this case is : - • cmd: field shall set to phHal_eMifareAuthentB . - • addr : indicates MIFARE block address. - Ex: 0x08 indicates block 8 needs to be authenticated. - • sSendData : Shall contain authentication key values. + • cmd: field shall set to phHal_eMifareAuthentB . + • addr : indicates MIFARE block address. + Ex: 0x08 indicates block 8 needs to be authenticated. + • sSendData : Shall contain authentication key values. sSendData ,buffer shall contain authentication key values 01 02 03 04 05 06 authenticates block 08 with the key 0x01[..]06. If this command fails, then user needs to reactivate the remote Mifare card. - */ - phNfc_eMifareRead16 = 0x30U, /**< Mifare Standard and Ultra Light:\n - Read 16 Bytes from a Mifare Standard block or 4 Mifare Ultra Light pages.\n + */ + phNfc_eMifareRead16 = 0x30U, /**< Mifare Standard and Ultra Light:\n + Read 16 Bytes from a Mifare Standard block or 4 Mifare Ultra Light pages.\n Format of the phLibNfc_sTransceiveInfo_t content in this case is : - • cmd: field shall set to phHal_eMifareRead16 . - • addr : memory adress to read. - • sRecvData : Shall contain buffer of size 16 + • cmd: field shall set to phHal_eMifareRead16 . + • addr : memory adress to read. + • sRecvData : Shall contain buffer of size 16 to read the data into. - + If this command fails, the user needs to reactivate the - the remote Mifare card - */ - phNfc_eMifareRead = 0x30U, - phNfc_eMifareWrite16 = 0xA0U, /**< Mifare Standard and Ultra Light:\n - Write 16 Bytes to a Mifare Standard block or 4 Mifare Ultra Light pages.\n + the remote Mifare card + */ + phNfc_eMifareRead = 0x30U, + phNfc_eMifareWrite16 = 0xA0U, /**< Mifare Standard and Ultra Light:\n + Write 16 Bytes to a Mifare Standard block or 4 Mifare Ultra Light pages.\n Format of the phLibNfc_sTransceiveInfo_t content in this case is : - • cmd: field shall set to phHal_eMifareWrite16 . - • addr : starting memory adress to write from. - • sSendData : Shall contain buffer of size 16 containing + • cmd: field shall set to phHal_eMifareWrite16 . + • addr : starting memory adress to write from. + • sSendData : Shall contain buffer of size 16 containing the data bytes to be written. If this command fails, the user needs to reactivate the - the remote Mifare card - */ - phNfc_eMifareWrite4 = 0xA2U, /**< Mifare Ultra Light:\n - Write 4 bytes.\n + the remote Mifare card + */ + phNfc_eMifareWrite4 = 0xA2U, /**< Mifare Ultra Light:\n + Write 4 bytes.\n Format of the phLibNfc_sTransceiveInfo_t content in this case is : - • cmd: field shall set to phHal_eMifareWrite4 . - • addr : starting memory adress to write from. - • sSendData : Shall contain buffer of size 4 containing + • cmd: field shall set to phHal_eMifareWrite4 . + • addr : starting memory adress to write from. + • sSendData : Shall contain buffer of size 4 containing the data bytes to be written. - + If this command fails, the user needs to reactivate the - the remote Mifare card - */ - phNfc_eMifareInc = 0xC1U, /**< Increment. */ - phNfc_eMifareDec = 0xC0U, /**< Decrement. */ - phNfc_eMifareTransfer = 0xB0U, /**< Tranfer. */ - phNfc_eMifareRestore = 0xC2U, /**< Restore. */ - phNfc_eMifareReadSector = 0x38U, /**< Read Sector. */ - phNfc_eMifareWriteSector= 0xA8U, /**< Write Sector. */ - phNfc_eMifareInvalidCmd = 0xFFU /**< Invalid Command */ -} phNfc_eMifareCmdList_t; - - -/** \ingroup grp_hal_common - * - * The T=Cl Command List Enumerator lists all available T=Cl Commands. - * - * \note None. - * - */ -typedef enum phNfc_eIso14443_4_CmdList_t -{ - phNfc_eIso14443_4_Raw = 0x00U /**< ISO 14443-4 Exchange command:\n + the remote Mifare card + */ + phNfc_eMifareInc = 0xC1U, /**< Increment. */ + phNfc_eMifareDec = 0xC0U, /**< Decrement. */ + phNfc_eMifareTransfer = 0xB0U, /**< Tranfer. */ + phNfc_eMifareRestore = 0xC2U, /**< Restore. */ + phNfc_eMifareReadSector = 0x38U, /**< Read Sector. */ + phNfc_eMifareWriteSector= 0xA8U, /**< Write Sector. */ + phNfc_eMifareInvalidCmd = 0xFFU /**< Invalid Command */ +} phNfc_eMifareCmdList_t; + + +/** \ingroup grp_hal_common + * + * The T=Cl Command List Enumerator lists all available T=Cl Commands. + * + * \note None. + * + */ +typedef enum phNfc_eIso14443_4_CmdList_t +{ + phNfc_eIso14443_4_Raw = 0x00U /**< ISO 14443-4 Exchange command:\n - This command sends the data buffer directly - to the remote device */ - -} phNfc_eIso14443_4_CmdList_t; - - -/** \ingroup grp_hal_common - * - * The NFCIP1 Command List Enumerator lists all available NFCIP1 Commands. - * - * \note None. - * - */ -typedef enum phNfc_eNfcIP1CmdList_t -{ - phNfc_eNfcIP1_Raw = 0x00U /**< NfcIP Exchange command:\n + to the remote device */ + +} phNfc_eIso14443_4_CmdList_t; + + +/** \ingroup grp_hal_common + * + * The NFCIP1 Command List Enumerator lists all available NFCIP1 Commands. + * + * \note None. + * + */ +typedef enum phNfc_eNfcIP1CmdList_t +{ + phNfc_eNfcIP1_Raw = 0x00U /**< NfcIP Exchange command:\n - This command sends the data buffer directly - to the remote device */ -}phNfc_eNfcIP1CmdList_t; - - -/** \ingroup grp_hal_common - * - * The ISO15693 Command List Enumerator lists all available ISO15693 Commands. - * - * \note None. - * - */ -typedef enum phNfc_eIso15693_CmdList_t -{ -#if 0 - phNfc_eIso15693_Raw = 0x00U, /**< ISO 15693 Exchange Raw command:\n + to the remote device */ +}phNfc_eNfcIP1CmdList_t; + + +/** \ingroup grp_hal_common + * + * The ISO15693 Command List Enumerator lists all available ISO15693 Commands. + * + * \note None. + * + */ +typedef enum phNfc_eIso15693_CmdList_t +{ +#if 0 + phNfc_eIso15693_Raw = 0x00U, /**< ISO 15693 Exchange Raw command:\n - This command sends the data buffer directly - to the remote device */ -#endif - phNfc_eIso15693_Cmd = 0x20U, /**< ISO 15693 Exchange command:\n + to the remote device */ +#endif + phNfc_eIso15693_Cmd = 0x20U, /**< ISO 15693 Exchange command:\n - This command is used to access the card - to the remote device */ - phNfc_eIso15693_Invalid = 0xFFU /**< Invalid Command */ -} phNfc_eIso15693_CmdList_t; - - -/** \ingroup grp_hal_common - * - * The Felica Command List Enumerator lists all available Felica Commands. - * - * \note None. - * - */ -typedef enum phNfc_eFelicaCmdList_t -{ - phNfc_eFelica_Raw = 0xF0U, /**< Felica Raw command:\n + to the remote device */ + phNfc_eIso15693_Invalid = 0xFFU /**< Invalid Command */ +} phNfc_eIso15693_CmdList_t; + + +/** \ingroup grp_hal_common + * + * The Felica Command List Enumerator lists all available Felica Commands. + * + * \note None. + * + */ +typedef enum phNfc_eFelicaCmdList_t +{ + phNfc_eFelica_Raw = 0xF0U, /**< Felica Raw command:\n - This command sends the data buffer directly - to the remote device */ - phNfc_eFelica_Check = 0x00, /**< Felica Check command:\n - - This command checks the data from the Felica - remote device */ - phNfc_eFelica_Update = 0x01, /**< Felica Update command:\n - - This command updates the data onto the Felica - remote device */ - phNfc_eFelica_Invalid = 0xFFU /**< Invalid Command */ -} phNfc_eFelicaCmdList_t; - - -/** \ingroup grp_hal_common - * - * The Jewel Command List Enumerator lists all available Jewel Commands. - * - * \note None. - * - */ -typedef enum phNfc_eJewelCmdList_t -{ - phNfc_eJewel_Raw = 0x00U, /**< Jewel command:\n + to the remote device */ + phNfc_eFelica_Check = 0x00, /**< Felica Check command:\n + - This command checks the data from the Felica + remote device */ + phNfc_eFelica_Update = 0x01, /**< Felica Update command:\n + - This command updates the data onto the Felica + remote device */ + phNfc_eFelica_Invalid = 0xFFU /**< Invalid Command */ +} phNfc_eFelicaCmdList_t; + + +/** \ingroup grp_hal_common + * + * The Jewel Command List Enumerator lists all available Jewel Commands. + * + * \note None. + * + */ +typedef enum phNfc_eJewelCmdList_t +{ + phNfc_eJewel_Raw = 0x00U, /**< Jewel command:\n - This command sends the data buffer directly - to the remote device */ - phNfc_eJewel_Invalid = 0xFFU /**< Invalid jewel command */ -}phNfc_eJewelCmdList_t; - - -/** \ingroup grp_hal_nfci -* + to the remote device */ + phNfc_eJewel_Invalid = 0xFFU /**< Invalid jewel command */ +}phNfc_eJewelCmdList_t; + + +/** \ingroup grp_hal_nfci +* * \brief Remote Device Reader A RF Gate Information Container -* -* The Reader A structure includes the available information +* +* The Reader A structure includes the available information * related to the discovered ISO14443A remote device. This information -* is updated for every device discovery. -* \note None. -* -*/ -typedef struct phNfc_sIso14443AInfo_t -{ - uint8_t Uid[PHHAL_MAX_UID_LENGTH]; /**< UID information of the TYPE A - Tag Discovered */ +* is updated for every device discovery. +* \note None. +* +*/ +typedef struct phNfc_sIso14443AInfo_t +{ + uint8_t Uid[PHHAL_MAX_UID_LENGTH]; /**< UID information of the TYPE A + Tag Discovered */ uint8_t UidLength; /**< UID information length, shall not be greater - than PHHAL_MAX_UID_LENGTH i.e., 10 */ + than PHHAL_MAX_UID_LENGTH i.e., 10 */ uint8_t AppData[PHHAL_MAX_ATR_LENGTH]; /**< Application data information of the tag discovered (= Historical bytes for type A) */ - uint8_t AppDataLength; /**< Application data length */ - uint8_t Sak; /**< SAK informationof the TYPE A - Tag Discovered */ - uint8_t AtqA[PHHAL_ATQA_LENGTH]; /**< ATQA informationof the TYPE A - Tag Discovered */ - uint8_t MaxDataRate; /**< Maximum data rate supported by the TYPE A - Tag Discovered */ + uint8_t AppDataLength; /**< Application data length */ + uint8_t Sak; /**< SAK informationof the TYPE A + Tag Discovered */ + uint8_t AtqA[PHHAL_ATQA_LENGTH]; /**< ATQA informationof the TYPE A + Tag Discovered */ + uint8_t MaxDataRate; /**< Maximum data rate supported by the TYPE A + Tag Discovered */ uint8_t Fwi_Sfgt; /**< Frame waiting time and start up frame guard time as defined in ISO/IEC 14443-4[7] for - type A */ -} phNfc_sIso14443AInfo_t; - - -/** \ingroup grp_hal_nfci -* + type A */ +} phNfc_sIso14443AInfo_t; + + +/** \ingroup grp_hal_nfci +* * \brief Remote Device Reader B RF Gate Information Container -* -* The Reader B structure includes the available information +* +* The Reader B structure includes the available information * related to the discovered ISO14443B remote device. This information -* is updated for every device discovery. -* \note None. -* -*/ +* is updated for every device discovery. +* \note None. +* +*/ typedef struct phNfc_sIso14443BInfo_t -{ - union phNfc_uAtqBInfo - { - struct phNfc_sAtqBInfo - { - uint8_t Pupi[PHHAL_PUPI_LENGTH]; /**< PUPI information of the TYPE B - Tag Discovered */ - uint8_t AppData[PHHAL_APP_DATA_B_LENGTH]; /**< Application Data of the TYPE B - Tag Discovered */ - uint8_t ProtInfo[PHHAL_PROT_INFO_B_LENGTH]; /**< Protocol Information of the TYPE B - Tag Discovered */ - } AtqResInfo; - uint8_t AtqRes[PHHAL_ATQB_LENGTH]; /**< ATQB Response Information of TYPE B - Tag Discovered */ - } AtqB; +{ + union phNfc_uAtqBInfo + { + struct phNfc_sAtqBInfo + { + uint8_t Pupi[PHHAL_PUPI_LENGTH]; /**< PUPI information of the TYPE B + Tag Discovered */ + uint8_t AppData[PHHAL_APP_DATA_B_LENGTH]; /**< Application Data of the TYPE B + Tag Discovered */ + uint8_t ProtInfo[PHHAL_PROT_INFO_B_LENGTH]; /**< Protocol Information of the TYPE B + Tag Discovered */ + } AtqResInfo; + uint8_t AtqRes[PHHAL_ATQB_LENGTH]; /**< ATQB Response Information of TYPE B + Tag Discovered */ + } AtqB; uint8_t HiLayerResp[PHHAL_MAX_ATR_LENGTH]; /**< Higher Layer Response information in answer to ATRRIB Command for Type B */ - uint8_t HiLayerRespLength; /**< Higher Layer Response length */ - uint8_t Afi; /**< Application Family Identifier of TYPE B - Tag Discovered */ - uint8_t MaxDataRate; /**< Maximum data rate supported by the TYPE B - Tag Discovered */ -} phNfc_sIso14443BInfo_t; - - -/** \ingroup grp_hal_nfci -* + uint8_t HiLayerRespLength; /**< Higher Layer Response length */ + uint8_t Afi; /**< Application Family Identifier of TYPE B + Tag Discovered */ + uint8_t MaxDataRate; /**< Maximum data rate supported by the TYPE B + Tag Discovered */ +} phNfc_sIso14443BInfo_t; + + +/** \ingroup grp_hal_nfci +* * \brief Remote Device Reader B prime RF Gate Information Container -* -*/ +* +*/ typedef struct phNfc_sIso14443BPrimeInfo_t -{ - /* TODO: This will be updated later */ - void *BPrimeCtxt; -} phNfc_sIso14443BPrimeInfo_t; - - -/** \ingroup grp_hal_nfci -* +{ + /* TODO: This will be updated later */ + void *BPrimeCtxt; +} phNfc_sIso14443BPrimeInfo_t; + + +/** \ingroup grp_hal_nfci +* * \brief Remote Device Jewel Reader RF Gate Information Container -* -* The Jewel Reader structure includes the available information +* +* The Jewel Reader structure includes the available information * related to the discovered Jewel remote device. This information -* is updated for every device discovery. -* \note None. -* -*/ +* is updated for every device discovery. +* \note None. +* +*/ typedef struct phNfc_sJewelInfo_t -{ - uint8_t Uid[PHHAL_MAX_UID_LENGTH]; /**< UID information of the TYPE A - Tag Discovered */ +{ + uint8_t Uid[PHHAL_MAX_UID_LENGTH]; /**< UID information of the TYPE A + Tag Discovered */ uint8_t UidLength; /**< UID information length, shall not be greater - than PHHAL_MAX_UID_LENGTH i.e., 10 */ - uint8_t HeaderRom0; /**< Header Rom byte zero */ - uint8_t HeaderRom1; /**< Header Rom byte one */ - -} phNfc_sJewelInfo_t; - - -/** \ingroup grp_hal_nfci -* + than PHHAL_MAX_UID_LENGTH i.e., 10 */ + uint8_t HeaderRom0; /**< Header Rom byte zero */ + uint8_t HeaderRom1; /**< Header Rom byte one */ + +} phNfc_sJewelInfo_t; + + +/** \ingroup grp_hal_nfci +* * \brief Remote Device Felica Reader RF Gate Information Container -* -* The Felica Reader structure includes the available information +* +* The Felica Reader structure includes the available information * related to the discovered Felica remote device. This information -* is updated for every device discovery. -* \note None. -* -*/ -typedef struct phNfc_sFelicaInfo_t -{ - uint8_t IDm[(PHHAL_FEL_ID_LEN + 2)]; /**< Current ID of Felica tag */ +* is updated for every device discovery. +* \note None. +* +*/ +typedef struct phNfc_sFelicaInfo_t +{ + uint8_t IDm[(PHHAL_FEL_ID_LEN + 2)]; /**< Current ID of Felica tag */ uint8_t IDmLength; /**< IDm length, shall not be greater - than PHHAL_FEL_ID_LEN i.e., 8 */ - uint8_t PMm[PHHAL_FEL_PM_LEN]; /**< Current PM of Felica tag */ - uint8_t SystemCode[PHHAL_FEL_SYS_CODE_LEN]; /**< System code of Felica tag */ -} phNfc_sFelicaInfo_t; - - -/** \ingroup grp_hal_nfci -* + than PHHAL_FEL_ID_LEN i.e., 8 */ + uint8_t PMm[PHHAL_FEL_PM_LEN]; /**< Current PM of Felica tag */ + uint8_t SystemCode[PHHAL_FEL_SYS_CODE_LEN]; /**< System code of Felica tag */ +} phNfc_sFelicaInfo_t; + + +/** \ingroup grp_hal_nfci +* * \brief Remote Device Reader 15693 RF Gate Information Container -* -* The Reader A structure includes the available information +* +* The Reader A structure includes the available information * related to the discovered ISO15693 remote device. This information -* is updated for every device discovery. -* \note None. -* -*/ - -typedef struct phNfc_sIso15693Info_t -{ - uint8_t Uid[PHHAL_15693_UID_LENGTH]; /**< UID information of the 15693 - Tag Discovered */ +* is updated for every device discovery. +* \note None. +* +*/ + +typedef struct phNfc_sIso15693Info_t +{ + uint8_t Uid[PHHAL_15693_UID_LENGTH]; /**< UID information of the 15693 + Tag Discovered */ uint8_t UidLength; /**< UID information length, shall not be greater - than PHHAL_15693_UID_LENGTH i.e., 8 */ - uint8_t Dsfid; /**< DSF information of the 15693 - Tag Discovered */ - uint8_t Flags; /**< Information about the Flags - in the 15693 Tag Discovered */ - uint8_t Afi; /**< Application Family Identifier of - 15693 Tag Discovered */ -} phNfc_sIso15693Info_t; - - -/** \ingroup grp_hal_nfci -* -* \brief NFC Data Rate Supported between the Reader and the Target -* + than PHHAL_15693_UID_LENGTH i.e., 8 */ + uint8_t Dsfid; /**< DSF information of the 15693 + Tag Discovered */ + uint8_t Flags; /**< Information about the Flags + in the 15693 Tag Discovered */ + uint8_t Afi; /**< Application Family Identifier of + 15693 Tag Discovered */ +} phNfc_sIso15693Info_t; + + +/** \ingroup grp_hal_nfci +* +* \brief NFC Data Rate Supported between the Reader and the Target +* * The \ref phHalNfc_eDataRate enum lists all the Data Rate -* values to be used to determine the rate at which the data is transmitted -* to the target. -* -* \note None. -*/ - - -/** \ingroup grp_hal_nfci -* +* values to be used to determine the rate at which the data is transmitted +* to the target. +* +* \note None. +*/ + + +/** \ingroup grp_hal_nfci +* * \brief NFCIP1 Data rates -* -*/ -typedef enum phNfc_eDataRate_t{ +* +*/ +typedef enum phNfc_eDataRate_t{ phNfc_eDataRate_106 = 0x00U, phNfc_eDataRate_212, phNfc_eDataRate_424, /* phNfc_eDataRate_848, phNfc_eDataRate_1696, phNfc_eDataRate_3392, - phNfc_eDataRate_6784,*/ + phNfc_eDataRate_6784,*/ phNfc_eDataRate_RFU -} phNfc_eDataRate_t; - - -/** \ingroup grp_hal_nfci -* +} phNfc_eDataRate_t; + + +/** \ingroup grp_hal_nfci +* * \brief NFCIP1 Gate Information Container -* -* The NFCIP1 structure includes the available information +* +* The NFCIP1 structure includes the available information * related to the discovered NFCIP1 remote device. This information -* is updated for every device discovery. -* \note None. -* -*/ +* is updated for every device discovery. +* \note None. +* +*/ typedef struct phNfc_sNfcIPInfo_t -{ +{ /* Contains the random NFCID3I conveyed with the ATR_REQ. always 10 bytes length - or contains the random NFCID3T conveyed with the ATR_RES. - always 10 bytes length */ + or contains the random NFCID3T conveyed with the ATR_RES. + always 10 bytes length */ uint8_t NFCID[PHHAL_MAX_UID_LENGTH]; - uint8_t NFCID_Length; - /* ATR_RES = General bytes length, Max length = 48 bytes */ + uint8_t NFCID_Length; + /* ATR_RES = General bytes length, Max length = 48 bytes */ uint8_t ATRInfo[PHHAL_MAX_ATR_LENGTH]; - uint8_t ATRInfo_Length; - /**< SAK information of the tag discovered */ - uint8_t SelRes; - /**< ATQA information of the tag discovered */ - uint8_t SenseRes[PHHAL_ATQA_LENGTH]; - /**< Is Detection Mode of the NFCIP Target Active */ - uint8_t Nfcip_Active; + uint8_t ATRInfo_Length; + /**< SAK information of the tag discovered */ + uint8_t SelRes; + /**< ATQA information of the tag discovered */ + uint8_t SenseRes[PHHAL_ATQA_LENGTH]; + /**< Is Detection Mode of the NFCIP Target Active */ + uint8_t Nfcip_Active; /**< Maximum frame length supported by the NFCIP device */ - uint16_t MaxFrameLength; - /**< Data rate supported by the NFCIP device */ - phNfc_eDataRate_t Nfcip_Datarate; - -} phNfc_sNfcIPInfo_t; - - -/** \ingroup grp_hal_nfci -* -* \brief Remote Device Specific Information Container -* -* The Remote Device Information Union includes the available Remote Device Information -* structures. Following the device detected, the corresponding data structure is used. -* -* \note None. -* -*/ -typedef union phNfc_uRemoteDevInfo_t -{ - phNfc_sIso14443AInfo_t Iso14443A_Info; - phNfc_sIso14443BInfo_t Iso14443B_Info; - phNfc_sIso14443BPrimeInfo_t Iso14443BPrime_Info; - phNfc_sNfcIPInfo_t NfcIP_Info; - phNfc_sFelicaInfo_t Felica_Info; - phNfc_sJewelInfo_t Jewel_Info; - phNfc_sIso15693Info_t Iso15693_Info; -} phNfc_uRemoteDevInfo_t; - - -/** \ingroup grp_hal_nfci -* -* \brief RF Device Type Listing -* -* The RF Device Type List is used to identify the type of -* remote device that is discovered/connected. There seperate + uint16_t MaxFrameLength; + /**< Data rate supported by the NFCIP device */ + phNfc_eDataRate_t Nfcip_Datarate; + +} phNfc_sNfcIPInfo_t; + + +/** \ingroup grp_hal_nfci +* +* \brief Remote Device Specific Information Container +* +* The Remote Device Information Union includes the available Remote Device Information +* structures. Following the device detected, the corresponding data structure is used. +* +* \note None. +* +*/ +typedef union phNfc_uRemoteDevInfo_t +{ + phNfc_sIso14443AInfo_t Iso14443A_Info; + phNfc_sIso14443BInfo_t Iso14443B_Info; + phNfc_sIso14443BPrimeInfo_t Iso14443BPrime_Info; + phNfc_sNfcIPInfo_t NfcIP_Info; + phNfc_sFelicaInfo_t Felica_Info; + phNfc_sJewelInfo_t Jewel_Info; + phNfc_sIso15693Info_t Iso15693_Info; +} phNfc_uRemoteDevInfo_t; + + +/** \ingroup grp_hal_nfci +* +* \brief RF Device Type Listing +* +* The RF Device Type List is used to identify the type of +* remote device that is discovered/connected. There seperate * types to identify a Remote Reader (denoted by _PCD) and -* Remote Tag (denoted by _PICC) -* \note None. -* -*/ -typedef enum phNfc_eRFDevType_t -{ - phNfc_eUnknown_DevType = 0x00U, - - /* Specific PCD Devices */ - phNfc_eISO14443_A_PCD, - phNfc_eISO14443_B_PCD, - phNfc_eISO14443_BPrime_PCD, - phNfc_eFelica_PCD, - phNfc_eJewel_PCD, - phNfc_eISO15693_PCD, - /* Generic PCD Type */ - phNfc_ePCD_DevType, - - /* Generic PICC Type */ - phNfc_ePICC_DevType, - /* Specific PICC Devices */ - phNfc_eISO14443_A_PICC, - phNfc_eISO14443_4A_PICC, - phNfc_eISO14443_3A_PICC, - phNfc_eMifare_PICC, - phNfc_eISO14443_B_PICC, - phNfc_eISO14443_4B_PICC, - phNfc_eISO14443_BPrime_PICC, - phNfc_eFelica_PICC, - phNfc_eJewel_PICC, - phNfc_eISO15693_PICC, - - /* NFC-IP1 Device Types */ +* Remote Tag (denoted by _PICC) +* \note None. +* +*/ +typedef enum phNfc_eRFDevType_t +{ + phNfc_eUnknown_DevType = 0x00U, + + /* Specific PCD Devices */ + phNfc_eISO14443_A_PCD, + phNfc_eISO14443_B_PCD, + phNfc_eISO14443_BPrime_PCD, + phNfc_eFelica_PCD, + phNfc_eJewel_PCD, + phNfc_eISO15693_PCD, + /* Generic PCD Type */ + phNfc_ePCD_DevType, + + /* Generic PICC Type */ + phNfc_ePICC_DevType, + /* Specific PICC Devices */ + phNfc_eISO14443_A_PICC, + phNfc_eISO14443_4A_PICC, + phNfc_eISO14443_3A_PICC, + phNfc_eMifare_PICC, + phNfc_eISO14443_B_PICC, + phNfc_eISO14443_4B_PICC, + phNfc_eISO14443_BPrime_PICC, + phNfc_eFelica_PICC, + phNfc_eJewel_PICC, + phNfc_eISO15693_PICC, + + /* NFC-IP1 Device Types */ phNfc_eNfcIP1_Target, phNfc_eNfcIP1_Initiator, - - /* Other Sources */ - phNfc_eInvalid_DevType - -} phNfc_eRFDevType_t; - - -/** \ingroup grp_hal_nfci -* -* \brief Remote Device Type Listing -* -* The Remote Device Type List is used to identify the type of -* remote device that is discovered/connected -* \note This is same as RF Device Type List. -* -*/ -typedef phNfc_eRFDevType_t phNfc_eRemDevType_t; - - -/** \ingroup grp_hal_common - * - * - * \brief Common Command Attribute - * - * The Hal Command Union includes each available type of Commands. - * - * \note None. - * - */ -typedef union phNfc_uCommand_t -{ - phNfc_eMifareCmdList_t MfCmd; /**< Mifare command structure. */ - phNfc_eIso14443_4_CmdList_t Iso144434Cmd; /**< ISO 14443-4 command structure. */ - phNfc_eFelicaCmdList_t FelCmd; /**< Felica command structure. */ - phNfc_eJewelCmdList_t JewelCmd; /**< Jewel command structure. */ - phNfc_eIso15693_CmdList_t Iso15693Cmd; /**< ISO 15693 command structure. */ - phNfc_eNfcIP1CmdList_t NfcIP1Cmd; /**< ISO 18092 (NFCIP1) command structure */ -} phNfc_uCmdList_t; - - -/** \ingroup grp_hal_nfci - * - * \brief Remote Device Information Structure - * - * The Remote Device Information Structure holds information about one single Remote - * Device detected by the polling function .\n - * It lists parameters common to all supported remote devices. - * + + /* Other Sources */ + phNfc_eInvalid_DevType + +} phNfc_eRFDevType_t; + + +/** \ingroup grp_hal_nfci +* +* \brief Remote Device Type Listing +* +* The Remote Device Type List is used to identify the type of +* remote device that is discovered/connected +* \note This is same as RF Device Type List. +* +*/ +typedef phNfc_eRFDevType_t phNfc_eRemDevType_t; + + +/** \ingroup grp_hal_common + * + * + * \brief Common Command Attribute + * + * The Hal Command Union includes each available type of Commands. + * + * \note None. + * + */ +typedef union phNfc_uCommand_t +{ + phNfc_eMifareCmdList_t MfCmd; /**< Mifare command structure. */ + phNfc_eIso14443_4_CmdList_t Iso144434Cmd; /**< ISO 14443-4 command structure. */ + phNfc_eFelicaCmdList_t FelCmd; /**< Felica command structure. */ + phNfc_eJewelCmdList_t JewelCmd; /**< Jewel command structure. */ + phNfc_eIso15693_CmdList_t Iso15693Cmd; /**< ISO 15693 command structure. */ + phNfc_eNfcIP1CmdList_t NfcIP1Cmd; /**< ISO 18092 (NFCIP1) command structure */ +} phNfc_uCmdList_t; + + +/** \ingroup grp_hal_nfci + * + * \brief Remote Device Information Structure + * + * The Remote Device Information Structure holds information about one single Remote + * Device detected by the polling function .\n + * It lists parameters common to all supported remote devices. + * * \note - * - * \sa \ref phHal4Nfc_ConfigureDiscovery and \ref phHal4Nfc_Connect - * - */ -typedef struct phNfc_sRemoteDevInformation_t -{ + * + * \sa \ref phHal4Nfc_ConfigureDiscovery and \ref phHal4Nfc_Connect + * + */ +typedef struct phNfc_sRemoteDevInformation_t +{ uint8_t SessionOpened; /**< [out] Boolean - * Flag indicating the validity of - * the handle of the remote device. */ + * Flag indicating the validity of + * the handle of the remote device. */ phNfc_eRemDevType_t RemDevType; /**< [out] Remote device type which says that remote is Reader A or Reader B or NFCIP or Felica or - Reader B Prime or Jewel*/ - phNfc_uRemoteDevInfo_t RemoteDevInfo; /**< Union of available Remote Device. - * \ref phNfc_uRemoteDevInfo_t Information. */ -} phNfc_sRemoteDevInformation_t; - - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -/* TARGET STRUCTURES */ - - -/** \ingroup grp_hal_common - * + Reader B Prime or Jewel*/ + phNfc_uRemoteDevInfo_t RemoteDevInfo; /**< Union of available Remote Device. + * \ref phNfc_uRemoteDevInfo_t Information. */ +} phNfc_sRemoteDevInformation_t; + + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +/* TARGET STRUCTURES */ + + +/** \ingroup grp_hal_common + * * \brief Transceive Information Data Structure for sending commands/response - * to the remote device - * + * to the remote device + * * The Transceive Information Data Structure is used to pass the - * Command, Address (only required for MIFARE) and the send and receive data - * data structure (buffer and length) for communication with remote device - * - * - */ -typedef struct phNfc_sTransceiveInfo_t -{ - phNfc_uCmdList_t cmd; - - /** \internal Address Field required for only Mifare - * Family Proprietary Cards. - * The Address Size is Valid only upto 255 Blocks limit - * i:e for Mifare 4K - */ - uint8_t addr; - phNfc_sData_t sSendData; - phNfc_sData_t sRecvData; -} phNfc_sTransceiveInfo_t; - - -/** \ingroup grp_hal_nfci -* -* \brief Poll Device Information for conifiguring the discovery wheel - Reader and Card Emulation Phases -* + * Command, Address (only required for MIFARE) and the send and receive data + * data structure (buffer and length) for communication with remote device + * + * + */ +typedef struct phNfc_sTransceiveInfo_t +{ + phNfc_uCmdList_t cmd; + + /** \internal Address Field required for only Mifare + * Family Proprietary Cards. + * The Address Size is Valid only upto 255 Blocks limit + * i:e for Mifare 4K + */ + uint8_t addr; + phNfc_sData_t sSendData; + phNfc_sData_t sRecvData; +} phNfc_sTransceiveInfo_t; + + +/** \ingroup grp_hal_nfci +* +* \brief Poll Device Information for conifiguring the discovery wheel + Reader and Card Emulation Phases +* * The \ref phNfc_sPollDevInfo_t enum is used to enable/disable * phases of the discovery wheel related to specific reader types and -* card emulation phase -* \note Enabling specific Reader technology when NFCIP1 speed is set in the -* phNfc_sADD_Cfg_t is implicitly done in HAL. Use this structure to only -* enable/disable Card Reader Functionality -*/ -typedef struct phNfc_sPollDevInfo_t -{ +* card emulation phase +* \note Enabling specific Reader technology when NFCIP1 speed is set in the +* phNfc_sADD_Cfg_t is implicitly done in HAL. Use this structure to only +* enable/disable Card Reader Functionality +*/ +typedef struct phNfc_sPollDevInfo_t +{ unsigned EnableIso14443A : 1; /**< Flag to enable - Reader A discovery */ + Reader A discovery */ unsigned EnableIso14443B : 1; /**< Flag to enable - Reader B discovery */ - unsigned EnableFelica212 : 1; /**< Flag to enable - Felica 212 discovery */ - unsigned EnableFelica424 : 1; /**< Flag to enable - Felica 424 discovery */ + Reader B discovery */ + unsigned EnableFelica212 : 1; /**< Flag to enable + Felica 212 discovery */ + unsigned EnableFelica424 : 1; /**< Flag to enable + Felica 424 discovery */ unsigned EnableIso15693 : 1; /**< Flag to enable - ISO 15693 discovery */ + ISO 15693 discovery */ unsigned EnableNfcActive : 1; /**< Flag to enable Active Mode of NFC-IP discovery. This is updated internally - based on the NFC-IP speed. - */ - unsigned RFU : 1; /**< Reserved for future use */ + based on the NFC-IP speed. + */ + unsigned RFU : 1; /**< Reserved for future use */ unsigned DisableCardEmulation : 1; /**< Flag to - disable the card emulation */ -} phNfc_sPollDevInfo_t; - - -/** \ingroup grp_hal_nfci -* -* \brief P2P speed for the Initiator -* + disable the card emulation */ +} phNfc_sPollDevInfo_t; + + +/** \ingroup grp_hal_nfci +* +* \brief P2P speed for the Initiator +* * The \ref phNfc_eP2PMode_t enum lists all the NFCIP1 speeds -* to be used for configuring the NFCIP1 discovery -* -* \note None. -*/ -typedef enum phNfc_eP2PMode_t -{ - phNfc_eDefaultP2PMode = 0x00U, - phNfc_ePassive106 = 0x01U, - phNfc_ePassive212 = 0x02U, - phNfc_ePassive424 = 0x04U, - phNfc_eActive106 = 0x08U, - phNfc_eActive212 = 0x10U, - phNfc_eActive424 = 0x20U, - phNfc_eP2P_ALL = 0x27U, /* All Passive and 424 Active */ - phNfc_eInvalidP2PMode = 0xFFU -} phNfc_eP2PMode_t; - - -/** \ingroup grp_hal_common -* -* \brief Identities the type of Notification -* -* This enumeration is used to specify the type of notification notified -* to the upper layer. This classifies the notification into two types -* one for the discovery notifications and the other for all the remaining -* event notifications -* \note None. -*/ -typedef enum phNfc_eNotificationType_t -{ - INVALID_NFC_NOTIFICATION = 0x00U, /* Invalid Notification */ - NFC_DISCOVERY_NOTIFICATION, /* Remote Device Discovery Notification */ - NFC_EVENT_NOTIFICATION /* Event Notification from the other hosts */ -} phNfc_eNotificationType_t; - - -/** \ingroup grp_hal_common -* +* to be used for configuring the NFCIP1 discovery +* +* \note None. +*/ +typedef enum phNfc_eP2PMode_t +{ + phNfc_eDefaultP2PMode = 0x00U, + phNfc_ePassive106 = 0x01U, + phNfc_ePassive212 = 0x02U, + phNfc_ePassive424 = 0x04U, + phNfc_eActive106 = 0x08U, + phNfc_eActive212 = 0x10U, + phNfc_eActive424 = 0x20U, + phNfc_eP2P_ALL = 0x27U, /* All Passive and 424 Active */ + phNfc_eInvalidP2PMode = 0xFFU +} phNfc_eP2PMode_t; + + +/** \ingroup grp_hal_common +* +* \brief Identities the type of Notification +* +* This enumeration is used to specify the type of notification notified +* to the upper layer. This classifies the notification into two types +* one for the discovery notifications and the other for all the remaining +* event notifications +* \note None. +*/ +typedef enum phNfc_eNotificationType_t +{ + INVALID_NFC_NOTIFICATION = 0x00U, /* Invalid Notification */ + NFC_DISCOVERY_NOTIFICATION, /* Remote Device Discovery Notification */ + NFC_EVENT_NOTIFICATION /* Event Notification from the other hosts */ +} phNfc_eNotificationType_t; + + +/** \ingroup grp_hal_common +* * \brief -* -* \note None. -*/ -typedef struct phNfc_sUiccInfo_t -{ - /* AID and Parameter Information is obtained if the - * eventType is NFC_EVT_TRANSACTION. - */ - phNfc_sData_t aid; - phNfc_sData_t param; - -} phNfc_sUiccInfo_t; - - -/** \ingroup grp_hal_nfci -* -* \brief P2P Information for the Initiator -* -* The \ref phNfc_sNfcIPCfg_t holds the P2P related information -* use by the NFC Device during P2P Discovery and connection -* -* \note None. -*/ +* +* \note None. +*/ +typedef struct phNfc_sUiccInfo_t +{ + /* AID and Parameter Information is obtained if the + * eventType is NFC_EVT_TRANSACTION. + */ + phNfc_sData_t aid; + phNfc_sData_t param; + +} phNfc_sUiccInfo_t; + + +/** \ingroup grp_hal_nfci +* +* \brief P2P Information for the Initiator +* +* The \ref phNfc_sNfcIPCfg_t holds the P2P related information +* use by the NFC Device during P2P Discovery and connection +* +* \note None. +*/ typedef struct phNfc_sNfcIPCfg_t -{ - /* ATR_RES = General bytes length, Max length = 48 bytes */ - uint8_t generalBytesLength; +{ + /* ATR_RES = General bytes length, Max length = 48 bytes */ + uint8_t generalBytesLength; uint8_t generalBytes[PHHAL_MAX_ATR_LENGTH]; - - /* TODO: This will be updated later for any additional params*/ -} phNfc_sNfcIPCfg_t; - - -/** \ingroup grp_hal_common -* -* \brief Discovery Configuration Mode -* -* This enumeration is used to choose the Discovery Configuration + + /* TODO: This will be updated later for any additional params*/ +} phNfc_sNfcIPCfg_t; + + +/** \ingroup grp_hal_common +* +* \brief Discovery Configuration Mode +* +* This enumeration is used to choose the Discovery Configuration * Mode :- Configure and Start, Stop or Start with last set -* configuration -* \note None. -*/ -typedef enum phNfc_eDiscoveryConfigMode_t -{ +* configuration +* \note None. +*/ +typedef enum phNfc_eDiscoveryConfigMode_t +{ NFC_DISCOVERY_CONFIG = 0x00U,/**< Configure discovery with values in phNfc_sADD_Cfg_t and start - discovery */ - NFC_DISCOVERY_START, /**< Start Discovery with previously set - configuration */ - NFC_DISCOVERY_STOP, /**< Stop the Discovery */ + discovery */ + NFC_DISCOVERY_START, /**< Start Discovery with previously set + configuration */ + NFC_DISCOVERY_STOP, /**< Stop the Discovery */ NFC_DISCOVERY_RESUME /**< Resume the Discovery with previously - * set configuration. - * This is valid only when the Target - * is not connected. - */ -}phNfc_eDiscoveryConfigMode_t; - -/** \ingroup grp_hal_common -* -* \brief Target or Tag Release Mode -* + * set configuration. + * This is valid only when the Target + * is not connected. + */ +}phNfc_eDiscoveryConfigMode_t; + +/** \ingroup grp_hal_common +* +* \brief Target or Tag Release Mode +* * This enumeration defines various modes of releasing an acquired target -* or tag. -* \note None. -*/ -typedef enum phNfc_eReleaseType_t -{ - NFC_INVALID_RELEASE_TYPE =0x00U,/** Poll configuration structure holds information about the * enabling the the type of discovery required by the application. This -* structure is the input parameter for the discovery call -* -* \note All members of this structure are input parameters [out]. -* -* \sa \ref phNfc_eP2PMode_t -* -*/ -typedef struct phNfc_sADD_Cfg_t -{ +* structure is the input parameter for the discovery call +* +* \note All members of this structure are input parameters [out]. +* +* \sa \ref phNfc_eP2PMode_t +* +*/ +typedef struct phNfc_sADD_Cfg_t +{ union - { + { phNfc_sPollDevInfo_t PollCfgInfo; /**< Enable/Disable Specific Reader Functionality and Card Emulation */ - unsigned PollEnabled; /** Can be used to set polling 'Off' - by setting PollEnabled to zero */ - - } PollDevInfo; + unsigned PollEnabled; /** Can be used to set polling 'Off' + by setting PollEnabled to zero */ + + } PollDevInfo; uint32_t Duration; /**< Duration of virtual or idle - period in microseconds in the step size - of 48 microseconds.If duration is set less - than 48 microseconds then default value is + period in microseconds in the step size + of 48 microseconds.If duration is set less + than 48 microseconds then default value is used.For more details please refer PN 544 - user manual*/ - uint8_t NfcIP_Mode ; /**< Select the P2P - speeds using phNfc_eP2PMode_t type. + user manual*/ + uint8_t NfcIP_Mode ; /**< Select the P2P + speeds using phNfc_eP2PMode_t type. This is used to enable NFC-IP Discovery - The related Reader Type will be implicitly - selected */ + The related Reader Type will be implicitly + selected */ uint8_t NfcIP_Tgt_Disable; /**< Flag to - disable the NFCIP1 TARGET */ -} phNfc_sADD_Cfg_t; - -/*@}*/ - -#endif /* PHNFCTYPES */ - + disable the NFCIP1 TARGET */ +} phNfc_sADD_Cfg_t; + +/*@}*/ + +#endif /* PHNFCTYPES */ + diff --git a/packaging/nfc-plugin-nxp.spec b/packaging/nfc-plugin-nxp.spec index 83c8a5a..0745c88 100755 --- a/packaging/nfc-plugin-nxp.spec +++ b/packaging/nfc-plugin-nxp.spec @@ -6,8 +6,8 @@ Name: nfc-plugin-nxp Summary: NFC Plugin for NXP Solution -Version: 0.0.2 -Release: 2 +Version: 0.0.3 +Release: 0 Group: TO_BE/FILLED_IN License: TO BE FILLED IN Source0: %{name}-%{version}.tar.gz diff --git a/src/cutils/log.h b/src/cutils/log.h new file mode 100644 index 0000000..0221f0b --- /dev/null +++ b/src/cutils/log.h @@ -0,0 +1,18 @@ + +#include + +#define LOG_COLOR_RED "\033[0;31m" +#define LOG_COLOR_GREEN "\033[0;32m" +#define LOG_COLOR_BROWN "\033[0;33m" +#define LOG_COLOR_BLUE "\033[0;34m" +#define LOG_COLOR_PURPLE "\033[0;35m" +#define LOG_COLOR_CYAN "\033[0;36m" +#define LOG_COLOR_LIGHTBLUE "\033[0;37m" +#define LOG_COLOR_END "\033[0;m" + +#define LOGE(format,args...) \ +do {\ + LOGD(LOG_COLOR_BROWN"[file = %s : method = %s : line = %d]"LOG_COLOR_END, basename(__FILE__), __func__, __LINE__); \ + LOGD(LOG_COLOR_BROWN""format""LOG_COLOR_END, ##args);\ +}while(0); + diff --git a/src/phDal4Nfc.h b/src/phDal4Nfc.h index 908f3d7..3e39130 100644 --- a/src/phDal4Nfc.h +++ b/src/phDal4Nfc.h @@ -127,19 +127,6 @@ typedef struct phDal4Nfc_Message pphNfcIF_Transact_Completion_CB_t writeCbPtr; } phDal4Nfc_Message_t,*pphDal4Nfc_Message_t; -/** - * \ingroup grp_nfc_dal - *\brief Possible DAL Configuration exposed to upper layer. - * Typically this should be port name (Ex:"COM1","COM2") to which PN544 is connected. - */ -#define PN544_LINK_TYPE_UART ENUM_LINK_TYPE_UART -#define PN544_LINK_TYPE_I2C ENUM_LINK_TYPE_I2C -#define PN544_LINK_TYPE_USB ENUM_LINK_TYPE_USB -#define PN544_LINK_TYPE_TCP ENUM_LINK_TYPE_TCP - -#define PN544_LINK_TYPE_NB ENUM_LINK_TYPE_NB -typedef phLibNfc_eConfigLinkType phDal4Nfc_eConfigLinkType; - typedef phLibNfc_sConfig_t phDal4Nfc_sConfig_t; typedef phLibNfc_sConfig_t *pphDal4Nfc_sConfig_t; @@ -505,8 +492,8 @@ typedef phLibNfc_sConfig_t *pphDal4Nfc_sConfig_t; * *\brief Aborts read wait opertaion. * - * This asynchronous function issues cancellation of the outstanding - * \b \e phDal4Nfc_ReadWait request.If upper layer wants to cancel the + * This asynchronous function issues cancellation of the outstanding + * \b \e phDal4Nfc_ReadWait request.If upper layer wants to cancel the * ongoing read wait operation this function is used. e.g. to abort the * transactions. * diff --git a/src/phDnldNfc.c b/src/phDnldNfc.c index d129b26..77f7764 100644 --- a/src/phDnldNfc.c +++ b/src/phDnldNfc.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd + * Copyright (C) 2010 NXP Semiconductors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +47,7 @@ #include #include #include -//#include +#include /* ################################################################################ ****************************** Macro Definitions ******************************* diff --git a/src/phFriNfc_NdefMap.c b/src/phFriNfc_NdefMap.c index ad9ece3..2583c5d 100644 --- a/src/phFriNfc_NdefMap.c +++ b/src/phFriNfc_NdefMap.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd + * Copyright (C) 2010 NXP Semiconductors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -675,14 +674,12 @@ phFriNfc_NdefMap_ConvertToReadOnly ( break; } -/* Samsung modify for TIZEN */ -#if 0 case PH_FRINFC_NDEFMAP_ISO15693_CARD: { result = phFriNfc_ISO15693_ConvertToReadOnly (NdefMap); break; } -#endif + default: { result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, diff --git a/src/phHal4Nfc.c b/src/phHal4Nfc.c index 2ea0da1..bcb6a1c 100644 --- a/src/phHal4Nfc.c +++ b/src/phHal4Nfc.c @@ -348,15 +348,6 @@ int dlopen_firmware() { return 0; } - -void dlclose_firmware() -{ - if (handle != NULL) - { - dlclose(handle); - handle = NULL; - } -} #endif /** * The open function called by the upper HAL when HAL4 is to be opened @@ -391,8 +382,10 @@ NFCSTATUS phHal4Nfc_Open( openRetVal = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_ALREADY_INITIALISED); } else/*Do an initialization*/ - { + { +#ifdef ANDROID dlopen_firmware(); +#endif /*If hal4 ctxt in Hwreference is NULL create a new context*/ if(NULL == ((phHal_sHwReference_t *)psHwReference)->hal_context) @@ -737,8 +730,6 @@ NFCSTATUS phHal4Nfc_Close( { } - - dlclose_firmware(); } return closeRetVal; } diff --git a/src/phHciNfc_DevMgmt.c b/src/phHciNfc_DevMgmt.c index 242ca9f..4d161a4 100644 --- a/src/phHciNfc_DevMgmt.c +++ b/src/phHciNfc_DevMgmt.c @@ -1,6 +1,5 @@ /* * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1371,7 +1370,7 @@ phHciNfc_Recv_DevMgmt_Event( case NXP_EVT_INFO_MEM_VIOLATION: { event_info.eventType = NFC_INFO_MEM_VIOLATION; -// LOGW("Your NFC controller is kinda hosed, take it to npelly@ to fix"); + LOGW("Your NFC controller is kinda hosed, take it to npelly@ to fix"); break; } case NXP_EVT_INFO_TEMP_OVERHEAT: diff --git a/src/phHciNfc_Generic.h b/src/phHciNfc_Generic.h index f51651c..ee1eeac 100644 --- a/src/phHciNfc_Generic.h +++ b/src/phHciNfc_Generic.h @@ -1,6 +1,5 @@ /* - * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd + * Copyright (C) 2010 NXP Semiconductors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,6 +56,7 @@ ################################################################################ */ #define LOG_TAG "NFC-HCI" +#include #include #include #include diff --git a/src/phLibNfc.c b/src/phLibNfc.c index 4499202..d36f240 100644 --- a/src/phLibNfc.c +++ b/src/phLibNfc.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd + * Copyright (C) 2010 NXP Semiconductors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +42,7 @@ #include #include #include -//#include +#include /* *************************** Macro's ****************************************** */ @@ -871,7 +870,7 @@ NFCSTATUS phLibNfc_Mgt_GetstackCapabilities( /* Check the firmware version */ if (nxp_nfc_full_version == NULL) { // Couldn't load firmware, just pretend we're up to date. -// LOGW("Firmware image not available: this device might be running old NFC firmware!"); + LOGW("Firmware image not available: this device might be running old NFC firmware!"); phLibNfc_StackCapabilities->psDevCapabilities.firmware_update_info = 0; } else { phLibNfc_StackCapabilities->psDevCapabilities.firmware_update_info = memcmp(phLibNfc_StackCapabilities->psDevCapabilities.full_version, nxp_nfc_full_version, diff --git a/src/phLlcNfc_Interface.c b/src/phLlcNfc_Interface.c index 45540ae..fa1b37c 100644 --- a/src/phLlcNfc_Interface.c +++ b/src/phLlcNfc_Interface.c @@ -1,6 +1,5 @@ /* * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +45,7 @@ #endif #define LOG_TAG "NFC-LLC" -//#include +#include /*********************** End of includes ****************************/ /***************************** Macros *******************************/ @@ -787,7 +786,7 @@ phLlcNfc_RdResp_Cb( else if (ps_frame_info->recv_error_count < PH_LLCNFC_MAX_REJ_RETRY_COUNT) { -// LOGW("LLC bad crc"); + LOGW("LLC bad crc"); PH_LLCNFC_PRINT("CRC ERROR RECVD \n"); PH_LLCNFC_DEBUG("RECV ERROR COUNT : 0x%02X\n", ps_frame_info->recv_error_count); @@ -808,7 +807,7 @@ phLlcNfc_RdResp_Cb( } else { -// LOGE("max LLC retries exceeded, stack restart"); + LOGE("max LLC retries exceeded, stack restart"); result = phLlcNfc_Interface_Read (ps_llc_ctxt, PH_LLCNFC_READWAIT_OFF, (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), @@ -833,7 +832,7 @@ phLlcNfc_RdResp_Cb( else if (ps_frame_info->recv_error_count >= PH_LLCNFC_MAX_REJ_RETRY_COUNT) { -// LOGE("max LLC retries exceeded, stack restart"); + LOGE("max LLC retries exceeded, stack restart"); result = phLlcNfc_Interface_Read (ps_llc_ctxt, PH_LLCNFC_READWAIT_OFF, (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), @@ -856,7 +855,7 @@ phLlcNfc_RdResp_Cb( (PH_LLCNFC_MAX_BUFLEN_RECV_SEND > pCompInfo->length) && (pCompInfo->length != ps_recv_pkt->s_llcbuf.llc_length_byte)) { -// LOGE("bad LLC length1 %d", pCompInfo->length); + LOGE("bad LLC length1 %d", pCompInfo->length); ps_frame_info->recv_error_count = (uint8_t) (ps_frame_info->recv_error_count + 1); libnfc_llc_error_count++; @@ -884,7 +883,7 @@ phLlcNfc_RdResp_Cb( value is greater than (0x21 - 1), then pend a read to get 1 byte again */ -// LOGW("bad LLC length byte %x\n", *(pCompInfo->buffer)); + LOGW("bad LLC length byte %x\n", *(pCompInfo->buffer)); ps_frame_info->recv_error_count = (uint8_t) (ps_frame_info->recv_error_count + 1); libnfc_llc_error_count++; @@ -896,7 +895,7 @@ phLlcNfc_RdResp_Cb( } else { -// LOGW("unknown LLC error1"); + LOGW("unknown LLC error1"); ps_frame_info->recv_error_count = (uint8_t) (ps_frame_info->recv_error_count + 1); libnfc_llc_error_count++; @@ -920,7 +919,7 @@ phLlcNfc_RdResp_Cb( } } else if (NFCSTATUS_READ_FAILED == pCompInfo->status) { // partial read - try reading the length byte again -// LOGW("LLC length mis-match\n"); + LOGW("LLC length mis-match\n"); ps_frame_info->recv_error_count = (uint8_t) (ps_frame_info->recv_error_count + 1); libnfc_llc_error_count++; @@ -932,7 +931,7 @@ phLlcNfc_RdResp_Cb( } else { -// LOGW("unknown LLC error2"); + LOGW("unknown LLC error2"); ps_frame_info->recv_error_count = (uint8_t) (ps_frame_info->recv_error_count + 1); libnfc_llc_error_count++; diff --git a/src/phOsalNfc.h b/src/phOsalNfc.h index 0b91341..4d02255 100644 --- a/src/phOsalNfc.h +++ b/src/phOsalNfc.h @@ -1,6 +1,5 @@ /* - * Copyright (C) 2010 NXP Semiconductors - * Copyright (C) 2012 Samsung Elevtronics Co., Ltd + * Copyright (C) 2010 NXP Semiconductors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -167,7 +166,8 @@ void phOsalNfc_DbgString(const char *pString); * * \retval None */ -void phOsalNfc_PrintData(const char *pString, uint32_t length, uint8_t *pBuffer); +void phOsalNfc_PrintData(const char *pString, uint32_t length, uint8_t *pBuffer, + int verbosity); /*! * \ingroup grp_osal_nfc diff --git a/src/utils/Log.h b/src/utils/Log.h new file mode 100644 index 0000000..0221f0b --- /dev/null +++ b/src/utils/Log.h @@ -0,0 +1,18 @@ + +#include + +#define LOG_COLOR_RED "\033[0;31m" +#define LOG_COLOR_GREEN "\033[0;32m" +#define LOG_COLOR_BROWN "\033[0;33m" +#define LOG_COLOR_BLUE "\033[0;34m" +#define LOG_COLOR_PURPLE "\033[0;35m" +#define LOG_COLOR_CYAN "\033[0;36m" +#define LOG_COLOR_LIGHTBLUE "\033[0;37m" +#define LOG_COLOR_END "\033[0;m" + +#define LOGE(format,args...) \ +do {\ + LOGD(LOG_COLOR_BROWN"[file = %s : method = %s : line = %d]"LOG_COLOR_END, basename(__FILE__), __func__, __LINE__); \ + LOGD(LOG_COLOR_BROWN""format""LOG_COLOR_END, ##args);\ +}while(0); + -- 2.7.4