ENDIF("${ARCH}" STREQUAL "arm")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DNFC_TIMER_CONTEXT")
ADD_DEFINITIONS("-DTIZEN_PUBLIC")
ADD_DEFINITIONS("-DSLP_DEBUG")
ADD_DEFINITIONS("-DDAL_TRACE")
static pphDal4Nfc_SContext_t pgDalContext;
static phHal_sHwReference_t * pgDalHwContext;
static sem_t nfc_read_sem;
+static int low_level_traces;
#ifdef USE_MQ_MESSAGE_QUEUE
static phDal4Nfc_DeferredCall_Msg_t nDeferedMessage;
static mqd_t nDeferedCallMessageQueueId;
DAL API IMPLEMENTATION
------------------------------------------------------------------------------------*/
+static void refresh_low_level_traces() {
+#ifdef LOW_LEVEL_TRACES
+ low_level_traces = 1;
+ return;
+#else
+
+#ifdef ANDROID
+ char value[PROPERTY_VALUE_MAX];
+
+ property_get("ro.debuggable", value, "");
+ if (!value[0] || !atoi(value)) {
+ low_level_traces = 0; // user build, do not allow debug
+ return;
+ }
+
+ property_get("debug.nfc.LOW_LEVEL_TRACES", value, "0");
+ if (value[0]) {
+ low_level_traces = atoi(value);
+ return;
+ }
+#endif
+ low_level_traces = 0;
+#endif
+}
+
/*-----------------------------------------------------------------------------
FUNCTION: phDal4Nfc_Register
{
NFCSTATUS result = NFCSTATUS_SUCCESS;
+ // refresh_low_level_traces();
+
if ((NULL != pContext) && (NULL != pHwRef))
{
pContext = pgDalContext;
else
{
static phDal4Nfc_sConfig_t hw_config;
- hw_config.deviceNode = NULL;\r
+ hw_config.deviceNode = NULL;
result = phDal4Nfc_Config(&hw_config, pHwRef );
}
}
return result;
}
-NFCSTATUS phDal4Nfc_ConfigRelease( void *pHwRef)
+NFCSTATUS phDal4Nfc_ConfigRelease(void *pHwRef)
{
NFCSTATUS result = NFCSTATUS_SUCCESS;
/* Register the link callbacks */
memset(&gLinkFunc, 0, sizeof(phDal4Nfc_link_cbk_interface_t));
- switch(PN544_LINK_TYPE_I2C)
+#if 0
+ switch(PN544_LINK_TYPE_I2C)
{
case PN544_LINK_TYPE_UART:
case PN544_LINK_TYPE_USB:
break;
case PN544_LINK_TYPE_I2C:
- {
+ {
+#endif
+
DAL_PRINT("I2C link Config");
/* i2c link interface */
gLinkFunc.init = phDal4Nfc_i2c_initialize;
gLinkFunc.read = phDal4Nfc_i2c_read;
gLinkFunc.write = phDal4Nfc_i2c_write;
gLinkFunc.reset = phDal4Nfc_i2c_reset;
+#if 0
break;
}
-
default:
{
/* Shound not happen : Bad parameter */
return PHNFCSTVAL(CID_NFC_DAL, NFCSTATUS_INVALID_PARAMETER);
}
- }
+}
+#endif
gLinkFunc.init(); /* So that link interface can initialize its internal state */
retstatus = gLinkFunc.open_and_configure(config, phwref);
nDeferedCallMessageQueueId = config->nClientId;
#endif
- usleep(50000);
-
- if(phDal4Nfc_Reset(0) != 0)
- {
- perror("power off is failed !!");
- }
-
- usleep(50000);
-
- if(phDal4Nfc_Reset(1) != 0)
- {
- perror("power on is failed !!");
- }
+// gDalContext.pDev = pn544_dev;
/* Start Read and Write Threads */
if(NFCSTATUS_SUCCESS != phDal4Nfc_StartThreads())
}
gDalContext.hw_valid = TRUE;
+ phDal4Nfc_Reset(1);
+ phDal4Nfc_Reset(0);
+ phDal4Nfc_Reset(1);
return NFCSTATUS_SUCCESS;
}
{
NFCSTATUS retstatus = NFCSTATUS_SUCCESS;
- DAL_DEBUG("phDal4Nfc_Reset: VEN to %d",(int)level);
+ DAL_DEBUG("phDal4Nfc_Reset: VEN to %ld",level);
retstatus = gLinkFunc.reset(level);
PURPOSE: Put the PN544 in download mode, using the GPIO4 pin
-----------------------------------------------------------------------------*/
-NFCSTATUS phDal4Nfc_Download()\r
+NFCSTATUS phDal4Nfc_Download()
{
- NFCSTATUS retstatus = NFCSTATUS_SUCCESS;\r
+ NFCSTATUS retstatus = NFCSTATUS_SUCCESS;
- DAL_DEBUG("phDal4Nfc_Download: GPIO4 to %d",1);\r
+ DAL_DEBUG("phDal4Nfc_Download: GPIO4 to %d",1);
- usleep(10000);\r
- retstatus = phDal4Nfc_Reset(2);\r
-\r
- return retstatus;\r
+ usleep(10000);
+ retstatus = phDal4Nfc_Reset(2);
+
+ return retstatus;
}
-\r
-\r
+
+
/*-----------------------------------------------------------------------------------
DAL INTERNAL IMPLEMENTATION
break;
case PHDAL4NFC_WRITE_MESSAGE:
DAL_PRINT(" Dal deferred write called \n");
-
+#if 0
+ if(low_level_traces)
+ {
+ phOsalNfc_PrintData("SEND", (uint16_t)gReadWriteContext.nNbOfBytesToWrite,
+ gReadWriteContext.pWriteBuffer, low_level_traces);
+ }
+#endif
/* DAL_DEBUG("dalMsg->transactInfo.length : %d\n", dalMsg->transactInfo.length); */
/* Make a Physical WRITE */
/* NOTE: need to usleep(3000) here if the write is for SWP */
usleep(500); /* NXP advise 500us sleep required between I2C writes */
- gReadWriteContext.nNbOfBytesWritten = gLinkFunc.write(gReadWriteContext.pWriteBuffer, gReadWriteContext.nNbOfBytesToWrite);
+ gReadWriteContext.nNbOfBytesWritten = gLinkFunc.write(gReadWriteContext.pWriteBuffer, gReadWriteContext.nNbOfBytesToWrite);
if (gReadWriteContext.nNbOfBytesWritten != gReadWriteContext.nNbOfBytesToWrite)
{
/* controller may be in standby. do it again! */
*/
void phDal4Nfc_DeferredCall(pphDal4Nfc_DeferFuncPointer_t func, void *param)
{
-// int retvalue = 0;
+ int retvalue = 0;
phDal4Nfc_Message_Wrapper_t nDeferedMessageWrapper;
phDal4Nfc_DeferredCall_Msg_t *pDeferedMessage;
static phDal4Nfc_DeferredCall_Msg_t nDeferedMessageRead;
-/*
- * 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 phDbgTrace.h
- * Project: NFC-FRI-1.1 / HAL4.0
- *
- * $Date: Tue Apr 28 11:48:33 2009 $
- * $Author: ing08203 $
- * $Revision: 1.17 $
- * $Aliases: NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,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 PHDBGTRACE_H
-#define PHDBGTRACE_H
-/*@}*/
-
-#include <stdio.h>
-
-
-#ifdef PHDBG_TRACES
-#define MAX_TRACE_BUFFER 300
-
-#ifndef PHDBG_TRACES_LEVEL_0
-#ifndef PHDBG_TRACES_LEVEL_1
-#ifndef PHDBG_TRACES_LEVEL_2
-#define PHDBG_TRACES_LEVEL_0
-#endif
-#endif
-#endif
-
- extern char phOsalNfc_DbgTraceBuffer[];
-
- #ifdef PHDBG_TRACES_LEVEL_0
-
- /*indicates an error that causes a program to abort.*/
- #define PHDBG_FATAL_ERROR(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer,MAX_TRACE_BUFFER, \
- "FATAL ERROR in Module :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "In Function:%s\n",__FUNCTION__ ); \
- phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\
- }
-
- #define PHDBG_CRITICAL_ERROR(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "CRITICAL ERROR in Module :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "In Function:%s\n",__FUNCTION__ ); \
- phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\
- }
- #define PHDBG_WARNING(Str)
- #define PHDBG_INFO(Str)
- #endif /*End of PHDBG_TRACES_LEVEL_0 */
-
- #ifdef PHDBG_TRACES_LEVEL_1
-
- /*indicates an error that causes a program to abort.*/
- #define PHDBG_FATAL_ERROR(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "FATAL ERROR in Module :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "In Function:%s\n",__FUNCTION__ ); \
- phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\
- }
-
- #define PHDBG_CRITICAL_ERROR(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "CRITICAL ERROR in Module :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "In Function:%s\n",__FUNCTION__ ); \
- phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\
- }
- /*Normally this macro shall be used indicate system state that might cause problems in future.*/
- #define PHDBG_WARNING(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "WARNING :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- phOsalNfc_DbgString (Str);\
- phOsalNfc_DbgString ("\n");\
- }
- #define PHDBG_INFO(Str)
- #endif /*End of PHDBG_TRACES_LEVEL_1 */
-
- #ifdef PHDBG_TRACES_LEVEL_2
-
- /*indicates an error that causes a program to abort.*/
- #define PHDBG_FATAL_ERROR(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "FATAL ERROR in Module :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "In Function:%s\n",__FUNCTION__ ); \
- phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\
- }
-
- #define PHDBG_CRITICAL_ERROR(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "CRITICAL ERROR in Module :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "In Function:%s\n",__FUNCTION__ ); \
- phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\
- }
- /*Normally this macro shall be used indicate system state that might cause problems in future.*/
- #define PHDBG_WARNING(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "WARNING :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- phOsalNfc_DbgString (Str);\
- phOsalNfc_DbgString ("\n");\
- }
-
- #define PHDBG_INFO(Str) {\
- snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \
- "DBG INFO :%s\n",__FILE__);\
- phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\
- phOsalNfc_DbgString (Str);\
- phOsalNfc_DbgString ("\n");\
- }
-
-
-
-#endif /*End of PHDBG_TRACES_LEVEL_2 */
-#else
-#define PHDBG_FATAL_ERROR(Str)
-#define PHDBG_CRITICAL_ERROR(Str)
-#define PHDBG_WARNING(Str)
-#define PHDBG_INFO(Str)
-
-
-#endif /*end of DEBUG trace*/
-
-
-#ifdef FRI_CUSTOM_LOG
-
-#include <stdio.h>
-#define LOG_TAG "NFC_STACK"
-#include <dlog.h>
-
-#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 CUST_MSG_DAL(format,args...) \
-do {\
- LOGD(LOG_COLOR_BLUE""format""LOG_COLOR_END, ##args);\
-}while(0)
-
-#define CUST_MSG_WFL_DAL(format,args...) \
-do {\
- LOGD(LOG_COLOR_BLUE"[file = %s : method = %s : line = %d] "LOG_COLOR_END,__FILE__, __func__, __LINE__); \
- LOGD(LOG_COLOR_BLUE""format""LOG_COLOR_END, ##args);\
-}while(0);
-
-#else
-#define CUST_MSG_DAL(format,args...)
-#define CUST_MSG_WFL_DAL(format,args...)
-#endif
-
-
-#endif /* end of PHDBGTRACE_H */
+/*\r
+ * Copyright (C) 2010 NXP Semiconductors\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+\r
+/**\r
+ * \file phDbgTrace.h\r
+ * Project: NFC-FRI-1.1 / HAL4.0\r
+ *\r
+ * $Date: Tue Apr 28 11:48:33 2009 $\r
+ * $Author: ing08203 $\r
+ * $Revision: 1.17 $\r
+ * $Aliases: NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,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 $\r
+ *\r
+ */\r
+\r
+/*@{*/\r
+#ifndef PHDBGTRACE_H\r
+#define PHDBGTRACE_H\r
+/*@}*/\r
+\r
+#include <stdio.h>\r
+\r
+\r
+#ifdef PHDBG_TRACES \r
+#define MAX_TRACE_BUFFER 300\r
+\r
+#ifndef PHDBG_TRACES_LEVEL_0\r
+#ifndef PHDBG_TRACES_LEVEL_1\r
+#ifndef PHDBG_TRACES_LEVEL_2\r
+#define PHDBG_TRACES_LEVEL_0\r
+#endif\r
+#endif\r
+#endif\r
+\r
+ extern char phOsalNfc_DbgTraceBuffer[];\r
+\r
+ #ifdef PHDBG_TRACES_LEVEL_0\r
+ \r
+ /*indicates an error that causes a program to abort.*/\r
+ #define PHDBG_FATAL_ERROR(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer,MAX_TRACE_BUFFER, \\r
+ "FATAL ERROR in Module :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "In Function:%s\n",__FUNCTION__ ); \\r
+ phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\\r
+ }\r
+\r
+ #define PHDBG_CRITICAL_ERROR(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "CRITICAL ERROR in Module :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "In Function:%s\n",__FUNCTION__ ); \\r
+ phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\\r
+ }\r
+ #define PHDBG_WARNING(Str)\r
+ #define PHDBG_INFO(Str) \r
+ #endif /*End of PHDBG_TRACES_LEVEL_0 */\r
+\r
+ #ifdef PHDBG_TRACES_LEVEL_1\r
+\r
+ /*indicates an error that causes a program to abort.*/\r
+ #define PHDBG_FATAL_ERROR(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "FATAL ERROR in Module :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "In Function:%s\n",__FUNCTION__ ); \\r
+ phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\\r
+ }\r
+\r
+ #define PHDBG_CRITICAL_ERROR(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "CRITICAL ERROR in Module :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "In Function:%s\n",__FUNCTION__ ); \\r
+ phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\\r
+ }\r
+ /*Normally this macro shall be used indicate system state that might cause problems in future.*/\r
+ #define PHDBG_WARNING(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "WARNING :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ phOsalNfc_DbgString (Str);\\r
+ phOsalNfc_DbgString ("\n");\\r
+ }\r
+ #define PHDBG_INFO(Str) \r
+ #endif /*End of PHDBG_TRACES_LEVEL_1 */\r
+\r
+ #ifdef PHDBG_TRACES_LEVEL_2\r
+\r
+ /*indicates an error that causes a program to abort.*/\r
+ #define PHDBG_FATAL_ERROR(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "FATAL ERROR in Module :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "In Function:%s\n",__FUNCTION__ ); \\r
+ phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\\r
+ }\r
+\r
+ #define PHDBG_CRITICAL_ERROR(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "CRITICAL ERROR in Module :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "In Function:%s\n",__FUNCTION__ ); \\r
+ phOsalNfc_DbgString (phOsalNfc_DbgTraceBuffer);\\r
+ }\r
+ /*Normally this macro shall be used indicate system state that might cause problems in future.*/\r
+ #define PHDBG_WARNING(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "WARNING :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ phOsalNfc_DbgString (Str);\\r
+ phOsalNfc_DbgString ("\n");\\r
+ }\r
+ \r
+ #define PHDBG_INFO(Str) {\\r
+ snprintf(phOsalNfc_DbgTraceBuffer, MAX_TRACE_BUFFER, \\r
+ "DBG INFO :%s\n",__FILE__);\\r
+ phOsalNfc_DbgString(phOsalNfc_DbgTraceBuffer);\\r
+ phOsalNfc_DbgString (Str);\\r
+ phOsalNfc_DbgString ("\n");\\r
+ }\r
+ \r
+\r
+\r
+#endif /*End of PHDBG_TRACES_LEVEL_2 */\r
+#else\r
+#define PHDBG_FATAL_ERROR(Str)\r
+#define PHDBG_CRITICAL_ERROR(Str) \r
+#define PHDBG_WARNING(Str)\r
+#define PHDBG_INFO(Str) \r
+\r
+\r
+#endif /*end of DEBUG trace*/\r
+#endif /* end of PHDBGTRACE_H */\r
/*
* 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.
/**< Indicates PN544 Power Modes Configuration for the NFC Device,
- 0x00U -> PN544 stays in active bat mode
+ 0x00U -> PN544 stays in active bat mode \r
(except when generating RF field)
- 0x01U -> PN544 goes in standby when possible otherwise
+ 0x01U -> PN544 goes in standby when possible otherwise \r
stays in active bat mode
- 0x02U -> PN544 goes in idle mode as soon as it can
+ 0x02U -> PN544 goes in idle mode as soon as it can \r
(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
+ 0x03U -> PN544 goes in standby when possible otherwise goes in idle mode \r
+ as soon as it can (otherwise it is in active bat except when \r
generating RF field)
*/
/**< Max number of remote devices supported */
#ifndef MAX_REMOTE_DEVICES
-#define MAX_REMOTE_DEVICES 0x0A
+#define MAX_REMOTE_DEVICES 0x0A \r
#endif
/**< System Event Notification
#endif
#ifndef NXP_MIFARE_XCHG_TIMEOUT
-#define NXP_MIFARE_XCHG_TIMEOUT 0x03U
+#define NXP_MIFARE_XCHG_TIMEOUT 0x0BU\r
#endif
#ifndef NXP_FELICA_XCHG_TIMEOUT
/**< Presence check interval in milliseconds */
#ifndef PRESENCE_CHECK_INTERVAL
#define PRESENCE_CHECK_INTERVAL 500U
-#endif
+#endif \r
-/** Resolution value for the timer, here the
+/** Resolution value for the timer, here the \r
timer resolution is 500 milliseconds */
#ifndef TIMER_RESOLUTION
#define TIMER_RESOLUTION 500U
-#endif
+#endif \r
/* 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,
+/**< Defines guard time out value for LLC timer, \r
1000 is in milliseconds */
#ifndef LINK_GUARD_TIMEOUT
#define LINK_GUARD_TIMEOUT 1000U
-#endif
+#endif \r
-/**< Defines connection time out value for LLC timer,
+/**< Defines connection time out value for LLC timer, \r
1000 is in milliseconds */
#ifndef LINK_CONNECTION_TIMEOUT
#define LINK_CONNECTION_TIMEOUT 1000U
+#endif \r
+\r
+/**< Defines ACK time out value for LLC timer,\r
+ 150 is in milliseconds */\r
+#ifndef LINK_ACK_TIMEOUT\r
+#define LINK_ACK_TIMEOUT 1U\r
#endif
#ifndef NXP_DNLD_COMPLETE_TIMEOUT
-#define NXP_DNLD_COMPLETE_TIMEOUT 120000U
+#define NXP_DNLD_COMPLETE_TIMEOUT 60000U\r
#endif
-/**< Define to configure the Active Mode Polling Guard Time-out
+/**< Define to configure the Active Mode Polling Guard Time-out \r
*/
#ifndef DEV_MGMT_ACT_GRD_TO_DEFAULT
#ifndef HOST_CE_A_SAK_DEFAULT
#define HOST_CE_A_SAK_DEFAULT 0x20U
-#endif
+#endif \r
#ifndef NXP_CE_A_ATQA_HIGH
#define NXP_CE_A_ATQA_HIGH 0x00U
#ifndef NXP_UICC_CE_RIGHTS
#define NXP_UICC_CE_RIGHTS 0x0FU
-#endif
+#endif \r
#ifndef NXP_UICC_RD_RIGHTS
#define NXP_UICC_RD_RIGHTS 0x00U
-#endif
+#endif \r
/*
*/
#define ES_HW_VER 32
-
+ \r
/*
*****************************************************************
*************** FEATURE SPECIFIC MACROS *************************
* Initialisation */
#if !defined(NXP_SMX)
-#define NXP_SMX 0
+#define NXP_SMX 1\r
#endif
#if (NXP_SMX == 1)
-#define NXP_HAL_ENABLE_SMX
+#define NXP_HAL_ENABLE_SMX \r
#endif
/**< Macro to Enable the Host Session
#define LLC_TIMER_ENABLE
/**< Macro to enable HCI Response timer */
-/* #define NXP_NFC_HCI_TIMER 1 */
+#define NXP_NFC_HCI_TIMER 1\r
/* A Workaround to Delay and obtain the UICC Status Information */
/* #define UICC_STATUS_DELAY */
boolean data type */
typedef uint16_t NFCSTATUS; /**< \ingroup grp_nfc_common
- NFC return values
+ NFC return values \r
\ref phNfcStatus.h for different status
values */
#endif
/* This Macro to be used to resolve Unused and unreference
- * compiler warnings.
+ * compiler warnings. \r
*/
#define PHNFC_UNUSED_VARIABLE(x) for((x)=(x);(x)!=(x);)
#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)
+#define PHHAL_MAX_ATR_LENGTH 0x30U /**< Maximum ATR_RES (General Bytes) \r
* length expected */
#define PHHAL_ATQB_LENGTH 0x0BU /**< ATQB length */
ISO15693 Tag */
#define VENDOR_NAME_LEN 0x14U
-#define MAX_TRANSFER_UNIT 0x21U
+#define MAX_TRANSFER_UNIT 0x21U \r
#define SESSIONID_SIZE 0x08U
#define MAX_AID_LEN 0x10U
#define MAX_UICC_PARAM_LEN 0xFFU
/**
* Data Buffer Structure to hold the Data Buffer
*
- * This structure holds the Data in the Buffer of the specified
+ * This structure holds the Data in the Buffer of the specified \r
* size.
- *
+ * \r
*/
typedef struct 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.
- */
+ */ \r
typedef struct phLibNfc_sConfig_t
{
/** Device node of the controller */
/**
*\brief Deferred call declaration.
- * This type of API is called from ClientApplication ( main thread) to notify
+ * This type of API is called from ClientApplication ( main thread) to notify \r
* 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
+ * This type of data is passed as parameter from ClientApplication (main thread) to the \r
* 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
+ * This type of information is packed as message data when \ref PH_LIBNFC_DEFERREDCALL_MSG \r
* type message is posted to message handler thread.
- */
+ */ \r
typedef struct phLibNfc_DeferredCall_t
{
pphLibNfc_DeferredCallback_t pCallback;/**< pointer to Deferred callback */
*/
typedef struct phNfc_sSupProtocol_t
{
- unsigned int MifareUL : 1; /**< Protocol Mifare Ultra Light or
+ unsigned int MifareUL : 1; /**< Protocol Mifare Ultra Light or \r
any NFC Forum Type-2 tags */
unsigned int MifareStd : 1; /**< Protocol Mifare Standard. */
unsigned int ISO14443_4A : 1; /**< Protocol ISO14443-4 Type A. */
* \brief Information related to the NFC Device
*
* The <em> Device Information Structure </em> holds information
- * related to the NFC IC read during initialization time.
+ * related to the NFC IC read during initialization time. \r
* It allows the caller firware, hardware version, the model id,
- * HCI verison supported and vendor name. Refer to the NFC Device
+ * HCI verison supported and vendor name. Refer to the NFC Device \r
* User Manual on how to interpret each of the values. In addition
- * it also contains capabilities of the NFC Device such as the
+ * it also contains capabilities of the NFC Device such as the \r
* protocols supported in Reader and emulation mode
*
*/
Vendor name (Null terminated string)*/
uint8_t full_version[NXP_FULL_VERSION_LEN];
- phNfc_sSupProtocol_t ReaderSupProtocol; /**< Supported protocols
+ phNfc_sSupProtocol_t ReaderSupProtocol; /**< Supported protocols \r
(Bitmapped) in Reader mode. */
phNfc_sSupProtocol_t EmulationSupProtocol; /**< Supported protocols
- (Bitmapped) in Emulation
+ (Bitmapped) in Emulation \r
mode. */
char firmware_update_info; /** */
} phNfc_sDeviceCapabilities_t;
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
- based on MIFARE commands type used.
- Formatted buffer shall follow below
+ Format of the phLibNfc_sTransceiveInfo_t \r
+ content in this case shall be as below: \r
+ \95 cmd: filed shall set to phHal_eMifareRaw . \r
+ \95 addr : doesn't carry any significance.\r
+ \95 sSendData : Shall contain formatted raw buffer \r
+ based on MIFARE commands type used. \r
+ Formatted buffer shall follow below \r
formating scheme.
-
+ \r
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
+ Ex: With Write 4 byte command on block 8 looks as \r
+ " 0xA2,0x08,0x01,0x02,0x03,0x04,CRC1,CRC2 \r
+ Note : For MIFARE Std card we recommend use MIFARE \r
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.
+ Format of the phLibNfc_sTransceiveInfo_t content in this case is : \r
+ \95 cmd: field shall set to phHal_eMifareAuthentA . \r
+ \95 addr : indicates MIFARE block address. \r
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.
+ \95 sSendData : Shall contain authentication key values. \r
+ sSendData ,buffer shall contain authentication \r
+ key values 01 02 03 04 05 06 authenticates \r
+ block 08 with the key 0x01[..]06. If this \r
+ command fails, then user needs to reactivate \r
+ the remote Mifare card. \r
*/
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.
+ Format of the phLibNfc_sTransceiveInfo_t content in this case is : \r
+ \95 cmd: field shall set to phHal_eMifareAuthentB . \r
+ \95 addr : indicates MIFARE block address. \r
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.
+ \95 sSendData : Shall contain authentication key values. \r
+ sSendData ,buffer shall contain authentication \r
+ key values 01 02 03 04 05 06 authenticates \r
+ block 08 with the key 0x01[..]06. If this \r
+ command fails, then user needs to reactivate \r
+ the remote Mifare card. \r
*/
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
- to read the data into.
+ Format of the phLibNfc_sTransceiveInfo_t content in this case is : \r
+ \95 cmd: field shall set to phHal_eMifareRead16 . \r
+ \95 addr : memory adress to read. \r
+ \95 sRecvData : Shall contain buffer of size 16 \r
+ to read the data into. \r
- If this command fails, the user needs to reactivate the
+ If this command fails, the user needs to reactivate the \r
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
- the data bytes to be written.
-
- If this command fails, the user needs to reactivate the
+ Format of the phLibNfc_sTransceiveInfo_t content in this case is : \r
+ \95 cmd: field shall set to phHal_eMifareWrite16 . \r
+ \95 addr : starting memory adress to write from. \r
+ \95 sSendData : Shall contain buffer of size 16 containing\r
+ the data bytes to be written. \r
+ \r
+ If this command fails, the user needs to reactivate the \r
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
- the data bytes to be written.
+ Format of the phLibNfc_sTransceiveInfo_t content in this case is : \r
+ \95 cmd: field shall set to phHal_eMifareWrite4 . \r
+ \95 addr : starting memory adress to write from. \r
+ \95 sSendData : Shall contain buffer of size 4 containing\r
+ the data bytes to be written. \r
- If this command fails, the user needs to reactivate the
+ If this command fails, the user needs to reactivate the \r
the remote Mifare card
*/
phNfc_eMifareInc = 0xC1U, /**< Increment. */
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
+ - This command sends the data buffer directly \r
to the remote device */
} phNfc_eIso14443_4_CmdList_t;
typedef enum phNfc_eNfcIP1CmdList_t
{
phNfc_eNfcIP1_Raw = 0x00U /**< NfcIP Exchange command:\n
- - This command sends the data buffer directly
+ - This command sends the data buffer directly \r
to the remote device */
}phNfc_eNfcIP1CmdList_t;
{
#if 0
phNfc_eIso15693_Raw = 0x00U, /**< ISO 15693 Exchange Raw command:\n
- - This command sends the data buffer directly
+ - This command sends the data buffer directly \r
to the remote device */
#endif
phNfc_eIso15693_Cmd = 0x20U, /**< ISO 15693 Exchange command:\n
- - This command is used to access the card
+ - This command is used to access the card \r
to the remote device */
phNfc_eIso15693_Invalid = 0xFFU /**< Invalid Command */
} phNfc_eIso15693_CmdList_t;
typedef enum phNfc_eFelicaCmdList_t
{
phNfc_eFelica_Raw = 0xF0U, /**< Felica Raw command:\n
- - This command sends the data buffer directly
+ - This command sends the data buffer directly \r
to the remote device */
phNfc_eFelica_Check = 0x00, /**< Felica Check command:\n
- This command checks the data from the Felica
typedef enum phNfc_eJewelCmdList_t
{
phNfc_eJewel_Raw = 0x00U, /**< Jewel command:\n
- - This command sends the data buffer directly
+ - This command sends the data buffer directly \r
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
+* \brief Remote Device Reader A RF Gate Information Container \r
*
* The <em> Reader A structure </em> includes the available information
-* related to the discovered ISO14443A remote device. This information
+* related to the discovered ISO14443A remote device. This information \r
* is updated for every device discovery.
* \note None.
*
{
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
+ uint8_t UidLength; /**< UID information length, shall not be greater \r
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 AppData[PHHAL_MAX_ATR_LENGTH]; /**< Application data information of the \r
+ tag discovered (= Historical bytes for \r
+ type A) */ \r
uint8_t AppDataLength; /**< Application data length */
uint8_t Sak; /**< SAK informationof the TYPE A
Tag Discovered */
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
+ uint8_t Fwi_Sfgt; /**< Frame waiting time and start up frame guard \r
+ time as defined in ISO/IEC 14443-4[7] for \r
type A */
} phNfc_sIso14443AInfo_t;
/** \ingroup grp_hal_nfci
*
-* \brief Remote Device Reader B RF Gate Information Container
+* \brief Remote Device Reader B RF Gate Information Container \r
*
* The <em> Reader B structure </em> includes the available information
-* related to the discovered ISO14443B remote device. This information
+* related to the discovered ISO14443B remote device. This information \r
* is updated for every device discovery.
* \note None.
*
*/
-typedef struct phNfc_sIso14443BInfo_t
+typedef struct phNfc_sIso14443BInfo_t \r
{
union phNfc_uAtqBInfo
{
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 HiLayerResp[PHHAL_MAX_ATR_LENGTH]; /**< Higher Layer Response information \r
+ in answer to ATRRIB Command for Type B */ \r
uint8_t HiLayerRespLength; /**< Higher Layer Response length */
uint8_t Afi; /**< Application Family Identifier of TYPE B
Tag Discovered */
/** \ingroup grp_hal_nfci
*
-* \brief Remote Device Reader B prime RF Gate Information Container
+* \brief Remote Device Reader B prime RF Gate Information Container \r
*
*/
-typedef struct phNfc_sIso14443BPrimeInfo_t
+typedef struct phNfc_sIso14443BPrimeInfo_t \r
{
/* TODO: This will be updated later */
void *BPrimeCtxt;
/** \ingroup grp_hal_nfci
*
-* \brief Remote Device Jewel Reader RF Gate Information Container
+* \brief Remote Device Jewel Reader RF Gate Information Container \r
*
* The <em> Jewel Reader structure </em> includes the available information
-* related to the discovered Jewel remote device. This information
+* related to the discovered Jewel remote device. This information \r
* is updated for every device discovery.
* \note None.
*
*/
-typedef struct phNfc_sJewelInfo_t
+typedef struct phNfc_sJewelInfo_t \r
{
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
+ uint8_t UidLength; /**< UID information length, shall not be greater \r
than PHHAL_MAX_UID_LENGTH i.e., 10 */
uint8_t HeaderRom0; /**< Header Rom byte zero */
uint8_t HeaderRom1; /**< Header Rom byte one */
/** \ingroup grp_hal_nfci
*
-* \brief Remote Device Felica Reader RF Gate Information Container
+* \brief Remote Device Felica Reader RF Gate Information Container \r
*
* The <em> Felica Reader structure </em> includes the available information
-* related to the discovered Felica remote device. This information
+* related to the discovered Felica remote device. This information \r
* 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
+ uint8_t IDmLength; /**< IDm length, shall not be greater \r
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 */
/** \ingroup grp_hal_nfci
*
-* \brief Remote Device Reader 15693 RF Gate Information Container
+* \brief Remote Device Reader 15693 RF Gate Information Container \r
*
* The <em> Reader A structure </em> includes the available information
-* related to the discovered ISO15693 remote device. This information
+* related to the discovered ISO15693 remote device. This information \r
* is updated for every device discovery.
* \note None.
*
{
uint8_t Uid[PHHAL_15693_UID_LENGTH]; /**< UID information of the 15693
Tag Discovered */
- uint8_t UidLength; /**< UID information length, shall not be greater
+ uint8_t UidLength; /**< UID information length, shall not be greater \r
than PHHAL_15693_UID_LENGTH i.e., 8 */
uint8_t Dsfid; /**< DSF information of the 15693
Tag Discovered */
*
* \brief NFC Data Rate Supported between the Reader and the Target
*
-* The <em> \ref phHalNfc_eDataRate enum </em> lists all the Data Rate
+* The <em> \ref phHalNfc_eDataRate enum </em> lists all the Data Rate \r
* values to be used to determine the rate at which the data is transmitted
* to the target.
*
/** \ingroup grp_hal_nfci
*
-* \brief NFCIP1 Data rates
+* \brief NFCIP1 Data rates \r
*
*/
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_106 = 0x00U, \r
+ phNfc_eDataRate_212, \r
+ phNfc_eDataRate_424, \r
+ /* phNfc_eDataRate_848, \r
+ phNfc_eDataRate_1696, \r
+ phNfc_eDataRate_3392, \r
phNfc_eDataRate_6784,*/
- phNfc_eDataRate_RFU
+ phNfc_eDataRate_RFU \r
} phNfc_eDataRate_t;
/** \ingroup grp_hal_nfci
*
-* \brief NFCIP1 Gate Information Container
+* \brief NFCIP1 Gate Information Container \r
*
* The <em> NFCIP1 structure </em> includes the available information
-* related to the discovered NFCIP1 remote device. This information
+* related to the discovered NFCIP1 remote device. This information \r
* is updated for every device discovery.
* \note None.
*
*/
-typedef struct phNfc_sNfcIPInfo_t
+typedef struct phNfc_sNfcIPInfo_t \r
{
- /* Contains the random NFCID3I conveyed with the ATR_REQ.
- always 10 bytes length
+ /* Contains the random NFCID3I conveyed with the ATR_REQ. \r
+ always 10 bytes length \r
or contains the random NFCID3T conveyed with the ATR_RES.
always 10 bytes length */
- uint8_t NFCID[PHHAL_MAX_UID_LENGTH];
+ uint8_t NFCID[PHHAL_MAX_UID_LENGTH]; \r
uint8_t NFCID_Length;
/* ATR_RES = General bytes length, Max length = 48 bytes */
- uint8_t ATRInfo[PHHAL_MAX_ATR_LENGTH];
+ uint8_t ATRInfo[PHHAL_MAX_ATR_LENGTH]; \r
uint8_t ATRInfo_Length;
/**< SAK information of the tag discovered */
uint8_t SelRes;
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 */
+ /**< Maximum frame length supported by the NFCIP device */ \r
uint16_t MaxFrameLength;
/**< Data rate supported by the NFCIP device */
phNfc_eDataRate_t Nfcip_Datarate;
*
* The <em> RF Device Type List </em> 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
+* types to identify a Remote Reader (denoted by _PCD) and \r
* Remote Tag (denoted by _PICC)
* \note None.
*
phNfc_eISO15693_PICC,
/* NFC-IP1 Device Types */
- phNfc_eNfcIP1_Target,
- phNfc_eNfcIP1_Initiator,
+ phNfc_eNfcIP1_Target, \r
+ phNfc_eNfcIP1_Initiator, \r
/* Other Sources */
phNfc_eInvalid_DevType
* Device detected by the polling function .\n
* It lists parameters common to all supported remote devices.
*
- * \note
+ * \note \r
*
* \sa \ref phHal4Nfc_ConfigureDiscovery and \ref phHal4Nfc_Connect
*
*/
typedef struct phNfc_sRemoteDevInformation_t
{
- uint8_t SessionOpened; /**< [out] Boolean
+ uint8_t SessionOpened; /**< [out] Boolean \r
* 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
+ phNfc_eRemDevType_t RemDevType; /**< [out] Remote device type which says that remote \r
+ is Reader A or Reader B or NFCIP or Felica or \r
Reader B Prime or Jewel*/
phNfc_uRemoteDevInfo_t RemoteDevInfo; /**< Union of available Remote Device.
* \ref phNfc_uRemoteDevInfo_t Information. */
/** \ingroup grp_hal_common
*
- * \brief Transceive Information Data Structure for sending commands/response
+ * \brief Transceive Information Data Structure for sending commands/response \r
* to the remote device
*
- * The <em> Transceive Information Data Structure </em> is used to pass the
+ * The <em> Transceive Information Data Structure </em> is used to pass the \r
* Command, Address (only required for MIFARE) and the send and receive data
* data structure (buffer and length) for communication with remote device
*
* \brief Poll Device Information for conifiguring the discovery wheel
Reader and Card Emulation Phases
*
-* The <em> \ref phNfc_sPollDevInfo_t enum </em> is used to enable/disable
-* phases of the discovery wheel related to specific reader types and
+* The <em> \ref phNfc_sPollDevInfo_t enum </em> is used to enable/disable \r
+* phases of the discovery wheel related to specific reader types and \r
* 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
*/
typedef struct phNfc_sPollDevInfo_t
{
- unsigned EnableIso14443A : 1; /**< Flag to enable
+ unsigned EnableIso14443A : 1; /**< Flag to enable \r
Reader A discovery */
- unsigned EnableIso14443B : 1; /**< Flag to enable
+ unsigned EnableIso14443B : 1; /**< Flag to enable \r
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
+ unsigned EnableIso15693 : 1; /**< Flag to enable \r
ISO 15693 discovery */
- unsigned EnableNfcActive : 1; /**< Flag to enable
- Active Mode of NFC-IP discovery.
- This is updated internally
+ unsigned EnableNfcActive : 1; /**< Flag to enable \r
+ Active Mode of NFC-IP discovery. \r
+ This is updated internally \r
based on the NFC-IP speed.
*/
unsigned RFU : 1; /**< Reserved for future use */
- unsigned DisableCardEmulation : 1; /**< Flag to
+ unsigned DisableCardEmulation : 1; /**< Flag to \r
disable the card emulation */
} phNfc_sPollDevInfo_t;
*
* \brief P2P speed for the Initiator
*
-* The <em> \ref phNfc_eP2PMode_t enum </em> lists all the NFCIP1 speeds
+* The <em> \ref phNfc_eP2PMode_t enum </em> lists all the NFCIP1 speeds \r
* to be used for configuring the NFCIP1 discovery
*
* \note None.
/** \ingroup grp_hal_common
*
-* \brief
+* \brief \r
*
* \note None.
*/
*
* \note None.
*/
-typedef struct phNfc_sNfcIPCfg_t
+typedef struct phNfc_sNfcIPCfg_t \r
{
/* ATR_RES = General bytes length, Max length = 48 bytes */
uint8_t generalBytesLength;
- uint8_t generalBytes[PHHAL_MAX_ATR_LENGTH];
+ uint8_t generalBytes[PHHAL_MAX_ATR_LENGTH]; \r
/* TODO: This will be updated later for any additional params*/
} phNfc_sNfcIPCfg_t;
* \brief Discovery Configuration Mode
*
* This enumeration is used to choose the Discovery Configuration
-* Mode :- Configure and Start, Stop or Start with last set
+* Mode :- Configure and Start, Stop or Start with last set \r
* configuration
* \note None.
*/
typedef enum phNfc_eDiscoveryConfigMode_t
{
- NFC_DISCOVERY_CONFIG = 0x00U,/**< Configure discovery with values
- in phNfc_sADD_Cfg_t and start
+ NFC_DISCOVERY_CONFIG = 0x00U,/**< Configure discovery with values \r
+ in phNfc_sADD_Cfg_t and start \r
discovery */
NFC_DISCOVERY_START, /**< Start Discovery with previously set
configuration */
NFC_DISCOVERY_STOP, /**< Stop the Discovery */
- NFC_DISCOVERY_RESUME /**< Resume the Discovery with previously
+ NFC_DISCOVERY_RESUME /**< Resume the Discovery with previously \r
* set configuration.
* This is valid only when the Target
* is not connected.
*
* \brief Target or Tag Release Mode
*
-* This enumeration defines various modes of releasing an acquired target
+* This enumeration defines various modes of releasing an acquired target \r
* or tag.
* \note None.
*/
typedef enum phNfc_eReleaseType_t
{
NFC_INVALID_RELEASE_TYPE =0x00U,/**<Invalid release type */
- NFC_DISCOVERY_RESTART, /**< Release current target and
+ NFC_DISCOVERY_RESTART, /**< Release current target and \r
restart discovery within same technology*/
NFC_DISCOVERY_CONTINUE, /**< Release current target and continue
discovery with next technology in the wheel */
*
* \brief Poll configuration structure
*
-* The <em> Poll configuration structure </em> holds information about the
-* enabling the the type of discovery required by the application. This
+* The <em> Poll configuration structure </em> holds information about the \r
+* enabling the the type of discovery required by the application. This \r
* structure is the input parameter for the discovery call
*
* \note All members of this structure are input parameters [out].
*/
typedef struct phNfc_sADD_Cfg_t
{
- union
+ union \r
{
- phNfc_sPollDevInfo_t PollCfgInfo; /**< Enable/Disable Specific
- Reader Functionality and
- Card Emulation */
+ phNfc_sPollDevInfo_t PollCfgInfo; /**< Enable/Disable Specific \r
+ Reader Functionality and \r
+ Card Emulation */ \r
unsigned PollEnabled; /** Can be used to set polling 'Off'
by setting PollEnabled to zero */
} PollDevInfo;
- uint32_t Duration; /**< Duration of virtual or idle
+ uint32_t Duration; /**< Duration of virtual or idle \r
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
+ used.For more details please refer PN 544 \r
user manual*/
uint8_t NfcIP_Mode ; /**< Select the P2P
speeds using phNfc_eP2PMode_t type.
- This is used to enable NFC-IP Discovery
+ This is used to enable NFC-IP Discovery \r
The related Reader Type will be implicitly
selected */
- uint8_t NfcIP_Tgt_Disable; /**< Flag to
+ uint8_t NfcIP_Tgt_Disable; /**< Flag to \r
disable the NFCIP1 TARGET */
} phNfc_sADD_Cfg_t;
* This asynchronous function reads the data from the driver in which length\r
* and the required buffer are sent by upper layer. This interface enables\r
* reader thread in case there is no read requests pending and returns sucessfully.\r
- * Once read operation is complete, it notifies to upper layer through callback\r
+ * Once read operation is complete, it notifies to upper layer through callback \r
* registered in the \b \e phDal4Nfc_Register() function.\r
*\r
*\r
* \brief Allows to wait before reading data block from HW Interface.\r
*\r
* This asynchronous function waits before reading the data from the\r
- * driver in which length and the required buffer are sent by upper layer.\r
+ * driver in which length and the required buffer are sent by upper layer. \r
* This interface enables reader thread to wait for predefined time period\r
- * (predefined time period is configurable by the DAL implementer) to complete\r
- * read request.Once read operation is complete, it notifies to upper layer\r
+ * (predefined time period is configurable by the DAL implementer) to complete \r
+ * read request.Once read operation is complete, it notifies to upper layer \r
* through callback registered in the \b \e phDal4Nfc_Register()\r
* function. Read request is expected to get complete within this time.\r
*\r
* sends the HANDLE to the caller.\r
*\r
* \param[in] config DAL configuration details as provided\r
- * by the upper layer.\r
+ * by the upper layer. \r
* \param[in,out] phwref pointer to which valid Handle to DAL\r
* interface is assigned.\r
*\r
*\r
* \brief Release configuration for the given HW Interface.\r
*\r
- * \copydoc page_reg Release all the variables of the DAL component, that has been\r
+ * \copydoc page_reg Release all the variables of the DAL component, that has been \r
* initialised in \b phDal4Nfc_Config function (Synchronous function).\r
*\r
* \param[in] pHwRef Link information of the hardware\r
*UpperLayer=>phDal4Nfc [label="phDal4Nfc_Shutdown()",URL="\ref phDal4Nfc_Shutdown"];\r
*UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];\r
*ClientApp=>phDal4Nfc [label="phDal4Nfc_ConfigRelease()",URL="\ref phDal4Nfc_ConfigRelease"];\r
- *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];\r
+ *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"]; \r
*\endmsc\r
*/\r
-extern\r
-NFCSTATUS\r
+extern \r
+NFCSTATUS \r
phDal4Nfc_ConfigRelease(\r
void *pHwRef);\r
\r
-extern\r
-NFCSTATUS\r
+extern \r
+NFCSTATUS \r
phDal4Nfc_Reset(long level);\r
\r
-extern\r
-NFCSTATUS\r
+extern \r
+NFCSTATUS \r
phDal4Nfc_Download();\r
\r
/******************** Function declarations *************************/\r
\r
#define NXP_FW_MIN_TX_RX_LEN 0x0AU\r
\r
-#define NFC_TIMER_CONTEXT\r
-\r
\r
#if defined( NXP_FW_MAX_TX_RX_LEN ) && \\r
( NXP_FW_MAX_TX_RX_LEN > NXP_FW_MIN_TX_RX_LEN )\r
* to compare the written data */\r
phNfc_sData_t dnld_store;\r
\r
- /** \internal Previously downloaded trimmed data stored\r
+ /** \internal Previously downloaded trimmed data stored \r
* to compare the written data */\r
phNfc_sData_t trim_store;\r
\r
#define CRC32_POLYNOMIAL 0xEDB88320L\r
\r
static uint32_t CRC32Table[0x100];\r
-\r
+ \r
void BuildCRCTable()\r
{\r
unsigned long crc;\r
uint8_t i = 0, j = 0;\r
-\r
- for ( i = 0; i <= 0xFF ; i++ )\r
+ \r
+ for ( i = 0; i <= 0xFF ; i++ ) \r
{\r
crc = i;\r
- for ( j = 8 ; j> 0; j-- )\r
+ for ( j = 8 ; j> 0; j-- ) \r
{\r
if ( crc & 1 )\r
{\r
* table lookup method. It accepts an original value for the crc,\r
* and returns the updated value.\r
*/\r
-\r
+ \r
uint32_t CalculateCRC32( void *buffer , uint32_t count, uint32_t crc )\r
{\r
uint8_t *p;\r
uint32_t temp1;\r
uint32_t temp2;\r
-\r
+ \r
p = (uint8_t *) buffer;\r
while ( count-- != 0 ) {\r
temp1 = ( crc>> 8 ) & 0x00FFFFFFL;\r
,psDnldContext->dnld_store.length);\r
p_sec_info->section_read = FALSE;\r
p_sec_info->section_write = FALSE;\r
- DNLD_DEBUG(" FW_DNLD: %X Bytes Write Complete ",\r
+ DNLD_DEBUG(" FW_DNLD: %X Bytes Write Complete ", \r
psDnldContext->dnld_store.length);\r
DNLD_DEBUG(" Comparison Status %X\n", cmp_val);\r
}\r
\r
/*\r
if(bit 0 of 0x813D is equal to 1) then\r
-\r
+ \r
Do not overwrite 0x9931 / 0x9981 during download\r
\r
else\r
@0x9931 = 0x79 // card Mode\r
@0x9981 = 0x79 // Reader Mode\r
*/\r
- trim_addr = p_sec_info->p_sec_hdr->section_address\r
+ trim_addr = p_sec_info->p_sec_hdr->section_address \r
+ p_sec_info->p_trim_data[i+1];\r
if (NXP_FW_VMID_TRIM_CHK_ADDR == trim_addr)\r
{\r
- psDnldContext->vmid_trim_update =\r
+ psDnldContext->vmid_trim_update = \r
p_sm_trim_data[p_sec_info->p_trim_data[i+1]] ;\r
}\r
\r
- if((NXP_FW_VMID_CARD_MODE_ADDR == trim_addr)\r
+ if((NXP_FW_VMID_CARD_MODE_ADDR == trim_addr) \r
|| (NXP_FW_VMID_RD_MODE_ADDR == trim_addr))\r
{\r
- if (TRUE == psDnldContext->vmid_trim_update)\r
+ if (TRUE == psDnldContext->vmid_trim_update) \r
{\r
dnld_data->data_packet[p_sec_info->p_trim_data[i+1]] =\r
p_sm_trim_data[p_sec_info->p_trim_data[i+1]] ;\r
}\r
}\r
else\r
-\r
+ \r
#endif\r
{\r
dnld_data->data_packet[p_sec_info->p_trim_data[i+1]] =\r
{\r
if(TRUE != skip_frame)\r
{\r
- psDnldContext->raw_mode_upgrade =\r
+ psDnldContext->raw_mode_upgrade = \r
(psDnldContext->raw_mode_upgrade &\r
~(frame_type & ~PHDNLD_MARKER_MASK));\r
}\r
#if (NXP_FW_INTEGRITY_CHK >= 0x01)\r
uint8_t verify_crc = 0x96;\r
\r
- if ( (NULL != psDnldContext->p_flash_code_crc)\r
- && (NULL != psDnldContext->p_patch_code_crc)\r
- && (NULL != psDnldContext->p_patch_table_crc)\r
+ if ( (NULL != psDnldContext->p_flash_code_crc) \r
+ && (NULL != psDnldContext->p_patch_code_crc) \r
+ && (NULL != psDnldContext->p_patch_table_crc) \r
)\r
{\r
uint8_t crc_i = 0;\r
| psDnldContext->chk_integrity_crc.patch_code.Chk_Crc32[crc_i]\r
<< (crc_i * BYTE_SIZE) ;\r
}\r
- verify_crc =(uint8_t)( (*((uint32_t *) psDnldContext->p_flash_code_crc)) !=\r
+ verify_crc =(uint8_t)( (*((uint32_t *) psDnldContext->p_flash_code_crc)) != \r
flash_code_crc );\r
- verify_crc |=(uint8_t)( (*((uint32_t *) psDnldContext->p_patch_code_crc)) !=\r
+ verify_crc |=(uint8_t)( (*((uint32_t *) psDnldContext->p_patch_code_crc)) != \r
patch_code_crc );\r
- verify_crc |=(uint8_t)( (*((uint16_t *) psDnldContext->p_patch_table_crc)) !=\r
+ verify_crc |=(uint8_t)( (*((uint16_t *) psDnldContext->p_patch_table_crc)) != \r
patch_table_crc );\r
}\r
else\r
\r
#endif /* #if (NXP_FW_INTEGRITY_CHK >= 0x01) */\r
\r
- integrity_chk = psDnldContext->chk_integrity_crc.config_page.Chk_status +\r
+ integrity_chk = psDnldContext->chk_integrity_crc.config_page.Chk_status + \r
psDnldContext->chk_integrity_crc.patch_table.Chk_status +\r
psDnldContext->chk_integrity_crc.flash_code.Chk_status +\r
psDnldContext->chk_integrity_crc.patch_code.Chk_status;\r
\r
- if ( ( 0 != integrity_chk )\r
+ if ( ( 0 != integrity_chk ) \r
#if (NXP_FW_INTEGRITY_CHK >= 0x01)\r
|| ( 0 != verify_crc )\r
#endif /* #if (NXP_FW_INTEGRITY_CHK >= 0x01) */\r
/* Handle the Error Scenario */\r
status = PHNFCSTVAL( CID_NFC_DNLD, NFCSTATUS_FAILED );\r
}\r
- else if ((0 == length)\r
+ else if ((0 == length) \r
|| (PHDNLD_MIN_PACKET > length ))\r
{\r
DNLD_DEBUG(" Receive Response Length = %u .... \n",length);\r
== psDnldContext->raw_mode_upgrade)\r
{\r
#if (NXP_FW_INTEGRITY_CHK >= 0x01)\r
- phDnldNfc_sChkCrcComplete_t *p_dnld_crc_all =\r
+ phDnldNfc_sChkCrcComplete_t *p_dnld_crc_all = \r
&psDnldContext->chk_integrity_crc;\r
switch(psDnldContext->chk_integrity_param)\r
{\r
case CHK_INTEGRITY_CONFIG_PAGE_CRC:\r
{\r
- (void)memcpy(&p_dnld_crc_all->config_page,\r
- (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length);\r
+ (void)memcpy(&p_dnld_crc_all->config_page, \r
+ (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length); \r
break;\r
}\r
case CHK_INTEGRITY_PATCH_TABLE_CRC:\r
{\r
- (void)memcpy(&p_dnld_crc_all->patch_table,\r
- (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length);\r
+ (void)memcpy(&p_dnld_crc_all->patch_table, \r
+ (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length); \r
break;\r
}\r
case CHK_INTEGRITY_FLASH_CODE_CRC:\r
{\r
- (void)memcpy(&p_dnld_crc_all->flash_code,\r
- (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length);\r
+ (void)memcpy(&p_dnld_crc_all->flash_code, \r
+ (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length); \r
break;\r
}\r
case CHK_INTEGRITY_PATCH_CODE_CRC:\r
{\r
- (void)memcpy(&p_dnld_crc_all->patch_code,\r
- (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length);\r
+ (void)memcpy(&p_dnld_crc_all->patch_code, \r
+ (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length); \r
break;\r
}\r
case CHK_INTEGRITY_COMPLETE_CRC:\r
{\r
(void)memcpy(p_dnld_crc_all,\r
- (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length);\r
- DNLD_DEBUG(" FW_DNLD: Check Integrity Complete Structure Size = %X \n",\r
+ (((uint8_t *)pdata) + PHDNLD_MIN_PACKET), resp_length); \r
+ DNLD_DEBUG(" FW_DNLD: Check Integrity Complete Structure Size = %X \n", \r
sizeof(psDnldContext->chk_integrity_crc));\r
break;\r
}\r
#if (NXP_FW_INTEGRITY_CHK >= 0x01)\r
if ((NULL != params) && ( param_length > 0 ))\r
{\r
- psDnldContext->chk_integrity_param =\r
+ psDnldContext->chk_integrity_param = \r
(phDnldNfc_eChkCrc_t)(*(uint8_t *)params);\r
tx_length = param_length;\r
}\r
case CHK_INTEGRITY_CONFIG_PAGE_CRC:\r
case CHK_INTEGRITY_PATCH_TABLE_CRC:\r
{\r
- psDnldContext->resp_length = PHDNLD_MIN_PACKET\r
+ psDnldContext->resp_length = PHDNLD_MIN_PACKET \r
+ CHECK_INTEGRITY_RESP_CRC16_LEN;\r
break;\r
}\r
case CHK_INTEGRITY_FLASH_CODE_CRC:\r
case CHK_INTEGRITY_PATCH_CODE_CRC:\r
{\r
- psDnldContext->resp_length = PHDNLD_MIN_PACKET\r
+ psDnldContext->resp_length = PHDNLD_MIN_PACKET \r
+ CHECK_INTEGRITY_RESP_CRC32_LEN;\r
break;\r
}\r
case CHK_INTEGRITY_COMPLETE_CRC:\r
default:\r
{\r
- psDnldContext->resp_length = PHDNLD_MIN_PACKET\r
+ psDnldContext->resp_length = PHDNLD_MIN_PACKET \r
+ CHECK_INTEGRITY_RESP_COMP_LEN;\r
break;\r
}\r
DNLD_PRINT(" FW_DNLD_CHK: Forceful Upgrade of the Firmware .... Required \n");\r
status = NFCSTATUS_SUCCESS;\r
}\r
- else if ( (pHwRef->device_info.fw_version >> (BYTE_SIZE * 2))\r
+ else if ( (pHwRef->device_info.fw_version >> (BYTE_SIZE * 2)) \r
!= ( cur_fw_hdr->fw_version >> (BYTE_SIZE * 2) ))\r
{\r
/* Check for the Compatible Romlib Version for the Hardware */\r
{\r
case DNLD_FW_CODE_ADDR:\r
{\r
- psDnldContext->p_flash_code_crc =\r
- p_cur_sec->p_sec_data\r
+ psDnldContext->p_flash_code_crc = \r
+ p_cur_sec->p_sec_data \r
+ p_cur_sec->p_sec_hdr->section_length\r
- DNLD_CRC32_SIZE;\r
break;\r
}\r
case DNLD_PATCH_CODE_ADDR:\r
{\r
- psDnldContext->p_patch_code_crc =\r
- p_cur_sec->p_sec_data\r
+ psDnldContext->p_patch_code_crc = \r
+ p_cur_sec->p_sec_data \r
+ p_cur_sec->p_sec_hdr->section_length\r
- DNLD_CRC32_SIZE;\r
break;\r
}\r
case DNLD_PATCH_TABLE_ADDR:\r
{\r
- psDnldContext->p_patch_table_crc =\r
- p_cur_sec->p_sec_data\r
+ psDnldContext->p_patch_table_crc = \r
+ p_cur_sec->p_sec_data \r
+ p_cur_sec->p_sec_hdr->section_length\r
- DNLD_CRC16_SIZE;\r
break;\r
{\r
DNLD_PRINT("\n FW_DNLD: Initial Reset .... \n");\r
\r
-#if defined(FW_DOWNLOAD_TIMER)\r
+#if defined(FW_DOWNLOAD_TIMER) \r
\r
psDnldContext->timer_id = phOsalNfc_Timer_Create( );\r
\r
else if (NFCSTATUS_SUCCESS == PHNFCSTATUS(status))\r
{\r
#if defined (NXP_FW_INTEGRITY_VERIFY)\r
- /*\r
- * To check for the integrity if the firmware is already\r
+ /* \r
+ * To check for the integrity if the firmware is already \r
* Upgraded.\r
*/\r
status = phDnldNfc_Send_Command( psDnldContext, pHwRef,\r
{\r
DNLD_PRINT("\n FW_DNLD: Integrity Reset .... \n");\r
(void)phDnldNfc_Set_Seq(psDnldContext, DNLD_SEQ_COMPLETE);\r
- status = PHNFCSTVAL( CID_NFC_DNLD,\r
+ status = PHNFCSTVAL( CID_NFC_DNLD, \r
NFCSTATUS_PENDING );\r
-#if defined(FW_DOWNLOAD_TIMER)\r
+#if defined(FW_DOWNLOAD_TIMER) \r
psDnldContext->timer_id = phOsalNfc_Timer_Create( );\r
#if (FW_DOWNLOAD_TIMER < 2)\r
phOsalNfc_Timer_Start( psDnldContext->timer_id,\r
- NXP_DNLD_COMPLETE_TIMEOUT,\r
+ NXP_DNLD_COMPLETE_TIMEOUT, \r
(ppCallBck_t) phDnldNfc_Abort\r
#ifdef NFC_TIMER_CONTEXT\r
, (void *) psDnldContext\r
{\r
result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER);\r
}\r
- else if ((NdefMap->CompletionRoutine->CompletionRoutine == NULL)\r
+ else if ((NdefMap->CompletionRoutine->CompletionRoutine == NULL) \r
|| (NdefMap->CompletionRoutine->Context == NULL))\r
{\r
result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER);\r
break;\r
}\r
#else /* #ifndef PH_FRINFC_MAP_ISO15693_DISABLED */\r
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\r
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, \r
NFCSTATUS_INVALID_REMOTE_DEVICE);\r
#endif /* #ifndef PH_FRINFC_MAP_ISO15693_DISABLED */\r
\r
\r
block_no = (uint16_t)\r
ISO15693_GET_VALUE_FIELD_BLOCK_NO (\r
- NdefMap->ISO15693Container.ndef_tlv_type_blk,\r
- NdefMap->ISO15693Container.ndef_tlv_type_byte,\r
+ NdefMap->ISO15693Container.ndef_tlv_type_blk, \r
+ NdefMap->ISO15693Container.ndef_tlv_type_byte, \r
NdefMap->ISO15693Container.actual_ndef_size);\r
byte_no = (uint8_t)\r
ISO15693_GET_VALUE_FIELD_BYTE_NO (\r
- NdefMap->ISO15693Container.ndef_tlv_type_blk,\r
- NdefMap->ISO15693Container.ndef_tlv_type_byte,\r
+ NdefMap->ISO15693Container.ndef_tlv_type_blk, \r
+ NdefMap->ISO15693Container.ndef_tlv_type_byte, \r
NdefMap->ISO15693Container.actual_ndef_size);\r
\r
- *maxSize = (NdefMap->ISO15693Container.max_data_size -\r
+ *maxSize = (NdefMap->ISO15693Container.max_data_size - \r
((block_no * ISO15693_BYTES_PER_BLOCK) + byte_no));\r
#else /* #if 1 */\r
/* 2 is used to exclude the T and L part of the TLV */\r
Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer\r
);\r
}\r
- if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice)\r
+ if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice) \r
&& (NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData))\r
{\r
phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData);\r
\r
\r
\r
+#ifdef ANDROID\r
\r
-const unsigned char *nxp_nfc_full_version;
-const unsigned char *nxp_nfc_fw;
-static void *handle = NULL;
+#define LOG_TAG "NFC-HCI"\r
\r
-int dlopen_firmware() {\r
-#ifdef TIZEN_PUBLIC\r
- return 0;\r
-#else\r
+#include <utils/Log.h>\r
+#include <dlfcn.h>\r
+\r
+#define FW_PATH "/system/vendor/firmware/libpn544_fw.so"\r
\r
- void *p;\r
+const unsigned char *nxp_nfc_full_version = NULL;\r
+const unsigned char *nxp_nfc_fw = NULL;\r
+\r
+int dlopen_firmware() {\r
+ void *p;\r
\r
- void *handle = dlopen("/lib/libpn544_fw.so", RTLD_NOW);
+ void *handle = dlopen(FW_PATH, RTLD_NOW);\r
if (handle == NULL) {\r
- PHDBG_INFO("Could not open libpn544.so");
+ LOGE("Could not open %s", FW_PATH);\r
return -1;\r
}\r
\r
p = dlsym(handle, "nxp_nfc_full_version");\r
if (p == NULL) {\r
- PHDBG_INFO("Could not link nxp_nfc_full_version");
+ LOGE("Could not link nxp_nfc_full_version");\r
return -1;\r
}\r
nxp_nfc_full_version = (unsigned char *)p;\r
\r
p = dlsym(handle, "nxp_nfc_fw");\r
if (p == NULL) {\r
- PHDBG_INFO("Could not link nxp_nfc_fw");
+ LOGE("Could not link nxp_nfc_fw");\r
return -1;\r
}\r
nxp_nfc_fw = (unsigned char *)p;\r
\r
return 0;\r
-#endif\r
+}\r
+#else\r
+\r
+const unsigned char *nxp_nfc_full_version;
+const unsigned char *nxp_nfc_fw;
+static void *handle = NULL;
+\r
+int dlopen_firmware() {\r
+ return 0;\r
+\r
}\r
void dlclose_firmware()
handle = NULL;
}
}
-\r
+#endif\r
/**\r
* The open function called by the upper HAL when HAL4 is to be opened\r
* (initialized).\r
/*Hci Init did not succeed.free Resources and return*/\r
if( (openRetVal != NFCSTATUS_SUCCESS)\r
&& (PHNFCSTATUS (openRetVal) != NFCSTATUS_PENDING) )\r
- {\r
+ { \r
phOsalNfc_FreeMemory(Hal4Ctxt->pHal4Nfc_LayerCfg);\r
phOsalNfc_FreeMemory(Hal4Ctxt);\r
Hal4Ctxt = NULL;\r
if(NFC_FW_DOWNLOAD_CHECK == IoctlCode)\r
{\r
RetStatus = phDnldNfc_Run_Check(\r
- psHwReference\r
+ psHwReference \r
);\r
}\r
else\r
Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)\r
phOsalNfc_GetMemory((uint32_t)sizeof(\r
phHal4Nfc_Hal4Ctxt_t)\r
- );\r
+ ); \r
if(NULL == Hal4Ctxt)\r
{\r
RetStatus = PHNFCSTVAL(CID_NFC_HAL,\r
}\r
else\r
{\r
- ((phHal_sHwReference_t *)psHwReference)->hal_context\r
+ ((phHal_sHwReference_t *)psHwReference)->hal_context \r
= Hal4Ctxt;\r
(void)memset((void *)Hal4Ctxt,\r
0,\r
- ((uint32_t)sizeof(phHal4Nfc_Hal4Ctxt_t)));\r
- Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;\r
+ ((uint32_t)sizeof(phHal4Nfc_Hal4Ctxt_t))); \r
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext; \r
Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb\r
= pIoctlCallback;/*Register upper layer callback*/\r
- Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam = pOutParam;\r
+ Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam = pOutParam; \r
/*Upgrade the firmware*/\r
RetStatus = phDnldNfc_Upgrade (\r
psHwReference,\r
else\r
#endif/*NFC_FW_DOWNLOAD*/\r
{\r
- RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);\r
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED); \r
}\r
}\r
else/*Status is Initialised*/\r
);\r
}\r
break;\r
- /*Used to Read Memory/Registers .3 bytes of Array passed form the\r
+ /*Used to Read Memory/Registers .3 bytes of Array passed form the \r
address to read from in MSB first format.*/\r
case NFC_MEM_READ:\r
{\r
}\r
}\r
break;\r
- /*Used to Write Memory/Registers .First 3 bytes of Array passed in MSB\r
- first format form the address to write to.The 4th Byte is the 8 bit\r
+ /*Used to Write Memory/Registers .First 3 bytes of Array passed in MSB \r
+ first format form the address to write to.The 4th Byte is the 8 bit \r
value to be written to the address*/\r
case NFC_MEM_WRITE:\r
{\r
{\r
for( ind = 0; ind < 3; ind++ )\r
{\r
- config_type = ((config_type << BYTE_SIZE )\r
+ config_type = ((config_type << BYTE_SIZE ) \r
| (pInParam->buffer[ind] ));\r
}\r
RetStatus = phHciNfc_System_Configure (\r
}\r
else\r
{\r
- RetStatus = PHNFCSTVAL(CID_NFC_HAL ,\r
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL , \r
NFCSTATUS_INVALID_PARAMETER);\r
}\r
}\r
\r
/**\r
* The close function called by the upper layer when HAL4 is to be closed\r
- * (shutdown).\r
+ * (shutdown). \r
*/\r
NFCSTATUS phHal4Nfc_Close(\r
phHal_sHwReference_t *psHwReference,\r
}\r
else if((NULL == psHwReference->hal_context)\r
|| (((phHal4Nfc_Hal4Ctxt_t *)\r
- psHwReference->hal_context)->Hal4CurrentState\r
+ psHwReference->hal_context)->Hal4CurrentState \r
< eHal4StateSelfTestMode)\r
|| (((phHal4Nfc_Hal4Ctxt_t *)\r
- psHwReference->hal_context)->Hal4NextState\r
+ psHwReference->hal_context)->Hal4NextState \r
== eHal4StateClosed))\r
{\r
/*return already closed*/\r
phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo\r
->sLowerRecvData.buffer);\r
}\r
- if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice)\r
+ if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice) \r
&& (NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData))\r
{\r
phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData);\r
/*Check for Initialized state*/\r
else if((NULL == psHwReference->hal_context)\r
|| (((phHal4Nfc_Hal4Ctxt_t *)\r
- psHwReference->hal_context)->Hal4CurrentState\r
+ psHwReference->hal_context)->Hal4CurrentState \r
< eHal4StateOpenAndReady)\r
|| (((phHal4Nfc_Hal4Ctxt_t *)\r
- psHwReference->hal_context)->Hal4NextState\r
+ psHwReference->hal_context)->Hal4NextState \r
== eHal4StateClosed))\r
{\r
retstatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);\r
gpphHal4Nfc_Hwref = (phHal_sHwReference_t *)pHwRef;\r
}\r
}\r
- else/*No Copy of Hw ref in HAL.Copy both Hwref and Hal context passed\r
+ else/*No Copy of Hw ref in HAL.Copy both Hwref and Hal context passed \r
by Hci*/\r
{\r
Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)pContext;\r
= Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt;\r
static phHal4Nfc_NotificationInfo_t uNotificationInfo;\r
if(NULL != Hal4Ctxt->sUpperLayerInfo.pDefaultEventHandler)\r
- {\r
+ { \r
Hal4Ctxt->Hal4NextState = eHal4StateInvalid;\r
Hal4Ctxt->sUpperLayerInfo.pDefaultEventHandler(\r
Hal4Ctxt->sUpperLayerInfo.DefaultListenerCtxt,\r
break;\r
}\r
case NFC_NOTIFY_CONNECT_FAILED:\r
- case NFC_NOTIFY_DISCONNECT_FAILED:\r
- /*Generic Error type received from Hci.Handle the error based on\r
+ case NFC_NOTIFY_DISCONNECT_FAILED: \r
+ /*Generic Error type received from Hci.Handle the error based on \r
Hal4 next state and which past callback was Pending*/\r
case NFC_NOTIFY_ERROR:\r
{\r
break;\r
default:\r
break;\r
- }\r
+ } \r
}\r
}\r
break;\r
case NFC_EVT_PROTECTED:\r
{\r
#ifdef IGNORE_EVT_PROTECTED\r
- /*Ignore_Event_Protected is set to false during Field Off event and\r
+ /*Ignore_Event_Protected is set to false during Field Off event and \r
Set protection Configuration.After a NFC_EVT_PROTECTED is received\r
once all subsequent NFC_EVT_PROTECTED events are ignored*/\r
if(FALSE == Hal4Ctxt->Ignore_Event_Protected)\r
sNotificationInfo.info = psEventInfo;\r
sNotificationInfo.status = NFCSTATUS_SUCCESS;\r
sNotificationInfo.type = NFC_EVENT_NOTIFICATION;\r
- pInfo = &sNotificationInfo;\r
+ pInfo = &sNotificationInfo; \r
phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);\r
#ifdef IGNORE_EVT_PROTECTED\r
}\r
}\r
if(NULL != Hal4Ctxt->psADDCtxtInfo)\r
{\r
- Hal4Ctxt->psADDCtxtInfo->sADDCfg.PollDevInfo.PollEnabled\r
+ Hal4Ctxt->psADDCtxtInfo->sADDCfg.PollDevInfo.PollEnabled \r
|= psEventInfo->eventInfo.rd_phases;\r
- /*Configure HCI Discovery*/\r
+ /*Configure HCI Discovery*/ \r
RetStatus = phHciNfc_Config_Discovery(\r
(void *)Hal4Ctxt->psHciHandle,\r
gpphHal4Nfc_Hwref,\r
&(Hal4Ctxt->psADDCtxtInfo->sADDCfg)\r
- );\r
+ ); \r
Hal4Ctxt->Hal4NextState = (NFCSTATUS_PENDING == RetStatus?\r
eHal4StateConfiguring:\r
Hal4Ctxt->Hal4NextState);\r
}\r
break;\r
- }\r
+ } \r
/*Call Default Event handler for these Events*/\r
case NFC_INFO_TXLDO_OVERCUR:\r
case NFC_INFO_MEM_VIOLATION:\r
case NFC_EVT_TRANSACTION:\r
case NFC_EVT_START_OF_TRANSACTION:\r
case NFC_EVT_END_OF_TRANSACTION:\r
- case NFC_EVT_CONNECTIVITY:\r
+ case NFC_EVT_CONNECTIVITY: \r
case NFC_EVT_OPERATION_ENDED:\r
case NFC_EVT_MIFARE_ACCESS:\r
case NFC_EVT_APDU_RECEIVED:\r
sNotificationInfo.type = NFC_EVENT_NOTIFICATION;\r
pInfo = &sNotificationInfo;\r
PHDBG_INFO("Hal4:Event Field ON\n");\r
- phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);\r
+ phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo); \r
break;\r
case NFC_EVT_FIELD_OFF:\r
#ifdef IGNORE_EVT_PROTECTED\r
sNotificationInfo.type = NFC_EVENT_NOTIFICATION;\r
pInfo = &sNotificationInfo;\r
PHDBG_INFO("Hal4:Event Field OFF\n");\r
- phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);\r
+ phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo); \r
break;\r
default:\r
PHDBG_WARNING("Hal4:Unhandled Event type received");\r
{\r
/*Copy status*/\r
NFCSTATUS status = (((phNfc_sCompletionInfo_t *)pInfo)->status);\r
- pphHal4Nfc_IoctlCallback_t pUpper_IoctlCb\r
+ pphHal4Nfc_IoctlCallback_t pUpper_IoctlCb \r
= Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb;\r
#ifdef MERGE_SAK_SW2\r
- pphHal4Nfc_GenCallback_t pConfigCallback =\r
+ pphHal4Nfc_GenCallback_t pConfigCallback = \r
Hal4Ctxt->sUpperLayerInfo.pConfigCallback;\r
#endif/*#ifdef MERGE_SAK_SW2*/\r
void *pUpper_Context = Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt;\r
- Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb = NULL;\r
+ Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb = NULL; \r
#ifdef MERGE_SAK_SW1 /*Software workaround 1*/\r
if(eHal4StateOpenAndReady == Hal4Ctxt->Hal4NextState)\r
{\r
NFCSTATUS_SUCCESS\r
);\r
}\r
-#endif/*#ifdef MERGE_SAK_SW1*/\r
+#endif/*#ifdef MERGE_SAK_SW1*/ \r
#ifdef MERGE_SAK_SW2 /*Software workaround 2*/\r
else if((eHal4StateConfiguring == Hal4Ctxt->Hal4NextState)\r
&&(NULL != pConfigCallback))\r
|| (NFC_GPIO_READ == Hal4Ctxt->Ioctl_Type)\r
)\r
{\r
- Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam->length\r
+ Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam->length \r
= sizeof (uint8_t);\r
}\r
/*Call registered Ioctl callback*/\r
/*\r
* Copyright (C) 2010 NXP Semiconductors\r
+ * Copyright (C) 2012 Samsung Elevtronics Co., Ltd\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
case NXP_EVT_INFO_MEM_VIOLATION:\r
{\r
event_info.eventType = NFC_INFO_MEM_VIOLATION;\r
- LOGW("Your NFC controller is kinda hosed, take it to npelly@ to fix");\r
+// LOGW("Your NFC controller is kinda hosed, take it to npelly@ to fix");\r
break;\r
}\r
case NXP_EVT_INFO_TEMP_OVERHEAT:\r
* $Date: Mon Mar 29 17:34:47 2010 $ *\r
* $Author: ing04880 $ *\r
* $Revision: 1.73 $ *\r
-* $Aliases: 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 $\r
+* $Aliases: 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 $ \r
* *\r
* =========================================================================== *\r
*/\r
#include <phDbgTrace.h>\r
#if defined(PHDBG_TRACES) && !defined(HCI_TRACE)\r
#define HCI_PRINT( str ) PHDBG_INFO(str)\r
-#define HCI_DEBUG(str, arg)\r
-#define HCI_PRINT_BUFFER(msg,buf,len)\r
+#define HCI_DEBUG(str, arg) \r
+#define HCI_PRINT_BUFFER(msg,buf,len) \r
#else\r
-#define HCI_PRINT( str )\r
+#define HCI_PRINT( str ) \r
#define HCI_DEBUG(...)\r
-#define HCI_PRINT_BUFFER(msg,buf,len)\r
+#define HCI_PRINT_BUFFER(msg,buf,len) \r
#endif /* #if defined(PHDBG_TRACES) */\r
/* #if defined(PHDBG_INFO) && defined (PHDBG_CRITICAL_ERROR) */\r
\r
uint8_t recv_msg_type;\r
/** \internal previous message sent to this pipe */\r
uint8_t prev_msg;\r
- /** \internal Index of the previous Set/Get Parameter command\r
+ /** \internal Index of the previous Set/Get Parameter command \r
* sent to this pipe */\r
uint8_t reg_index;\r
- /** \internal length of Parameter of the Set/Get Parameter\r
+ /** \internal length of Parameter of the Set/Get Parameter \r
* command sent to this pipe */\r
uint16_t param_length;\r
- /** \internal Parameter of the Set/Get Parameter command\r
+ /** \internal Parameter of the Set/Get Parameter command \r
* sent to this pipe */\r
void *param_info;\r
/** \internal Pointer to a Pipe specific Receive Response function */\r
- pphHciNfc_Pipe_Receive_t recv_resp;\r
+ pphHciNfc_Pipe_Receive_t recv_resp; \r
/** \internal Pointer to a Pipe specific Receive Event function */\r
- pphHciNfc_Pipe_Receive_t recv_event;\r
+ pphHciNfc_Pipe_Receive_t recv_event; \r
/** \internal Pointer to a Pipe specific Receive Command function */\r
- pphHciNfc_Pipe_Receive_t recv_cmd;\r
+ pphHciNfc_Pipe_Receive_t recv_cmd; \r
}phHciNfc_Pipe_Info_t;\r
\r
\r
typedef struct phHciNfc_sContext{\r
- /** \internal HCI Layer Pointer from the upper layer for\r
+ /** \internal HCI Layer Pointer from the upper layer for \r
lower layer function registration */\r
phNfcLayer_sCfg_t *p_hci_layer;\r
/** \internal Pointer to the upper layer context */\r
void *p_device_mgmt_info;\r
/** \internal HCI RF Reader Gates Management Information */\r
void *p_reader_mgmt_info;\r
- /** \internal HCI Card Application Gates and Emulation\r
+ /** \internal HCI Card Application Gates and Emulation \r
Information */\r
void *p_emulation_mgmt_info;\r
/** \internal HCI RF Reader A Gate Information */\r
/** \internal HCI ISO15693 Reader Gate Information */\r
void *p_iso_15693_info;\r
#endif\r
-\r
+ \r
#ifdef ENABLE_P2P\r
/** \internal HCI NFC-IP1 Peer to Peer Information */\r
void *p_nfcip_info;\r
volatile uint16_t rx_total;\r
/** \internal Number of bytes received */\r
volatile uint16_t rx_recvd;\r
- /** \internal Index of the received data in the\r
- * response packet\r
+ /** \internal Index of the received data in the \r
+ * response packet \r
*/\r
\r
/** \internal Send HCP Chaining Information */\r
* the Device Interface Link .\r
* \param[in] type type of the notification to\r
* the upper HAL layer.\r
- * \param[in] pInfo completion information returned\r
+ * \param[in] pInfo completion information returned \r
* to the Upper HAL Layer.\r
* NFCSTATUS_SUCCESS Notification successfully completed .\r
* NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Send_Generic_Cmd function sends the HCI Generic Commands\r
+ * The phHciNfc_Send_Generic_Cmd function sends the HCI Generic Commands \r
* to the device.\r
*\r
* \param[in] psHciContext psHciContext is the context of\r
* particular pipe .\r
*\r
* \retval NFCSTATUS_PENDING HCI Generic Command send in progress .\r
- * \retval\r
- * NFCSTATUS_INSUFFICIENT_RESOURCES The memory could not be allocated\r
- * as required amount of memory\r
+ * \retval \r
+ * NFCSTATUS_INSUFFICIENT_RESOURCES The memory could not be allocated \r
+ * as required amount of memory \r
* is not sufficient.\r
*\r
*/\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Set_Param function configures the Gate specific register\r
+ * The phHciNfc_Set_Param function configures the Gate specific register \r
* with the provided value.\r
*\r
* \param[in] psHciContext psHciContext is the context of\r
* \param[in] pHwRef pHwRef is the Information of\r
* the Device Interface Link .\r
* \param[in] p_pipe_info Pointer to pipe specific information.\r
- * \param[in] reg_index Index of the register to be\r
+ * \param[in] reg_index Index of the register to be \r
* configured .\r
- * \param[in] p_param Value to the configured in\r
+ * \param[in] p_param Value to the configured in \r
* particular register.\r
* \param[in] param_length Length of the parameter provided\r
* for the configuration.\r
*\r
* \retval NFCSTATUS_PENDING HCI Set parameter in progress .\r
- * \retval\r
+ * \retval \r
* NFCSTATUS_INVALID_HCI_INFORMATION The Information like p_pipe_info,\r
* p_param or param_length is invalid\r
*\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Send_HCP function sends the HCI Host Control Packet\r
+ * The phHciNfc_Send_HCP function sends the HCI Host Control Packet \r
* Frames to the device.\r
*\r
* \param[in] psHciContext psHciContext is the context of\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Build_HCPFrame function initially builds the HCP Packet Frame\r
+ * The phHciNfc_Build_HCPFrame function initially builds the HCP Packet Frame \r
* with the values passed in the arguments .\r
*\r
* \param[in] hcp_packet hcp_packet is the frame packet structure\r
- * in which the frame is populated with the\r
+ * in which the frame is populated with the \r
* appropriate fields.\r
- * \param[in] chainbit chainbit specifies whether the following\r
- * HCP frames are chained or the frame is a\r
+ * \param[in] chainbit chainbit specifies whether the following \r
+ * HCP frames are chained or the frame is a \r
* normal frame.\r
* \param[in] pipe_id pipe_id of the pipe to which the frame has\r
* to be sent.\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Append_HCPFrame function Appends the HCP Packet Frame\r
+ * The phHciNfc_Append_HCPFrame function Appends the HCP Packet Frame \r
* with the values passed in the arguments .\r
*\r
- * \param[in] hcp_data hcp_data is the pointer to the HCP\r
+ * \param[in] hcp_data hcp_data is the pointer to the HCP \r
* payload to which the data is to be\r
* appended.\r
- * \param[in] hcp_index hcp_index is the index from which\r
+ * \param[in] hcp_index hcp_index is the index from which \r
* the data source needs to be appended.\r
* \param[in] src_data src_data that is to be appended to the\r
* HCP packet.\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Allocate_Resource function allocates and initialises the\r
+ * The phHciNfc_Allocate_Resource function allocates and initialises the \r
* resource memory for the HCI layer.\r
*\r
* \param[in] ppBuffer ppBuffer is the pointer to which the\r
*\r
* \retval NFCSTATUS_SUCCESS The Resource Memory was allocated\r
* successfully .\r
- * \retval\r
- * NFCSTATUS_INSUFFICIENT_RESOURCES The memory could not be allocated\r
- * as required amount of memory\r
+ * \retval \r
+ * NFCSTATUS_INSUFFICIENT_RESOURCES The memory could not be allocated \r
+ * as required amount of memory \r
* is not suffient.\r
*\r
*/\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Release_Resources function releases all the resources\r
+ * The phHciNfc_Release_Resources function releases all the resources \r
* allocated in the HCI Layer.\r
*\r
* \param[in] psHciContext psHciContext is the context of\r
/**\r
* \ingroup grp_hci_nfc\r
*\r
- * The phHciNfc_Release_Lower function initiates the release of the\r
+ * The phHciNfc_Release_Lower function initiates the release of the \r
* lower layers.\r
*\r
* \param[in] psHciContext psHciContext is the context of\r
/* Shutdown callback */\r
STATIC void phLibNfc_ShutdownCb(void *pContext,NFCSTATUS status);\r
\r
-/**Default notification handler registered with lower layer immediately after\r
+/**Default notification handler registered with lower layer immediately after \r
successful initialization*/\r
STATIC void phLibNfc_DefaultHandler(\r
- void *context,\r
+ void *context, \r
phHal_eNotificationType_t type,\r
phHal4Nfc_NotificationInfo_t info,\r
NFCSTATUS status\r
if(NULL != gpphLibContext)\r
{\r
return NFCSTATUS_ALREADY_INITIALISED;\r
- }\r
+ } \r
\r
return phDal4Nfc_Config(psConfig, ppDriverHandle);\r
}\r
if(NULL != gpphLibContext)\r
{\r
return NFCSTATUS_ALREADY_INITIALISED;\r
- }\r
+ } \r
\r
return phDal4Nfc_ConfigRelease(pDriverHandle);\r
}\r
pphLibNfc_RspCb_t pInitCb,\r
void *pContext)\r
{\r
- NFCSTATUS Status = NFCSTATUS_SUCCESS;\r
+ NFCSTATUS Status = NFCSTATUS_SUCCESS; \r
if((NULL == pDriverHandle)||(NULL == pInitCb))\r
{\r
Status = NFCSTATUS_INVALID_PARAMETER;\r
gpphLibContext->sSeContext.eActivatedMode = phLibNfc_SE_ActModeDefault;\r
sSecuredElementInfo[LIBNFC_SE_UICC_INDEX].eSE_CurrentState=phLibNfc_SE_Active;\r
pLibContext->sSeContext.uUiccActivate=TRUE;\r
- }\r
+ } \r
if(pLibContext->psHwReference->smx_connected==TRUE)\r
{\r
/* populate state of the secured element */\r
gpphLibContext->sSeContext.eActivatedMode = phLibNfc_SE_ActModeDefault;\r
- sSecuredElementInfo[LIBNFC_SE_SMARTMX_INDEX].eSE_CurrentState=phLibNfc_SE_Inactive;\r
+ sSecuredElementInfo[LIBNFC_SE_SMARTMX_INDEX].eSE_CurrentState=phLibNfc_SE_Inactive; \r
pLibContext->sSeContext.uSmxActivate =FALSE;\r
}\r
\r
phLibNfc_UpdateCurState(status,pLibContext);\r
- (void)phHal4Nfc_RegisterNotification(\r
+ (void)phHal4Nfc_RegisterNotification( \r
pLibContext->psHwReference,\r
eRegisterDefault,\r
phLibNfc_DefaultHandler,\r
(void*)pLibContext\r
- );\r
+ ); \r
/* call the upper layer register function */\r
(*pClientCb)(pUpperLayerContext,status);\r
\r
phOsalNfc_FreeMemory(pLibContext);\r
pLibContext= NULL;\r
gpphLibContext = NULL;\r
-\r
+ \r
}\r
return;\r
}\r
\r
-/**Default notification handler registered with lower layer immediately after\r
+/**Default notification handler registered with lower layer immediately after \r
successful initialization*/\r
STATIC void phLibNfc_DefaultHandler(\r
- void *context,\r
+ void *context, \r
phHal_eNotificationType_t type,\r
phHal4Nfc_NotificationInfo_t info,\r
NFCSTATUS status\r
{\r
Status =NFCSTATUS_FAILED;\r
}\r
- }\r
+ } \r
}\r
return Status;\r
}\r
phLibNfc_UpdateCurState(status,pLibContext);\r
\r
pLibContext->status.GenCb_pending_status=FALSE;\r
-\r
+ \r
/* Allocate the Memory for the Transceive info */\r
if(pClientCb!=NULL)\r
{\r
}\r
/*Free the memory allocated during NDEF read,write\r
and NDEF formatting*/\r
- phLibNfc_Ndef_DeInit();\r
+ phLibNfc_Ndef_DeInit(); \r
phOsalNfc_FreeMemory(pLibContext);\r
gpphLibContext=NULL;\r
pLibContext= NULL;\r
-\r
+ \r
}\r
else\r
{\r
== eLibNfcHalStateShutdown))\r
{ /*Lib Nfc not initlized*/\r
Status = NFCSTATUS_NOT_INITIALISED;\r
- }\r
- else if(NULL == pContext)\r
+ } \r
+ else if(NULL == pContext) \r
{\r
Status = NFCSTATUS_INVALID_PARAMETER;\r
}\r
Status = NFCSTATUS_SHUTDOWN;\r
}\r
else\r
- {\r
+ { \r
/*Reset all callback status*/\r
(void) memset(&(gpphLibContext->RegNtfType),0,\r
sizeof(phLibNfc_Registry_Info_t));\r
phOsalNfc_FreeMemory(gpphLibContext->ndef_cntx.ndef_fmt);\r
gpphLibContext->ndef_cntx.ndef_fmt = NULL;\r
}\r
- if(NULL != pNdefRecord)\r
+ if(NULL != pNdefRecord) \r
{\r
if(NULL != pNdefRecord->Id)\r
{\r
{\r
phOsalNfc_FreeMemory(NdefInfo.pNdefRecord);\r
NdefInfo.pNdefRecord = NULL;\r
- }\r
+ } \r
if(NULL != gpphLibContext->phLib_NdefRecCntx.NdefCb)\r
{\r
phOsalNfc_FreeMemory(gpphLibContext->phLib_NdefRecCntx.NdefCb);\r
gpphLibContext->phLib_NdefRecCntx.ndef_message.buffer = NULL;\r
}\r
/* No device is connected */\r
- gpphLibContext->Connected_handle = 0x00;\r
+ gpphLibContext->Connected_handle = 0x00; \r
gpphLibContext->Prev_Connected_handle = 0x00;\r
- gpphLibContext->ReleaseType = NFC_INVALID_RELEASE_TYPE;\r
+ gpphLibContext->ReleaseType = NFC_INVALID_RELEASE_TYPE; \r
gpphLibContext->eLibNfcCfgMode = NFC_DISCOVERY_STOP;\r
/*Lib Nfc Stack is initilized and in idle state*/\r
gpphLibContext->LibNfcState.cur_state = eLibNfcHalStateInitandIdle;\r
gpphLibContext->sSeContext.sSeCallabackInfo.pSEsetModeCb = NULL;\r
gpphLibContext->sSeContext.sSeCallabackInfo.pSEsetModeCtxt = NULL;\r
/*No callback is pending*/\r
- gpphLibContext->status.GenCb_pending_status = FALSE;\r
-\r
+ gpphLibContext->status.GenCb_pending_status = FALSE; \r
+ \r
}\r
return Status;\r
}\r
default:\r
break;\r
}\r
- pLibContext->LibNfcState.next_state =\r
+ pLibContext->LibNfcState.next_state = \r
(uint8_t)((NFCSTATUS_SUCCESS == status)?next_state:pLibContext->LibNfcState.next_state);\r
\r
return status;\r
{\r
NFCSTATUS RetVal = NFCSTATUS_FAILED;\r
/*Check Lib Nfc stack is initilized*/\r
- if((NULL == gpphLibContext)||\r
+ if((NULL == gpphLibContext)|| \r
(gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))\r
{\r
RetVal = NFCSTATUS_NOT_INITIALISED;\r
- }\r
+ } \r
/*Check application has sent the valid parameters*/\r
else if((NULL == phLibNfc_StackCapabilities)\r
|| (NULL == pContext))\r
{\r
RetVal= NFCSTATUS_INVALID_PARAMETER;\r
- }\r
+ } \r
else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)\r
{\r
RetVal = NFCSTATUS_SHUTDOWN;\r
}\r
- else if(TRUE == gpphLibContext->status.GenCb_pending_status)\r
+ else if(TRUE == gpphLibContext->status.GenCb_pending_status) \r
{\r
/*Previous operation is pending */\r
RetVal = NFCSTATUS_BUSY;\r
- }\r
+ } \r
else\r
{\r
/* Tag Format Capabilities*/\r
phLibNfc_StackCapabilities->psMappingCapabilities.ISO14443_4B = TRUE;\r
phLibNfc_StackCapabilities->psMappingCapabilities.MifareStd = TRUE;\r
phLibNfc_StackCapabilities->psMappingCapabilities.MifareUL = TRUE;\r
- phLibNfc_StackCapabilities->psMappingCapabilities.MifareULC = TRUE;\r
+ phLibNfc_StackCapabilities->psMappingCapabilities.MifareULC = TRUE; \r
phLibNfc_StackCapabilities->psMappingCapabilities.Jewel = TRUE;\r
phLibNfc_StackCapabilities->psMappingCapabilities.ISO15693 = FALSE;\r
-\r
+ \r
/*Call Hal4 Get Dev Capabilities to get info about protocols supported\r
by Lib Nfc*/\r
PHDBG_INFO("LibNfc:Get Stack capabilities ");\r
- RetVal= phHal4Nfc_GetDeviceCapabilities(\r
- gpphLibContext->psHwReference,\r
+ RetVal= phHal4Nfc_GetDeviceCapabilities( \r
+ gpphLibContext->psHwReference, \r
&(phLibNfc_StackCapabilities->psDevCapabilities),\r
- (void *)gpphLibContext);\r
+ (void *)gpphLibContext); \r
\r
LIB_NFC_VERSION_SET(phLibNfc_StackCapabilities->psDevCapabilities.hal_version,\r
PH_HAL4NFC_VERSION,\r
PH_HAL4NFC_REVISION,\r
PH_HAL4NFC_PATCH,\r
PH_HAL4NFC_BUILD);\r
-\r
+ \r
phLibNfc_StackCapabilities->psDevCapabilities.fw_version=\r
gpphLibContext->psHwReference->device_info.fw_version;\r
phLibNfc_StackCapabilities->psDevCapabilities.hci_version=\r
phLibNfc_StackCapabilities->psDevCapabilities.hw_version=\r
gpphLibContext->psHwReference->device_info.hw_version;\r
phLibNfc_StackCapabilities->psDevCapabilities.model_id=\r
- gpphLibContext->psHwReference->device_info.model_id;\r
+ gpphLibContext->psHwReference->device_info.model_id; \r
(void)memcpy(phLibNfc_StackCapabilities->psDevCapabilities.full_version,\r
gpphLibContext->psHwReference->device_info.full_version,NXP_FULL_VERSION_LEN);\r
/* Check the firmware version */\r
-\r
if (nxp_nfc_full_version == NULL) {\r
// Couldn't load firmware, just pretend we're up to date.\r
// LOGW("Firmware image not available: this device might be running old NFC firmware!");\r
}\r
\r
if(NFCSTATUS_SUCCESS != RetVal)\r
- {\r
+ { \r
RetVal = NFCSTATUS_FAILED;\r
}\r
}\r
phLibNfc_Cfg_Testmode_t eTstmode,\r
void *pContext)\r
{\r
- NFCSTATUS Status = NFCSTATUS_SUCCESS;\r
+ NFCSTATUS Status = NFCSTATUS_SUCCESS; \r
phHal4Nfc_InitType_t eInitType=eInitDefault;\r
-\r
+ \r
if((NULL == pDriverHandle)||(NULL == pTestModeCb))\r
{\r
Status = NFCSTATUS_INVALID_PARAMETER;\r
}\r
else if((NULL != gpphLibContext) && \\r
(gpphLibContext->LibNfcState.next_state==eLibNfcHalStateShutdown))\r
- {\r
+ { \r
Status = NFCSTATUS_SHUTDOWN;\r
- }\r
+ } \r
else if( (eTstmode == phLibNfc_TstMode_On) && (NULL != gpphLibContext))\r
{\r
Status=NFCSTATUS_ALREADY_INITIALISED;\r
Status = NFCSTATUS_NOT_INITIALISED;\r
}\r
else if( (eTstmode == phLibNfc_TstMode_Off) && (NULL != gpphLibContext))\r
- {\r
+ { \r
if (NULL!= gpphLibContext->CBInfo.pClientShutdownCb)\r
{ /* Previous callback pending */\r
Status = NFCSTATUS_BUSY;\r
{\r
Status =NFCSTATUS_FAILED;\r
}\r
- }\r
+ } \r
}\r
- else\r
+ else \r
{\r
/* Initialize the Lib context */\r
gpphLibContext=(pphLibNfc_LibContext_t)phOsalNfc_GetMemory(\r
phLibNfc_Ndef_Init();\r
}\r
}\r
-\r
+ \r
return Status;\r
}\r
\r
/*\r
- * Copyright (C) 2010 NXP Semiconductors
- * Copyright (C) 2012 Samsung Elevtronics Co., Ltd\r
+ * Copyright (C) 2010 NXP Semiconductors\r
+ * Copyright (C) 2012 Samsung Elevtronics Co., Ltd *\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
#endif\r
#define LOG_TAG "NFC-LLC"\r
\r
+//#include <utils/Log.h>\r
/*********************** End of includes ****************************/\r
\r
/***************************** Macros *******************************/\r
\r
/*********************** Local functions ****************************/\r
static\r
-void\r
+void \r
phLlcNfc_WrResp_Cb(\r
- void *pContext,\r
- void *pHwInfo,\r
+ void *pContext, \r
+ void *pHwInfo, \r
phNfc_sTransactionInfo_t *pCompInfo\r
);\r
\r
static\r
-void\r
+void \r
phLlcNfc_RdResp_Cb(\r
void *pContext,\r
- void *pHwInfo,\r
+ void *pHwInfo, \r
phNfc_sTransactionInfo_t *pCompInfo\r
);\r
\r
\r
/******************** End of Global Variables ***********************/\r
\r
-NFCSTATUS\r
+NFCSTATUS \r
phLlcNfc_Interface_Register(\r
- phLlcNfc_Context_t *psLlcCtxt,\r
+ phLlcNfc_Context_t *psLlcCtxt, \r
phNfcLayer_sCfg_t *psIFConfig\r
)\r
{\r
NFCSTATUS result = NFCSTATUS_SUCCESS;\r
phNfcIF_sCallBack_t if_cb = {0,0,0,0};\r
phNfcIF_sReference_t sreference = {0,0,0};\r
-\r
+ \r
if ((NULL == psLlcCtxt) || (NULL == psIFConfig))\r
{\r
- result = PHNFCSTVAL(CID_NFC_LLC,\r
+ result = PHNFCSTVAL(CID_NFC_LLC, \r
NFCSTATUS_INVALID_PARAMETER);\r
}\r
- else\r
+ else \r
{\r
result = NFCSTATUS_SUCCESS;\r
if_cb.notify = NULL;\r
if_cb.receive_complete = (pphNfcIF_Transact_Completion_CB_t)&phLlcNfc_RdResp_Cb;\r
if_cb.send_complete = (pphNfcIF_Transact_Completion_CB_t)&phLlcNfc_WrResp_Cb;\r
- if_cb.pif_ctxt = psLlcCtxt;\r
+ if_cb.pif_ctxt = psLlcCtxt; \r
sreference.plower_if = &(psLlcCtxt->lower_if);\r
result = PHNFCSTVAL(CID_NFC_LLC, NFCSTATUS_INVALID_PARAMETER);\r
#ifdef PH_LLCNFC_STUB\r
#ifdef PH_LLCNFC_DALINT\r
result = phDal4Nfc_Register(&sreference, if_cb, psIFConfig->layer_next);\r
#else\r
- if ((NULL != psIFConfig->layer_next) &&\r
+ if ((NULL != psIFConfig->layer_next) && \r
(NULL != psIFConfig->layer_next->layer_registry))\r
{\r
result = psIFConfig->layer_next->layer_registry(\r
- &sreference,\r
- if_cb,\r
+ &sreference, \r
+ if_cb, \r
(void *)&psIFConfig[(psIFConfig->layer_index - 1)]);\r
}\r
#endif /* #ifdef PH_LLCNFC_DALINT */\r
PH_LLCNFC_DEBUG("Llc Dal Interface Register result : 0x%x\n", result);\r
return result;\r
}\r
-\r
-NFCSTATUS\r
+ \r
+NFCSTATUS \r
phLlcNfc_Interface_Init(\r
phLlcNfc_Context_t *psLlcCtxt\r
)\r
1. Get the pointer of the main llc context\r
*/\r
NFCSTATUS result = NFCSTATUS_SUCCESS;\r
- if ((NULL == psLlcCtxt) ||\r
+ if ((NULL == psLlcCtxt) || \r
(NULL == psLlcCtxt->lower_if.init))\r
{\r
- result = PHNFCSTVAL(CID_NFC_LLC,\r
+ result = PHNFCSTVAL(CID_NFC_LLC, \r
NFCSTATUS_INVALID_PARAMETER);\r
}\r
else\r
- {\r
+ { \r
/* Initialise the main context */\r
- result = psLlcCtxt->lower_if.init( psLlcCtxt->lower_if.pcontext,\r
- psLlcCtxt->phwinfo);\r
+ result = psLlcCtxt->lower_if.init( psLlcCtxt->lower_if.pcontext, \r
+ psLlcCtxt->phwinfo); \r
}\r
PH_LLCNFC_DEBUG("Llc Dal Interface Init result : 0x%x\n", result);\r
return result;\r
}\r
\r
-NFCSTATUS\r
+NFCSTATUS \r
phLlcNfc_Interface_Read(\r
- phLlcNfc_Context_t *psLlcCtxt,\r
- uint8_t readWaitOn,\r
- uint8_t *pLlcBuffer,\r
+ phLlcNfc_Context_t *psLlcCtxt, \r
+ uint8_t readWaitOn, \r
+ uint8_t *pLlcBuffer, \r
uint32_t llcBufferLength\r
)\r
{\r
NFCSTATUS result = NFCSTATUS_PENDING;\r
/*\r
- 1. Call DAL or TL read with "phLlcNfc_LlcTl_RdResp_Cb" as\r
+ 1. Call DAL or TL read with "phLlcNfc_LlcTl_RdResp_Cb" as \r
callback function\r
*/\r
PH_LLCNFC_PRINT("Llc Dal Interface Read called\n");\r
- if ((NULL == psLlcCtxt) || (NULL == pLlcBuffer) ||\r
- (0 == llcBufferLength) || (NULL == psLlcCtxt->lower_if.receive) ||\r
+ if ((NULL == psLlcCtxt) || (NULL == pLlcBuffer) || \r
+ (0 == llcBufferLength) || (NULL == psLlcCtxt->lower_if.receive) || \r
(readWaitOn > PH_LLCNFC_READWAIT_ON))\r
{\r
result = PHNFCSTVAL(CID_NFC_LLC, NFCSTATUS_INVALID_PARAMETER);\r
}\r
- else if (PH_LLCNFC_READPEND_FLAG_OFF !=\r
+ else if (PH_LLCNFC_READPEND_FLAG_OFF != \r
psLlcCtxt->s_frameinfo.read_pending)\r
{\r
/* do nothing */\r
- }\r
- else\r
+ } \r
+ else \r
{\r
if (PH_LLCNFC_READWAIT_OFF == readWaitOn)\r
- {\r
+ { \r
result = psLlcCtxt->lower_if.receive(\r
- psLlcCtxt->lower_if.pcontext,\r
- psLlcCtxt->phwinfo,\r
- pLlcBuffer,\r
+ psLlcCtxt->lower_if.pcontext, \r
+ psLlcCtxt->phwinfo, \r
+ pLlcBuffer, \r
(uint8_t)llcBufferLength);\r
- }\r
+ } \r
else\r
{\r
result = psLlcCtxt->lower_if.receive_wait(\r
- psLlcCtxt->lower_if.pcontext,\r
- psLlcCtxt->phwinfo,\r
- pLlcBuffer,\r
+ psLlcCtxt->lower_if.pcontext, \r
+ psLlcCtxt->phwinfo, \r
+ pLlcBuffer, \r
(uint16_t)llcBufferLength);\r
}\r
\r
{\r
if (PH_LLCNFC_READPEND_ONE_BYTE == llcBufferLength)\r
{\r
- psLlcCtxt->s_frameinfo.read_pending =\r
+ psLlcCtxt->s_frameinfo.read_pending = \r
PH_LLCNFC_READPEND_ONE_BYTE;\r
}\r
else\r
{\r
- psLlcCtxt->s_frameinfo.read_pending =\r
+ psLlcCtxt->s_frameinfo.read_pending = \r
PH_LLCNFC_READPEND_REMAIN_BYTE;\r
}\r
}\r
return result;\r
}\r
\r
-NFCSTATUS\r
+NFCSTATUS \r
phLlcNfc_Interface_Write(\r
phLlcNfc_Context_t *psLlcCtxt,\r
- uint8_t *pLlcBuffer,\r
+ uint8_t *pLlcBuffer, \r
uint32_t llcBufferLength\r
)\r
{\r
\r
PH_LLCNFC_PRINT("Llc Dal Interface Write called\n");\r
/*\r
- 1. Call DAL or TL write with "phLlcNfc_LlcTl_WrResp_Cb" as\r
+ 1. Call DAL or TL write with "phLlcNfc_LlcTl_WrResp_Cb" as \r
callback function\r
*/\r
- if ((NULL == psLlcCtxt) || (NULL == pLlcBuffer) ||\r
- (0 == llcBufferLength) ||\r
+ if ((NULL == psLlcCtxt) || (NULL == pLlcBuffer) || \r
+ (0 == llcBufferLength) || \r
(NULL == psLlcCtxt->lower_if.send))\r
{\r
PH_LLCNFC_DEBUG ("psLlcCtxt : 0x%p\n", psLlcCtxt);\r
PH_LLCNFC_DEBUG ("llcBufferLength : 0x%08X\n", llcBufferLength);\r
result = PHNFCSTVAL(CID_NFC_LLC, NFCSTATUS_INVALID_PARAMETER);\r
}\r
- else\r
- {\r
+ else \r
+ { \r
PH_LLCNFC_PRINT("Buffer to be send to Dal : \n");\r
PH_LLCNFC_PRINT_BUFFER(pLlcBuffer, llcBufferLength);\r
\r
- if ((TRUE == psLlcCtxt->s_frameinfo.write_pending) ||\r
- (PH_LLCNFC_READPEND_REMAIN_BYTE ==\r
+ if ((TRUE == psLlcCtxt->s_frameinfo.write_pending) || \r
+ (PH_LLCNFC_READPEND_REMAIN_BYTE == \r
psLlcCtxt->s_frameinfo.read_pending))\r
{\r
result = PHNFCSTVAL(CID_NFC_LLC, NFCSTATUS_BUSY);\r
\r
PH_LLCNFC_PRINT_DATA (pLlcBuffer, llcBufferLength);\r
PH_LLCNFC_STRING (";\n");\r
-\r
+ \r
#endif /* LLC_DATA_BYTES */\r
\r
psLlcCtxt->s_frameinfo.s_llcpacket.llcbuf_len = (uint8_t)llcBufferLength;\r
(void)memcpy ((void *)&(psLlcCtxt->s_frameinfo.s_llcpacket.s_llcbuf),\r
(void *)pLlcBuffer, llcBufferLength);\r
\r
- result = psLlcCtxt->lower_if.send(psLlcCtxt->lower_if.pcontext,\r
- psLlcCtxt->phwinfo,\r
+ result = psLlcCtxt->lower_if.send(psLlcCtxt->lower_if.pcontext, \r
+ psLlcCtxt->phwinfo, \r
(uint8_t *)&(psLlcCtxt->s_frameinfo.s_llcpacket.s_llcbuf),\r
(uint16_t)llcBufferLength);\r
if(NFCSTATUS_PENDING == result)\r
}\r
\r
static\r
-void\r
+void \r
phLlcNfc_WrResp_Cb(\r
- void *pContext,\r
- void *pHwInfo,\r
+ void *pContext, \r
+ void *pHwInfo, \r
phNfc_sTransactionInfo_t *pCompInfo\r
)\r
{\r
- /*\r
+ /* \r
1. Check the window size, if window size = windows\r
- 1. Call the send callback, which has been registered by upper\r
+ 1. Call the send callback, which has been registered by upper \r
layer\r
*/\r
NFCSTATUS result = NFCSTATUS_SUCCESS;\r
uint8_t count = 0;\r
\r
PH_LLCNFC_PRINT("\n\nLLC : WRITE RESP CB CALLED\n\n");\r
-\r
+ \r
if ((NULL != ps_llc_ctxt) && (NULL != pCompInfo) && (NULL != pHwInfo))\r
{\r
ps_llc_ctxt->s_frameinfo.write_pending = FALSE;\r
\r
PHNFC_UNUSED_VARIABLE(result);\r
-\r
+ \r
if(NFCSTATUS_SUCCESS == pCompInfo->status)\r
{\r
ps_frame_info = &(ps_llc_ctxt->s_frameinfo);\r
{\r
case init_u_rset_frame:\r
{\r
- /* First U frame sent properly, update sent frame type\r
+ /* First U frame sent properly, update sent frame type \r
in the callback */\r
- result = phLlcNfc_Interface_Read (ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ result = phLlcNfc_Interface_Read (ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS (ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
\r
case init_u_a_frame:\r
{\r
- /* First UA frame sent properly, update sent frame type\r
- in the callback. Send the notification to the\r
+ /* First UA frame sent properly, update sent frame type \r
+ in the callback. Send the notification to the \r
upper layer */\r
ps_frame_info->sent_frame_type = write_resp_received;\r
- result = phLlcNfc_Interface_Read (ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ result = phLlcNfc_Interface_Read (ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
{\r
notifyinfo.status = NFCSTATUS_SUCCESS;\r
ps_llc_ctxt->cb_for_if.notify (\r
- ps_llc_ctxt->cb_for_if.pif_ctxt,\r
- ps_llc_ctxt->phwinfo,\r
- NFC_NOTIFY_INIT_COMPLETED,\r
+ ps_llc_ctxt->cb_for_if.pif_ctxt, \r
+ ps_llc_ctxt->phwinfo, \r
+ NFC_NOTIFY_INIT_COMPLETED, \r
¬ifyinfo);\r
- }\r
+ } \r
break;\r
}\r
\r
/* Retries has failed to work, so U frame is sent */\r
ps_frame_info->sent_frame_type = write_resp_received;\r
\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS (ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
/* Send complete */\r
count = ps_frame_info->n_s;\r
\r
- ps_store_frame->s_llcpacket[count].frame_to_send =\r
+ ps_store_frame->s_llcpacket[count].frame_to_send = \r
ps_frame_info->sent_frame_type = write_resp_received;\r
\r
/* N(S) shall be incremented now, because, this callback\r
ensures that packet is sent */\r
- count =\r
- ps_frame_info->n_s = ((ps_frame_info->n_s + 1) %\r
+ count = \r
+ ps_frame_info->n_s = ((ps_frame_info->n_s + 1) % \r
PH_LLCNFC_MOD_NS_NR);\r
\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS (ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
result = phLlcNfc_H_WriteWaitCall (ps_llc_ctxt);\r
}\r
+ \r
\r
-\r
- if ((((ps_store_frame->start_pos + ps_store_frame->winsize_cnt) %\r
- PH_LLCNFC_MOD_NS_NR) == ps_frame_info->n_s) &&\r
+ if ((((ps_store_frame->start_pos + ps_store_frame->winsize_cnt) % \r
+ PH_LLCNFC_MOD_NS_NR) == ps_frame_info->n_s) && \r
(ps_frame_info->window_size == ps_store_frame->winsize_cnt))\r
{\r
- /* Don't call the upper layer send completion callback,\r
- because last sent frame is the maximum that can be\r
+ /* Don't call the upper layer send completion callback, \r
+ because last sent frame is the maximum that can be \r
held by LLC due to windowing\r
- store the callback info, call send completion shall\r
- be sent to upper layer only after the ACK is received for the\r
+ store the callback info, call send completion shall \r
+ be sent to upper layer only after the ACK is received for the \r
I frames */\r
- ps_llc_ctxt->send_cb_len = (pCompInfo->length -\r
+ ps_llc_ctxt->send_cb_len = (pCompInfo->length - \r
PH_LLCNFC_APPEND_LEN);\r
}\r
- else\r
+ else \r
{\r
- /* Send completion is sent to upper layer\r
+ /* Send completion is sent to upper layer \r
Actually, this allows the upper layer to send data, if any\r
*/\r
- if (NULL != ps_llc_ctxt->cb_for_if.send_complete)\r
- {\r
- pCompInfo->length = (pCompInfo->length -\r
+ if (NULL != ps_llc_ctxt->cb_for_if.send_complete) \r
+ { \r
+ pCompInfo->length = (pCompInfo->length - \r
PH_LLCNFC_APPEND_LEN);\r
ps_llc_ctxt->cb_for_if.send_complete (\r
- ps_llc_ctxt->cb_for_if.pif_ctxt,\r
+ ps_llc_ctxt->cb_for_if.pif_ctxt, \r
pHwInfo, pCompInfo);\r
}\r
}\r
#if 0\r
uint8_t i_frame_ns_value = 0;\r
#endif /* #if 0 */\r
- /* S frame is only sent when ever a I frame is received from\r
- the PN544 in the read response callback, so the received I\r
- frame is acknowledged with S frame. The write response\r
+ /* S frame is only sent when ever a I frame is received from \r
+ the PN544 in the read response callback, so the received I \r
+ frame is acknowledged with S frame. The write response \r
callback for sent S frame is in progress. */\r
ps_frame_info->sent_frame_type = write_resp_received;\r
\r
#if 0\r
- i_frame_ns_value =\r
- ((ps_store_frame->s_llcpacket[count].s_llcbuf.sllcpayload.llcheader\r
+ i_frame_ns_value = \r
+ ((ps_store_frame->s_llcpacket[count].s_llcbuf.sllcpayload.llcheader \r
& LLC_NS_FRAME_HEADER_MASK) >> PH_LLCNFC_NS_START_BIT_POS);\r
\r
\r
PH_LLCNFC_DEBUG("frame to send : 0x%02X\n",\r
ps_store_frame->s_llcpacket[count].frame_to_send);\r
\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS(ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
#ifdef LLC_RR_INSTEAD_OF_REJ\r
case rej_rr_s_frame:\r
{\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS(ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
\r
case resend_i_frame:\r
{\r
- /* The code reaches here, only if stored I frame is sent\r
- No changes here, but send next I frame from the stored list,\r
- in the read response callback, only if proper S or I frame\r
- is received from the PN544 */\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ /* The code reaches here, only if stored I frame is sent \r
+ No changes here, but send next I frame from the stored list, \r
+ in the read response callback, only if proper S or I frame \r
+ is received from the PN544 */ \r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
result = phLlcNfc_H_WriteWaitCall (ps_llc_ctxt);\r
}\r
\r
- if (ps_store_frame->winsize_cnt ==\r
+ if (ps_store_frame->winsize_cnt == \r
ps_frame_info->window_size)\r
{\r
- /* Don't call the upper layer send completion callback,\r
- store the callback info, call send completion after\r
- ack for written frame\r
+ /* Don't call the upper layer send completion callback, \r
+ store the callback info, call send completion after \r
+ ack for written frame \r
ps_llc_ctxt->send_cb_len = pCompInfo->length; */\r
}\r
- else\r
+ else \r
{\r
/* ***** This notification needs to be disabled ***** */\r
- if(NULL != ps_llc_ctxt->cb_for_if.send_complete)\r
+ if(NULL != ps_llc_ctxt->cb_for_if.send_complete) \r
{\r
- pCompInfo->length = (pCompInfo->length -\r
+ pCompInfo->length = (pCompInfo->length - \r
PH_LLCNFC_APPEND_LEN);\r
ps_llc_ctxt->cb_for_if.send_complete(\r
- ps_llc_ctxt->cb_for_if.pif_ctxt,\r
+ ps_llc_ctxt->cb_for_if.pif_ctxt, \r
pHwInfo, pCompInfo);\r
}\r
- }\r
+ } \r
\r
- if(user_i_frame ==\r
+ if(user_i_frame == \r
ps_store_frame->s_llcpacket[count].frame_to_send)\r
{\r
/* Send complete */\r
- ps_store_frame->s_llcpacket[count].frame_to_send =\r
+ ps_store_frame->s_llcpacket[count].frame_to_send = \r
resend_i_frame;\r
}\r
break;\r
{\r
/* Update the sent frame type, if window size count is 0 */\r
ps_frame_info->sent_frame_type = write_resp_received;\r
- /* The code enters here, whenever a I frame is resent and for\r
- this resent I frame, an I frame received from PN544.\r
+ /* The code enters here, whenever a I frame is resent and for \r
+ this resent I frame, an I frame received from PN544. \r
So the S frame is sent as the acknowledgment */\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS(ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
{\r
/* Update the sent frame type, if window size count is 0 */\r
ps_frame_info->sent_frame_type = write_resp_received;\r
- /* The code enters here, whenever a I frame is resent and for\r
- this resent I frame, an I frame received from PN544.\r
+ /* The code enters here, whenever a I frame is resent and for \r
+ this resent I frame, an I frame received from PN544. \r
So the S frame is sent as the acknowledgment */\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS(ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
result = phLlcNfc_H_WriteWaitCall (ps_llc_ctxt);\r
}\r
-\r
+ \r
#ifdef LLC_UPP_LAYER_NTFY_WRITE_RSP_CB\r
phLlcNfc_H_SendInfo (ps_llc_ctxt);\r
#endif /* #ifdef LLC_UPP_LAYER_NTFY_WRITE_RSP_CB */\r
\r
case reject_s_frame:\r
{\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
- if (NFCSTATUS_BUSY ==\r
+ if (NFCSTATUS_BUSY == \r
PHNFCSTATUS(ps_frame_info->write_status))\r
{\r
ps_frame_info->write_status = NFCSTATUS_PENDING;\r
\r
case u_a_frame:\r
{\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
\r
case resend_rej_s_frame:\r
{\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
/* Write not successful */\r
if(NULL != ps_llc_ctxt->cb_for_if.send_complete)\r
{\r
- phLlcNfc_StopTimers(PH_LLCNFC_GUARDTIMER,\r
+ phLlcNfc_StopTimers(PH_LLCNFC_GUARDTIMER, \r
ps_llc_ctxt->s_timerinfo.guard_to_count);\r
PH_LLCNFC_DEBUG("Error status received : 0x%x\n", pCompInfo->status);\r
ps_llc_ctxt->cb_for_if.send_complete(\r
- ps_llc_ctxt->cb_for_if.pif_ctxt,\r
+ ps_llc_ctxt->cb_for_if.pif_ctxt, \r
pHwInfo, pCompInfo);\r
}\r
}\r
}\r
\r
static\r
-void\r
+void \r
phLlcNfc_RdResp_Cb(\r
void *pContext,\r
void *pHwInfo,\r
)\r
{\r
/*\r
- 1. LLC Receive has been called by the upper layer, the response\r
+ 1. LLC Receive has been called by the upper layer, the response \r
for this function is called by the lower layer\r
2. Get the frame information from the receive buffer\r
- 3. Depending on the received frame type, process the received\r
+ 3. Depending on the received frame type, process the received \r
buffer\r
*/\r
NFCSTATUS result = NFCSTATUS_SUCCESS;\r
phLlcNfc_Context_t *ps_llc_ctxt = (phLlcNfc_Context_t*)pContext;\r
void *p_upperctxt = NULL;\r
- uint8_t crc1 = 0,\r
+ uint8_t crc1 = 0, \r
crc2 = 0;\r
phLlcNfc_Frame_t *ps_frame_info = NULL;\r
phLlcNfc_LlcPacket_t *ps_recv_pkt = NULL;\r
phNfc_sCompletionInfo_t notifyinfo = {0,0,0};\r
\r
PH_LLCNFC_PRINT("\n\nLLC : READ RESP CB CALLED\n\n");\r
-\r
+ \r
if ((NULL != ps_llc_ctxt) && (NULL != pCompInfo) && (NULL != pHwInfo)\r
&& (NULL != pCompInfo->buffer))\r
{\r
ps_llc_payload = &(ps_recv_pkt->s_llcbuf.sllcpayload);\r
\r
ps_llc_ctxt->s_frameinfo.read_pending = PH_LLCNFC_READPEND_FLAG_OFF;\r
-\r
+ \r
if (NFCSTATUS_SUCCESS == pCompInfo->status)\r
{\r
if ((PH_LLCNFC_MIN_BUFLEN_RECVD == pCompInfo->length) &&\r
PH_LLCNFC_PRINT_BUFFER(pCompInfo->buffer, pCompInfo->length);\r
\r
#if 0\r
- /* Received length is 1 and receive buffer\r
- contains the length field which is greater than 2,\r
+ /* Received length is 1 and receive buffer \r
+ contains the length field which is greater than 2, \r
so read the remaining bytes*/\r
ps_recv_pkt->s_llcbuf.llc_length_byte = pCompInfo->buffer[0];\r
#endif\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
- (uint8_t *)ps_llc_payload,\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
+ (uint8_t *)ps_llc_payload, \r
(uint32_t)(ps_recv_pkt->s_llcbuf.llc_length_byte));\r
\r
- if ((init_u_rset_frame == ps_frame_info->sent_frame_type) &&\r
- (NFCSTATUS_PENDING != result) &&\r
+ if ((init_u_rset_frame == ps_frame_info->sent_frame_type) && \r
+ (NFCSTATUS_PENDING != result) && \r
(NULL != ps_llc_ctxt->cb_for_if.notify))\r
{\r
PH_LLCNFC_PRINT("Initialised error\n");\r
notifyinfo.status = result;\r
- /* Copy the upper layer callback pointer and the upper\r
+ /* Copy the upper layer callback pointer and the upper \r
layer context, after that call release */\r
notifyul = ps_llc_ctxt->cb_for_if.notify;\r
p_upperctxt = ps_llc_ctxt->cb_for_if.pif_ctxt;\r
result = phLlcNfc_Release(ps_llc_ctxt, pHwInfo);\r
\r
/* Wrong result, so Init failed sent */\r
- notifyul(p_upperctxt, pHwInfo,\r
+ notifyul(p_upperctxt, pHwInfo, \r
NFC_NOTIFY_INIT_FAILED, ¬ifyinfo);\r
}\r
}\r
else if (TRUE == ps_llc_ctxt->s_frameinfo.write_pending)\r
{\r
- /* Ignore the bytes as write is not complete and\r
+ /* Ignore the bytes as write is not complete and \r
pend a read for reading 1 byte */\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
(uint8_t *)&(\r
- ps_recv_pkt->s_llcbuf.llc_length_byte),\r
+ ps_recv_pkt->s_llcbuf.llc_length_byte), \r
PH_LLCNFC_MIN_BUFLEN_RECVD);\r
}\r
else if (((PH_LLCNFC_MIN_BUFLEN_RECVD + 1) < pCompInfo->length) &&\r
- (PH_LLCNFC_MAX_BUFLEN_RECV_SEND > pCompInfo->length) &&\r
+ (PH_LLCNFC_MAX_BUFLEN_RECV_SEND > pCompInfo->length) && \r
(pCompInfo->length == ps_recv_pkt->s_llcbuf.llc_length_byte))\r
{\r
PH_LLCNFC_PRINT("Buffer received : \n");\r
/* Receive is complete, so move the state to INITIALISED */\r
if (phLlcNfc_Resend_State != ps_llc_ctxt->state)\r
{\r
- result = phLlcNfc_H_ChangeState(ps_llc_ctxt,\r
+ result = phLlcNfc_H_ChangeState(ps_llc_ctxt, \r
phLlcNfc_Initialised_State);\r
}\r
/* Copy the received buffer and length */\r
ps_recv_pkt->llcbuf_len = (uint8_t)\r
(ps_recv_pkt->s_llcbuf.llc_length_byte + 1);\r
#if 0\r
- (void)memcpy(ps_llc_payload, pCompInfo->buffer,\r
+ (void)memcpy(ps_llc_payload, pCompInfo->buffer, \r
pCompInfo->length);\r
#endif\r
\r
- /*\r
+ /* \r
Check the CRC\r
- ps_llc_ctxt->s_frameinfo.s_recvpacket.s_llcbuf :\r
- consists llc length byte + llc header + data + CRC\r
+ ps_llc_ctxt->s_frameinfo.s_recvpacket.s_llcbuf : \r
+ consists llc length byte + llc header + data + CRC \r
(which needs to be calculated by the below function)\r
- ps_llc_ctxt->s_frameinfo.s_recvpacket.llcbuf_len :\r
+ ps_llc_ctxt->s_frameinfo.s_recvpacket.llcbuf_len : \r
Total length of the above buffer\r
- ps_llc_ctxt->s_frameinfo.s_recvpacket.llcbuf_len - 2 :\r
- -2 because the CRC has to be calculated, only for the\r
- bytes which has llc length byte + llc header + data.\r
- But total length (llcbuf_len) consists of above mentioned\r
- things with 2 byte CRC\r
- ps_llc_ctxt->s_frameinfo.s_recvpacket.s_llcbuf.sllcpayload.llcpayload :\r
+ ps_llc_ctxt->s_frameinfo.s_recvpacket.llcbuf_len - 2 : \r
+ -2 because the CRC has to be calculated, only for the \r
+ bytes which has llc length byte + llc header + data. \r
+ But total length (llcbuf_len) consists of above mentioned \r
+ things with 2 byte CRC \r
+ ps_llc_ctxt->s_frameinfo.s_recvpacket.s_llcbuf.sllcpayload.llcpayload : \r
consists only data (no length byte and no llc header)\r
- (psllcctxt->s_frameinfo.s_recvpacket.llcbuf_len - 4) :\r
+ (psllcctxt->s_frameinfo.s_recvpacket.llcbuf_len - 4) : \r
is the array index of the first CRC byte to be calculated\r
- (psllcctxt->s_frameinfo.s_recvpacket.llcbuf_len - 3) :\r
+ (psllcctxt->s_frameinfo.s_recvpacket.llcbuf_len - 3) : \r
is the array index of the second CRC byte to be calculated\r
*/\r
- phLlcNfc_H_ComputeCrc((uint8_t *)&(ps_recv_pkt->s_llcbuf),\r
- (ps_recv_pkt->llcbuf_len - 2),\r
+ phLlcNfc_H_ComputeCrc((uint8_t *)&(ps_recv_pkt->s_llcbuf), \r
+ (ps_recv_pkt->llcbuf_len - 2), \r
&crc1, &crc2);\r
\r
if ((crc1 == ps_llc_payload->llcpayload[\r
- (ps_recv_pkt->llcbuf_len - 4)])\r
+ (ps_recv_pkt->llcbuf_len - 4)]) \r
&& (crc2 == ps_llc_payload->llcpayload[\r
(ps_recv_pkt->llcbuf_len - 3)]))\r
{\r
}\r
#ifdef LLC_DISABLE_CRC\r
else\r
- {\r
+ { \r
result = phLlcNfc_H_ProRecvFrame(ps_llc_ctxt);\r
}\r
#else\r
- else if (ps_frame_info->recv_error_count <\r
+ else if (ps_frame_info->recv_error_count < \r
PH_LLCNFC_MAX_REJ_RETRY_COUNT)\r
{\r
// LOGW("LLC bad crc");\r
(ps_frame_info->recv_error_count + 1);\r
libnfc_llc_error_count++;\r
\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
- (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
+ (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), \r
PH_LLCNFC_BYTES_INIT_READ);\r
#ifdef CRC_ERROR_REJ\r
/* Send REJ (S frame), as the CRC received has error */\r
else\r
{\r
// LOGE("max LLC retries exceeded, stack restart");\r
- result = phLlcNfc_Interface_Read (ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
- (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
+ result = phLlcNfc_Interface_Read (ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
+ (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), \r
PH_LLCNFC_BYTES_INIT_READ);\r
\r
/* Raise the exception for CRC error received from the */\r
- notifyinfo.status = PHNFCSTVAL(CID_NFC_LLC,\r
+ notifyinfo.status = PHNFCSTVAL(CID_NFC_LLC, \r
NFCSTATUS_BOARD_COMMUNICATION_ERROR);\r
#if 0\r
- phOsalNfc_RaiseException(phOsalNfc_e_UnrecovFirmwareErr,1);\r
+ phOsalNfc_RaiseException(phOsalNfc_e_UnrecovFirmwareErr,1); \r
#endif /* #if 0 */\r
/* Resend done, no answer from the device */\r
ps_llc_ctxt->cb_for_if.notify (\r
ps_llc_ctxt->cb_for_if.pif_ctxt,\r
- ps_llc_ctxt->phwinfo,\r
- NFC_NOTIFY_DEVICE_ERROR,\r
+ ps_llc_ctxt->phwinfo, \r
+ NFC_NOTIFY_DEVICE_ERROR, \r
¬ifyinfo);\r
}\r
\r
#endif /* #ifdef LLC_DISABLE_CRC */\r
} /* read more than 1 byte */\r
- else if (ps_frame_info->recv_error_count >=\r
+ else if (ps_frame_info->recv_error_count >= \r
PH_LLCNFC_MAX_REJ_RETRY_COUNT)\r
{\r
- // LOGE("max LLC retries exceeded, stack restart");\r
- result = phLlcNfc_Interface_Read (ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
- (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
+// LOGE("max LLC retries exceeded, stack restart");\r
+ result = phLlcNfc_Interface_Read (ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
+ (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), \r
PH_LLCNFC_BYTES_INIT_READ);\r
\r
/* Raise the exception for CRC error received from the */\r
- notifyinfo.status = PHNFCSTVAL(CID_NFC_LLC,\r
+ notifyinfo.status = PHNFCSTVAL(CID_NFC_LLC, \r
NFCSTATUS_BOARD_COMMUNICATION_ERROR);\r
#if 0\r
- phOsalNfc_RaiseException(phOsalNfc_e_UnrecovFirmwareErr,1);\r
+ phOsalNfc_RaiseException(phOsalNfc_e_UnrecovFirmwareErr,1); \r
#endif /* #if 0 */\r
/* Resend done, no answer from the device */\r
ps_llc_ctxt->cb_for_if.notify (\r
ps_llc_ctxt->cb_for_if.pif_ctxt,\r
- ps_llc_ctxt->phwinfo,\r
- NFC_NOTIFY_DEVICE_ERROR,\r
+ ps_llc_ctxt->phwinfo, \r
+ NFC_NOTIFY_DEVICE_ERROR, \r
¬ifyinfo);\r
}\r
else if (((PH_LLCNFC_MIN_BUFLEN_RECVD + 1) < pCompInfo->length) &&\r
- (PH_LLCNFC_MAX_BUFLEN_RECV_SEND > pCompInfo->length) &&\r
+ (PH_LLCNFC_MAX_BUFLEN_RECV_SEND > pCompInfo->length) && \r
(pCompInfo->length != ps_recv_pkt->s_llcbuf.llc_length_byte))\r
{\r
- // LOGE("bad LLC length1 %d", pCompInfo->length);\r
+// LOGE("bad LLC length1 %d", pCompInfo->length);\r
ps_frame_info->recv_error_count = (uint8_t)\r
(ps_frame_info->recv_error_count + 1);\r
libnfc_llc_error_count++;\r
\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
- (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
+ (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), \r
PH_LLCNFC_BYTES_INIT_READ);\r
\r
#ifdef CRC_ERROR_REJ\r
((*(pCompInfo->buffer) > (PH_LLCNFC_MAX_BUFLEN_RECV_SEND - 1))\r
||(*(pCompInfo->buffer) <= (PH_LLCNFC_MIN_BUFLEN_RECVD + 1))))\r
{\r
- /* Temporary fix for the 0xFF data received\r
+ /* Temporary fix for the 0xFF data received \r
Solution for the read one byte, giving error in buffer\r
- PH_LLCNFC_MAX_BUFLEN_RECV_SEND (0x21) is the maximum\r
- bytes expected by LLC, if the buffer\r
- value is greater than (0x21 - 1), then pend a read to\r
+ PH_LLCNFC_MAX_BUFLEN_RECV_SEND (0x21) is the maximum \r
+ bytes expected by LLC, if the buffer \r
+ value is greater than (0x21 - 1), then pend a read to \r
get 1 byte again\r
*/\r
// LOGW("bad LLC length byte %x\n", *(pCompInfo->buffer));\r
(ps_frame_info->recv_error_count + 1);\r
libnfc_llc_error_count++;\r
\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
- (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
+ (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), \r
PH_LLCNFC_BYTES_INIT_READ);\r
}\r
else\r
{\r
- // LOGW("unknown LLC error1");\r
+// LOGW("unknown LLC error1");\r
ps_frame_info->recv_error_count = (uint8_t)\r
(ps_frame_info->recv_error_count + 1);\r
libnfc_llc_error_count++;\r
\r
- phLlcNfc_StopTimers(PH_LLCNFC_GUARDTIMER,\r
+ phLlcNfc_StopTimers(PH_LLCNFC_GUARDTIMER, \r
ps_llc_ctxt->s_timerinfo.guard_to_count);\r
- pCompInfo->status = PHNFCSTVAL(CID_NFC_LLC,\r
+ pCompInfo->status = PHNFCSTVAL(CID_NFC_LLC, \r
NFCSTATUS_INVALID_FORMAT);\r
pCompInfo->buffer = NULL;\r
pCompInfo->length = 0;\r
- result = phLlcNfc_Interface_Read(ps_llc_ctxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
- (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
+ result = phLlcNfc_Interface_Read(ps_llc_ctxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
+ (uint8_t *)&(ps_recv_pkt->s_llcbuf.llc_length_byte), \r
PH_LLCNFC_BYTES_INIT_READ);\r
if (NULL != ps_llc_ctxt->cb_for_if.receive_complete)\r
{\r
ps_llc_ctxt->cb_for_if.receive_complete(\r
- ps_llc_ctxt->cb_for_if.pif_ctxt,\r
+ ps_llc_ctxt->cb_for_if.pif_ctxt, \r
pHwInfo, pCompInfo);\r
}\r
}\r
}\r
else\r
{\r
- // LOGW("unknown LLC error2");\r
+// LOGW("unknown LLC error2");\r
ps_frame_info->recv_error_count = (uint8_t)\r
(ps_frame_info->recv_error_count + 1);\r
libnfc_llc_error_count++;\r
\r
- phLlcNfc_StopTimers(PH_LLCNFC_GUARDTIMER,\r
+ phLlcNfc_StopTimers(PH_LLCNFC_GUARDTIMER, \r
ps_llc_ctxt->s_timerinfo.guard_to_count);\r
PH_LLCNFC_DEBUG("Status Error : 0x%x\n", pCompInfo->status);\r
if (NULL != ps_llc_ctxt->cb_for_if.receive_complete)\r
{\r
ps_llc_ctxt->cb_for_if.receive_complete(\r
- ps_llc_ctxt->cb_for_if.pif_ctxt,\r
+ ps_llc_ctxt->cb_for_if.pif_ctxt, \r
pHwInfo, pCompInfo);\r
}\r
}\r
}\r
else\r
{\r
- if ((NULL != ps_llc_ctxt) && (NULL != pCompInfo)\r
+ if ((NULL != ps_llc_ctxt) && (NULL != pCompInfo) \r
&& (NULL != ps_llc_ctxt->cb_for_if.receive_complete))\r
{\r
ps_llc_ctxt->cb_for_if.receive_complete(\r
- ps_llc_ctxt->cb_for_if.pif_ctxt,\r
+ ps_llc_ctxt->cb_for_if.pif_ctxt, \r
pHwInfo, pCompInfo);\r
}\r
}\r
PH_LLCNFC_PRINT("\n\nLLC : READ RESP CB END\n\n");\r
}\r
\r
-void\r
+void \r
phLlcNfc_H_SendInfo (\r
phLlcNfc_Context_t *psLlcCtxt\r
)\r
ps_frame_info = &(psLlcCtxt->s_frameinfo);\r
ps_recv_pkt = &(ps_frame_info->s_recvpacket);\r
\r
- if ((ps_recv_pkt->llcbuf_len > 0) &&\r
+ if ((ps_recv_pkt->llcbuf_len > 0) && \r
(ps_recv_pkt->llcbuf_len <= PH_LLCNFC_MAX_LLC_PAYLOAD))\r
{\r
comp_info.status = NFCSTATUS_SUCCESS;\r
/* Chop the extra Llc bytes received */\r
#if 0\r
- comp_info.length = (ps_recv_pkt->llcbuf_len -\r
+ comp_info.length = (ps_recv_pkt->llcbuf_len - \r
PH_LLCNFC_LEN_APPEND);\r
#else\r
comp_info.length = (uint16_t)psLlcCtxt->recvbuf_length;\r
{\r
#if 0\r
(void)memcpy ((void *)psLlcCtxt->precv_buf, (void *)(\r
- ps_recv_pkt->s_llcbuf.sllcpayload.llcpayload),\r
+ ps_recv_pkt->s_llcbuf.sllcpayload.llcpayload), \r
comp_info.length);\r
#endif /* #if 0 */\r
comp_info.buffer = psLlcCtxt->precv_buf;\r
}\r
else\r
{\r
- comp_info.status = PHNFCSTVAL(CID_NFC_LLC,\r
+ comp_info.status = PHNFCSTVAL(CID_NFC_LLC, \r
NFCSTATUS_INVALID_FORMAT);\r
comp_info.length = 0;\r
comp_info.buffer = NULL;\r
}\r
\r
- (void)phLlcNfc_Interface_Read(psLlcCtxt,\r
- PH_LLCNFC_READWAIT_OFF,\r
+ (void)phLlcNfc_Interface_Read(psLlcCtxt, \r
+ PH_LLCNFC_READWAIT_OFF, \r
&(ps_recv_pkt->s_llcbuf.llc_length_byte),\r
(uint8_t)PH_LLCNFC_BYTES_INIT_READ);\r
\r
- if ((NFCSTATUS_SUCCESS == comp_info.status) &&\r
+ if ((NFCSTATUS_SUCCESS == comp_info.status) && \r
(0 == comp_info.length))\r
{\r
- /* May be a NULL I frame received from PN544, so dont do\r
+ /* May be a NULL I frame received from PN544, so dont do \r
any thing */\r
}\r
else\r
{\r
- if ((NULL != psLlcCtxt->cb_for_if.receive_complete) &&\r
+ if ((NULL != psLlcCtxt->cb_for_if.receive_complete) && \r
(TRUE == ps_frame_info->upper_recv_call))\r
{\r
ps_frame_info->upper_recv_call = FALSE;\r
psLlcCtxt->cb_for_if.receive_complete(\r
- psLlcCtxt->cb_for_if.pif_ctxt,\r
- psLlcCtxt->phwinfo,\r
+ psLlcCtxt->cb_for_if.pif_ctxt, \r
+ psLlcCtxt->phwinfo, \r
&comp_info);\r
}\r
else\r
if (NULL != psLlcCtxt->cb_for_if.notify)\r
{\r
psLlcCtxt->cb_for_if.notify(\r
- psLlcCtxt->cb_for_if.pif_ctxt,\r
- psLlcCtxt->phwinfo,\r
- NFC_NOTIFY_RECV_COMPLETED,\r
+ psLlcCtxt->cb_for_if.pif_ctxt, \r
+ psLlcCtxt->phwinfo, \r
+ NFC_NOTIFY_RECV_COMPLETED, \r
&comp_info);\r
}\r
}\r
/*\r
- * Copyright (C) 2010 NXP Semiconductors
- * Copyright (C) 2012 Samsung Elevtronics Co., Ltd\r
+ * Copyright (C) 2010 NXP Semiconductors\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
#ifdef PIGGY_BACK\r
\r
-#define PH_LLCNFC_ACK_TO_VALUE 1000\r
+#define PH_LLCNFC_ACK_TO_VALUE LINK_ACK_TIMEOUT\r
\r
#endif /* #ifdef PIGGY_BACK */\r
\r
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.\r
*\r
*/\r
-NFCSTATUS\r
+NFCSTATUS \r
phLlcNfc_TimerInit (\r
phLlcNfc_Context_t *psLlcCtxt\r
);\r
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.\r
*\r
*/\r
-void\r
+void \r
phLlcNfc_TimerUnInit (\r
phLlcNfc_Context_t *psLlcCtxt\r
);\r
*\r
*\r
*/\r
-void\r
+void \r
phLlcNfc_CreateTimers (void);\r
\r
/**\r
* \retval Others Errors related to OsalNfc.\r
*\r
*/\r
-NFCSTATUS\r
+NFCSTATUS \r
phLlcNfc_StartTimers (\r
- uint8_t TimerType,\r
+ uint8_t TimerType, \r
uint8_t ns_value\r
);\r
\r
* \copydoc page_reg stop the timer type given by the user\r
*\r
* \param[in] TimerType Timer type to start\r
-* \param[in] no_of_gaurd_to_del Guard time-out count shall be decreased as and when\r
+* \param[in] no_of_gaurd_to_del Guard time-out count shall be decreased as and when \r
* frame is removed\r
*\r
*\r
*/\r
-void\r
+void \r
phLlcNfc_StopTimers (\r
- uint8_t TimerType,\r
+ uint8_t TimerType, \r
uint8_t no_of_guard_to_del\r
);\r
\r
*\r
*\r
*/\r
-void\r
+void \r
phLlcNfc_StopAllTimers (void);\r
\r
\r
* \retval Others Errors related to OsalNfc.\r
*\r
*/\r
-void\r
+void \r
phLlcNfc_DeleteTimer (void);\r
\r
#ifdef LLC_URSET_NO_DELAY\r
\r
#else /* #ifdef LLC_URSET_NO_DELAY */\r
\r
-void\r
+void \r
phLlcNfc_URSET_Delay_Notify (\r
\r
uint32_t delay_id);\r