summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/phFriNfc_LlcpMacNfcip.c61
-rw-r--r--src/phLibNfcStatus.h12
-rw-r--r--src/phLibNfc_initiator.c15
-rw-r--r--src/phLibNfc_target.c15
4 files changed, 98 insertions, 5 deletions
diff --git a/src/phFriNfc_LlcpMacNfcip.c b/src/phFriNfc_LlcpMacNfcip.c
index f522c11..f4e069d 100644
--- a/src/phFriNfc_LlcpMacNfcip.c
+++ b/src/phFriNfc_LlcpMacNfcip.c
@@ -32,7 +32,6 @@
#include <stdio.h>
#include <string.h>
-
static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Send(phFriNfc_LlcpMac_t *LlcpMac,
phNfc_sData_t *psData,
phFriNfc_LlcpMac_Send_CB_t LlcpMacSend_Cb,
@@ -118,6 +117,15 @@ static void phFriNfc_LlcpMac_Nfcip_Send_Cb(void *pContext,
phFriNfc_LlcpMac_Send_CB_t pfSendCB;
void *pSendContext;
+#ifdef LLCP_CHANGES
+ if(gpphLibContext->LibNfcState.next_state
+ == eLibNfcHalStateShutdown)
+ {
+ phLibNfc_Pending_Shutdown();
+ Status = NFCSTATUS_SHUTDOWN;
+ }
+#endif /* #ifdef LLCP_CHANGES */
+
/* Reset Send and Receive Flag */
LlcpMac->SendPending = FALSE;
LlcpMac->RecvPending = FALSE;
@@ -140,6 +148,35 @@ static void phFriNfc_LlcpMac_Nfcip_Receive_Cb(void *pContext,
phFriNfc_LlcpMac_t *LlcpMac = (phFriNfc_LlcpMac_t *)pContext;
phFriNfc_LlcpMac_Reveive_CB_t pfReceiveCB;
void *pReceiveContext;
+#ifdef LLCP_CHANGES
+
+ phFriNfc_LlcpMac_Send_CB_t pfSendCB;
+ void *pSendContext;
+
+
+ if(gpphLibContext->LibNfcState.next_state
+ == eLibNfcHalStateShutdown)
+ {
+ phLibNfc_Pending_Shutdown();
+ Status = NFCSTATUS_SHUTDOWN;
+ }
+
+ if (NFCSTATUS_SHUTDOWN == Status)
+ {
+ /* Save context in local variables */
+ pfSendCB = LlcpMac->MacSend_Cb;
+ pSendContext = LlcpMac->MacSend_Context;
+
+ /* Reset the pointer to the Send Callback */
+ LlcpMac->MacSend_Cb = NULL;
+ LlcpMac->MacSend_Context = NULL;
+
+ /* Reset Send and Receive Flag */
+ LlcpMac->SendPending = FALSE;
+ LlcpMac->RecvPending = FALSE;
+ }
+
+#endif /* #ifdef LLCP_CHANGES */
/* Save callback params */
pfReceiveCB = LlcpMac->MacReceive_Cb;
@@ -152,12 +189,26 @@ static void phFriNfc_LlcpMac_Nfcip_Receive_Cb(void *pContext,
/* Call the receive callback */
pfReceiveCB(pReceiveContext, Status, LlcpMac->psReceiveBuffer);
+#ifdef LLCP_CHANGES
+
+ if (NFCSTATUS_SHUTDOWN == Status)
+ {
+ if ((LlcpMac->SendPending) && (NULL != pfSendCB))
+ {
+ pfSendCB(pSendContext, Status);
+ }
+ }
+ else
+
+#endif /* #ifdef LLCP_CHANGES */
+ {
/* Test if a send is pending */
if(LlcpMac->SendPending)
{
Status = phFriNfc_LlcpMac_Nfcip_Send(LlcpMac,LlcpMac->psSendBuffer,LlcpMac->MacSend_Cb,LlcpMac->MacReceive_Context);
}
}
+}
static void phFriNfc_LlcpMac_Nfcip_Transceive_Cb(void *pContext,
NFCSTATUS Status)
@@ -168,6 +219,14 @@ static void phFriNfc_LlcpMac_Nfcip_Transceive_Cb(void *pContext,
phFriNfc_LlcpMac_Send_CB_t pfSendCB;
void *pSendContext;
+#ifdef LLCP_CHANGES
+ if(gpphLibContext->LibNfcState.next_state
+ == eLibNfcHalStateShutdown)
+ {
+ phLibNfc_Pending_Shutdown();
+ Status = NFCSTATUS_SHUTDOWN;
+ }
+#endif /* #ifdef LLCP_CHANGES */
/* Save context in local variables */
pfReceiveCB = LlcpMac->MacReceive_Cb;
pReceiveContext = LlcpMac->MacReceive_Context;
diff --git a/src/phLibNfcStatus.h b/src/phLibNfcStatus.h
index 5894dd9..62bd3ec 100644
--- a/src/phLibNfcStatus.h
+++ b/src/phLibNfcStatus.h
@@ -31,6 +31,18 @@
#include <phNfcStatus.h>
+#define LLCP_CHANGES
+#define LLCP_TRANSACT_CHANGES
+
+#ifdef LLCP_TRANSACT_CHANGES
+/* These two macros are defined due to non availibity of the below macros in header files
+#define PHFRINFC_LLCP_STATE_RESET_INIT 0 // \internal Initial state
+#define PHFRINFC_LLCP_STATE_CHECKED 1 // \internal The tag has been checked for LLCP compliance
+*/
+#define LLCP_STATE_RESET_INIT 0x00U
+#define LLCP_STATE_CHECKED 0x01U
+
+#endif /* #ifdef LLCP_TRANSACT_CHANGES */
#define LIB_NFC_VERSION_SET(v,major,minor,patch,build) ((v) = \
( ((major) << 24) & 0xFF000000 ) | \
( ((minor) << 16) & 0x00FF0000 ) | \
diff --git a/src/phLibNfc_initiator.c b/src/phLibNfc_initiator.c
index efb7ec1..a694e6f 100644
--- a/src/phLibNfc_initiator.c
+++ b/src/phLibNfc_initiator.c
@@ -650,17 +650,19 @@ NFCSTATUS phLibNfc_RemoteDev_Disconnect( phLibNfc_Handle hRemote
{
if((eLibNfcHalStateRelease == gpphLibContext->LibNfcState.next_state)
||((gpphLibContext->sSeContext.eActivatedMode == phLibNfc_SE_ActModeWired)&&
- (ReleaseType != NFC_SMARTMX_RELEASE))
- ||((gpphLibContext->sSeContext.eActivatedMode != phLibNfc_SE_ActModeWired)&&
- (ReleaseType == NFC_SMARTMX_RELEASE)))
+ (ReleaseType != NFC_SMARTMX_RELEASE))
+ ||((gpphLibContext->sSeContext.eActivatedMode != phLibNfc_SE_ActModeWired)&&
+ (ReleaseType == NFC_SMARTMX_RELEASE)))
{ /* Previous disconnect callback is pending */
RetVal = NFCSTATUS_REJECTED;
}
+#ifndef LLCP_CHANGES
else if(eLibNfcHalStateTransaction == gpphLibContext->LibNfcState.next_state)
{ /* Previous Transaction is Pending*/
RetVal = NFCSTATUS_BUSY;
PHDBG_INFO("LibNfc:Transaction is Pending");
}
+#endif /* #ifdef LLCP_CHANGES */
else
{
gpphLibContext->ReleaseType = ReleaseType;
@@ -820,6 +822,13 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
{
RetVal = NFCSTATUS_REJECTED;
}
+#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->ndef_cntx.eLast_Call = RawTrans;
diff --git a/src/phLibNfc_target.c b/src/phLibNfc_target.c
index 3013e2f..982d8dd 100644
--- a/src/phLibNfc_target.c
+++ b/src/phLibNfc_target.c
@@ -116,6 +116,13 @@ NFCSTATUS phLibNfc_RemoteDev_Receive(phLibNfc_Handle hRemoteDevice,
{
RetVal= NFCSTATUS_INVALID_DEVICE;
}
+#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
{
if(eLibNfcHalStatePresenceChk ==
@@ -264,11 +271,17 @@ phLibNfc_RemoteDev_Send(
{
RetVal= NFCSTATUS_INVALID_DEVICE;
}
-
else if((NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb))
{
RetVal =NFCSTATUS_BUSY ;
}
+#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
{
if(eLibNfcHalStatePresenceChk ==