summaryrefslogtreecommitdiff
path: root/src/phFriNfc_LlcpMacNfcip.c
diff options
context:
space:
mode:
authordaniel_Tomas <daniel.tomas@trusted-logic.com>2010-11-19 09:51:28 +0100
committerNick Pelly <npelly@google.com>2010-12-05 18:33:18 -0800
commit6e286043593b281d161dad4969e05ba9c53ef6d1 (patch)
treeb74fe3829b5be2fe04f5e5f76b832565368d5d56 /src/phFriNfc_LlcpMacNfcip.c
parent75b0473b9eedf7673ed4502978205f4fa5563357 (diff)
downloadlibnfc-nxp-6e286043593b281d161dad4969e05ba9c53ef6d1.tar.gz
LLCP modification for concurence accesses
Change-Id: I428c58dfc2c791f87e0f5761f11bb59d26ad85b1
Diffstat (limited to 'src/phFriNfc_LlcpMacNfcip.c')
-rw-r--r--src/phFriNfc_LlcpMacNfcip.c61
1 files changed, 60 insertions, 1 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;