summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/phFriNfc_OvrHal.c5
-rw-r--r--src/phHal4Nfc_ADD.c15
-rw-r--r--src/phHal4Nfc_Internal.h4
-rw-r--r--src/phLibNfc_discovery.c7
-rw-r--r--src/phLibNfc_ndef_raw.c28
5 files changed, 55 insertions, 4 deletions
diff --git a/src/phFriNfc_OvrHal.c b/src/phFriNfc_OvrHal.c
index bd9bc0a..539210e 100644
--- a/src/phFriNfc_OvrHal.c
+++ b/src/phFriNfc_OvrHal.c
@@ -34,7 +34,6 @@
#include <phFriNfc_SmtCrdFmt.h>
-
#ifdef PHFRINFC_OVRHAL_MOCKUP /* */
//#include <phLibNfc_Gen.h>
#endif /* PHFRINFC_OVRHAL_MOCKUP */
@@ -321,7 +320,7 @@ static void phFriNfc_OvrHal_CB_Transceive(void *context,
if (NULL != OvrHal)
{
- if(NULL != pRecvdata)
+ if(NULL != pRecvdata && OvrHal->TranceiveInfo.sRecvData.buffer != NULL && pRecvdata->buffer != NULL)
{
/* Work-around for the NFCIP Tranceive API */
memcpy(OvrHal->TranceiveInfo.sRecvData.buffer, pRecvdata->buffer, pRecvdata->length);
@@ -370,7 +369,7 @@ static void phFriNfc_OvrHal_CB_Receive(void *context,
if (NULL != OvrHal)
{
/* Copy the received buffer */
- if(NULL != pDataInfo)
+ if(NULL != pDataInfo && OvrHal->sReceiveData.buffer != NULL && pDataInfo->buffer != NULL)
{
memcpy(OvrHal->sReceiveData.buffer, pDataInfo->buffer, pDataInfo->length);
*OvrHal->pndef_recv_length = (uint16_t) pDataInfo->length;
diff --git a/src/phHal4Nfc_ADD.c b/src/phHal4Nfc_ADD.c
index e95d872..9fef2db 100644
--- a/src/phHal4Nfc_ADD.c
+++ b/src/phHal4Nfc_ADD.c
@@ -103,7 +103,11 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
else
{
/*Register Upper layer context*/
+#ifdef LLCP_DISCON_CHANGES
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCfgDiscCtxt = pContext;
+#else /* #ifdef LLCP_DISCON_CHANGES */
Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+#endif /* #ifdef LLCP_DISCON_CHANGES */
switch(CfgType)
{
/*NFC_EMULATION_CONFIG*/
@@ -244,7 +248,11 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
else
{
/*Register Upper layer context*/
+#ifdef LLCP_DISCON_CHANGES
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCfgDiscCtxt = pContext;
+#else /* #ifdef LLCP_DISCON_CHANGES */
Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+#endif /* #ifdef LLCP_DISCON_CHANGES */
switch(discoveryMode)
{
case NFC_DISCOVERY_START:
@@ -371,7 +379,12 @@ void phHal4Nfc_ConfigureComplete(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
Hal4Ctxt->Hal4NextState = eHal4StateInvalid;
Hal4Ctxt->sUpperLayerInfo.pConfigCallback = NULL;
(*pConfigCallback)(
- Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,Status
+#ifdef LLCP_DISCON_CHANGES
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCfgDiscCtxt,
+#else /* #ifdef LLCP_DISCON_CHANGES */
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+#endif /* #ifdef LLCP_DISCON_CHANGES */
+ Status
);
#ifdef MERGE_SAK_SW2
}
diff --git a/src/phHal4Nfc_Internal.h b/src/phHal4Nfc_Internal.h
index 70f7b16..8675c55 100644
--- a/src/phHal4Nfc_Internal.h
+++ b/src/phHal4Nfc_Internal.h
@@ -52,6 +52,7 @@
/* -----------------Include files ---------------------------------------*/
/* ---------------- Macros ----------------------------------------------*/
+#define LLCP_DISCON_CHANGES
#define PH_HAL4NFC_TRANSCEIVE_TIMEOUT 30000 /**<Transceive operation
on any target should be
completed within this
@@ -176,6 +177,9 @@ typedef struct phHal4Nfc_UpperLayerInfo{
pphHal4Nfc_GenCallback_t pConfigCallback;
void *psUpperLayerCtxt;
void *psUpperLayerDisconnectCtxt;
+#ifdef LLCP_DISCON_CHANGES
+ void *psUpperLayerCfgDiscCtxt;
+#endif /* #ifdef LLCP_DISCON_CHANGES */
/**Upper layer's Open Callback registry*/
pphHal4Nfc_GenCallback_t pUpperOpenCb;
/**Upper layer's Close Callback registry */
diff --git a/src/phLibNfc_discovery.c b/src/phLibNfc_discovery.c
index ead278e..1fe4d8f 100644
--- a/src/phLibNfc_discovery.c
+++ b/src/phLibNfc_discovery.c
@@ -246,6 +246,13 @@ NFCSTATUS phLibNfc_RemoteDev_CheckPresence( phLibNfc_Handle hTargetDev,
{
RetVal = NFCSTATUS_INVALID_HANDLE;
}
+#ifdef LLCP_TRANSACT_CHANGES
+ else if ((LLCP_STATE_RESET_INIT != gpphLibContext->llcp_cntx.sLlcpContext.state)
+ && (LLCP_STATE_CHECKED != gpphLibContext->llcp_cntx.sLlcpContext.state))
+ {
+ RetVal= NFCSTATUS_BUSY;
+ }
+#endif /* #ifdef LLCP_TRANSACT_CHANGES */
else
{
ps_rem_dev_info = (phHal_sRemoteDevInformation_t *)
diff --git a/src/phLibNfc_ndef_raw.c b/src/phLibNfc_ndef_raw.c
index 1392895..ac29d70 100644
--- a/src/phLibNfc_ndef_raw.c
+++ b/src/phLibNfc_ndef_raw.c
@@ -158,6 +158,13 @@ NFCSTATUS phLibNfc_Ndef_Read( phLibNfc_Handle hRemoteDevice,
psRd->length = 0;
RetVal = NFCSTATUS_SUCCESS;
}
+#ifdef LLCP_TRANSACT_CHANGES
+ else if ((LLCP_STATE_RESET_INIT != gpphLibContext->llcp_cntx.sLlcpContext.state)
+ && (LLCP_STATE_CHECKED != gpphLibContext->llcp_cntx.sLlcpContext.state))
+ {
+ RetVal= NFCSTATUS_BUSY;
+ }
+#endif /* #ifdef LLCP_TRANSACT_CHANGES */
else
{
gpphLibContext->psRemoteDevList->psRemoteDevInfo->SessionOpened = SESSION_OPEN;
@@ -401,6 +408,13 @@ NFCSTATUS phLibNfc_Ndef_Write(
{
RetVal = NFCSTATUS_NOT_ENOUGH_MEMORY;
}
+#ifdef LLCP_TRANSACT_CHANGES
+ else if ((LLCP_STATE_RESET_INIT != gpphLibContext->llcp_cntx.sLlcpContext.state)
+ && (LLCP_STATE_CHECKED != gpphLibContext->llcp_cntx.sLlcpContext.state))
+ {
+ RetVal= NFCSTATUS_BUSY;
+ }
+#endif /* #ifdef LLCP_TRANSACT_CHANGES */
else
{
uint8_t cr_index = 0;
@@ -747,6 +761,13 @@ NFCSTATUS phLibNfc_Ndef_CheckNdef(phLibNfc_Handle hRemoteDevice,
{
RetVal=NFCSTATUS_INVALID_HANDLE;
}
+#ifdef LLCP_TRANSACT_CHANGES
+ else if ((LLCP_STATE_RESET_INIT != gpphLibContext->llcp_cntx.sLlcpContext.state)
+ && (LLCP_STATE_CHECKED != gpphLibContext->llcp_cntx.sLlcpContext.state))
+ {
+ RetVal= NFCSTATUS_BUSY;
+ }
+#endif /* #ifdef LLCP_TRANSACT_CHANGES */
else
{
uint8_t cr_index = 0;
@@ -1214,6 +1235,13 @@ NFCSTATUS phLibNfc_RemoteDev_FormatNdef(phLibNfc_Handle hRemoteDevice,
RetVal = NFCSTATUS_REJECTED;
PHDBG_INFO("LIbNfc:Previous Callback is Pending");
}
+#ifdef LLCP_TRANSACT_CHANGES
+ else if ((LLCP_STATE_RESET_INIT != gpphLibContext->llcp_cntx.sLlcpContext.state)
+ && (LLCP_STATE_CHECKED != gpphLibContext->llcp_cntx.sLlcpContext.state))
+ {
+ RetVal= NFCSTATUS_BUSY;
+ }
+#endif /* #ifdef LLCP_TRANSACT_CHANGES */
else
{
uint8_t fun_id;