summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordoug yeager <doug@simplytapp.com>2012-08-23 10:27:28 -0500
committerdoug yeager <doug@simplytapp.com>2012-08-28 10:03:02 -0500
commit55f43da8fa1a5ac7e9e88f81381a80345fa3ac50 (patch)
tree1d98c808147e9c5c1cbb84077049c0d634d53636 /src
parent42fef9f8aa6d0878cb3f2c050c637afa7f8d8abd (diff)
downloadexternal_libnfc-nxp-55f43da8fa1a5ac7e9e88f81381a80345fa3ac50.zip
external_libnfc-nxp-55f43da8fa1a5ac7e9e88f81381a80345fa3ac50.tar.gz
external_libnfc-nxp-55f43da8fa1a5ac7e9e88f81381a80345fa3ac50.tar.bz2
card emulation patch port to JB
Change-Id: I86657f9c547840de33c35df4912b5f282d4fe459
Diffstat (limited to 'src')
-rwxr-xr-x[-rw-r--r--]src/phHal4Nfc.c136
-rwxr-xr-x[-rw-r--r--]src/phHal4Nfc.h352
-rwxr-xr-x[-rw-r--r--]src/phHal4Nfc_ADD.c238
-rwxr-xr-x[-rw-r--r--]src/phHal4Nfc_Emulation.c64
-rwxr-xr-x[-rw-r--r--]src/phHal4Nfc_Internal.h49
-rwxr-xr-x[-rw-r--r--]src/phHciNfc.c4
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_AdminMgmt.c107
-rwxr-xr-xsrc/phHciNfc_CE.c455
-rwxr-xr-xsrc/phHciNfc_CE.h114
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_CE_A.c1264
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_CE_A.h55
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_CE_B.c1256
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_CE_B.h56
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_Generic.c167
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_Pipe.c106
-rwxr-xr-x[-rw-r--r--]src/phHciNfc_Sequence.c240
-rwxr-xr-x[-rw-r--r--]src/phLibNfc.h1149
-rwxr-xr-x[-rw-r--r--]src/phLibNfc_Internal.h4
-rwxr-xr-x[-rw-r--r--]src/phLibNfc_initiator.c656
19 files changed, 5135 insertions, 1337 deletions
diff --git a/src/phHal4Nfc.c b/src/phHal4Nfc.c
index 0f6ce2b..b4c1d45 100644..100755
--- a/src/phHal4Nfc.c
+++ b/src/phHal4Nfc.c
@@ -213,7 +213,7 @@ static void phHal4Nfc_CloseComplete(
Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer
);
}
- if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice)
+ if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice)
&& (NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData))
{
phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData);
@@ -371,7 +371,7 @@ NFCSTATUS phHal4Nfc_Open(
openRetVal = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_ALREADY_INITIALISED);
}
else/*Do an initialization*/
- {
+ {
#ifdef ANDROID
dlopen_firmware();
#endif
@@ -431,7 +431,7 @@ NFCSTATUS phHal4Nfc_Open(
/*Hci Init did not succeed.free Resources and return*/
if( (openRetVal != NFCSTATUS_SUCCESS)
&& (PHNFCSTATUS (openRetVal) != NFCSTATUS_PENDING) )
- {
+ {
phOsalNfc_FreeMemory(Hal4Ctxt->pHal4Nfc_LayerCfg);
phOsalNfc_FreeMemory(Hal4Ctxt);
Hal4Ctxt = NULL;
@@ -479,7 +479,7 @@ NFCSTATUS phHal4Nfc_Ioctl(
if(NFC_FW_DOWNLOAD_CHECK == IoctlCode)
{
RetStatus = phDnldNfc_Run_Check(
- psHwReference
+ psHwReference
);
}
else
@@ -490,7 +490,7 @@ NFCSTATUS phHal4Nfc_Ioctl(
Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)
phOsalNfc_GetMemory((uint32_t)sizeof(
phHal4Nfc_Hal4Ctxt_t)
- );
+ );
if(NULL == Hal4Ctxt)
{
RetStatus = PHNFCSTVAL(CID_NFC_HAL,
@@ -498,15 +498,15 @@ NFCSTATUS phHal4Nfc_Ioctl(
}
else
{
- ((phHal_sHwReference_t *)psHwReference)->hal_context
+ ((phHal_sHwReference_t *)psHwReference)->hal_context
= Hal4Ctxt;
(void)memset((void *)Hal4Ctxt,
0,
- ((uint32_t)sizeof(phHal4Nfc_Hal4Ctxt_t)));
- Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+ ((uint32_t)sizeof(phHal4Nfc_Hal4Ctxt_t)));
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb
= pIoctlCallback;/*Register upper layer callback*/
- Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam = pOutParam;
+ Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam = pOutParam;
/*Upgrade the firmware*/
RetStatus = phDnldNfc_Upgrade (
psHwReference,
@@ -525,7 +525,7 @@ NFCSTATUS phHal4Nfc_Ioctl(
else
#endif/*NFC_FW_DOWNLOAD*/
{
- RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
}
}
else/*Status is Initialised*/
@@ -589,7 +589,7 @@ NFCSTATUS phHal4Nfc_Ioctl(
);
}
break;
- /*Used to Read Memory/Registers .3 bytes of Array passed form the
+ /*Used to Read Memory/Registers .3 bytes of Array passed form the
address to read from in MSB first format.*/
case NFC_MEM_READ:
{
@@ -615,8 +615,8 @@ NFCSTATUS phHal4Nfc_Ioctl(
}
}
break;
- /*Used to Write Memory/Registers .First 3 bytes of Array passed in MSB
- first format form the address to write to.The 4th Byte is the 8 bit
+ /*Used to Write Memory/Registers .First 3 bytes of Array passed in MSB
+ first format form the address to write to.The 4th Byte is the 8 bit
value to be written to the address*/
case NFC_MEM_WRITE:
{
@@ -625,7 +625,7 @@ NFCSTATUS phHal4Nfc_Ioctl(
{
for( ind = 0; ind < 3; ind++ )
{
- config_type = ((config_type << BYTE_SIZE )
+ config_type = ((config_type << BYTE_SIZE )
| (pInParam->buffer[ind] ));
}
RetStatus = phHciNfc_System_Configure (
@@ -637,7 +637,7 @@ NFCSTATUS phHal4Nfc_Ioctl(
}
else
{
- RetStatus = PHNFCSTVAL(CID_NFC_HAL ,
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,
NFCSTATUS_INVALID_PARAMETER);
}
}
@@ -660,7 +660,7 @@ NFCSTATUS phHal4Nfc_Ioctl(
/**
* The close function called by the upper layer when HAL4 is to be closed
- * (shutdown).
+ * (shutdown).
*/
NFCSTATUS phHal4Nfc_Close(
phHal_sHwReference_t *psHwReference,
@@ -678,10 +678,10 @@ NFCSTATUS phHal4Nfc_Close(
}
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateSelfTestMode)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
/*return already closed*/
@@ -781,7 +781,7 @@ void phHal4Nfc_Hal4Reset(
phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo
->sLowerRecvData.buffer);
}
- if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice)
+ if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice)
&& (NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData))
{
phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData);
@@ -831,10 +831,10 @@ NFCSTATUS phHal4Nfc_GetDeviceCapabilities(
/*Check for Initialized state*/
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
retstatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
@@ -900,7 +900,7 @@ static void phHal4Nfc_LowerNotificationHandler(
gpphHal4Nfc_Hwref = (phHal_sHwReference_t *)pHwRef;
}
}
- else/*No Copy of Hw ref in HAL.Copy both Hwref and Hal context passed
+ else/*No Copy of Hw ref in HAL.Copy both Hwref and Hal context passed
by Hci*/
{
Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)pContext;
@@ -990,6 +990,22 @@ static void phHal4Nfc_LowerNotificationHandler(
phHal4Nfc_SendCompleteHandler(Hal4Ctxt,pInfo);
}
break;
+#if defined (HOST_EMULATION)
+ case NFC_NOTIFY_SEND_CE_A_COMPLETED :
+ PHDBG_INFO("Hal4:CE A Send Callback");
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ phHal4Nfc_CE_A_SendCompleteHandler(Hal4Ctxt,pInfo);
+ }
+ break;
+ case NFC_NOTIFY_SEND_CE_B_COMPLETED :
+ PHDBG_INFO("Hal4:CE B Send Callback");
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ phHal4Nfc_CE_B_SendCompleteHandler(Hal4Ctxt,pInfo);
+ }
+ break;
+#endif //HOST_EMULATION
case NFC_NOTIFY_TRANSACTION :
phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);
break;
@@ -1013,6 +1029,46 @@ static void phHal4Nfc_LowerNotificationHandler(
}
phHal4Nfc_RecvCompleteHandler(Hal4Ctxt,pInfo);
break;
+#if defined (HOST_EMULATION)
+ case NFC_NOTIFY_CE_A_RECV_EVENT:
+ PHDBG_INFO("Hal4:Receive Event");
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ if(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ != PH_OSALNFC_INVALID_TIMER_ID)
+ {
+ phOsalNfc_Timer_Stop(
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ );
+ phOsalNfc_Timer_Delete(
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ );
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ }
+ }
+ phHal4Nfc_CE_A_RecvCompleteHandler(Hal4Ctxt,pInfo);
+ break;
+ case NFC_NOTIFY_CE_B_RECV_EVENT:
+ PHDBG_INFO("Hal4:Receive Event");
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ if(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ != PH_OSALNFC_INVALID_TIMER_ID)
+ {
+ phOsalNfc_Timer_Stop(
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ );
+ phOsalNfc_Timer_Delete(
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ );
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ }
+ }
+ phHal4Nfc_CE_B_RecvCompleteHandler(Hal4Ctxt,pInfo);
+ break;
+#endif //HOST_EMULATION
case NFC_NOTIFY_TARGET_PRESENT:
phHal4Nfc_PresenceChkComplete(Hal4Ctxt,pInfo);
break;
@@ -1025,7 +1081,7 @@ static void phHal4Nfc_LowerNotificationHandler(
= Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt;
static phHal4Nfc_NotificationInfo_t uNotificationInfo;
if(NULL != Hal4Ctxt->sUpperLayerInfo.pDefaultEventHandler)
- {
+ {
Hal4Ctxt->Hal4NextState = eHal4StateInvalid;
Hal4Ctxt->sUpperLayerInfo.pDefaultEventHandler(
Hal4Ctxt->sUpperLayerInfo.DefaultListenerCtxt,
@@ -1064,8 +1120,8 @@ static void phHal4Nfc_LowerNotificationHandler(
break;
}
case NFC_NOTIFY_CONNECT_FAILED:
- case NFC_NOTIFY_DISCONNECT_FAILED:
- /*Generic Error type received from Hci.Handle the error based on
+ case NFC_NOTIFY_DISCONNECT_FAILED:
+ /*Generic Error type received from Hci.Handle the error based on
Hal4 next state and which past callback was Pending*/
case NFC_NOTIFY_ERROR:
{
@@ -1159,7 +1215,7 @@ static void phHal4Nfc_HandleEvent(
break;
default:
break;
- }
+ }
}
}
break;
@@ -1190,7 +1246,7 @@ static void phHal4Nfc_HandleEvent(
case NFC_EVT_PROTECTED:
{
#ifdef IGNORE_EVT_PROTECTED
- /*Ignore_Event_Protected is set to false during Field Off event and
+ /*Ignore_Event_Protected is set to false during Field Off event and
Set protection Configuration.After a NFC_EVT_PROTECTED is received
once all subsequent NFC_EVT_PROTECTED events are ignored*/
if(FALSE == Hal4Ctxt->Ignore_Event_Protected)
@@ -1200,7 +1256,7 @@ static void phHal4Nfc_HandleEvent(
sNotificationInfo.info = psEventInfo;
sNotificationInfo.status = NFCSTATUS_SUCCESS;
sNotificationInfo.type = NFC_EVENT_NOTIFICATION;
- pInfo = &sNotificationInfo;
+ pInfo = &sNotificationInfo;
phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);
#ifdef IGNORE_EVT_PROTECTED
}
@@ -1238,20 +1294,20 @@ static void phHal4Nfc_HandleEvent(
}
if(NULL != Hal4Ctxt->psADDCtxtInfo)
{
- Hal4Ctxt->psADDCtxtInfo->sADDCfg.PollDevInfo.PollEnabled
+ Hal4Ctxt->psADDCtxtInfo->sADDCfg.PollDevInfo.PollEnabled
|= psEventInfo->eventInfo.rd_phases;
- /*Configure HCI Discovery*/
+ /*Configure HCI Discovery*/
RetStatus = phHciNfc_Config_Discovery(
(void *)Hal4Ctxt->psHciHandle,
gpphHal4Nfc_Hwref,
&(Hal4Ctxt->psADDCtxtInfo->sADDCfg)
- );
+ );
Hal4Ctxt->Hal4NextState = (NFCSTATUS_PENDING == RetStatus?
eHal4StateConfiguring:
Hal4Ctxt->Hal4NextState);
}
break;
- }
+ }
/*Call Default Event handler for these Events*/
case NFC_INFO_TXLDO_OVERCUR:
case NFC_INFO_MEM_VIOLATION:
@@ -1280,7 +1336,7 @@ static void phHal4Nfc_HandleEvent(
case NFC_EVT_TRANSACTION:
case NFC_EVT_START_OF_TRANSACTION:
case NFC_EVT_END_OF_TRANSACTION:
- case NFC_EVT_CONNECTIVITY:
+ case NFC_EVT_CONNECTIVITY:
case NFC_EVT_OPERATION_ENDED:
case NFC_EVT_MIFARE_ACCESS:
case NFC_EVT_APDU_RECEIVED:
@@ -1298,7 +1354,7 @@ static void phHal4Nfc_HandleEvent(
sNotificationInfo.type = NFC_EVENT_NOTIFICATION;
pInfo = &sNotificationInfo;
PHDBG_INFO("Hal4:Event Field ON\n");
- phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);
+ phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);
break;
case NFC_EVT_FIELD_OFF:
#ifdef IGNORE_EVT_PROTECTED
@@ -1309,7 +1365,7 @@ static void phHal4Nfc_HandleEvent(
sNotificationInfo.type = NFC_EVENT_NOTIFICATION;
pInfo = &sNotificationInfo;
PHDBG_INFO("Hal4:Event Field OFF\n");
- phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);
+ phHal4Nfc_HandleEmulationEvent(Hal4Ctxt,pInfo);
break;
default:
PHDBG_WARNING("Hal4:Unhandled Event type received");
@@ -1373,14 +1429,14 @@ static void phHal4Nfc_IoctlComplete(
{
/*Copy status*/
NFCSTATUS status = (((phNfc_sCompletionInfo_t *)pInfo)->status);
- pphHal4Nfc_IoctlCallback_t pUpper_IoctlCb
+ pphHal4Nfc_IoctlCallback_t pUpper_IoctlCb
= Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb;
#ifdef MERGE_SAK_SW2
- pphHal4Nfc_GenCallback_t pConfigCallback =
+ pphHal4Nfc_GenCallback_t pConfigCallback =
Hal4Ctxt->sUpperLayerInfo.pConfigCallback;
#endif/*#ifdef MERGE_SAK_SW2*/
void *pUpper_Context = Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt;
- Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb = NULL;
+ Hal4Ctxt->sUpperLayerInfo.pUpperIoctlCb = NULL;
#ifdef MERGE_SAK_SW1 /*Software workaround 1*/
if(eHal4StateOpenAndReady == Hal4Ctxt->Hal4NextState)
{
@@ -1392,7 +1448,7 @@ static void phHal4Nfc_IoctlComplete(
NFCSTATUS_SUCCESS
);
}
-#endif/*#ifdef MERGE_SAK_SW1*/
+#endif/*#ifdef MERGE_SAK_SW1*/
#ifdef MERGE_SAK_SW2 /*Software workaround 2*/
else if((eHal4StateConfiguring == Hal4Ctxt->Hal4NextState)
&&(NULL != pConfigCallback))
@@ -1411,7 +1467,7 @@ static void phHal4Nfc_IoctlComplete(
|| (NFC_GPIO_READ == Hal4Ctxt->Ioctl_Type)
)
{
- Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam->length
+ Hal4Ctxt->sUpperLayerInfo.pIoctlOutParam->length
= sizeof (uint8_t);
}
/*Call registered Ioctl callback*/
diff --git a/src/phHal4Nfc.h b/src/phHal4Nfc.h
index 47e3136..0392c40 100644..100755
--- a/src/phHal4Nfc.h
+++ b/src/phHal4Nfc.h
@@ -87,7 +87,7 @@
HAL functionality */
#define PH_HAL4NFC_VERSION 8
#define PH_HAL4NFC_REVISION 21
-#define PH_HAL4NFC_PATCH 1
+#define PH_HAL4NFC_PATCH 1
#define PH_HAL4NFC_BUILD 0
/** HAL Interface Version Macros : Updated for every external release of
@@ -273,7 +273,7 @@ typedef enum{
firmware operation*/
eInitTestModeOn, /**<Limited Initialization used for running self
tests */
- eInitCustom /**<Reserved for Future Use */
+ eInitCustom /**<Reserved for Future Use */
} phHal4Nfc_InitType_t;
/**
@@ -587,8 +587,8 @@ extern NFCSTATUS phHal4Nfc_ConfigParameters(
* session has to be closed before
* (see\ref phHal4Nfc_Disconnect).
* \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
- * \retval NFCSTATUS_FEATURE_NOT_SUPPORTED Reactivation is not supported for
- * NfcIp target and Jewel/Topaz
+ * \retval NFCSTATUS_FEATURE_NOT_SUPPORTED Reactivation is not supported for
+ * NfcIp target and Jewel/Topaz
* remote device types.
* \retval NFCSTATUS_INVALID_REMOTE_DEVICE The Remote Device Identifier is
* not valid.
@@ -996,6 +996,334 @@ phHal4Nfc_Receive(
);
+
+/**
+* \if hal
+* \ingroup grp_hal_common
+* \else
+* \ingroup grp_mw_external_hal_funcs
+* \endif
+*
+* This function is called by the type A Peer to wait for receiving data from
+* the other reader.It is used only by the NfcIP Target.
+* \note NOTE: After this function is called, its mandatory to wait for the
+* pphHal4Nfc_ReceiveCallback_t callback, before calling any other function.
+* Only functions allowed are phHal4Nfc_Close() and phHal4Nfc_Hal4Reset().
+*
+*
+* \param[in] psHwReference Hardware Reference, pre-initialized by
+* upper layer. \n
+*
+* \param[in] psTransactInfo information required for transferring the
+* data
+*
+* \param[in] pReceiveCallback Callback function called after receiving
+* the data or in case an error has
+* has occurred.
+*
+* \param[in] pContext Upper layer context to be returned
+* in the callback.
+*
+* \retval NFCSTATUS_PENDING Receive is in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or has
+* been disconnected meanwhile.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
+* \retval Others Errors related to the lower layers
+*
+*/
+extern
+NFCSTATUS
+phHal4Nfc_CE_A_Receive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psRecvInfo,
+ pphHal4Nfc_TransceiveCallback_t pReceiveCallback,
+ void *pContext
+ );
+
+/**
+* \if hal
+* \ingroup grp_hal_common
+* \else
+* \ingroup grp_mw_external_hal_funcs
+* \endif
+*
+* The function is used by the type A Target to respond to packect received
+* from reader. pSendCallback()
+* is called , when all steps in the send sequence are completed.
+*
+* \param[in] psHwReference Hardware Reference, pre-initialized by
+* upper layer. \n
+*
+* \param[in] psTransactInfo information required for transferring
+* the data
+*
+* \param[in] sTransferData Data and the length of the data to be
+* transferred
+*
+* \param[in] pSendCallback Callback function called on completion
+* of the NfcIP sequence or in case an
+* error has occurred.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+* \retval NFCSTATUS_PENDING Send is in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or has
+* been disconnected meanwhile.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
+* \retval Others Errors related to the lower layers.
+*
+*
+*/
+extern
+NFCSTATUS
+phHal4Nfc_CE_A_Send(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_SendCallback_t pSendCallback,
+ void *pContext
+ );
+
+
+/**
+ * \if hal
+ * \ingroup grp_hal_nfci
+ * \else
+ * \ingroup grp_mw_external_hal_funcs
+ * \endif
+ *
+ * The phHal4Nfc_CE_A_Transceive function allows to send data to and receive data
+ * from the reader selected by the caller.
+ * The caller has to provide the Remote Device Information structure and the
+ * command in order to communicate with the selected remote device.For CE
+ * transactions the command type will not be used.
+ *
+ *
+ *
+ *
+ * \param[in] psHwReference Hardware Reference, pre-initialized by
+ * upper layer. \n
+ *
+ * \param[in,out] psTransferInfo Information required by transceive is
+ * concealed in this structure.It contains
+ * the send,receive buffers and their
+ * lengths.
+ *
+ * \param[in] psRemoteDevInfo Points to the Remote Device Information
+ * structure which identifies the selected
+ * Remote Device.
+ *
+ * \param[in] pReceiveCallback Callback function for returning the
+ * received response or error.
+ *
+ * \param[in] pContext Upper layer context to be returned in
+ * the callback.
+ *
+ * \retval NFCSTATUS_PENDING Transceive initiated.pTrcvCallback
+ * will return the response or error.
+ * \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
+ * \retval NFCSTATUS_SUCCESS This status is used when send data
+ * length is zero and HAL contains
+ * previously more bytes from previous
+ * receive. \n
+ * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied
+ * parameters could not be properly
+ * interpreted or are invalid.
+ * \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or
+ * has been disconnected meanwhile.
+ * \retval NFCSTATUS_FEATURE_NOT_SUPPORTED Transaction on this Device type is
+ * not supported.
+ * \retval NFCSTATUS_BUSY Previous transaction is not
+ * completed.
+ * \retval NFCSTATUS_INSUFFICIENT_RESOURCES System resources are insufficient
+ * to complete the request at that
+ * point in time.
+ * \retval NFCSTATUS_MORE_INFORMATION Received number of bytes is greater
+ * than receive buffer provided by the
+ * upper layer.Extra bytes will be
+ * retained by Hal and returned on next
+ * call to transceive.
+ * \retval Others Errors related to the lower layers.
+ *
+ */
+extern
+NFCSTATUS
+phHal4Nfc_CE_A_Transceive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_TransceiveCallback_t pReceiveCallback,
+ void *pContext
+ );
+
+/**
+* \if hal
+* \ingroup grp_hal_common
+* \else
+* \ingroup grp_mw_external_hal_funcs
+* \endif
+*
+* This function is called by the type B Peer to wait for receiving data from
+* the other reader.It is used only by the NfcIP Target.
+* \note NOTE: After this function is called, its mandatory to wait for the
+* pphHal4Nfc_ReceiveCallback_t callback, before calling any other function.
+* Only functions allowed are phHal4Nfc_Close() and phHal4Nfc_Hal4Reset().
+*
+*
+* \param[in] psHwReference Hardware Reference, pre-initialized by
+* upper layer. \n
+*
+* \param[in] psTransactInfo information required for transferring the
+* data
+*
+* \param[in] pReceiveCallback Callback function called after receiving
+* the data or in case an error has
+* has occurred.
+*
+* \param[in] pContext Upper layer context to be returned
+* in the callback.
+*
+* \retval NFCSTATUS_PENDING Receive is in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or has
+* been disconnected meanwhile.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
+* \retval Others Errors related to the lower layers
+*
+*/
+extern
+NFCSTATUS
+phHal4Nfc_CE_B_Receive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psRecvInfo,
+ pphHal4Nfc_TransceiveCallback_t pReceiveCallback,
+ void *pContext
+ );
+
+/**
+* \if hal
+* \ingroup grp_hal_common
+* \else
+* \ingroup grp_mw_external_hal_funcs
+* \endif
+*
+* The function is used by the type B Target to respond to packect received
+* from reader. pSendCallback()
+* is called , when all steps in the send sequence are completed.
+*
+* \param[in] psHwReference Hardware Reference, pre-initialized by
+* upper layer. \n
+*
+* \param[in] psTransactInfo information required for transferring
+* the data
+*
+* \param[in] sTransferData Data and the length of the data to be
+* transferred
+*
+* \param[in] pSendCallback Callback function called on completion
+* of the NfcIP sequence or in case an
+* error has occurred.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+* \retval NFCSTATUS_PENDING Send is in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or has
+* been disconnected meanwhile.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
+* \retval Others Errors related to the lower layers.
+*
+*
+*/
+extern
+NFCSTATUS
+phHal4Nfc_CE_B_Send(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_SendCallback_t pSendCallback,
+ void *pContext
+ );
+
+
+/**
+ * \if hal
+ * \ingroup grp_hal_nfci
+ * \else
+ * \ingroup grp_mw_external_hal_funcs
+ * \endif
+ *
+ * The phHal4Nfc_CE_B_Transceive function allows to send data to and receive data
+ * from the reader selected by the caller.
+ * The caller has to provide the Remote Device Information structure and the
+ * command in order to communicate with the selected remote device.For CE
+ * transactions the command type will not be used.
+ *
+ *
+ *
+ *
+ * \param[in] psHwReference Hardware Reference, pre-initialized by
+ * upper layer. \n
+ *
+ * \param[in,out] psTransferInfo Information required by transceive is
+ * concealed in this structure.It contains
+ * the send,receive buffers and their
+ * lengths.
+ *
+ * \param[in] psRemoteDevInfo Points to the Remote Device Information
+ * structure which identifies the selected
+ * Remote Device.
+ *
+ * \param[in] pReceiveCallback Callback function for returning the
+ * received response or error.
+ *
+ * \param[in] pContext Upper layer context to be returned in
+ * the callback.
+ *
+ * \retval NFCSTATUS_PENDING Transceive initiated.pTrcvCallback
+ * will return the response or error.
+ * \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
+ * \retval NFCSTATUS_SUCCESS This status is used when send data
+ * length is zero and HAL contains
+ * previously more bytes from previous
+ * receive. \n
+ * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied
+ * parameters could not be properly
+ * interpreted or are invalid.
+ * \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or
+ * has been disconnected meanwhile.
+ * \retval NFCSTATUS_FEATURE_NOT_SUPPORTED Transaction on this Device type is
+ * not supported.
+ * \retval NFCSTATUS_BUSY Previous transaction is not
+ * completed.
+ * \retval NFCSTATUS_INSUFFICIENT_RESOURCES System resources are insufficient
+ * to complete the request at that
+ * point in time.
+ * \retval NFCSTATUS_MORE_INFORMATION Received number of bytes is greater
+ * than receive buffer provided by the
+ * upper layer.Extra bytes will be
+ * retained by Hal and returned on next
+ * call to transceive.
+ * \retval Others Errors related to the lower layers.
+ *
+ */
+extern
+NFCSTATUS
+phHal4Nfc_CE_B_Transceive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_TransceiveCallback_t pReceiveCallback,
+ void *pContext
+ );
/**
* \if hal
* \ingroup grp_hal_common
@@ -1127,13 +1455,13 @@ extern NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
* \ingroup grp_mw_external_hal_funcs
* \endif
*
-* This function is called to switch the UICC on or Off.
+* This function is called to switch the UICC on or Off.
*
*
-* \param[in] psHwReference Hardware Reference, pre-initialized by
+* \param[in] psHwReference Hardware Reference, pre-initialized by
* upper layer. \n
*
-* \param[in] smx_mode Mode to which the switch should be made.
+* \param[in] smx_mode Mode to which the switch should be made.
*
* \param[in] pSwitchModecb Callback for Switch mode complete
* with success/error notification.
@@ -1142,22 +1470,22 @@ extern NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
*
* \retval NFCSTATUS_PENDING Switch in progress.Status will be
* returned in pSwitchModecb.
-* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied
* parameters could not be properly
* interpreted.
* \retval NFCSTATUS_NOT_INITIALIZED Hal is not initialized.
-* \retval NFCSTATUS_BUSY Configuration in Progress or
+* \retval NFCSTATUS_BUSY Configuration in Progress or
* remote device is connected.
* \retval NFCSTATUS_INSUFFICIENT_RESOURCES System resources are insufficient
* to complete the request at that
* point in time.
-* \retval NFCSTATUS_FAILED No listener has been registered
+* \retval NFCSTATUS_FAILED No listener has been registered
* by the upper layer for Emulation
* before making this call.
-* \retval Others Errors related to the lower
+* \retval Others Errors related to the lower
* layers.
*/
-extern NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
+extern NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
phHal_sHwReference_t *psHwReference,
phHal_eSWP_Mode_t swp_mode,
pphHal4Nfc_GenCallback_t pSwitchModecb,
diff --git a/src/phHal4Nfc_ADD.c b/src/phHal4Nfc_ADD.c
index 0a3303c..54dd1c1 100644..100755
--- a/src/phHal4Nfc_ADD.c
+++ b/src/phHal4Nfc_ADD.c
@@ -33,12 +33,12 @@
#include <phOsalNfc.h>
/* ------------------------------- Macros ------------------------------------*/
-#define NFCIP_ACTIVE_SHIFT 0x03U
+#define NFCIP_ACTIVE_SHIFT 0x03U
#define NXP_UID 0x04U
#define NXP_MIN_UID_LEN 0x07U
/* --------------------Structures and enumerations --------------------------*/
-NFCSTATUS phHal4Nfc_ConfigParameters(
+NFCSTATUS phHal4Nfc_ConfigParameters(
phHal_sHwReference_t *psHwReference,
phHal_eConfigType_t CfgType,
phHal_uConfig_t *puConfig,
@@ -49,7 +49,7 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
NFCSTATUS CfgStatus = NFCSTATUS_SUCCESS;
phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
/*NULL checks*/
- if(NULL == psHwReference
+ if(NULL == psHwReference
|| NULL == pConfigCallback
|| NULL == puConfig
)
@@ -60,10 +60,10 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
/*Check if initialised*/
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
@@ -72,7 +72,7 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
else
{
Hal4Ctxt = psHwReference->hal_context;
- /*If previous Configuration request has not completed,do not allow new
+ /*If previous Configuration request has not completed,do not allow new
configuration*/
if(Hal4Ctxt->Hal4NextState == eHal4StateConfiguring)
{
@@ -116,12 +116,12 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
(void)memcpy((void *)&Hal4Ctxt->uConfig,
(void *)puConfig,
sizeof(phHal_uConfig_t)
- );
+ );
break;
}
/*P2P Configuration*/
case NFC_P2P_CONFIG:
- {
+ {
/*If general bytes are not provided by above layer copy zeros
in general bytes*/
if(puConfig->nfcIPConfig.generalBytesLength == 0)
@@ -139,7 +139,7 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
);
}
break;
- }
+ }
/*Protection config*/
case NFC_SE_PROTECTION_CONFIG:
{
@@ -158,13 +158,13 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
}
if ( NFCSTATUS_SUCCESS == CfgStatus )
{
- /*Issue configure with given configuration*/
+ /*Issue configure with given configuration*/
CfgStatus = phHciNfc_Configure(
(void *)Hal4Ctxt->psHciHandle,
(void *)psHwReference,
CfgType,
&Hal4Ctxt->uConfig
- );
+ );
/* Change the State of the HAL only if status is Pending */
if ( NFCSTATUS_PENDING == CfgStatus )
{
@@ -186,9 +186,9 @@ NFCSTATUS phHal4Nfc_ConfigParameters(
/**Configure the discovery*/
-NFCSTATUS phHal4Nfc_ConfigureDiscovery(
+NFCSTATUS phHal4Nfc_ConfigureDiscovery(
phHal_sHwReference_t *psHwReference,
- phHal_eDiscoveryConfigMode_t discoveryMode,
+ phHal_eDiscoveryConfigMode_t discoveryMode,
phHal_sADD_Cfg_t *discoveryCfg,
pphHal4Nfc_GenCallback_t pConfigCallback,
void *pContext
@@ -196,7 +196,7 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
{
NFCSTATUS CfgStatus = NFCSTATUS_SUCCESS;
phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
- if(NULL == psHwReference
+ if(NULL == psHwReference
|| NULL == pConfigCallback
|| NULL == discoveryCfg
)
@@ -206,10 +206,10 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
}
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
@@ -218,7 +218,7 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
else
{
Hal4Ctxt = psHwReference->hal_context;
- /*If previous Configuration request has not completed ,do not allow
+ /*If previous Configuration request has not completed ,do not allow
new configuration*/
if(Hal4Ctxt->Hal4NextState == eHal4StateConfiguring)
{
@@ -260,23 +260,23 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
break;
case NFC_DISCOVERY_CONFIG:
PHDBG_INFO("Hal4:Call to NFC_DISCOVERY_CONFIG");
- /*Since sADDCfg is allocated in stack ,copy the ADD
+ /*Since sADDCfg is allocated in stack ,copy the ADD
configuration structure to HAL4 context*/
(void)memcpy((void *)
&(Hal4Ctxt->psADDCtxtInfo->sADDCfg),
(void *)discoveryCfg,
sizeof(phHal_sADD_Cfg_t)
- );
- PHDBG_INFO("Hal4:Finished copying sADDCfg");
+ );
+ PHDBG_INFO("Hal4:Finished copying sADDCfg");
Hal4Ctxt->psADDCtxtInfo->smx_discovery = FALSE;
#ifdef UPDATE_NFC_ACTIVE
Hal4Ctxt->psADDCtxtInfo->sADDCfg.PollDevInfo.PollCfgInfo.EnableNfcActive
= ( 0 == Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode?
Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode:
NXP_NFCIP_ACTIVE_DEFAULT);
- Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode = ((
+ Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode = ((
Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode <<
- (NXP_NFCIP_ACTIVE_DEFAULT * NFCIP_ACTIVE_SHIFT))
+ (NXP_NFCIP_ACTIVE_DEFAULT * NFCIP_ACTIVE_SHIFT))
| Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode);
#endif/*#ifdef UPDATE_NFC_ACTIVE*/
/* information system_code(Felica) and
@@ -286,24 +286,24 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
(void *)Hal4Ctxt->psHciHandle,
(void *)psHwReference,
&(Hal4Ctxt->psADDCtxtInfo->sADDCfg)
- );/*Configure HCI Discovery*/
+ );/*Configure HCI Discovery*/
break;
case NFC_DISCOVERY_STOP:
break;
- /*Restart Discovery wheel*/
+ /*Restart Discovery wheel*/
case NFC_DISCOVERY_RESUME:
PHDBG_INFO("Hal4:Call to NFC_DISCOVERY_RESUME");
Hal4Ctxt->psADDCtxtInfo->nbr_of_devices = 0;
CfgStatus = phHciNfc_Restart_Discovery (
(void *)Hal4Ctxt->psHciHandle,
- (void *)psHwReference,
+ (void *)psHwReference,
FALSE
);
break;
default:
break;
}
- /* Change the State of the HAL only if HCI Configure
+ /* Change the State of the HAL only if HCI Configure
Returns status as Pending */
if ( NFCSTATUS_PENDING == CfgStatus )
{
@@ -311,7 +311,7 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
&(Hal4Ctxt->psADDCtxtInfo->sCurrentPollConfig),
(void *)&(discoveryCfg->PollDevInfo.PollCfgInfo),
sizeof(phHal_sPollDevInfo_t)
- );
+ );
PHDBG_INFO("Hal4:Finished copying PollCfgInfo");
PHDBG_INFO("Hal4:Configure returned NFCSTATUS_PENDING");
Hal4Ctxt->Hal4NextState = eHal4StateConfiguring;
@@ -324,7 +324,7 @@ NFCSTATUS phHal4Nfc_ConfigureDiscovery(
&(Hal4Ctxt->psADDCtxtInfo->sADDCfg.PollDevInfo.PollCfgInfo),
(void *)&(Hal4Ctxt->psADDCtxtInfo->sCurrentPollConfig),
sizeof(phHal_sPollDevInfo_t)
- );
+ );
}
}
}
@@ -346,8 +346,8 @@ void phHal4Nfc_ConfigureComplete(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
{
pphHal4Nfc_GenCallback_t pConfigCallback
= Hal4Ctxt->sUpperLayerInfo.pConfigCallback;
- pphHal4Nfc_ConnectCallback_t pUpperConnectCb
- = Hal4Ctxt->sTgtConnectInfo.pUpperConnectCb;
+ pphHal4Nfc_ConnectCallback_t pUpperConnectCb
+ = Hal4Ctxt->sTgtConnectInfo.pUpperConnectCb;
NFCSTATUS Status = ((phNfc_sCompletionInfo_t *)pInfo)->status;
if((type == NFC_NOTIFY_POLL_ENABLED) ||(type == NFC_NOTIFY_POLL_RESTARTED))
{
@@ -360,7 +360,7 @@ void phHal4Nfc_ConfigureComplete(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
PHDBG_WARNING("Hal4:Poll disabled,config success or config error");
}
if(NULL != Hal4Ctxt->sUpperLayerInfo.pConfigCallback)
- {
+ {
#ifdef MERGE_SAK_SW2
if((NFC_UICC_EMULATION == Hal4Ctxt->uConfig.emuConfig.emuType)&&
(FALSE ==
@@ -421,18 +421,18 @@ void phHal4Nfc_TargetDiscoveryComplete(
void *pInfo
)
{
- static phHal4Nfc_DiscoveryInfo_t sDiscoveryInfo;
+ static phHal4Nfc_DiscoveryInfo_t sDiscoveryInfo;
NFCSTATUS status = NFCSTATUS_SUCCESS;
/**SAK byte*/
uint8_t Sak = 0;
/*Union type to encapsulate and return the discovery info*/
phHal4Nfc_NotificationInfo_t uNotificationInfo;
- /*All the following types will be discovered as type A ,and differentiation
+ /*All the following types will be discovered as type A ,and differentiation
will have to be done within this module based on SAK byte and UID info*/
phHal_eRemDevType_t aRemoteDevTypes[3] = {
phHal_eISO14443_A_PICC,
phHal_eNfcIP1_Target,
- phHal_eMifare_PICC
+ phHal_eMifare_PICC
};
/*Count is used to add multiple info into remote dvice list for devices that
support multiple protocols*/
@@ -445,7 +445,7 @@ void phHal4Nfc_TargetDiscoveryComplete(
/*Update Hal4 state*/
Hal4Ctxt->Hal4CurrentState = eHal4StateTargetDiscovered;
Hal4Ctxt->Hal4NextState = eHal4StateInvalid;
- PHDBG_INFO("Hal4:Remotedevice Discovered");
+ PHDBG_INFO("Hal4:Remotedevice Discovered");
if(NULL != ((phNfc_sCompletionInfo_t *)pInfo)->info)
{
/*Extract Remote device Info*/
@@ -484,9 +484,9 @@ void phHal4Nfc_TargetDiscoveryComplete(
if((0 == Sak)&& (0 == Count))
{
/*Mifare check*/
- if((NXP_UID ==
+ if((NXP_UID ==
psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Uid[0])
- &&(NXP_MIN_UID_LEN <=
+ &&(NXP_MIN_UID_LEN <=
psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.UidLength))
{
aRemoteDevTypes[Count] = phHal_eMifare_PICC;
@@ -502,9 +502,9 @@ void phHal4Nfc_TargetDiscoveryComplete(
}
}
/*Check for P2P target passive*/
- if((Sak & NFCIP_BITMASK) &&
+ if((Sak & NFCIP_BITMASK) &&
(NULL != Hal4Ctxt->sUpperLayerInfo.pP2PNotification)&&
- (Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode
+ (Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode
& phHal_ePassive106))
{
if( Sak == 0x53 // Fudan card incompatible to ISO18092
@@ -519,7 +519,7 @@ void phHal4Nfc_TargetDiscoveryComplete(
{
aRemoteDevTypes[Count] = phHal_eNfcIP1_Target;
Count++;
- }
+ }
}
}/*case phHal_eISO14443_A_PICC:*/
break;
@@ -527,7 +527,7 @@ void phHal4Nfc_TargetDiscoveryComplete(
aRemoteDevTypes[Count] = phHal_eNfcIP1_Target;
Count++;
break;
- case phHal_eISO14443_B_PICC: /*TYPE_B*/
+ case phHal_eISO14443_B_PICC: /*TYPE_B*/
#ifdef TYPE_B
aRemoteDevTypes[Count] = phHal_eISO14443_B_PICC;
Count++;
@@ -539,14 +539,14 @@ void phHal4Nfc_TargetDiscoveryComplete(
/*nfc_id is used to differentiate between Felica and NfcIp target
discovered in Type F*/
nfc_id = (((uint16_t)psRemoteDevInfo->RemoteDevInfo.Felica_Info.IDm[0])
- << BYTE_SIZE) |
+ << BYTE_SIZE) |
psRemoteDevInfo->RemoteDevInfo.Felica_Info.IDm[1];
/*check for NfcIp target*/
if(NXP_NFCIP_NFCID2_ID == nfc_id)
{
if((NULL != Hal4Ctxt->sUpperLayerInfo.pP2PNotification)
- &&((Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode
- & phHal_ePassive212) ||
+ &&((Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode
+ & phHal_ePassive212) ||
(Hal4Ctxt->psADDCtxtInfo->sADDCfg.NfcIP_Mode
& phHal_ePassive424)))
{
@@ -560,12 +560,12 @@ void phHal4Nfc_TargetDiscoveryComplete(
|| Hal4Ctxt->psADDCtxtInfo->sCurrentPollConfig.EnableFelica424)
{
aRemoteDevTypes[Count] = phHal_eFelica_PICC;
- Count++;
+ Count++;
}
}
break;
}
-#endif
+#endif
case phHal_eJewel_PICC: /*Jewel*/
#ifdef TYPE_JEWEL
{
@@ -573,10 +573,10 @@ void phHal4Nfc_TargetDiscoveryComplete(
if(Hal4Ctxt->psADDCtxtInfo->sCurrentPollConfig.EnableIso14443A)
{
aRemoteDevTypes[Count] = phHal_eJewel_PICC;
- Count++;
+ Count++;
}
break;
- }
+ }
#endif
#ifdef TYPE_ISO15693
case phHal_eISO15693_PICC: /*ISO15693*/
@@ -584,10 +584,10 @@ void phHal4Nfc_TargetDiscoveryComplete(
if(Hal4Ctxt->psADDCtxtInfo->sCurrentPollConfig.EnableIso15693)
{
aRemoteDevTypes[Count] = phHal_eISO15693_PICC;
- Count++;
+ Count++;
}
break;
- }
+ }
#endif /* #ifdef TYPE_ISO15693 */
/*Types currently not supported*/
case phHal_eISO14443_BPrime_PICC:
@@ -596,11 +596,11 @@ void phHal4Nfc_TargetDiscoveryComplete(
break;
}/*End of switch*/
/*Update status code to success if atleast one device info is available*/
- status = (((NFCSTATUS_SUCCESS != status)
+ status = (((NFCSTATUS_SUCCESS != status)
&& (NFCSTATUS_MULTIPLE_TAGS != status))
&&(Hal4Ctxt->psADDCtxtInfo->nbr_of_devices != 0))?
NFCSTATUS_SUCCESS:status;
-
+
/*Update status to NFCSTATUS_MULTIPLE_PROTOCOLS if count > 1 ,and this
is first discovery notification from Hci*/
status = ((NFCSTATUS_SUCCESS == status)
@@ -611,15 +611,15 @@ void phHal4Nfc_TargetDiscoveryComplete(
/*Allocate and copy Remote device info into Hal4 Context*/
while(Count)
{
- PHDBG_INFO("Hal4:Count is not zero");
+ PHDBG_INFO("Hal4:Count is not zero");
--Count;
- /*Allocate memory for each of Count number of
+ /*Allocate memory for each of Count number of
devices*/
if(NULL == Hal4Ctxt->rem_dev_list[
Hal4Ctxt->psADDCtxtInfo->nbr_of_devices])
{
Hal4Ctxt->rem_dev_list[
- Hal4Ctxt->psADDCtxtInfo->nbr_of_devices]
+ Hal4Ctxt->psADDCtxtInfo->nbr_of_devices]
= (phHal_sRemoteDevInformation_t *)
phOsalNfc_GetMemory(
(uint32_t)(
@@ -644,13 +644,13 @@ void phHal4Nfc_TargetDiscoveryComplete(
);
/*Now copy appropriate device type from aRemoteDevTypes array*/
Hal4Ctxt->rem_dev_list[
- Hal4Ctxt->psADDCtxtInfo->nbr_of_devices]->RemDevType
+ Hal4Ctxt->psADDCtxtInfo->nbr_of_devices]->RemDevType
= aRemoteDevTypes[Count];
/*Increment number of devices*/
- Hal4Ctxt->psADDCtxtInfo->nbr_of_devices++;
+ Hal4Ctxt->psADDCtxtInfo->nbr_of_devices++;
}/*End of else*/
}/*End of while*/
-
+
/*If Upper layer is interested only in P2P notifications*/
if((NULL != Hal4Ctxt->sUpperLayerInfo.pP2PNotification)
&&(((Hal4Ctxt->psADDCtxtInfo->nbr_of_devices == 1)
@@ -658,9 +658,9 @@ void phHal4Nfc_TargetDiscoveryComplete(
||(NULL == Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification))
)
{
- PHDBG_INFO("Hal4:Trying to notify P2P Listener");
+ PHDBG_INFO("Hal4:Trying to notify P2P Listener");
/*NFCSTATUS_SUCCESS or NFCSTATUS_MULTIPLE_PROTOCOLS*/
- if((NFCSTATUS_SUCCESS == status)
+ if((NFCSTATUS_SUCCESS == status)
||(NFCSTATUS_MULTIPLE_PROTOCOLS == status))
{
/*Pick only the P2P target device info from the list*/
@@ -668,15 +668,15 @@ void phHal4Nfc_TargetDiscoveryComplete(
Count > 0;--Count)
{
/*Only one P2P target can be detected in one discovery*/
- if(phHal_eNfcIP1_Target ==
+ if(phHal_eNfcIP1_Target ==
Hal4Ctxt->rem_dev_list[Count-1]->RemDevType)
{
(void)memcpy(
(void *)Hal4Ctxt->rem_dev_list[0],
(void *)Hal4Ctxt->rem_dev_list[Count-1],
sizeof(phHal_sRemoteDevInformation_t)
- );
- NfcIpDeviceCount = 1;
+ );
+ NfcIpDeviceCount = 1;
break;
}
}
@@ -691,7 +691,7 @@ void phHal4Nfc_TargetDiscoveryComplete(
/*Issue P2P notification*/
if(NfcIpDeviceCount == 1)
{
- sDiscoveryInfo.NumberOfDevices
+ sDiscoveryInfo.NumberOfDevices
= Hal4Ctxt->psADDCtxtInfo->nbr_of_devices;
sDiscoveryInfo.ppRemoteDevInfo = Hal4Ctxt->rem_dev_list;
uNotificationInfo.psDiscoveryInfo = &sDiscoveryInfo;
@@ -703,14 +703,14 @@ void phHal4Nfc_TargetDiscoveryComplete(
NFCSTATUS_SUCCESS
);
}
- else/*Restart Discovery wheel*/
+ else/*Restart Discovery wheel*/
{
- PHDBG_INFO("Hal4:No P2P device in list");
+ PHDBG_INFO("Hal4:No P2P device in list");
Hal4Ctxt->psADDCtxtInfo->nbr_of_devices = 0;
- PHDBG_INFO("Hal4:Restart discovery1");
+ PHDBG_INFO("Hal4:Restart discovery1");
status = phHciNfc_Restart_Discovery (
(void *)Hal4Ctxt->psHciHandle,
- (void *)gpphHal4Nfc_Hwref,
+ (void *)gpphHal4Nfc_Hwref,
FALSE
);
Hal4Ctxt->Hal4NextState = (NFCSTATUS_PENDING == status?
@@ -720,7 +720,7 @@ void phHal4Nfc_TargetDiscoveryComplete(
}
/*More discovery info available ,get next info from HCI*/
else if((NFCSTATUS_MULTIPLE_TAGS == status)
- &&(Hal4Ctxt->psADDCtxtInfo->nbr_of_devices
+ &&(Hal4Ctxt->psADDCtxtInfo->nbr_of_devices
< MAX_REMOTE_DEVICES))
{
status = phHciNfc_Select_Next_Target (
@@ -731,12 +731,12 @@ void phHal4Nfc_TargetDiscoveryComplete(
else/*Failed discovery ,restart discovery*/
{
Hal4Ctxt->psADDCtxtInfo->nbr_of_devices = 0;
- PHDBG_INFO("Hal4:Restart discovery2");
+ PHDBG_INFO("Hal4:Restart discovery2");
status = phHciNfc_Restart_Discovery (
(void *)Hal4Ctxt->psHciHandle,
- (void *)gpphHal4Nfc_Hwref,
+ (void *)gpphHal4Nfc_Hwref,
FALSE
- );/*Restart Discovery wheel*/
+ );/*Restart Discovery wheel*/
Hal4Ctxt->Hal4NextState = (NFCSTATUS_PENDING == status?
eHal4StateConfiguring:
Hal4Ctxt->Hal4NextState);
@@ -747,23 +747,23 @@ void phHal4Nfc_TargetDiscoveryComplete(
else if(NULL != Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification)
{
PHDBG_INFO("Hal4:Trying to notify Tag notification");
- /*Multiple tags in field, get discovery info a second time for the
+ /*Multiple tags in field, get discovery info a second time for the
other devices*/
if((NFCSTATUS_MULTIPLE_TAGS == status)
&&(Hal4Ctxt->psADDCtxtInfo->nbr_of_devices < MAX_REMOTE_DEVICES))
{
- PHDBG_INFO("Hal4:select next target1");
+ PHDBG_INFO("Hal4:select next target1");
status = phHciNfc_Select_Next_Target (
Hal4Ctxt->psHciHandle,
(void *)gpphHal4Nfc_Hwref
);
}
- /*Single tag multiple protocols scenario,Notify Multiple Protocols
+ /*Single tag multiple protocols scenario,Notify Multiple Protocols
status to upper layer*/
- else if(status == NFCSTATUS_MULTIPLE_PROTOCOLS)
+ else if(status == NFCSTATUS_MULTIPLE_PROTOCOLS)
{
PHDBG_INFO("Hal4:Multiple Tags or protocols");
- sDiscoveryInfo.NumberOfDevices
+ sDiscoveryInfo.NumberOfDevices
= Hal4Ctxt->psADDCtxtInfo->nbr_of_devices;
sDiscoveryInfo.ppRemoteDevInfo = Hal4Ctxt->rem_dev_list;
uNotificationInfo.psDiscoveryInfo = &sDiscoveryInfo;
@@ -775,13 +775,13 @@ void phHal4Nfc_TargetDiscoveryComplete(
);
}
else /*NFCSTATUS_SUCCESS*/
- {
+ {
if(((Hal4Ctxt->psADDCtxtInfo->nbr_of_devices == 1)
- &&(phHal_eNfcIP1_Target
+ &&(phHal_eNfcIP1_Target
== Hal4Ctxt->rem_dev_list[0]->RemDevType))
||(NFCSTATUS_SUCCESS != status)
|| (Hal4Ctxt->psADDCtxtInfo->nbr_of_devices == 0)
- )/*device detected but upper layer is not interested
+ )/*device detected but upper layer is not interested
in the type(P2P) or activate next failed*/
{
while(Hal4Ctxt->psADDCtxtInfo->nbr_of_devices > 0)
@@ -791,12 +791,12 @@ void phHal4Nfc_TargetDiscoveryComplete(
Hal4Ctxt->rem_dev_list[
Hal4Ctxt->psADDCtxtInfo->nbr_of_devices] = NULL;
}
- PHDBG_INFO("Hal4:Restart discovery3");
+ PHDBG_INFO("Hal4:Restart discovery3");
status = phHciNfc_Restart_Discovery (
(void *)Hal4Ctxt->psHciHandle,
- (void *)gpphHal4Nfc_Hwref,
+ (void *)gpphHal4Nfc_Hwref,
FALSE
- );/*Restart Discovery wheel*/
+ );/*Restart Discovery wheel*/
Hal4Ctxt->Hal4NextState = (
NFCSTATUS_PENDING == status?eHal4StateConfiguring
:Hal4Ctxt->Hal4NextState
@@ -806,13 +806,13 @@ void phHal4Nfc_TargetDiscoveryComplete(
{
/*Update status for MULTIPLE_TAGS here*/
status = (Hal4Ctxt->psADDCtxtInfo->nbr_of_devices > 1?
- NFCSTATUS_MULTIPLE_TAGS:status);
+ NFCSTATUS_MULTIPLE_TAGS:status);
/*If listener is registered ,call it*/
- sDiscoveryInfo.NumberOfDevices
+ sDiscoveryInfo.NumberOfDevices
= Hal4Ctxt->psADDCtxtInfo->nbr_of_devices;
sDiscoveryInfo.ppRemoteDevInfo
= Hal4Ctxt->rem_dev_list;
- uNotificationInfo.psDiscoveryInfo = &sDiscoveryInfo;
+ uNotificationInfo.psDiscoveryInfo = &sDiscoveryInfo;
PHDBG_INFO("Hal4:Calling Discovery Handler1");
(*Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification)(
(void *)(Hal4Ctxt->sUpperLayerInfo.DiscoveryCtxt),
@@ -821,17 +821,17 @@ void phHal4Nfc_TargetDiscoveryComplete(
status
);
}
- }
- } /*else if(NULL != Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification)*/
- else/*listener not registered ,Restart Discovery wheel*/
- {
+ }
+ } /*else if(NULL != Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification)*/
+ else/*listener not registered ,Restart Discovery wheel*/
+ {
PHDBG_INFO("Hal4:No listener registered.Ignoring Discovery \
- Notification");
+ Notification");
Hal4Ctxt->psADDCtxtInfo->nbr_of_devices = 0;
- PHDBG_INFO("Hal4:Restart discovery4");
+ PHDBG_INFO("Hal4:Restart discovery4");
status = phHciNfc_Restart_Discovery (
(void *)Hal4Ctxt->psHciHandle,
- (void *)gpphHal4Nfc_Hwref,
+ (void *)gpphHal4Nfc_Hwref,
FALSE
);
Hal4Ctxt->Hal4NextState = (NFCSTATUS_PENDING == status?
@@ -841,40 +841,40 @@ void phHal4Nfc_TargetDiscoveryComplete(
}/*if(NULL != ((phNfc_sCompletionInfo_t *)pInfo)->info)*/
else/*NULL info received*/
{
- sDiscoveryInfo.NumberOfDevices
+ sDiscoveryInfo.NumberOfDevices
= Hal4Ctxt->psADDCtxtInfo->nbr_of_devices;
sDiscoveryInfo.ppRemoteDevInfo = Hal4Ctxt->rem_dev_list;
uNotificationInfo.psDiscoveryInfo = &sDiscoveryInfo;
- /*If Discovery info is available from previous notifications try to
+ /*If Discovery info is available from previous notifications try to
notify that to the upper layer*/
if((NULL != Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification)
#ifdef NFC_RF_NOISE_SW
- &&((NFCSTATUS_SUCCESS == status)
+ &&((NFCSTATUS_SUCCESS == status)
|| (NFCSTATUS_MULTIPLE_TAGS == status))
#endif /* #ifdef NFC_RF_NOISE_SW */
)
{
-#ifndef NFC_RF_NOISE_SW
- status = (((NFCSTATUS_SUCCESS != status)
+#ifndef NFC_RF_NOISE_SW
+ status = (((NFCSTATUS_SUCCESS != status)
&& (NFCSTATUS_MULTIPLE_TAGS != status))
&&(Hal4Ctxt->psADDCtxtInfo->nbr_of_devices != 0))?
NFCSTATUS_SUCCESS:status;
#endif/*#ifndef NFC_RF_NOISE_SW*/
PHDBG_INFO("Hal4:Calling Discovery Handler2");
(*Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification)(
- (void *)(Hal4Ctxt->sUpperLayerInfo.DiscoveryCtxt),
+ (void *)(Hal4Ctxt->sUpperLayerInfo.DiscoveryCtxt),
NFC_DISCOVERY_NOTIFICATION,
uNotificationInfo,
status
);
}
- else/*Restart Discovery wheel*/
+ else/*Restart Discovery wheel*/
{
Hal4Ctxt->psADDCtxtInfo->nbr_of_devices = 0;
- PHDBG_INFO("Hal4:Restart discovery5");
+ PHDBG_INFO("Hal4:Restart discovery5");
status = phHciNfc_Restart_Discovery (
(void *)Hal4Ctxt->psHciHandle,
- (void *)gpphHal4Nfc_Hwref,
+ (void *)gpphHal4Nfc_Hwref,
FALSE
);
Hal4Ctxt->Hal4NextState = (NFCSTATUS_PENDING == status?
@@ -886,9 +886,9 @@ void phHal4Nfc_TargetDiscoveryComplete(
/**Register Notification handlers*/
-NFCSTATUS phHal4Nfc_RegisterNotification(
+NFCSTATUS phHal4Nfc_RegisterNotification(
phHal_sHwReference_t *psHwReference,
- phHal4Nfc_RegisterType_t eRegisterType,
+ phHal4Nfc_RegisterType_t eRegisterType,
pphHal4Nfc_Notification_t pNotificationHandler,
void *Context
)
@@ -902,10 +902,10 @@ NFCSTATUS phHal4Nfc_RegisterNotification(
}
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
@@ -928,11 +928,13 @@ NFCSTATUS phHal4Nfc_RegisterNotification(
= pNotificationHandler; /*Register the P2P Notification*/
break;
case eRegisterHostCardEmulation:
- RetStatus = NFCSTATUS_FEATURE_NOT_SUPPORTED;
+ Hal4Ctxt->sUpperLayerInfo.HCEEventNotificationCtxt = Context;
+ Hal4Ctxt->sUpperLayerInfo.pHCEEventNotification
+ = pNotificationHandler; /*Register the CE Notification*/
break;
case eRegisterSecureElement:
Hal4Ctxt->sUpperLayerInfo.EventNotificationCtxt = Context;
- Hal4Ctxt->sUpperLayerInfo.pEventNotification
+ Hal4Ctxt->sUpperLayerInfo.pEventNotification
= pNotificationHandler; /*Register the Se Notification*/
break;
default:
@@ -948,7 +950,7 @@ NFCSTATUS phHal4Nfc_RegisterNotification(
/**Unregister Notification handlers*/
-NFCSTATUS phHal4Nfc_UnregisterNotification(
+NFCSTATUS phHal4Nfc_UnregisterNotification(
phHal_sHwReference_t *psHwReference,
phHal4Nfc_RegisterType_t eRegisterType,
void *Context
@@ -963,10 +965,10 @@ NFCSTATUS phHal4Nfc_UnregisterNotification(
}
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
@@ -982,17 +984,19 @@ NFCSTATUS phHal4Nfc_UnregisterNotification(
Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = Context;
Hal4Ctxt->sUpperLayerInfo.DiscoveryCtxt = NULL;
/*UnRegister the tag Notification*/
- Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification = NULL;
+ Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification = NULL;
PHDBG_INFO("Hal4:Tag Discovery Listener Unregistered");
break;
case eRegisterP2PDiscovery:
Hal4Ctxt->sUpperLayerInfo.P2PDiscoveryCtxt = NULL;
/*UnRegister the p2p Notification*/
- Hal4Ctxt->sUpperLayerInfo.pP2PNotification = NULL;
+ Hal4Ctxt->sUpperLayerInfo.pP2PNotification = NULL;
PHDBG_INFO("Hal4:P2P Discovery Listener Unregistered");
- break;
- case eRegisterHostCardEmulation:/*RFU*/
- RetStatus = NFCSTATUS_FEATURE_NOT_SUPPORTED;
+ break;
+ case eRegisterHostCardEmulation:
+ Hal4Ctxt->sUpperLayerInfo.HCEEventNotificationCtxt = NULL;
+ Hal4Ctxt->sUpperLayerInfo.pHCEEventNotification = NULL;
+ PHDBG_INFO("Hal4:SE Listener Unregistered");
break;
/*UnRegister the Se Notification*/
case eRegisterSecureElement:
@@ -1003,7 +1007,7 @@ NFCSTATUS phHal4Nfc_UnregisterNotification(
default:
Hal4Ctxt->sUpperLayerInfo.DefaultListenerCtxt = NULL;
/*UnRegister the default Notification*/
- Hal4Ctxt->sUpperLayerInfo.pDefaultEventHandler = NULL;
+ Hal4Ctxt->sUpperLayerInfo.pDefaultEventHandler = NULL;
PHDBG_INFO("Hal4:Default Listener Unregistered");
break;
}
diff --git a/src/phHal4Nfc_Emulation.c b/src/phHal4Nfc_Emulation.c
index 6bb60e2..0756408 100644..100755
--- a/src/phHal4Nfc_Emulation.c
+++ b/src/phHal4Nfc_Emulation.c
@@ -52,7 +52,7 @@ void phHal4Nfc_HandleEmulationEvent(
/*Pass on Event notification info from Hci to Upper layer*/
uNotificationInfo.psEventInfo = psNotificationInfo->info;
if(NULL != Hal4Ctxt->sUpperLayerInfo.pEventNotification)
- {
+ {
Hal4Ctxt->sUpperLayerInfo.pEventNotification(
Hal4Ctxt->sUpperLayerInfo.EventNotificationCtxt,
psNotificationInfo->type,
@@ -60,7 +60,17 @@ void phHal4Nfc_HandleEmulationEvent(
NFCSTATUS_SUCCESS
);
}
- else/*No Event notification handler registered*/
+ if(NULL != Hal4Ctxt->sUpperLayerInfo.pHCEEventNotification)
+ {
+ Hal4Ctxt->sUpperLayerInfo.pHCEEventNotification(
+ Hal4Ctxt->sUpperLayerInfo.HCEEventNotificationCtxt,
+ psNotificationInfo->type,
+ uNotificationInfo,
+ NFCSTATUS_SUCCESS
+ );
+ }
+ if(NULL == Hal4Ctxt->sUpperLayerInfo.pHCEEventNotification &&
+ NULL == Hal4Ctxt->sUpperLayerInfo.pEventNotification)
{
/*Use default handler to notify to the upper layer*/
if(NULL != Hal4Ctxt->sUpperLayerInfo.pDefaultEventHandler)
@@ -78,7 +88,7 @@ void phHal4Nfc_HandleEmulationEvent(
/* Switch mode from Virtual to Wired or Vice Versa for SMX.
*/
-NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
+NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
phHal_sHwReference_t *psHwReference,
phHal_eSmartMX_Mode_t smx_mode,
pphHal4Nfc_GenCallback_t pSwitchModecb,
@@ -88,7 +98,7 @@ NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
NFCSTATUS CfgStatus = NFCSTATUS_PENDING;
phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
static phHal_sADD_Cfg_t sSmxCfg;
-
+
/*NULL checks*/
if((NULL == psHwReference) || (NULL == pSwitchModecb))
{
@@ -98,10 +108,10 @@ NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
/*Check Initialised state*/
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
@@ -119,7 +129,7 @@ NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
}
else if(Hal4Ctxt->Hal4CurrentState >= eHal4StateOpenAndReady)
{
- /**If config discovery has not been called prior to this ,allocate
+ /**If config discovery has not been called prior to this ,allocate
ADD Context here*/
if (NULL == Hal4Ctxt->psADDCtxtInfo)
{
@@ -135,26 +145,26 @@ NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
if(NULL == Hal4Ctxt->psADDCtxtInfo)
{
phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
- CfgStatus= PHNFCSTVAL(CID_NFC_HAL ,
+ CfgStatus= PHNFCSTVAL(CID_NFC_HAL ,
NFCSTATUS_INSUFFICIENT_RESOURCES);
}
else
- {
+ {
/* Switch request to Wired mode */
if(eSmartMx_Wired == smx_mode)
{
- if(Hal4Ctxt->Hal4CurrentState
+ if(Hal4Ctxt->Hal4CurrentState
== eHal4StateTargetConnected)
{
PHDBG_INFO("Hal4:In Connected state.Returning Busy");
CfgStatus= PHNFCSTVAL(CID_NFC_HAL , NFCSTATUS_BUSY);
}
- /*It is Mandatory to register a listener before switching
+ /*It is Mandatory to register a listener before switching
to wired mode*/
else if(NULL ==
Hal4Ctxt->sUpperLayerInfo.pTagDiscoveryNotification)
{
- CfgStatus = PHNFCSTVAL(CID_NFC_HAL ,
+ CfgStatus = PHNFCSTVAL(CID_NFC_HAL ,
NFCSTATUS_FAILED);
}
else
@@ -192,7 +202,7 @@ NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
Hal4Ctxt->sUpperLayerInfo.pConfigCallback
= pSwitchModecb;
}
- }
+ }
}
else/*Return Status not initialised*/
{
@@ -206,7 +216,7 @@ NFCSTATUS phHal4Nfc_Switch_SMX_Mode(
/* Switch mode for Swp.*/
-NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
+NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
phHal_sHwReference_t *psHwReference,
phHal_eSWP_Mode_t swp_mode,
pphHal4Nfc_GenCallback_t pSwitchModecb,
@@ -214,9 +224,9 @@ NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
)
{
NFCSTATUS CfgStatus = NFCSTATUS_PENDING;
- phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
/*NULL checks*/
- if(NULL == psHwReference
+ if(NULL == psHwReference
|| NULL == pSwitchModecb
)
{
@@ -226,10 +236,10 @@ NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
/*Check Initialised state*/
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
@@ -247,7 +257,7 @@ NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
}
else if(Hal4Ctxt->Hal4CurrentState >= eHal4StateOpenAndReady)
{
- /**If config discovery has not been called prior to this ,allocate
+ /**If config discovery has not been called prior to this ,allocate
ADD Context here*/
if (NULL == Hal4Ctxt->psADDCtxtInfo)
{
@@ -263,11 +273,11 @@ NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
if(NULL == Hal4Ctxt->psADDCtxtInfo)
{
phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
- CfgStatus= PHNFCSTVAL(CID_NFC_HAL ,
+ CfgStatus= PHNFCSTVAL(CID_NFC_HAL ,
NFCSTATUS_INSUFFICIENT_RESOURCES);
}
else
- {
+ {
/*Switch mode to On or off*/
CfgStatus = phHciNfc_Switch_SwpMode(
Hal4Ctxt->psHciHandle,
@@ -283,7 +293,7 @@ NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
Hal4Ctxt->sUpperLayerInfo.pConfigCallback
= pSwitchModecb;
}
- }
+ }
}
else/*Return Status not initialised*/
{
@@ -296,7 +306,7 @@ NFCSTATUS phHal4Nfc_Switch_Swp_Mode(
#ifdef FULL_HAL4_EMULATION_ENABLE
/* Switch Emulation mode ON or OFF.*/
-NFCSTATUS phHal4Nfc_Host_Emulation_Mode(
+NFCSTATUS phHal4Nfc_Host_Emulation_Mode(
phHal_sHwReference_t *psHwReference,
phNfc_eModeType_t eModeType,
pphHal4Nfc_GenCallback_t pEmulationModecb,
@@ -306,7 +316,7 @@ NFCSTATUS phHal4Nfc_Host_Emulation_Mode(
NFCSTATUS RetStatus = NFCSTATUS_PENDING;
phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
/*NULL checks*/
- if(NULL == psHwReference
+ if(NULL == psHwReference
|| NULL == pEmulationModecb
)
{
@@ -316,15 +326,15 @@ NFCSTATUS phHal4Nfc_Host_Emulation_Mode(
/*Check Initialised state*/
else if((NULL == psHwReference->hal_context)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4CurrentState
+ psHwReference->hal_context)->Hal4CurrentState
< eHal4StateOpenAndReady)
|| (((phHal4Nfc_Hal4Ctxt_t *)
- psHwReference->hal_context)->Hal4NextState
+ psHwReference->hal_context)->Hal4NextState
== eHal4StateClosed))
{
phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
RetStatus = PHNFCSTVAL(CID_NFC_HAL , NFCSTATUS_NOT_INITIALISED);
- }
+ }
else
{
diff --git a/src/phHal4Nfc_Internal.h b/src/phHal4Nfc_Internal.h
index 50f4ea1..4765e3e 100644..100755
--- a/src/phHal4Nfc_Internal.h
+++ b/src/phHal4Nfc_Internal.h
@@ -37,7 +37,7 @@
#include <phHciNfc.h>
-/**
+/**
* \name HAL4
*
* File: \ref phHal4Nfc_Internal.h
@@ -49,18 +49,18 @@
#define PH_HAL4NFC_INTERNAL_FILEALIASES "$Aliases: NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */
/*@}*/
-/* -----------------Include files ---------------------------------------*/
+/* -----------------Include files ---------------------------------------*/
/* ---------------- Macros ----------------------------------------------*/
#define LLCP_DISCON_CHANGES
#define PH_HAL4NFC_TRANSCEIVE_TIMEOUT 30000 /**<Transceive operation
- on any target should be
- completed within this
+ on any target should be
+ completed within this
interval.Else the
operation is timed out*/
#define PH_HAL4NFC_TGT_MERGE_ADDRESS 0x988BU
-#define PH_HAL4NFC_TGT_MERGE_SAK 0x00U
+#define PH_HAL4NFC_TGT_MERGE_SAK 0x00U
/*---------------- Hal4 Internal Data Structures -------------------------*/
@@ -80,7 +80,7 @@ typedef enum{
} phHal4Nfc_Hal4state_t;
-/**Global Pointer to hardware reference used in timer callbacks to get the
+/**Global Pointer to hardware reference used in timer callbacks to get the
context pointer*/
extern phHal_sHwReference_t *gpphHal4Nfc_Hwref;
@@ -100,7 +100,7 @@ typedef struct phHal4Nfc_TrcvCtxtInfo{
phHciNfc_XchgInfo_t XchangeInfo;
/*sData pointer to point to upper layer's send data*/
phNfc_sData_t *psUpperSendData;
- /*Maintains the offset of number of bytes sent in one go ,so that the
+ /*Maintains the offset of number of bytes sent in one go ,so that the
remaining bytes can be sent during the next transceive*/
uint32_t NumberOfBytesSent;
/*Number of bytes received during a P2p receive*/
@@ -145,9 +145,9 @@ typedef struct phHal4Nfc_TargetConnectInfo{
/*used when a release call is pending in HAL*/
phHal_eReleaseType_t ReleaseType;
/*Points to Remote device info of a connected device*/
- phHal_sRemoteDevInformation_t *psConnectedDevice;
+ phHal_sRemoteDevInformation_t *psConnectedDevice;
/*Emulation state Activated/Deactivated*/
- phHal_Event_t EmulationState;
+ phHal_Event_t EmulationState;
/*Presence check callback*/
pphHal4Nfc_GenCallback_t pPresenceChkCb;
}phHal4Nfc_TargetConnectInfo_t,*pphHal4Nfc_TargetConnectInfo_t;
@@ -163,16 +163,19 @@ typedef struct phHal4Nfc_UpperLayerInfo{
void *DefaultListenerCtxt;
/*Default event handler*/
pphHal4Nfc_Notification_t pDefaultEventHandler;
- /**Upper layer has to register this listener for receiving info about
+ /**Upper layer has to register this listener for receiving info about
discovered tags*/
pphHal4Nfc_Notification_t pTagDiscoveryNotification;
- /**Upper layer has to register this listener for receiving info about
+ /**Upper layer has to register this listener for receiving info about
discovered P2P devices*/
pphHal4Nfc_Notification_t pP2PNotification;
/*Event Notification Context*/
void *EventNotificationCtxt;
/**Notification handler for emulation and other events*/
pphHal4Nfc_Notification_t pEventNotification;
+ /**Notification handler for emulation and other events*/
+ void *HCEEventNotificationCtxt;
+ pphHal4Nfc_Notification_t pHCEEventNotification;
/**Upper layer's Config discovery/Emulation callback registry*/
pphHal4Nfc_GenCallback_t pConfigCallback;
void *psUpperLayerCtxt;
@@ -183,7 +186,7 @@ typedef struct phHal4Nfc_UpperLayerInfo{
/**Upper layer's Open Callback registry*/
pphHal4Nfc_GenCallback_t pUpperOpenCb;
/**Upper layer's Close Callback registry */
- pphHal4Nfc_GenCallback_t pUpperCloseCb;
+ pphHal4Nfc_GenCallback_t pUpperCloseCb;
/*Ioctl out param pointer ,points to buffer provided by upper layer during
a ioctl call*/
phNfc_sData_t *pIoctlOutParam;
@@ -193,16 +196,16 @@ typedef struct phHal4Nfc_UpperLayerInfo{
/**Context structure for HAL4.0*/
typedef struct phHal4Nfc_Hal4Ctxt{
- /**Hci handle obtained in Hci_Init*/
+ /**Hci handle obtained in Hci_Init*/
void *psHciHandle;
/**Layer configuration*/
pphNfcLayer_sCfg_t pHal4Nfc_LayerCfg;
/**Device capabilities*/
phHal_sDeviceCapabilities_t Hal4Nfc_DevCaps;
/*Current state of HAL4.Updated generally in callbacks*/
- phHal4Nfc_Hal4state_t Hal4CurrentState;
+ phHal4Nfc_Hal4state_t Hal4CurrentState;
/*Next state of HAL.Updated during calls*/
- phHal4Nfc_Hal4state_t Hal4NextState;
+ phHal4Nfc_Hal4state_t Hal4NextState;
/**Info related to upper layer*/
phHal4Nfc_UpperLayerInfo_t sUpperLayerInfo;
/*ADD context info*/
@@ -213,11 +216,11 @@ typedef struct phHal4Nfc_Hal4Ctxt{
phHal_sEventInfo_t *psEventInfo;
/*Select sector flag*/
uint8_t SelectSectorFlag;
- /**List of pointers to remote device information for all discovered
+ /**List of pointers to remote device information for all discovered
targets*/
phHal_sRemoteDevInformation_t *rem_dev_list[MAX_REMOTE_DEVICES];
/*Transceive context info*/
- pphHal4Nfc_TrcvCtxtInfo_t psTrcvCtxtInfo;
+ pphHal4Nfc_TrcvCtxtInfo_t psTrcvCtxtInfo;
/*Connect context info*/
phHal4Nfc_TargetConnectInfo_t sTgtConnectInfo;
/*Last called Ioctl_type*/
@@ -279,9 +282,21 @@ extern void phHal4Nfc_HandleEmulationEvent(
/*Callback completion routine for NFCIP1 Receive*/
extern void phHal4Nfc_RecvCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo);
+/*Callback completion routine for CE_A Receive*/
+extern void phHal4Nfc_CE_A_RecvCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo);
+
+/*Callback completion routine for CE_B Receive*/
+extern void phHal4Nfc_CE_B_RecvCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo);
+
/*Callback completion routine for Send*/
extern void phHal4Nfc_SendCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo);
+/*Callback completion routine for Send*/
+extern void phHal4Nfc_CE_A_SendCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo);
+
+/*Callback completion routine for Send*/
+extern void phHal4Nfc_CE_B_SendCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo);
+
/*Callback completion routine for P2P Activate Event received from HCI*/
extern void phHal4Nfc_P2PActivateComplete(
phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
diff --git a/src/phHciNfc.c b/src/phHciNfc.c
index d6990c1..bad0ad5 100644..100755
--- a/src/phHciNfc.c
+++ b/src/phHciNfc.c
@@ -703,11 +703,11 @@ phHciNfc_Config_Emulation (
case NFC_HOST_CE_B_EMULATION:
#if defined(HOST_EMULATION)
{
- if(TRUE == pEmulationCfg->config.
+ /*if(TRUE == pEmulationCfg->config.
hostEmuCfg_A.enableEmulation)
{
psHciContext->hci_seq = ADMIN_CE_SEQ;
- }
+ }*/
status = phHciNfc_EmulationCfg_Sequence(
psHciContext, pHwRef);
break;
diff --git a/src/phHciNfc_AdminMgmt.c b/src/phHciNfc_AdminMgmt.c
index b65abf2..ba8a023 100644..100755
--- a/src/phHciNfc_AdminMgmt.c
+++ b/src/phHciNfc_AdminMgmt.c
@@ -192,7 +192,7 @@ static
*
* This function initialses the Admin Gates and Establishes the Session by creating
* all the required pipes and sets the Session ID
- *
+ *
*/
NFCSTATUS
@@ -251,13 +251,13 @@ phHciNfc_Admin_Initialise(
else
{
/* Populate the pipe information in the pipe handle */
- ((phHciNfc_Pipe_Info_t *)p_pipe_info)->pipe.pipe_id =
+ ((phHciNfc_Pipe_Info_t *)p_pipe_info)->pipe.pipe_id =
PIPETYPE_STATIC_ADMIN;
- ((phHciNfc_Pipe_Info_t *)p_pipe_info)->recv_resp =
+ ((phHciNfc_Pipe_Info_t *)p_pipe_info)->recv_resp =
&phHciNfc_Recv_Admin_Response;
- ((phHciNfc_Pipe_Info_t *)p_pipe_info)->recv_cmd =
+ ((phHciNfc_Pipe_Info_t *)p_pipe_info)->recv_cmd =
&phHciNfc_Recv_Admin_Cmd;
- ((phHciNfc_Pipe_Info_t *)p_pipe_info)->recv_event =
+ ((phHciNfc_Pipe_Info_t *)p_pipe_info)->recv_event =
&phHciNfc_Recv_Admin_Event;
psHciContext->p_pipe_list[PIPETYPE_STATIC_ADMIN] =
p_pipe_info ;
@@ -276,8 +276,8 @@ phHciNfc_Admin_Initialise(
{
p_pipe_info = p_admin_info->admin_pipe_info;
p_pipe_info->reg_index = SESSION_INDEX;
- p_pipe_info->prev_status =
- phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
+ p_pipe_info->prev_status =
+ phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
(uint8_t)HCI_ADMIN_PIPE_ID,
(uint8_t)ANY_GET_PARAMETER);
if(NFCSTATUS_PENDING == p_pipe_info->prev_status )
@@ -313,28 +313,36 @@ phHciNfc_Admin_Initialise(
#endif
case ADMIN_VERIFY_SESSION:
{
- phHal_sHwConfig_t *p_hw_config =
+ phHal_sHwConfig_t *p_hw_config =
(phHal_sHwConfig_t *) psHciContext->p_config_params;
- phHal_sHwReference_t *p_hw_ref =
+ phHal_sHwReference_t *p_hw_ref =
(phHal_sHwReference_t *) pHwRef;
int cmp_val = 0;
p_pipe_info = p_admin_info->admin_pipe_info;
- cmp_val = phOsalNfc_MemCompare(p_hw_config->session_id ,
- p_hw_ref->session_id ,
+ cmp_val = phOsalNfc_MemCompare(p_hw_config->session_id ,
+ p_hw_ref->session_id ,
sizeof(p_hw_ref->session_id));
- if((cmp_val == 0)
+//this ifdef can be removed when this is not a patch that is being
+//administered after a new release of Android. it is required that
+//the new pipes for A and B emu get created for the CE patch
+//if this patch is adminstered after the phone has been updated with
+//a release, it is possible that the create A/B pipe code could never
+//get executed, so we are forcing it every time. this can be removed
+//for a main build with a new OS release
+#ifndef FIRST_CE_PATCH
+ if((cmp_val == 0)
&& ( HCI_SESSION == psHciContext->init_mode)
)
{
psHciContext->hci_mode = hciMode_Session;
status = phHciNfc_Update_Pipe( psHciContext, pHwRef,
&p_admin_info->pipe_seq );
- if((status == NFCSTATUS_SUCCESS)
+ if((status == NFCSTATUS_SUCCESS)
&& (NULL != p_pipe_info))
{
-
+
p_pipe_info->reg_index = MAX_PIPE_INDEX;
- status = phHciNfc_Send_Generic_Cmd( psHciContext,
+ status = phHciNfc_Send_Generic_Cmd( psHciContext,
pHwRef, (uint8_t)HCI_ADMIN_PIPE_ID,
(uint8_t)ANY_GET_PARAMETER );
p_pipe_info->prev_status = status;
@@ -346,12 +354,13 @@ phHciNfc_Admin_Initialise(
}
else
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_SEQUENCE);
}
break;
}
else
+#endif
{
/* To clear the pipe information*/
psHciContext->hci_mode = hciMode_Override;
@@ -362,14 +371,14 @@ phHciNfc_Admin_Initialise(
case ADMIN_CLEAR_PIPES:
{
p_pipe_info = p_admin_info->admin_pipe_info;
- p_pipe_info->prev_status =
+ p_pipe_info->prev_status =
phHciNfc_Send_Admin_Cmd( psHciContext,
pHwRef, ADM_CLEAR_ALL_PIPE,
length, p_pipe_info);
status = ((p_pipe_info->prev_status == NFCSTATUS_PENDING)?
- NFCSTATUS_SUCCESS :
+ NFCSTATUS_SUCCESS :
p_pipe_info->prev_status);
- if(status == NFCSTATUS_SUCCESS)
+ if(status == NFCSTATUS_SUCCESS)
{
p_admin_info->next_seq = ADMIN_PIPE_REOPEN;
status = NFCSTATUS_PENDING;
@@ -393,7 +402,7 @@ phHciNfc_Admin_Initialise(
{
status = phHciNfc_Create_All_Pipes( psHciContext, pHwRef,
&p_admin_info->pipe_seq );
- if(status == NFCSTATUS_SUCCESS)
+ if(status == NFCSTATUS_SUCCESS)
{
p_admin_info->next_seq = ADMIN_GET_WHITE_LIST;
status = NFCSTATUS_PENDING;
@@ -405,13 +414,13 @@ phHciNfc_Admin_Initialise(
p_pipe_info = p_admin_info->admin_pipe_info;
if(NULL == p_pipe_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_SEQUENCE);
}
else
{
p_pipe_info->reg_index = WHITELIST_INDEX;
- status = phHciNfc_Send_Generic_Cmd( psHciContext,
+ status = phHciNfc_Send_Generic_Cmd( psHciContext,
pHwRef, (uint8_t)HCI_ADMIN_PIPE_ID,
(uint8_t)ANY_GET_PARAMETER );
p_pipe_info->prev_status = status;
@@ -420,7 +429,7 @@ phHciNfc_Admin_Initialise(
status = ((NFCSTATUS_PENDING == status )?
NFCSTATUS_SUCCESS : status);
}
- else
+ else
{
if(NFCSTATUS_PENDING == status )
{
@@ -436,13 +445,13 @@ phHciNfc_Admin_Initialise(
p_pipe_info = p_admin_info->admin_pipe_info;
if(NULL == p_pipe_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_SEQUENCE);
}
else
{
p_pipe_info->reg_index = HOST_LIST_INDEX;
- status = phHciNfc_Send_Generic_Cmd( psHciContext,
+ status = phHciNfc_Send_Generic_Cmd( psHciContext,
pHwRef, (uint8_t)HCI_ADMIN_PIPE_ID,
(uint8_t)ANY_GET_PARAMETER );
p_pipe_info->prev_status = status;
@@ -464,7 +473,7 @@ phHciNfc_Admin_Initialise(
p_pipe_info = p_admin_info->admin_pipe_info;
if(NULL == p_pipe_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_SEQUENCE);
}
else
@@ -476,7 +485,7 @@ phHciNfc_Admin_Initialise(
p_admin_info->whitelist[i] = i + 2;
}
status = phHciNfc_Set_Param(psHciContext, pHwRef,
- p_pipe_info, WHITELIST_INDEX,
+ p_pipe_info, WHITELIST_INDEX,
(uint8_t *)p_admin_info->whitelist, i );
if(NFCSTATUS_PENDING == status )
{
@@ -488,7 +497,7 @@ phHciNfc_Admin_Initialise(
}
case ADMIN_SET_SESSION:
{
- phHal_sHwConfig_t *p_hw_config =
+ phHal_sHwConfig_t *p_hw_config =
(phHal_sHwConfig_t *) psHciContext->p_config_params;
p_pipe_info = p_admin_info->admin_pipe_info;
status = phHciNfc_Set_Param(psHciContext, pHwRef, p_pipe_info,
@@ -644,8 +653,8 @@ phHciNfc_Admin_Release(
phHciNfc_AdminGate_Info_t *p_admin_info=NULL;
NFCSTATUS status = NFCSTATUS_SUCCESS;
- if( (NULL == psHciContext)
- || (NULL == pHwRef)
+ if( (NULL == psHciContext)
+ || (NULL == pHwRef)
)
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
@@ -711,8 +720,8 @@ phHciNfc_Admin_Release(
uint8_t i=0;
NFCSTATUS status = NFCSTATUS_SUCCESS;
- if( (NULL == psHciContext)
- || (NULL == pHwRef)
+ if( (NULL == psHciContext)
+ || (NULL == pHwRef)
|| (NULL == params)
)
{
@@ -737,7 +746,7 @@ phHciNfc_Admin_Release(
HCP_MSG_TYPE_COMMAND, cmd);
hcp_message = &(hcp_packet->msg.message);
- /* Source HOST ID Parameter is not passed as a
+ /* Source HOST ID Parameter is not passed as a
* parameter in the HCI SPEC */
/* hcp_message->payload[i++] = p_pipe_info->pipe.source.host_id; */
@@ -831,7 +840,7 @@ phHciNfc_Recv_Admin_Response(
#endif
)
{
- phHciNfc_sContext_t *psHciContext =
+ phHciNfc_sContext_t *psHciContext =
(phHciNfc_sContext_t *)psContext ;
phHciNfc_HCP_Packet_t *hcp_packet = NULL;
phHciNfc_HCP_Message_t *hcp_message = NULL;
@@ -869,7 +878,7 @@ phHciNfc_Recv_Admin_Response(
{
status = phHciNfc_Admin_InfoUpdate(psHciContext,
(phHal_sHwReference_t *)pHwRef,
- p_admin_info->admin_pipe_info->reg_index,
+ p_admin_info->admin_pipe_info->reg_index,
&pResponse[HCP_HEADER_LEN],
(uint8_t)(length - HCP_HEADER_LEN));
break;
@@ -961,7 +970,7 @@ static
#endif
)
{
- phHciNfc_sContext_t *psHciContext =
+ phHciNfc_sContext_t *psHciContext =
(phHciNfc_sContext_t *)psContext ;
phHciNfc_HCP_Packet_t *hcp_packet = NULL;
phHciNfc_HCP_Message_t *hcp_message = NULL;
@@ -973,9 +982,9 @@ static
uint8_t response = (uint8_t) ANY_OK;
NFCSTATUS status = NFCSTATUS_SUCCESS;
- if( (NULL == psHciContext)
- || (NULL == pHwRef)
- || (HCP_HEADER_LEN > length )
+ if( (NULL == psHciContext)
+ || (NULL == pHwRef)
+ || (HCP_HEADER_LEN > length )
)
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
@@ -1000,17 +1009,17 @@ static
if(NULL != p_pipe_info)
{
/* The Source Host is the UICC Host */
- p_pipe_info->pipe.source.host_id =
+ p_pipe_info->pipe.source.host_id =
hcp_message->payload[index++];
/* The Source Gate is same as the Destination Gate */
- p_pipe_info->pipe.source.gate_id =
+ p_pipe_info->pipe.source.gate_id =
hcp_message->payload[index++];
/* The Source Host is the Terminal Host */
- p_pipe_info->pipe.dest.host_id =
+ p_pipe_info->pipe.dest.host_id =
hcp_message->payload[index++];
- p_pipe_info->pipe.dest.gate_id =
+ p_pipe_info->pipe.dest.gate_id =
hcp_message->payload[index++];
- p_pipe_info->pipe.pipe_id =
+ p_pipe_info->pipe.pipe_id =
hcp_message->payload[index++];
}
status = phHciNfc_Update_PipeInfo(psHciContext,
@@ -1094,16 +1103,16 @@ static
#endif
)
{
- phHciNfc_sContext_t *psHciContext =
+ phHciNfc_sContext_t *psHciContext =
(phHciNfc_sContext_t *)psContext ;
phHciNfc_HCP_Packet_t *hcp_packet = NULL;
phHciNfc_HCP_Message_t *hcp_message = NULL;
uint8_t event = (uint8_t) HCP_MSG_INSTRUCTION_INVALID;
NFCSTATUS status = NFCSTATUS_SUCCESS;
- if( (NULL == psHciContext)
- || (NULL == pHwRef)
- || (HCP_HEADER_LEN > length )
+ if( (NULL == psHciContext)
+ || (NULL == pHwRef)
+ || (HCP_HEADER_LEN > length )
)
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
@@ -1118,7 +1127,7 @@ static
if( EVT_HOT_PLUG == event )
{
- status = phHciNfc_Send_Admin_Event ( psHciContext, pHwRef,
+ status = phHciNfc_Send_Admin_Event ( psHciContext, pHwRef,
EVT_HOT_PLUG, 0 ,NULL);
}
diff --git a/src/phHciNfc_CE.c b/src/phHciNfc_CE.c
new file mode 100755
index 0000000..b52316c
--- /dev/null
+++ b/src/phHciNfc_CE.c
@@ -0,0 +1,455 @@
+/*
+ * Copyright (C) 2010 NXP Semiconductors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+* =========================================================================== *
+* *
+* *
+* \file phHciNfc_CE.c *
+* \brief HCI card emulation management routines. *
+* *
+* *
+* Project: NFC-FRI-1.1 *
+* *
+* $Date: Thu Dec 29 2011 $ *
+* $Author: doug yeager (doug@simplytapp.com) $ *
+* $Revision: 0.01 $ *
+* *
+* =========================================================================== *
+*/
+
+/*
+***************************** Header File Inclusion ****************************
+*/
+#include <phLibNfc.h>
+#include <phLibNfc_Internal.h>
+#include <phHal4Nfc_Internal.h>
+/*
+****************************** Macro Definitions *******************************
+*/
+#if defined (HOST_EMULATION)
+#include <phHciNfc_CE.h>
+
+/*
+*************************** Structure and Enumeration ***************************
+*/
+
+
+/*
+*************************** Static Function Declaration **************************
+*/
+
+
+/*
+*************************** Function Definitions ***************************
+*/
+
+/**
+* Registers notification handler to handle CE specific events
+*/
+NFCSTATUS phLibNfc_CE_NtfRegister (
+ pphLibNfc_CE_NotificationCb_t pCE_NotificationCb,
+ void *pContext
+ )
+{
+ NFCSTATUS Status = NFCSTATUS_SUCCESS;
+ pphLibNfc_LibContext_t pLibContext=(pphLibNfc_LibContext_t)gpphLibContext;
+
+ if((NULL == gpphLibContext) ||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ Status = NFCSTATUS_NOT_INITIALISED;
+ }
+ else if((pCE_NotificationCb == NULL)
+ ||(NULL == pContext))
+ {
+ /*parameters sent by upper layer are not valid*/
+ Status = NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ Status = NFCSTATUS_SHUTDOWN;
+ }
+ else
+ {
+ /*Register CE notification with lower layer.
+ Any activity on Smx or UICC will be notified */
+ Status = phHal4Nfc_RegisterNotification(
+ pLibContext->psHwReference,
+ eRegisterHostCardEmulation,
+ phLibNfc_CeNotification,
+ (void*)pLibContext);
+ if(Status == NFCSTATUS_SUCCESS)
+ {
+ pLibContext->sCeContext.pCeListenerNtfCb = pCE_NotificationCb;
+ pLibContext->sCeContext.pCeListenerCtxt=pContext;
+ }
+ else
+ {
+ /* Registration failed */
+ Status = NFCSTATUS_FAILED;
+ }
+ }
+ return Status;
+}
+/**
+* CE Notification events are notified with this callback
+*/
+void phLibNfc_CeNotification(void *context,
+ phHal_eNotificationType_t type,
+ phHal4Nfc_NotificationInfo_t info,
+ NFCSTATUS status)
+{
+ pphLibNfc_LibContext_t pLibContext=(pphLibNfc_LibContext_t)context;
+ phHal_sEventInfo_t *pEvtInfo = NULL;
+
+ if(pLibContext != gpphLibContext)
+ {
+ /*wrong context returned*/
+ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1);
+ }
+ else
+ {
+ if((status == NFCSTATUS_SUCCESS) && (type == NFC_EVENT_NOTIFICATION))
+ {
+ pEvtInfo = info.psEventInfo;
+ status = NFCSTATUS_SUCCESS;
+ if(pEvtInfo->eventHost == phHal_eHostController &&
+ (pEvtInfo->eventSource==phHal_eISO14443_A_PICC ||
+ pEvtInfo->eventSource==phHal_eISO14443_B_PICC)
+ )
+ {
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)pLibContext->psHwReference->hal_context;
+ switch(pEvtInfo->eventType)
+ {
+ case NFC_EVT_ACTIVATED:
+ {
+ phHal4Nfc_CEActivateComplete(Hal4Ctxt,pEvtInfo);
+ break;
+ }
+ case NFC_EVT_DEACTIVATED:
+ {
+ phHal4Nfc_HandleCEDeActivate(Hal4Ctxt,pEvtInfo);
+ break;
+ }
+ case NFC_EVT_FIELD_ON:
+ {
+ (*pLibContext->sCeContext.pCeListenerNtfCb)(
+ pLibContext->sCeContext.pCeListenerCtxt,
+ phLibNfc_eCE_EvtFieldOn,
+ NULL,
+ status);
+ break;
+ }
+ case NFC_EVT_FIELD_OFF:
+ {
+ (*pLibContext->sCeContext.pCeListenerNtfCb)(
+ pLibContext->sCeContext.pCeListenerCtxt,
+ phLibNfc_eCE_EvtFieldOff,
+ NULL,
+ status);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+
+ }
+ }
+ }
+ return;
+}
+
+/*Activation complete handler*/
+void phHal4Nfc_CEActivateComplete(
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
+ void *pInfo
+ )
+{
+ phHal_sEventInfo_t *psEventInfo = (phHal_sEventInfo_t *)pInfo;
+
+ pphLibNfc_LibContext_t pLibContext=(pphLibNfc_LibContext_t)Hal4Ctxt->sUpperLayerInfo.HCEEventNotificationCtxt;
+
+ NFCSTATUS Status = NFCSTATUS_SUCCESS;
+ Hal4Ctxt->sTgtConnectInfo.EmulationState = NFC_EVT_ACTIVATED;
+ /*if P2p notification is registered*/
+ if( NULL != pLibContext->sCeContext.pCeListenerNtfCb)
+ {
+ /*Allocate remote device Info for CE target*/
+ Hal4Ctxt->rem_dev_list[0]
+ = (phHal_sRemoteDevInformation_t *)
+ phOsalNfc_GetMemory(
+ sizeof(phHal_sRemoteDevInformation_t)
+ );
+ if(NULL == Hal4Ctxt->rem_dev_list[0])
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
+ Status = PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else
+ {
+ (void)memset((void *)Hal4Ctxt->rem_dev_list[0],
+ 0,sizeof(phHal_sRemoteDevInformation_t));
+ /*Copy device info*/
+ (void)memcpy(Hal4Ctxt->rem_dev_list[0],
+ psEventInfo->eventInfo.pRemoteDevInfo,
+ sizeof(phHal_sRemoteDevInformation_t)
+ );
+ Hal4Ctxt->psADDCtxtInfo->nbr_of_devices = 1;
+ /*Allocate Trcv context info*/
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo= (pphHal4Nfc_TrcvCtxtInfo_t)
+ phOsalNfc_GetMemory((uint32_t)
+ (sizeof(phHal4Nfc_TrcvCtxtInfo_t)));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo,0,
+ sizeof(phHal4Nfc_TrcvCtxtInfo_t));
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus
+ = NFCSTATUS_PENDING;
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ }
+ }
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
+ Status= PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else
+ {
+ /*Update state*/
+ Hal4Ctxt->Hal4CurrentState = eHal4StateEmulation;
+ Hal4Ctxt->Hal4NextState = eHal4StateInvalid;
+ /*set session Opened ,this will keep track of whether the session
+ is alive.will be reset if a Event DEACTIVATED is received*/
+ Hal4Ctxt->rem_dev_list[0]->SessionOpened = TRUE;
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice = Hal4Ctxt->rem_dev_list[0];
+ gpphLibContext->Connected_handle = Hal4Ctxt->sTgtConnectInfo.psConnectedDevice;
+ if(psEventInfo->eventSource==phHal_eISO14443_A_PICC)
+ {
+ (*pLibContext->sCeContext.pCeListenerNtfCb)(
+ pLibContext->sCeContext.pCeListenerCtxt,
+ phLibNfc_eCE_A_EvtActivated,
+ (uint32_t)Hal4Ctxt->rem_dev_list[0],
+ Status);
+ }
+ else
+ {
+ (*pLibContext->sCeContext.pCeListenerNtfCb)(
+ pLibContext->sCeContext.pCeListenerCtxt,
+ phLibNfc_eCE_B_EvtActivated,
+ (uint32_t)Hal4Ctxt->rem_dev_list[0],
+ Status);
+ }
+ }
+ }
+ }
+ return;
+}
+
+/*Deactivation complete handler*/
+void phHal4Nfc_HandleCEDeActivate(
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
+ void *pInfo
+ )
+{
+ pphLibNfc_LibContext_t pLibContext=(pphLibNfc_LibContext_t)Hal4Ctxt->sUpperLayerInfo.HCEEventNotificationCtxt;
+
+ pphHal4Nfc_TransceiveCallback_t pUpperRecvCb = NULL;
+ pphHal4Nfc_SendCallback_t pUpperSendCb = NULL;
+ phHal4Nfc_NotificationInfo_t uNotificationInfo;
+ uNotificationInfo.psEventInfo = (phHal_sEventInfo_t *)pInfo;
+ uint32_t handle=0;
+ /*session is closed*/
+ if(NULL != Hal4Ctxt->rem_dev_list[0])
+ {
+ if(Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.Iso14443_4_PCD_Info.buffer != NULL)
+ {
+ phOsalNfc_FreeMemory((void *)(Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.Iso14443_4_PCD_Info.buffer));
+ Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.Iso14443_4_PCD_Info.buffer = NULL;
+ }
+ Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.Iso14443_4_PCD_Info.length = 0;
+ Hal4Ctxt->rem_dev_list[0]->SessionOpened = FALSE;
+ handle = (uint32_t)Hal4Ctxt->rem_dev_list[0];
+ Hal4Ctxt->rem_dev_list[0] = NULL;
+ Hal4Ctxt->psADDCtxtInfo->nbr_of_devices = 0;
+ }
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice = NULL;
+ gpphLibContext->Connected_handle = 0x0000;
+ /*Update state*/
+ Hal4Ctxt->Hal4CurrentState = eHal4StateOpenAndReady;
+ Hal4Ctxt->Hal4NextState = eHal4StateInvalid;
+ Hal4Ctxt->sTgtConnectInfo.EmulationState = NFC_EVT_DEACTIVATED;
+ /*If Trcv ctxt info is allocated ,free it here*/
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ if(PH_OSALNFC_INVALID_TIMER_ID !=
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId)
+ {
+ phOsalNfc_Timer_Stop(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId);
+ phOsalNfc_Timer_Delete(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId);
+ }
+ pUpperRecvCb = (pphHal4Nfc_TransceiveCallback_t)Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb;
+ pUpperSendCb = Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb;
+ /*Free Hal4 resources used by Target*/
+ if (NULL != Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer)
+ {
+ phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo->
+ sLowerRecvData.buffer);
+ }
+ if((NULL == Hal4Ctxt->sTgtConnectInfo.psConnectedDevice)
+ && (NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData))
+ {
+ phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData);
+ }
+ phOsalNfc_FreeMemory(Hal4Ctxt->psTrcvCtxtInfo);
+ Hal4Ctxt->psTrcvCtxtInfo = NULL;
+ }
+ /*if recv callback is pending*/
+ if(NULL != pUpperRecvCb)
+ {
+ (*pUpperRecvCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice,
+ NULL,
+ NFCSTATUS_DESELECTED
+ );
+ }
+ /*if send callback is pending*/
+ else if(NULL != pUpperSendCb)
+ {
+ (*pUpperSendCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ NFCSTATUS_DESELECTED
+ );
+ }
+ /*if CENotification is registered*/
+ else if(NULL != pLibContext->sCeContext.pCeListenerNtfCb)
+ {
+ if(uNotificationInfo.psEventInfo->eventSource==phHal_eISO14443_A_PICC)
+ {
+ (*pLibContext->sCeContext.pCeListenerNtfCb)(
+ pLibContext->sCeContext.pCeListenerCtxt,
+ phLibNfc_eCE_A_EvtDeActivated,
+ handle,
+ NFCSTATUS_SUCCESS);
+ }
+ else
+ {
+ (*pLibContext->sCeContext.pCeListenerNtfCb)(
+ pLibContext->sCeContext.pCeListenerCtxt,
+ phLibNfc_eCE_B_EvtDeActivated,
+ handle,
+ NFCSTATUS_SUCCESS);
+ }
+ }
+}
+
+/**
+ * Unregister the CE Notification.
+ */
+NFCSTATUS phLibNfc_CE_NtfUnregister(void)
+{
+ NFCSTATUS Status = NFCSTATUS_SUCCESS;
+ pphLibNfc_LibContext_t pLibContext=(pphLibNfc_LibContext_t)gpphLibContext;
+
+ if((NULL == gpphLibContext) ||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ /*Lib Nfc is not initialized*/
+ Status = NFCSTATUS_NOT_INITIALISED;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ Status = NFCSTATUS_SHUTDOWN;
+ }
+ else
+ {
+ /*Unregister CE event notification with lower layer.
+ even some transaction happens on UICC or Smx will not
+ be notified afterworlds */
+ Status = phHal4Nfc_UnregisterNotification(
+ pLibContext->psHwReference,
+ eRegisterHostCardEmulation,
+ pLibContext);
+ if(Status != NFCSTATUS_SUCCESS)
+ {
+ /*Unregister failed*/
+ Status=NFCSTATUS_FAILED;
+ }
+ pLibContext->sCeContext.pCeListenerNtfCb=NULL;
+ pLibContext->sCeContext.pCeListenerCtxt=NULL;
+ }
+ return Status;
+}
+
+
+/*Timer callback for recv data timer for CE.This timer is used for creating
+ Asynchronous behavior in the scenario where the data is received even before
+ the upper layer calls the phHal4Nfc_receive().*/
+void phHal4Nfc_CE_RecvTimerCb(uint32_t CERecvTimerId, void *pContext)
+{
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)(
+ gpphHal4Nfc_Hwref->hal_context);
+ pphLibNfc_TransceiveCallback_t pUpperRecvCb = NULL;
+ NFCSTATUS RecvDataBufferStatus = NFCSTATUS_PENDING;
+ PHNFC_UNUSED_VARIABLE(pContext);
+
+ phOsalNfc_Timer_Stop(CERecvTimerId);
+ phOsalNfc_Timer_Delete(CERecvTimerId);
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ RecvDataBufferStatus = Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus;
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus = NFCSTATUS_PENDING;
+
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ /*Update state*/
+ Hal4Ctxt->Hal4NextState = (eHal4StateTransaction
+ == Hal4Ctxt->Hal4NextState?eHal4StateInvalid:Hal4Ctxt->Hal4NextState);
+ /*Provide address of received data to upper layer data pointer*/
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperRecvData
+ = &(Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData);
+ /*Chk NULL and call recv callback*/
+ if(Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb != NULL)
+ {
+ pUpperRecvCb = (pphLibNfc_TransceiveCallback_t)Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb = NULL;
+ (*pUpperRecvCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice,
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperRecvData,
+ RecvDataBufferStatus
+ );
+ }
+ }
+ return;
+}
+
+
+#endif /* #if defined (HOST_EMULATION) */
+
+
diff --git a/src/phHciNfc_CE.h b/src/phHciNfc_CE.h
new file mode 100755
index 0000000..864066a
--- /dev/null
+++ b/src/phHciNfc_CE.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2010 NXP Semiconductors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+* =========================================================================== *
+* *
+* *
+* \file phHciNfc_CE_A.h *
+* \brief HCI card emulation management routines. *
+* *
+* *
+* Project: NFC-FRI-1.1 *
+* *
+* $Date: Fri Aug 14 17:01:27 2009 $ *
+* $Author: ing04880 $ *
+* $Revision: 1.5 $ *
+* $Aliases: 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 PHHCINFC_CE_H
+#define PHHCINFC_CE_H
+
+/*@}*/
+
+
+/**
+* \name HCI
+*
+* File: \ref phHciNfc_CE_A.h
+*
+*/
+/*@{*/
+#define PHHCINFC_CE_FILEREVISION "$Revision: 1.5 $" /**< \ingroup grp_file_attributes */
+#define PHHCINFC_CE_FILEALIASES "$Aliases: NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */
+/*@}*/
+
+/*
+***************************** Header File Inclusion ****************************
+*/
+
+#include <phHal4Nfc_Internal.h>
+
+/*
+****************************** Macro Definitions *******************************
+*/
+
+#ifdef _WIN32
+/*Timeout value for recv data timer for CE.This timer is used for creating
+ Asynchronous behavior in the scenario where the data is received even before
+ the upper layer calls the phHal4Nfc_receive().*/
+#define PH_HAL4NFC_CE_RECV_CB_TIMEOUT 100U
+#else
+#define PH_HAL4NFC_CE_RECV_CB_TIMEOUT 0x00U
+#endif/*#ifdef _WIN32*/
+#define CE_MAX_SEND_BUFFER_LEN 257
+
+/*
+******************** Enumeration and Structure Definition **********************
+*/
+
+/* Context for secured element */
+typedef struct phLibNfc_CeCtxt
+{
+ /* Store SE discovery notification callback and its context */
+ pphLibNfc_CE_NotificationCb_t pCeListenerNtfCb;
+ void *pCeListenerCtxt;
+
+}phLibNfc_CeCtxt_t;
+
+
+/*
+*********************** Function Prototype Declaration *************************
+*/
+/*timer callback to send already buffered receive data to upper layer*/
+void phHal4Nfc_CE_RecvTimerCb(uint32_t CERecvTimerId, void *pContext);
+
+/* SE register listner response notification */
+void phLibNfc_CeNotification(void *context,
+ phHal_eNotificationType_t type,
+ phHal4Nfc_NotificationInfo_t info,
+ NFCSTATUS status
+ );
+
+
+/*Activation complete handler*/
+void phHal4Nfc_CEActivateComplete(
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
+ void *pInfo
+ );
+
+/*Deactivation complete handler*/
+void phHal4Nfc_HandleCEDeActivate(
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,
+ void *pInfo
+ );
+#endif /* PHHCINFC_CE_H */
+
+
diff --git a/src/phHciNfc_CE_A.c b/src/phHciNfc_CE_A.c
index 511a3c5..8cb1aca 100644..100755
--- a/src/phHciNfc_CE_A.c
+++ b/src/phHciNfc_CE_A.c
@@ -40,10 +40,16 @@
#include <phHciNfc_Pipe.h>
#include <phHciNfc_Emulation.h>
#include <phOsalNfc.h>
+#include <phLibNfc.h>
+#include <phLibNfc_Internal.h>
+#include <phHal4Nfc_Internal.h>
+#include <phHciNfc_NfcIPMgmt.h>
+#include <phHciNfc_Sequence.h>
/*
****************************** Macro Definitions *******************************
*/
#if defined (HOST_EMULATION)
+#include <phHciNfc_CE.h>
#include <phHciNfc_CE_A.h>
#define CE_A_EVT_NFC_SEND_DATA 0x10U
@@ -87,16 +93,34 @@ phHciNfc_Recv_CE_A_Response(
#endif
);
-#if defined (SEND_DATA_EVENT)
-static
-NFCSTATUS
-phHciNfc_CE_A_ProcessData(
- phHciNfc_sContext_t *psHciContext,
- void *pHwRef,
- uint8_t *pData,
- uint8_t length
- );
-#endif /* #if defined (SEND_DATA_EVENT) */
+/*Set CE config paramater response callback*/
+static
+ void phLibNfc_Mgt_SetCE_A_14443_4_ConfigParams_Cb(
+ void *context,
+ NFCSTATUS status
+ );
+
+
+/* Response callback for Remote Device Receive.*/
+static void phLibNfc_RemoteDev_CE_A_Receive_Cb(
+ void *context,
+ phHal_sRemoteDevInformation_t *ConnectedDevice,
+ phNfc_sData_t *rec_rsp_data,
+ NFCSTATUS status
+ );
+
+/*Response callback for Remote Device Send.*/
+static void phLibNfc_RemoteDev_CE_A_Send_Cb(
+ void *Context,
+ NFCSTATUS status
+ );
+
+static NFCSTATUS
+phHciNfc_CE_A_SendData (
+ phHciNfc_sContext_t *psHciContext,
+ void *pHwRef,
+ phHciNfc_XchgInfo_t *sData
+ );
/*
*************************** Function Definitions ***************************
@@ -129,7 +153,7 @@ phHciNfc_CE_A_Init_Resources(
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES);
}
-
+
}
return status;
}
@@ -140,14 +164,15 @@ phHciNfc_CE_A_Initialise(
void *pHwRef
)
{
- /*
- 1. Open Pipe,
- 2. Set all parameters
+ /*
+ 1. Open Pipe,
+ 2. Set all parameters
*/
NFCSTATUS status = NFCSTATUS_SUCCESS;
static uint8_t sak = HOST_CE_A_SAK_DEFAULT;
- static uint8_t atqa_info[] = { NXP_CE_A_ATQA_HIGH,
- NXP_CE_A_ATQA_LOW};
+ static uint8_t atqa_info[] = { NXP_CE_A_ATQA_LOW,
+ NXP_CE_A_ATQA_HIGH
+ };
if ((NULL == psHciContext) || (NULL == pHwRef))
{
@@ -166,7 +191,7 @@ phHciNfc_CE_A_Initialise(
ps_pipe_info = ps_ce_a_info->p_pipe_info;
if(NULL == ps_pipe_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_INFORMATION);
}
else
@@ -174,7 +199,7 @@ phHciNfc_CE_A_Initialise(
switch(ps_ce_a_info->current_seq)
{
case HOST_CE_A_PIPE_OPEN:
- {
+ {
status = phHciNfc_Open_Pipe( psHciContext,
pHwRef, ps_pipe_info );
if(status == NFCSTATUS_SUCCESS)
@@ -185,14 +210,14 @@ phHciNfc_CE_A_Initialise(
break;
}
case HOST_CE_A_SAK_SEQ:
- {
+ {
/* HOST Card Emulation A SAK Configuration */
ps_pipe_info->reg_index = HOST_CE_A_SAK_INDEX;
/* Configure the SAK of Host Card Emulation A */
sak = (uint8_t)HOST_CE_A_SAK_DEFAULT;
ps_pipe_info->param_info =(void*)&sak ;
ps_pipe_info->param_length = sizeof(sak) ;
- status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
+ status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
ps_pipe_info->pipe.pipe_id,
(uint8_t)ANY_SET_PARAMETER);
if(status == NFCSTATUS_PENDING)
@@ -208,12 +233,12 @@ phHciNfc_CE_A_Initialise(
/* Configure the ATQA of Host Card Emulation A */
ps_pipe_info->param_info = (void*)atqa_info ;
ps_pipe_info->param_length = sizeof(atqa_info) ;
- status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
+ status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
ps_pipe_info->pipe.pipe_id,
(uint8_t)ANY_SET_PARAMETER);
if(status == NFCSTATUS_PENDING)
{
- ps_ce_a_info->next_seq = HOST_CE_A_ENABLE_SEQ;
+ ps_ce_a_info->next_seq = HOST_CE_A_ENABLE_SEQ;
}
break;
}
@@ -266,7 +291,7 @@ phHciNfc_CE_A_Release(
ps_pipe_info = ps_ce_a_info->p_pipe_info;
if(NULL == ps_pipe_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_NOT_ALLOWED);
}
else
@@ -290,8 +315,9 @@ phHciNfc_CE_A_Release(
pHwRef, ps_pipe_info );
if(status == NFCSTATUS_SUCCESS)
{
- ps_ce_a_info->next_seq = HOST_CE_A_PIPE_DELETE;
- status = NFCSTATUS_PENDING;
+// ps_ce_a_info->next_seq = HOST_CE_A_PIPE_DELETE;
+// status = NFCSTATUS_PENDING;
+ ps_ce_a_info->next_seq = HOST_CE_A_PIPE_OPEN;
}
break;
}
@@ -355,7 +381,7 @@ phHciNfc_CE_A_Update_PipeInfo(
ps_ce_a_info->p_pipe_info = pPipeInfo;
if (NULL != pPipeInfo)
{
- /* Update the Response Receive routine of the card
+ /* Update the Response Receive routine of the card
emulation A Gate */
pPipeInfo->recv_resp = &phHciNfc_Recv_CE_A_Response;
/* Update the event Receive routine of the card emulation A Gate */
@@ -381,7 +407,7 @@ phHciNfc_CE_A_Get_PipeID(
if( (NULL != psHciContext)
&& ( NULL != ppipe_id )
- && ( NULL != psHciContext->p_ce_a_info )
+ && ( NULL != psHciContext->p_ce_a_info )
)
{
phHciNfc_CE_A_Info_t *ps_ce_a_info=NULL;
@@ -389,29 +415,13 @@ phHciNfc_CE_A_Get_PipeID(
psHciContext->p_ce_a_info ;
*ppipe_id = ps_ce_a_info->pipe_id ;
}
- else
+ else
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
}
return status;
}
-#ifdef CE_A_SEND_EVENT
-NFCSTATUS
-phHciNfc_CE_A_SendData_Event(
- void *psContext,
- void *pHwRef,
- uint8_t *pEvent,
- uint8_t length
- )
-{
- NFCSTATUS status = NFCSTATUS_SUCCESS;
- phHciNfc_sContext_t *psHciContext =
- (phHciNfc_sContext_t *)psContext ;
- return status;
-}
-#endif /* #ifdef CE_A_SEND_EVENT */
-
static
NFCSTATUS
phHciNfc_Recv_CE_A_Response(
@@ -426,7 +436,7 @@ phHciNfc_Recv_CE_A_Response(
)
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
- phHciNfc_sContext_t *psHciContext =
+ phHciNfc_sContext_t *psHciContext =
(phHciNfc_sContext_t *)psContext ;
if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pResponse)
|| (length == 0))
@@ -445,7 +455,7 @@ phHciNfc_Recv_CE_A_Response(
psHciContext->p_ce_a_info ;
if( NULL == ps_ce_a_info->p_pipe_info)
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_SEQUENCE);
}
else
@@ -457,7 +467,7 @@ phHciNfc_Recv_CE_A_Response(
{
#if 0
status = phHciNfc_CE_A_InfoUpdate(psHciContext,
- ps_ce_a_info->p_pipe_info->reg_index,
+ ps_ce_a_info->p_pipe_info->reg_index,
&pResponse[HCP_HEADER_LEN],
(length - HCP_HEADER_LEN));
#endif /* #if 0 */
@@ -475,7 +485,7 @@ phHciNfc_Recv_CE_A_Response(
}
case ANY_CLOSE_PIPE:
{
- HCI_PRINT("CE A close pipe complete\n");
+ HCI_PRINT("CE A close pipe complete\n");
break;
}
default:
@@ -486,7 +496,7 @@ phHciNfc_Recv_CE_A_Response(
}
if( NFCSTATUS_SUCCESS == status )
{
- status = phHciNfc_CE_A_Update_Seq(psHciContext,
+ status = phHciNfc_CE_A_Update_Seq(psHciContext,
UPDATE_SEQ);
ps_ce_a_info->p_pipe_info->prev_status = NFCSTATUS_SUCCESS;
}
@@ -510,7 +520,7 @@ phHciNfc_CE_A_Update_Seq(
}
else if( NULL == psHciContext->p_ce_a_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_FEATURE_NOT_SUPPORTED);
}
else
@@ -583,7 +593,7 @@ phHciNfc_CE_A_Mode(
param = (uint8_t)enable_type;
p_pipe_info->param_info =(void*)&param ;
p_pipe_info->param_length = sizeof(param) ;
- status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
+ status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
ps_ce_a_info->pipe_id,(uint8_t)ANY_SET_PARAMETER);
}
else
@@ -596,7 +606,7 @@ phHciNfc_CE_A_Mode(
-static
+static
NFCSTATUS
phHciNfc_Recv_CE_A_Event(
void *psContext,
@@ -610,7 +620,7 @@ phHciNfc_Recv_CE_A_Event(
)
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
- phHciNfc_sContext_t *psHciContext =
+ phHciNfc_sContext_t *psHciContext =
(phHciNfc_sContext_t *)psContext ;
if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pEvent)
|| (length == 0))
@@ -623,10 +633,15 @@ phHciNfc_Recv_CE_A_Event(
}
else
{
+ phHciNfc_NfcIP_Info_t *p_nfcipinfo= (phHciNfc_NfcIP_Info_t *) psHciContext->p_nfcip_info ;
+ p_nfcipinfo->rem_nfcip_tgt_info.RemDevType = phHal_eISO14443_A_PCD;
phHciNfc_HCP_Packet_t *p_packet = NULL;
phHciNfc_CE_A_Info_t *ps_ce_a_info=NULL;
phHciNfc_HCP_Message_t *message = NULL;
static phHal_sEventInfo_t event_info;
+ static phNfc_sTransactionInfo_t trans_info;
+ void * pInfo = &event_info;
+ uint8_t evt = NFC_NOTIFY_EVENT;
uint8_t instruction=0;
ps_ce_a_info = (phHciNfc_CE_A_Info_t *)
@@ -639,16 +654,19 @@ phHciNfc_Recv_CE_A_Event(
message = &p_packet->msg.message;
/* Get the instruction bits from the Message Header */
instruction = (uint8_t) GET_BITS8( message->msg_header,
- HCP_MSG_INSTRUCTION_OFFSET,
+ HCP_MSG_INSTRUCTION_OFFSET,
HCP_MSG_INSTRUCTION_LEN);
psHciContext->host_rf_type = phHal_eISO14443_A_PICC;
event_info.eventHost = phHal_eHostController;
event_info.eventSource = phHal_eISO14443_A_PICC;
+ event_info.eventInfo.pRemoteDevInfo = &(p_nfcipinfo->rem_nfcip_tgt_info);
switch(instruction)
- {
+ {
case CE_A_EVT_NFC_ACTIVATED:
- {
- event_info.eventType = NFC_EVT_ACTIVATED;
+ {
+ psHciContext->hci_state.cur_state = hciState_Listen;
+ psHciContext->hci_state.next_state = hciState_Unknown;
+ event_info.eventType = NFC_EVT_ACTIVATED;
/* Notify to the HCI Generic layer To Update the FSM */
break;
}
@@ -661,20 +679,23 @@ phHciNfc_Recv_CE_A_Event(
case CE_A_EVT_NFC_SEND_DATA:
{
HCI_PRINT("CE A data is received from the PN544\n");
-#if defined (SEND_DATA_EVENT)
- if(length > HCP_HEADER_LEN)
+
+ if(length > (HCP_HEADER_LEN+1))
{
- status = phHciNfc_CE_A_ProcessData(
- psHciContext, pHwRef,
- &pEvent[HCP_HEADER_LEN],
- (length - HCP_HEADER_LEN));
+ event_info.eventType = NFC_EVT_APDU_RECEIVED;
+ trans_info.status = status;
+ trans_info.type = NFC_NOTIFY_CE_A_RECV_EVENT;
+ trans_info.length = length - HCP_HEADER_LEN - 1;
+ trans_info.buffer = &pEvent[HCP_HEADER_LEN];
+ trans_info.info = &event_info;
+ pInfo = &trans_info;
+ evt = NFC_NOTIFY_CE_A_RECV_EVENT;
}
else
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_RESPONSE);
}
-#endif /* #if defined (SEND_DATA_EVENT) */
break;
}
case CE_A_EVT_NFC_FIELD_ON:
@@ -691,41 +712,1120 @@ phHciNfc_Recv_CE_A_Event(
}
default:
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_INSTRUCTION);
break;
}
}
if(NFCSTATUS_SUCCESS == status)
{
- phHciNfc_Notify_Event(psHciContext, pHwRef,
- NFC_NOTIFY_EVENT,
- &event_info);
+ phHciNfc_Notify_Event(psHciContext, pHwRef,
+ evt,
+ pInfo);
}
}
return status;
}
-#if defined (SEND_DATA_EVENT)
-static
NFCSTATUS
-phHciNfc_CE_A_ProcessData(
- phHciNfc_sContext_t *psHciContext,
- void *pHwRef,
- uint8_t *pData,
- uint8_t length
- )
+phHciNfc_CE_A_SendData (
+ phHciNfc_sContext_t *psHciContext,
+ void *pHwRef,
+ phHciNfc_XchgInfo_t *sData
+ )
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
- static uint8_t send_data[] = {0x6D, 0x80};
- status = phHciNfc_CE_A_SendData_Event(
- (void *)psHciContext, pHwRef,
- send_data, sizeof(send_data));
+ if( (NULL == psHciContext) || (NULL == pHwRef) ||
+ (NULL == sData) || (0 == sData->tx_length) || (CE_MAX_SEND_BUFFER_LEN < sData->tx_length))
+ {
+ status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
+ }
+ else if(NULL == psHciContext->p_ce_a_info)
+ {
+ status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
+ }
+ else
+ {
+ phHciNfc_CE_A_Info_t *ps_ce_a_info = (phHciNfc_CE_A_Info_t *)
+ psHciContext->p_ce_a_info ;
+ phHciNfc_Pipe_Info_t *p_pipe_info = ps_ce_a_info->p_pipe_info;
+
+ if(NULL == p_pipe_info )
+ {
+ status = PHNFCSTVAL(CID_NFC_HCI,
+ NFCSTATUS_INVALID_HCI_INFORMATION);
+ }
+ else
+ {
+ if (NFCSTATUS_SUCCESS == status)
+ {
+ phHciNfc_HCP_Packet_t *hcp_packet = NULL;
+ phHciNfc_HCP_Message_t *hcp_message = NULL;
+ uint16_t length = HCP_HEADER_LEN;
+ uint8_t pipeid = 0,
+ i = 0;
+ HCI_PRINT_BUFFER("HCI CE Send Data: ", sData->tx_buffer, sData->tx_length);
+
+ psHciContext->tx_total = 0 ;
+ pipeid = p_pipe_info->pipe.pipe_id;
+ hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
+ hcp_message = &(hcp_packet->msg.message);
+
+ /* Construct the HCP Frame */
+ phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
+ (uint8_t) pipeid, (uint8_t)HCP_MSG_TYPE_EVENT,
+ (uint8_t)CE_A_EVT_NFC_SEND_DATA);
+
+ phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
+ i, sData->tx_buffer,
+ sData->tx_length);
+
+ length =(uint16_t)(length + i + sData->tx_length);
+
+ p_pipe_info->sent_msg_type = (uint8_t)HCP_MSG_TYPE_EVENT;
+ p_pipe_info->prev_msg = CE_A_EVT_NFC_SEND_DATA;
+ psHciContext->tx_total = length;
+ /* Send the Constructed HCP packet to the lower layer */
+ status = phHciNfc_Send_HCP( psHciContext, pHwRef);
+ p_pipe_info->prev_status = status;
+ }
+ }
+ }
return status;
}
-#endif /* #if defined (SEND_DATA_EVENT) */
+
+/**Receive complete handler*/
+void phHal4Nfc_CE_A_RecvCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo)
+{
+ pphHal4Nfc_TransceiveCallback_t pUpperRecvCb = NULL;
+ NFCSTATUS RecvStatus = ((phNfc_sTransactionInfo_t *)pInfo)->status;
+ /*allocate TrcvContext if not already allocated.Required since
+ Receive complete can occur before any other send /receive calls.*/
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo= (pphHal4Nfc_TrcvCtxtInfo_t)
+ phOsalNfc_GetMemory((uint32_t)
+ (sizeof(phHal4Nfc_TrcvCtxtInfo_t)));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo,0,
+ sizeof(phHal4Nfc_TrcvCtxtInfo_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus
+ = NFCSTATUS_PENDING;
+ }
+ }
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
+ RecvStatus = PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else
+ {
+ /*Allocate 4K buffer to copy the received data into*/
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer
+ = (uint8_t *)phOsalNfc_GetMemory(
+ PH_HAL4NFC_MAX_RECEIVE_BUFFER
+ );
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer)
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,
+ 0);
+ RecvStatus = NFCSTATUS_INSUFFICIENT_RESOURCES;
+ }
+ else /*memset*/
+ {
+ (void)memset(
+ Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer,
+ 0,
+ PH_HAL4NFC_MAX_RECEIVE_BUFFER
+ );
+ }
+ }
+
+ if(RecvStatus != NFCSTATUS_INSUFFICIENT_RESOURCES)
+ {
+ /*Copy the data*/
+ (void)memcpy(
+ (Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer
+ + Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength),
+ ((phNfc_sTransactionInfo_t *)pInfo)->buffer,
+ ((phNfc_sTransactionInfo_t *)pInfo)->length
+ );
+ /*Update P2PRecvLength,this also acts as the offset to append more
+ received bytes*/
+ Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength
+ += ((phNfc_sTransactionInfo_t *)pInfo)->length;
+ Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.length
+ = Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength;
+ }
+
+ if(RecvStatus != NFCSTATUS_MORE_INFORMATION)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength = 0;
+ Hal4Ctxt->Hal4NextState = (eHal4StateTransaction
+ == Hal4Ctxt->Hal4NextState?eHal4StateInvalid:Hal4Ctxt->Hal4NextState);
+ if(NFCSTATUS_PENDING == Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus)
+ {
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb)
+ {
+ pUpperRecvCb = (pphHal4Nfc_TransceiveCallback_t)Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperRecvData
+ = &(Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData);
+ (*pUpperRecvCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice,
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperRecvData,
+ RecvStatus
+ );
+ }
+ else
+ {
+ /*Receive data buffer is complete with data & P2P receive has
+ not yet been called*/
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus
+ = NFCSTATUS_SUCCESS;
+ }
+ }
+ }
+ }
+ return;
+}
+
+/**
+* unblock any pending callback functions.
+*/
+NFCSTATUS
+phLibNfc_Mgt_Unblock_Cb_CE_A_14443_4( )
+{
+ NFCSTATUS RetVal = NFCSTATUS_NOT_INITIALISED;
+ if(gpphLibContext!=NULL && (gpphLibContext->psHwReference)!=NULL && (gpphLibContext->psHwReference->hal_context)!=NULL)
+ {
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ Hal4Ctxt = gpphLibContext->psHwReference->hal_context;
+ if(Hal4Ctxt->rem_dev_list[0]!=NULL &&
+ Hal4Ctxt->rem_dev_list[0]->SessionOpened==TRUE &&
+ Hal4Ctxt->rem_dev_list[0]->RemDevType == phNfc_eISO14443_A_PCD
+ )
+ {
+ phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)(Hal4Ctxt->psHciHandle));
+ phHciNfc_NfcIP_Info_t *p_nfcipinfo= (phHciNfc_NfcIP_Info_t *) psHciContext->p_nfcip_info ;
+ p_nfcipinfo->rem_nfcip_tgt_info.RemDevType = phHal_eISO14443_A_PCD;
+ phHciNfc_CE_A_Info_t *ps_ce_a_info=NULL;
+ static phHal_sEventInfo_t event_info;
+ void * pInfo = &event_info;
+
+ ps_ce_a_info = (phHciNfc_CE_A_Info_t *)psHciContext->p_ce_a_info ;
+
+ /* Variable was set but never used (ARM warning) */
+ PHNFC_UNUSED_VARIABLE(ps_ce_a_info);
+
+ psHciContext->host_rf_type = phHal_eISO14443_A_PICC;
+ event_info.eventHost = phHal_eHostController;
+ event_info.eventSource = phHal_eISO14443_A_PICC;
+ event_info.eventInfo.pRemoteDevInfo = &(p_nfcipinfo->rem_nfcip_tgt_info);
+ event_info.eventType = NFC_EVT_DEACTIVATED;
+ phHciNfc_Notify_Event(psHciContext, gpphLibContext->psHwReference,
+ NFC_NOTIFY_EVENT,
+ pInfo);
+ RetVal = NFCSTATUS_SUCCESS;
+ }
+ }
+ return RetVal;
+}
+
+
+/**
+* Interface to configure Card Emulation configurations.
+*/
+NFCSTATUS
+phLibNfc_Mgt_SetCE_A_14443_4_ConfigParams(
+ uint8_t emulate,
+ pphLibNfc_RspCb_t pConfigRspCb,
+ void* pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /* LibNfc Initialized or not */
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }/* Check for valid parameters */
+ else if((NULL == pConfigRspCb)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if(TRUE == gpphLibContext->status.GenCb_pending_status)
+ { /*Previous callback is pending */
+ RetVal = NFCSTATUS_BUSY;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk !=
+ gpphLibContext->LibNfcState.next_state)
+ {
+ phHal_uConfig_t uConfig;
+ uConfig.emuConfig.emuType = NFC_HOST_CE_A_EMULATION;
+ uConfig.emuConfig.config.hostEmuCfg_A.enableEmulation = emulate;
+ if(emulate==FALSE)
+ {
+ //de-activate any pending commands
+ phLibNfc_Mgt_Unblock_Cb_CE_A_14443_4();
+ }
+ RetVal = phHal4Nfc_ConfigParameters(
+ gpphLibContext->psHwReference,
+ NFC_EMULATION_CONFIG,
+ &uConfig,
+ phLibNfc_Mgt_SetCE_A_14443_4_ConfigParams_Cb,
+ (void *)gpphLibContext
+ );
+ }
+ else
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb= NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /* save the context and callback for later use */
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb = pConfigRspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ /* Next state is configured */
+ gpphLibContext->LibNfcState.next_state =eLibNfcHalStateConfigReady;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+/**
+* Response callback for CE configurations.
+*/
+static void phLibNfc_Mgt_SetCE_A_14443_4_ConfigParams_Cb(void *context,
+ NFCSTATUS status)
+{
+ pphLibNfc_RspCb_t pClientCb=NULL;
+ void *pUpperLayerContext=NULL;
+ /* Check for the context returned by below layer */
+ if((phLibNfc_LibContext_t *)context != gpphLibContext)
+ { /*wrong context returned*/
+ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1);
+ }
+ else
+ {
+ if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
+ { /*shutdown called before completion of this api allow
+ shutdown to happen */
+ phLibNfc_Pending_Shutdown();
+ status = NFCSTATUS_SHUTDOWN;
+ }
+ else
+ {
+ gpphLibContext->status.GenCb_pending_status = FALSE;
+ if(NFCSTATUS_SUCCESS != status)
+ {
+ status = NFCSTATUS_FAILED;
+ }
+ else
+ {
+ status = NFCSTATUS_SUCCESS;
+ }
+ }
+ /*update the current state */
+ phLibNfc_UpdateCurState(status,gpphLibContext);
+
+ pClientCb = gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb;
+ pUpperLayerContext = gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCntx;
+
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb = NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCntx = NULL;
+ if (NULL != pClientCb)
+ {
+ /* Notify to upper layer status of configure operation */
+ pClientCb(pUpperLayerContext, status);
+ }
+ }
+ return;
+}
+
+
+/* Transfer the user data to the another NfcIP device from the host.
+ * pTransferCallback is called, when all steps in the transfer sequence are
+ * completed.*/
+NFCSTATUS
+phHal4Nfc_CE_A_Receive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psRecvInfo,
+ pphHal4Nfc_TransceiveCallback_t pReceiveCallback,
+ void *pContext
+ )
+{
+ NFCSTATUS RetStatus = NFCSTATUS_PENDING;
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ /*NULL checks*/
+ if((NULL == psHwReference)
+ ||( NULL == pReceiveCallback)
+ ||( NULL == psRecvInfo))
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_INVALID_PARAMETER);
+ }
+ /*Check initialised state*/
+ else if((NULL == psHwReference->hal_context)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4CurrentState
+ < eHal4StateOpenAndReady)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4NextState
+ == eHal4StateClosed))
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
+ }
+ else
+ {
+ Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)psHwReference->hal_context;
+ if(NFC_EVT_ACTIVATED == Hal4Ctxt->sTgtConnectInfo.EmulationState)
+ {
+ /*Following condition gets satisfied only on target side,if receive
+ is not already called*/
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo= (pphHal4Nfc_TrcvCtxtInfo_t)
+ phOsalNfc_GetMemory((uint32_t)
+ (sizeof(phHal4Nfc_TrcvCtxtInfo_t)));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo,0,
+ sizeof(phHal4Nfc_TrcvCtxtInfo_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus = NFCSTATUS_PENDING;
+ }
+ }
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else /*Store callback & Return status pending*/
+ {
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+ /*Register upper layer callback*/
+ Hal4Ctxt->psTrcvCtxtInfo->pUpperTranceiveCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb = (pphHal4Nfc_ReceiveCallback_t)pReceiveCallback;
+ if(NFCSTATUS_PENDING !=
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus)
+ {
+ /**Create a timer to send received data in the callback*/
+ if(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ == PH_OSALNFC_INVALID_TIMER_ID)
+ {
+ PHDBG_INFO("HAL4: Transaction Timer Create for Receive");
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = phOsalNfc_Timer_Create();
+ }
+ if(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ == PH_OSALNFC_INVALID_TIMER_ID)
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else/*start the timer*/
+ {
+ phOsalNfc_Timer_Start(
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId,
+ PH_HAL4NFC_CE_RECV_CB_TIMEOUT,
+ phHal4Nfc_CE_RecvTimerCb,
+ NULL
+ );
+ }
+ }
+ }
+ }
+ else/*deactivated*/
+ {
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_DESELECTED);
+ }
+ }
+ return RetStatus;
+}
+
+/**
+* Interface used to transceive data from target to reader during CE communication
+*/
+NFCSTATUS
+phLibNfc_RemoteDev_CE_A_Transceive(
+ phNfc_sData_t * pTransferData,
+ pphLibNfc_TransceiveCallback_t pTransceive_RspCb,
+ void *pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /*Check Lib Nfc stack is initilized*/
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }
+ else if (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateRelease)
+ {
+ RetVal = NFCSTATUS_DESELECTED;
+ }
+ /*Check application has sent the valid parameters*/
+ else if((NULL == pTransferData)
+ || (NULL == pTransceive_RspCb)
+ || (NULL == pTransferData->buffer)
+ || (0 == pTransferData->length)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if((TRUE == gpphLibContext->status.GenCb_pending_status)
+ ||(NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb))
+ {
+ /*Previous callback is pending or local device is Initiator
+ then don't allow */
+ RetVal = NFCSTATUS_REJECTED;
+ }
+ else if((NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb))
+ {
+ RetVal =NFCSTATUS_BUSY ;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk ==
+ gpphLibContext->LibNfcState.next_state)
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb = NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ else
+ {
+ if(gpphLibContext->psTransInfo!=NULL)
+ {
+ (void)memset(gpphLibContext->psTransInfo,
+ 0,
+ sizeof(phLibNfc_sTransceiveInfo_t));
+
+ gpphLibContext->psTransInfo->addr =UNKNOWN_BLOCK_ADDRESS;
+ /*pointer to send data */
+ gpphLibContext->psTransInfo->sSendData.buffer =
+ pTransferData->buffer;
+ /*size of send data*/
+ gpphLibContext->psTransInfo->sSendData.length =
+ pTransferData->length;
+
+ /*Call Hal4 Send API and register callback with it*/
+ PHDBG_INFO("LibNfc:CE send In Progress");
+ RetVal= phHal4Nfc_CE_A_Transceive(
+ gpphLibContext->psHwReference,
+ &(gpphLibContext->sNfcIp_Context.TransactInfoRole),
+ gpphLibContext->psTransInfo->sSendData,
+ (pphHal4Nfc_TransceiveCallback_t) phLibNfc_RemoteDev_CE_A_Receive_Cb,
+ (void *)gpphLibContext
+ );
+ }
+ }
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /* Update next state to transaction */
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb= (pphLibNfc_Receive_RspCb_t) pTransceive_RspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb= NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx = pContext;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateTransaction;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+
+/* Transfer the user data to reader device from the host.
+ * pTransferCallback is called, when all steps in the transfer sequence are
+ * completed.*/
+NFCSTATUS
+phHal4Nfc_CE_A_Transceive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_TransceiveCallback_t pTransceiveCallback,
+ void *pContext
+ )
+{
+ NFCSTATUS RetStatus = NFCSTATUS_PENDING;
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ /*NULL checks*/
+ if((NULL == psHwReference)
+ ||( NULL == pTransceiveCallback )
+ || (NULL == psTransferInfo)
+ )
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_INVALID_PARAMETER);
+ }
+ /*Check initialised state*/
+ else if((NULL == psHwReference->hal_context)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4CurrentState
+ < eHal4StateOpenAndReady)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4NextState
+ == eHal4StateClosed))
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
+ }
+ else
+ {
+ Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)psHwReference->hal_context;
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_FAILED);
+ }
+ /*Check Activated*/
+ else if(NFC_EVT_ACTIVATED == Hal4Ctxt->sTgtConnectInfo.EmulationState)
+ {
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+ /*Register upper layer callback*/
+ Hal4Ctxt->psTrcvCtxtInfo->pUpperTranceiveCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb = (pphHal4Nfc_ReceiveCallback_t)pTransceiveCallback;
+ PHDBG_INFO("NfcIP1 Send");
+ /*allocate buffer to store senddata received from upper layer*/
+ if (NULL == Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData = (phNfc_sData_t *)
+ phOsalNfc_GetMemory(sizeof(phNfc_sData_t));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData, 0,
+ sizeof(phNfc_sData_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ }
+ }
+
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->buffer
+ = sTransferData.buffer;
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ = sTransferData.length;
+ /*If data size is less than MAX_SEND_LEN ,no chaining is required*/
+ Hal4Ctxt->psTrcvCtxtInfo->
+ XchangeInfo.params.nfc_info.more_info = FALSE;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length
+ = (uint8_t)sTransferData.length;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_buffer
+ = sTransferData.buffer;
+
+ PHDBG_INFO("HAL4:Calling Hci_Send_data()");
+
+ RetStatus = phHciNfc_CE_A_SendData (
+ (phHciNfc_sContext_t *)Hal4Ctxt->psHciHandle,
+ psHwReference,
+ &(Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo)
+ );
+
+ /*check return status*/
+ if (NFCSTATUS_PENDING == RetStatus)
+ {
+ /*Set P2P_Send_In_Progress to defer any disconnect call until
+ Send complete occurs*/
+ Hal4Ctxt->psTrcvCtxtInfo->P2P_Send_In_Progress = TRUE;
+ Hal4Ctxt->Hal4NextState = eHal4StateTransaction;
+ /*No of bytes remaining for next send*/
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ -= Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length;
+ }
+ }
+ else/*Deactivated*/
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_DESELECTED);
+ }
+ }
+ return RetStatus;
+}
+
+/**
+* Interface used to receive data from initiator at target side during P2P
+* communication.
+*/
+NFCSTATUS phLibNfc_RemoteDev_CE_A_Receive(
+ pphLibNfc_TransceiveCallback_t pReceiveRspCb,
+ void *pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /*Check Lib Nfc is initialized*/
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }/*Check application has sent valid parameters*/
+ else if (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateRelease)
+ {
+ RetVal = NFCSTATUS_DESELECTED;
+ }
+ else if((NULL == pReceiveRspCb)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if((TRUE == gpphLibContext->status.GenCb_pending_status)
+ ||(NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb))
+ {
+ /*Previous callback is pending or if initiator uses this api */
+ RetVal = NFCSTATUS_REJECTED;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk ==
+ gpphLibContext->LibNfcState.next_state)
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb = NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ else
+ {
+ /*Call below layer receive and register the callback with it*/
+ PHDBG_INFO("LibNfc:CE Receive In Progress");
+ RetVal =phHal4Nfc_CE_A_Receive(
+ gpphLibContext->psHwReference,
+ (phHal4Nfc_TransactInfo_t*)gpphLibContext->psTransInfo,
+ (pphHal4Nfc_TransceiveCallback_t)phLibNfc_RemoteDev_CE_A_Receive_Cb,
+ (void *)gpphLibContext
+ );
+ }
+
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /*Update the Next state as Transaction*/
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb= (pphHal4Nfc_ReceiveCallback_t) pReceiveRspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateTransaction;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+
+/**
+* Response callback for Remote Device Receive.
+*/
+static void phLibNfc_RemoteDev_CE_A_Receive_Cb(
+ void *context,
+ phHal_sRemoteDevInformation_t *ConnectedDevice,
+ phNfc_sData_t *rec_rsp_data,
+ NFCSTATUS status
+ )
+{
+ pphLibNfc_TransceiveCallback_t pClientCb=NULL;
+
+ phLibNfc_LibContext_t *pLibNfc_Ctxt = (phLibNfc_LibContext_t *)context;
+ void *pUpperLayerContext=NULL;
+
+ /* Check for the context returned by below layer */
+ if(pLibNfc_Ctxt != gpphLibContext)
+ { /*wrong context returned*/
+ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1);
+ }
+ else
+ {
+ pClientCb = (pphLibNfc_TransceiveCallback_t) gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb;
+ pUpperLayerContext = gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx;
+
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb = NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx = NULL;
+ gpphLibContext->status.GenCb_pending_status = FALSE;
+ if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
+ { /*shutdown called before completion of P2P receive allow
+ shutdown to happen */
+ phLibNfc_Pending_Shutdown();
+ status = NFCSTATUS_SHUTDOWN;
+ }
+ else if(eLibNfcHalStateRelease == gpphLibContext->LibNfcState.next_state)
+ {
+ status = NFCSTATUS_ABORTED;
+ }
+ else
+ {
+ if((NFCSTATUS_SUCCESS != status) &&
+ (PHNFCSTATUS(status) != NFCSTATUS_MORE_INFORMATION ) )
+ {
+ /*During CE receive operation initiator was removed
+ from RF field of target*/
+ status = NFCSTATUS_DESELECTED;
+ }
+ else
+ {
+ status = NFCSTATUS_SUCCESS;
+ }
+ }
+ /* Update current state */
+ phLibNfc_UpdateCurState(status,gpphLibContext);
+
+ if (NULL != pClientCb)
+ {
+ /*Notify to upper layer status and No. of bytes
+ actually received */
+ pClientCb(pUpperLayerContext, (uint32_t)ConnectedDevice, rec_rsp_data, status);
+ }
+ }
+ return;
+}
+
+
+/* Transfer the user data to a reader device from the host.
+ * pTransferCallback is called, when all steps in the transfer sequence are
+ * completed.*/
+NFCSTATUS
+phHal4Nfc_CE_A_Send(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_SendCallback_t pSendCallback,
+ void *pContext
+ )
+{
+ NFCSTATUS RetStatus = NFCSTATUS_PENDING;
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ /*NULL checks*/
+ if((NULL == psHwReference)
+ ||( NULL == pSendCallback )
+ || (NULL == psTransferInfo)
+ )
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_INVALID_PARAMETER);
+ }
+ /*Check initialised state*/
+ else if((NULL == psHwReference->hal_context)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4CurrentState
+ < eHal4StateOpenAndReady)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4NextState
+ == eHal4StateClosed))
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
+ }
+ else
+ {
+ Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)psHwReference->hal_context;
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_FAILED);
+ }
+ /*Check Activated*/
+ else if(NFC_EVT_ACTIVATED == Hal4Ctxt->sTgtConnectInfo.EmulationState)
+ {
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+ /*Register upper layer callback*/
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb = pSendCallback;
+ PHDBG_INFO("NfcIP1 Send");
+ /*allocate buffer to store senddata received from upper layer*/
+ if (NULL == Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData = (phNfc_sData_t *)
+ phOsalNfc_GetMemory(sizeof(phNfc_sData_t));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData, 0,
+ sizeof(phNfc_sData_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ }
+ }
+
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->buffer
+ = sTransferData.buffer;
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ = sTransferData.length;
+ /*If data size is less than MAX_SEND_LEN ,no chaining is required*/
+ Hal4Ctxt->psTrcvCtxtInfo->
+ XchangeInfo.params.nfc_info.more_info = FALSE;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length
+ = (uint8_t)sTransferData.length;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_buffer
+ = sTransferData.buffer;
+
+ PHDBG_INFO("HAL4:Calling Hci_Send_data()");
+
+ RetStatus = phHciNfc_CE_A_SendData (
+ (phHciNfc_sContext_t *)Hal4Ctxt->psHciHandle,
+ psHwReference,
+ &(Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo)
+ );
+
+ /*check return status*/
+ if (NFCSTATUS_PENDING == RetStatus)
+ {
+ /*Set P2P_Send_In_Progress to defer any disconnect call until
+ Send complete occurs*/
+ Hal4Ctxt->psTrcvCtxtInfo->P2P_Send_In_Progress = TRUE;
+ Hal4Ctxt->Hal4NextState = eHal4StateTransaction;
+ /*No of bytes remaining for next send*/
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ -= Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length;
+ }
+ }
+ else/*Deactivated*/
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_DESELECTED);
+ }
+ }
+ return RetStatus;
+}
+
+/**
+* Interface used to send data from target to reader during CE communication
+*/
+NFCSTATUS
+phLibNfc_RemoteDev_CE_A_Send(
+ phNfc_sData_t * pTransferData,
+ pphLibNfc_RspCb_t pSendRspCb,
+ void *pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /*Check Lib Nfc stack is initilized*/
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }
+ else if (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateRelease)
+ {
+ RetVal = NFCSTATUS_DESELECTED;
+ }
+ /*Check application has sent the valid parameters*/
+ else if((NULL == pTransferData)
+ || (NULL == pSendRspCb)
+ || (NULL == pTransferData->buffer)
+ || (0 == pTransferData->length)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if((TRUE == gpphLibContext->status.GenCb_pending_status)
+ ||(NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb))
+ {
+ /*Previous callback is pending or local device is Initiator
+ then don't allow */
+ RetVal = NFCSTATUS_REJECTED;
+ }/*Check for Discovered initiator handle and handle sent by application */
+ else if((NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb))
+ {
+ RetVal =NFCSTATUS_BUSY ;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk ==
+ gpphLibContext->LibNfcState.next_state)
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb = NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ else
+ {
+ if(gpphLibContext->psTransInfo!=NULL)
+ {
+ (void)memset(gpphLibContext->psTransInfo,
+ 0,
+ sizeof(phLibNfc_sTransceiveInfo_t));
+
+ gpphLibContext->psTransInfo->addr =UNKNOWN_BLOCK_ADDRESS;
+ /*pointer to send data */
+ gpphLibContext->psTransInfo->sSendData.buffer =
+ pTransferData->buffer;
+ /*size of send data*/
+ gpphLibContext->psTransInfo->sSendData.length =
+ pTransferData->length;
+
+ /*Call Hal4 Send API and register callback with it*/
+ PHDBG_INFO("LibNfc:CE send In Progress");
+ RetVal= phHal4Nfc_CE_A_Send(
+ gpphLibContext->psHwReference,
+ &(gpphLibContext->sNfcIp_Context.TransactInfoRole),
+ gpphLibContext->psTransInfo->sSendData,
+ (pphLibNfc_RspCb_t)
+ phLibNfc_RemoteDev_CE_A_Send_Cb,
+ (void *)gpphLibContext
+ );
+ }
+ }
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /* Update next state to transaction */
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb= pSendRspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateTransaction;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+
+/*
+* Response callback for Remote Device Send.
+*/
+static void phLibNfc_RemoteDev_CE_A_Send_Cb(
+ void *Context,
+ NFCSTATUS status
+ )
+{
+ pphLibNfc_RspCb_t pClientCb=NULL;
+ phLibNfc_LibContext_t *pLibNfc_Ctxt = (phLibNfc_LibContext_t *)Context;
+ void *pUpperLayerContext=NULL;
+
+ /* Check for the context returned by below layer */
+ if(pLibNfc_Ctxt != gpphLibContext)
+ { /*wrong context returned*/
+ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1);
+ }
+ else
+ {
+ if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
+ { /*shutdown called before completion p2p send allow
+ shutdown to happen */
+ phLibNfc_Pending_Shutdown();
+ status = NFCSTATUS_SHUTDOWN;
+ }
+ else if(eLibNfcHalStateRelease == gpphLibContext->LibNfcState.next_state)
+ {
+ status = NFCSTATUS_ABORTED;
+ }
+ else
+ {
+ gpphLibContext->status.GenCb_pending_status = FALSE;
+ if((NFCSTATUS_SUCCESS != status) &&
+ (PHNFCSTATUS(status) != NFCSTATUS_MORE_INFORMATION ) )
+ {
+ /*During p2p send operation initator was not present in RF
+ field of target*/
+ status = NFCSTATUS_DESELECTED;
+ }
+ else
+ {
+ status = NFCSTATUS_SUCCESS;
+ }
+ }
+ /* Update current state */
+ phLibNfc_UpdateCurState(status,gpphLibContext);
+
+ pClientCb = gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb;
+ pUpperLayerContext = gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx;
+
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb = NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx = NULL;
+ if (NULL != pClientCb)
+ {
+ /* Notify to upper layer status and No. of bytes
+ actually written or send to initiator */
+ pClientCb(pUpperLayerContext, status);
+ }
+ }
+ return;
+}
+
+/**Send complete handler*/
+void phHal4Nfc_CE_A_SendCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo)
+{
+ pphHal4Nfc_SendCallback_t pUpperSendCb = NULL;
+ NFCSTATUS SendStatus = ((phNfc_sCompletionInfo_t *)pInfo)->status;
+ pphHal4Nfc_DiscntCallback_t pUpperDisconnectCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->P2P_Send_In_Progress = FALSE;
+
+ /*Send status Success or Pending disconnect in HAl4*/
+ if((SendStatus != NFCSTATUS_SUCCESS)
+ ||(NFC_INVALID_RELEASE_TYPE != Hal4Ctxt->sTgtConnectInfo.ReleaseType))
+ {
+ Hal4Ctxt->Hal4NextState = eHal4StateInvalid;
+ /*Update Status*/
+ SendStatus = (NFCSTATUS)(NFC_INVALID_RELEASE_TYPE !=
+ Hal4Ctxt->sTgtConnectInfo.ReleaseType?NFCSTATUS_RELEASED:SendStatus);
+ /*Callback For Target Send*/
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb)
+ {
+ pUpperSendCb = Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb = NULL;
+ (*pUpperSendCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ SendStatus
+ );
+ }
+ /*Issue Pending disconnect from HAl4*/
+ if(NFC_INVALID_RELEASE_TYPE != Hal4Ctxt->sTgtConnectInfo.ReleaseType)
+ {
+ SendStatus = phHal4Nfc_Disconnect_Execute(gpphHal4Nfc_Hwref);
+ if((NFCSTATUS_PENDING != SendStatus) &&
+ (NULL != Hal4Ctxt->sTgtConnectInfo.pUpperDisconnectCb))
+ {
+ pUpperDisconnectCb =
+ Hal4Ctxt->sTgtConnectInfo.pUpperDisconnectCb;
+ Hal4Ctxt->sTgtConnectInfo.pUpperDisconnectCb = NULL;
+ (*pUpperDisconnectCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerDisconnectCtxt,
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice,
+ SendStatus
+ );/*Notify disconnect failed to upper layer*/
+ }
+ }
+ }
+ else
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->NumberOfBytesSent = 0;
+ /*Callback For Target Send*/
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb)
+ {
+ pUpperSendCb = Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb = NULL;
+ (*pUpperSendCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ SendStatus
+ );
+ }
+ }
+ return;
+}
#endif /* #if defined (HOST_EMULATION) */
diff --git a/src/phHciNfc_CE_A.h b/src/phHciNfc_CE_A.h
index aab5b24..da792e2 100644..100755
--- a/src/phHciNfc_CE_A.h
+++ b/src/phHciNfc_CE_A.h
@@ -83,7 +83,7 @@ typedef enum phHciNfc_CE_A_Seq{
HOST_CE_A_ATQA_SEQ,
HOST_CE_A_ENABLE_SEQ,
HOST_CE_A_DISABLE_SEQ,
- HOST_CE_A_PIPE_CLOSE,
+ HOST_CE_A_PIPE_CLOSE,
HOST_CE_A_PIPE_DELETE
}phHciNfc_CE_A_Seq_t;
@@ -95,7 +95,7 @@ typedef struct phHciNfc_CE_A_Info{
/* Pointer to the card emulation A pipe information */
phHciNfc_Pipe_Info_t *p_pipe_info;
uint8_t pipe_id;
-
+
} phHciNfc_CE_A_Info_t;
/*
@@ -107,7 +107,7 @@ typedef struct phHciNfc_CE_A_Info{
*
* This function Allocates the resources of the card emulation A management
* gate Information Structure.
- *
+ *
*/
extern
NFCSTATUS
@@ -118,7 +118,7 @@ phHciNfc_CE_A_Init_Resources(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_A_Get_PipeID function gives the pipe id of the card
+* The phHciNfc_CE_A_Get_PipeID function gives the pipe id of the card
* emulation A gate
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
@@ -141,13 +141,13 @@ phHciNfc_CE_A_Get_PipeID(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_A_Update_PipeInfo function updates the pipe_id of the card
+* The phHciNfc_CE_A_Update_PipeInfo function updates the pipe_id of the card
* emulation A gate management Structure.
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
* context Structure.
* \param[in] pipeID pipeID of the card emulation A gate
-* \param[in] pPipeInfo Update the pipe Information of the reader
+* \param[in] pPipeInfo Update the pipe Information of the reader
* A gate
*
* \retval NFCSTATUS_SUCCESS Function execution is successful.
@@ -167,35 +167,6 @@ phHciNfc_CE_A_Update_PipeInfo(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_A_SendData_Event function sends data to the lo
-*
-* \param[in] psHciContext psHciContext is the pointer to HCI Layer
-* context Structure.
-* \param[in] pHwRef pHwRef is the Information of
-* the Device Interface Link
-* \param[in] pipeID pipeID of the card emulation A gate
-* \param[in] pPipeInfo Update the pipe Information of the reader
-* A gate
-*
-* \retval NFCSTATUS_SUCCESS Function execution is successful.
-* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
-* could not be interpreted properly.
-*
-*/
-#ifdef CE_A_SEND_EVENT
-extern
-NFCSTATUS
-phHciNfc_CE_A_SendData_Event(
- void *psContext,
- void *pHwRef,
- uint8_t *pEvent,
- uint8_t length
- );
-#endif /* #ifdef CE_A_SEND_EVENT */
-
-/**
-* \ingroup grp_hci_nfc
-*
* The phHciNfc_CE_A_Mode function sends data to the set the card emulation mode
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
@@ -220,7 +191,7 @@ phHciNfc_CE_A_Mode(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_A_Initialise function opens the CE A and set all the
+* The phHciNfc_CE_A_Initialise function opens the CE A and set all the
* required parameters for CE A
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
@@ -233,7 +204,7 @@ phHciNfc_CE_A_Mode(
* could not be interpreted properly.
*
*/
-extern
+extern
NFCSTATUS
phHciNfc_CE_A_Initialise(
phHciNfc_sContext_t *psHciContext,
@@ -243,7 +214,7 @@ phHciNfc_CE_A_Initialise(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_A_Initialise function close the CE A and reset all the
+* The phHciNfc_CE_A_Initialise function close the CE A and reset all the
* required parameters to default value of CE A
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
@@ -256,7 +227,7 @@ phHciNfc_CE_A_Initialise(
* could not be interpreted properly.
*
*/
-extern
+extern
NFCSTATUS
phHciNfc_CE_A_Release(
phHciNfc_sContext_t *psHciContext,
@@ -267,12 +238,12 @@ phHciNfc_CE_A_Release(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_A_Update_Seq function to update CE A sequence depending on the
+* The phHciNfc_CE_A_Update_Seq function to update CE A sequence depending on the
* specified \ref seq_type
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
* context Structure.
-* \param[in] seq_type sequence type specified in
+* \param[in] seq_type sequence type specified in
* \ref phHciNfc_eSeqType_t
*
* \retval NFCSTATUS_SUCCESS Function execution is successful.
@@ -280,7 +251,7 @@ phHciNfc_CE_A_Release(
* could not be interpreted properly.
*
*/
-extern
+extern
NFCSTATUS
phHciNfc_CE_A_Update_Seq(
phHciNfc_sContext_t *psHciContext,
diff --git a/src/phHciNfc_CE_B.c b/src/phHciNfc_CE_B.c
index 4b985a3..6583160 100644..100755
--- a/src/phHciNfc_CE_B.c
+++ b/src/phHciNfc_CE_B.c
@@ -40,10 +40,16 @@
#include <phHciNfc_Pipe.h>
#include <phHciNfc_Emulation.h>
#include <phOsalNfc.h>
+#include <phLibNfc.h>
+#include <phLibNfc_Internal.h>
+#include <phHal4Nfc_Internal.h>
+#include <phHciNfc_NfcIPMgmt.h>
+#include <phHciNfc_Sequence.h>
/*
****************************** Macro Definitions *******************************
*/
#if defined (HOST_EMULATION)
+#include <phHciNfc_CE.h>
#include <phHciNfc_CE_B.h>
#define CE_B_EVT_NFC_SEND_DATA 0x10U
@@ -87,16 +93,34 @@ phHciNfc_Recv_CE_B_Response(
#endif
);
-#if defined (SEND_DATA_EVENT)
-static
-NFCSTATUS
-phHciNfc_CE_B_ProcessData(
- phHciNfc_sContext_t *psHciContext,
- void *pHwRef,
- uint8_t *pData,
- uint8_t length
- );
-#endif /* #if defined (SEND_DATA_EVENT) */
+/*Set CE config paramater response callback*/
+static
+ void phLibNfc_Mgt_SetCE_B_14443_4_ConfigParams_Cb(
+ void *context,
+ NFCSTATUS status
+ );
+
+
+/* Response callback for Remote Device Receive.*/
+static void phLibNfc_RemoteDev_CE_B_Receive_Cb(
+ void *context,
+ phHal_sRemoteDevInformation_t *ConnectedDevice,
+ phNfc_sData_t *rec_rsp_data,
+ NFCSTATUS status
+ );
+
+/*Response callback for Remote Device Send.*/
+static void phLibNfc_RemoteDev_CE_B_Send_Cb(
+ void *Context,
+ NFCSTATUS status
+ );
+
+static NFCSTATUS
+phHciNfc_CE_B_SendData (
+ phHciNfc_sContext_t *psHciContext,
+ void *pHwRef,
+ phHciNfc_XchgInfo_t *sData
+ );
/*
*************************** Function Definitions ***************************
@@ -129,7 +153,7 @@ phHciNfc_CE_B_Init_Resources(
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES);
}
-
+
}
return status;
}
@@ -161,7 +185,7 @@ phHciNfc_CE_B_Initialise(
ps_pipe_info = ps_ce_b_info->p_pipe_info;
if(NULL == ps_pipe_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_INFORMATION);
}
else
@@ -169,14 +193,14 @@ phHciNfc_CE_B_Initialise(
switch(ps_ce_b_info->current_seq)
{
case HOST_CE_B_PIPE_OPEN:
- {
+ {
status = phHciNfc_Open_Pipe( psHciContext,
pHwRef, ps_pipe_info );
if(status == NFCSTATUS_SUCCESS)
{
#if defined (CE_B_CONTINUE_SEQ)
ps_ce_b_info->next_seq = HOST_CE_B_PUPI_SEQ;
-#else
+#else
ps_ce_b_info->next_seq = HOST_CE_B_ENABLE_SEQ;
#endif /* #if defined (CE_CONTINUE_SEQ) */
status = NFCSTATUS_PENDING;
@@ -184,13 +208,13 @@ phHciNfc_CE_B_Initialise(
break;
}
case HOST_CE_B_PUPI_SEQ:
- {
+ {
/* HOST Card Emulation B PUPI Configuration */
ps_pipe_info->reg_index = HOST_CE_B_ATQB_INDEX;
-
+
ps_pipe_info->param_info =(void*)&pupi ;
ps_pipe_info->param_length = sizeof(pupi) ;
- status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
+ status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
ps_pipe_info->pipe.pipe_id,
(uint8_t)ANY_SET_PARAMETER);
if(status == NFCSTATUS_PENDING)
@@ -206,7 +230,7 @@ phHciNfc_CE_B_Initialise(
/* Configure the ATQA of Host Card Emulation B */
ps_pipe_info->param_info = (void*)atqb_info ;
ps_pipe_info->param_length = sizeof(atqb_info) ;
- status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
+ status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
ps_pipe_info->pipe.pipe_id,
(uint8_t)ANY_SET_PARAMETER);
if(status == NFCSTATUS_PENDING)
@@ -261,7 +285,7 @@ phHciNfc_CE_B_Release(
ps_pipe_info = ps_ce_b_info->p_pipe_info;
if(NULL == ps_pipe_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_INFORMATION);
}
else
@@ -285,8 +309,9 @@ phHciNfc_CE_B_Release(
pHwRef, ps_pipe_info );
if(status == NFCSTATUS_SUCCESS)
{
- ps_ce_b_info->next_seq = HOST_CE_B_PIPE_DELETE;
- status = NFCSTATUS_PENDING;
+// ps_ce_b_info->next_seq = HOST_CE_B_PIPE_DELETE;
+// status = NFCSTATUS_PENDING;
+ ps_ce_b_info->next_seq = HOST_CE_B_PIPE_OPEN;
}
break;
}
@@ -347,11 +372,11 @@ phHciNfc_CE_B_Mode(
if (NULL != ps_pipe_info)
{
ps_pipe_info->reg_index = HOST_CE_B_MODE_INDEX;
- /* Enable/Disable Host Card Emulation A */
+ /* Enable/Disable Host Card Emulation B */
param = (uint8_t)enable_type;
ps_pipe_info->param_info =(void*)&param ;
ps_pipe_info->param_length = sizeof(param) ;
- status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
+ status = phHciNfc_Send_Generic_Cmd(psHciContext,pHwRef,
ps_ce_b_info->pipe_id,(uint8_t)ANY_SET_PARAMETER);
}
else
@@ -374,7 +399,7 @@ phHciNfc_CE_B_Get_PipeID(
if( (NULL != psHciContext)
&& ( NULL != ppipe_id )
- && ( NULL != psHciContext->p_ce_b_info )
+ && ( NULL != psHciContext->p_ce_b_info )
)
{
phHciNfc_CE_B_Info_t *ps_ce_b_info=NULL;
@@ -382,7 +407,7 @@ phHciNfc_CE_B_Get_PipeID(
psHciContext->p_ce_b_info ;
*ppipe_id = ps_ce_b_info->pipe_id ;
}
- else
+ else
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
}
@@ -422,7 +447,7 @@ phHciNfc_CE_B_Update_PipeInfo(
ps_ce_b_info->p_pipe_info = pPipeInfo;
if (NULL != pPipeInfo)
{
- /* Update the Response Receive routine of the card
+ /* Update the Response Receive routine of the card
emulation A Gate */
pPipeInfo->recv_resp = &phHciNfc_Recv_CE_B_Response;
/* Update the event Receive routine of the card emulation A Gate */
@@ -438,22 +463,6 @@ phHciNfc_CE_B_Update_PipeInfo(
return status;
}
-#ifdef CE_B_SEND_EVENT
-NFCSTATUS
-phHciNfc_CE_B_SendData_Event(
- void *psContext,
- void *pHwRef,
- uint8_t *pEvent,
- uint8_t length
- )
-{
- NFCSTATUS status = NFCSTATUS_SUCCESS;
- phHciNfc_sContext_t *psHciContext =
- (phHciNfc_sContext_t *)psContext ;
- return status;
-}
-#endif /* #ifdef CE_B_SEND_EVENT */
-
static
NFCSTATUS
phHciNfc_Recv_CE_B_Response(
@@ -468,7 +477,7 @@ phHciNfc_Recv_CE_B_Response(
)
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
- phHciNfc_sContext_t *psHciContext =
+ phHciNfc_sContext_t *psHciContext =
(phHciNfc_sContext_t *)psContext ;
if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pResponse)
|| (length == 0))
@@ -487,7 +496,7 @@ phHciNfc_Recv_CE_B_Response(
psHciContext->p_ce_b_info ;
if( NULL == ps_ce_b_info->p_pipe_info)
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_SEQUENCE);
}
else
@@ -499,7 +508,7 @@ phHciNfc_Recv_CE_B_Response(
{
#if 0
status = phHciNfc_CE_B_InfoUpdate(psHciContext,
- ps_ce_b_info->p_pipe_info->reg_index,
+ ps_ce_b_info->p_pipe_info->reg_index,
&pResponse[HCP_HEADER_LEN],
(length - HCP_HEADER_LEN));
#endif /* #if 0 */
@@ -517,19 +526,19 @@ phHciNfc_Recv_CE_B_Response(
}
case ANY_CLOSE_PIPE:
{
- HCI_PRINT("CE B close pipe complete\n");
+ HCI_PRINT("CE B close pipe complete\n");
break;
}
default:
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_RESPONSE);
break;
}
}
if( NFCSTATUS_SUCCESS == status )
{
- status = phHciNfc_CE_B_Update_Seq(psHciContext,
+ status = phHciNfc_CE_B_Update_Seq(psHciContext,
UPDATE_SEQ);
ps_ce_b_info->p_pipe_info->prev_status = NFCSTATUS_SUCCESS;
}
@@ -553,7 +562,7 @@ phHciNfc_CE_B_Update_Seq(
}
else if( NULL == psHciContext->p_ce_b_info )
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_FEATURE_NOT_SUPPORTED);
}
else
@@ -594,7 +603,7 @@ phHciNfc_CE_B_Update_Seq(
}
-static
+static
NFCSTATUS
phHciNfc_Recv_CE_B_Event(
void *psContext,
@@ -608,7 +617,7 @@ phHciNfc_Recv_CE_B_Event(
)
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
- phHciNfc_sContext_t *psHciContext =
+ phHciNfc_sContext_t *psHciContext =
(phHciNfc_sContext_t *)psContext ;
if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pEvent)
|| (length == 0))
@@ -621,10 +630,15 @@ phHciNfc_Recv_CE_B_Event(
}
else
{
+ phHciNfc_NfcIP_Info_t *p_nfcipinfo= (phHciNfc_NfcIP_Info_t *) psHciContext->p_nfcip_info ;
+ p_nfcipinfo->rem_nfcip_tgt_info.RemDevType = phHal_eISO14443_B_PCD;
phHciNfc_HCP_Packet_t *p_packet = NULL;
phHciNfc_CE_B_Info_t *ps_ce_b_info=NULL;
phHciNfc_HCP_Message_t *message = NULL;
static phHal_sEventInfo_t event_info;
+ static phNfc_sTransactionInfo_t trans_info;
+ void * pInfo = &event_info;
+ uint8_t evt = NFC_NOTIFY_EVENT;
uint8_t instruction=0;
ps_ce_b_info = (phHciNfc_CE_B_Info_t *)
@@ -637,15 +651,18 @@ phHciNfc_Recv_CE_B_Event(
message = &p_packet->msg.message;
/* Get the instruction bits from the Message Header */
instruction = (uint8_t) GET_BITS8( message->msg_header,
- HCP_MSG_INSTRUCTION_OFFSET,
+ HCP_MSG_INSTRUCTION_OFFSET,
HCP_MSG_INSTRUCTION_LEN);
psHciContext->host_rf_type = phHal_eISO14443_B_PICC;
event_info.eventHost = phHal_eHostController;
event_info.eventSource = phHal_eISO14443_B_PICC;
+ event_info.eventInfo.pRemoteDevInfo = &(p_nfcipinfo->rem_nfcip_tgt_info);
switch(instruction)
- {
+ {
case CE_B_EVT_NFC_ACTIVATED:
{
+ psHciContext->hci_state.cur_state = hciState_Listen;
+ psHciContext->hci_state.next_state = hciState_Unknown;
event_info.eventType = NFC_EVT_ACTIVATED;
/* Notify to the HCI Generic layer To Update the FSM */
break;
@@ -658,27 +675,29 @@ phHciNfc_Recv_CE_B_Event(
}
case CE_B_EVT_NFC_SEND_DATA:
{
-#if defined (SEND_DATA_EVENT)
HCI_PRINT("CE B data is received from the PN544\n");
if(length > HCP_HEADER_LEN)
{
- status = phHciNfc_CE_B_ProcessData(
- psHciContext, pHwRef,
- &pEvent[HCP_HEADER_LEN],
- (length - HCP_HEADER_LEN));
+ event_info.eventType = NFC_EVT_APDU_RECEIVED;
+ trans_info.status = status;
+ trans_info.type = NFC_NOTIFY_CE_B_RECV_EVENT;
+ trans_info.length = length - HCP_HEADER_LEN - 1;
+ trans_info.buffer = &pEvent[HCP_HEADER_LEN];
+ trans_info.info = &event_info;
+ pInfo = &trans_info;
+ evt = NFC_NOTIFY_CE_B_RECV_EVENT;
}
else
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_RESPONSE);
}
-#endif /* #if defined (SEND_DATA_EVENT) */
break;
}
case CE_B_EVT_NFC_FIELD_ON:
{
HCI_PRINT("CE B field on\n");
- event_info.eventType = NFC_EVT_FIELD_ON;
+ event_info.eventType = NFC_EVT_FIELD_ON;
break;
}
case CE_B_EVT_NFC_FIELD_OFF:
@@ -689,41 +708,1120 @@ phHciNfc_Recv_CE_B_Event(
}
default:
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_HCI_INSTRUCTION);
break;
}
}
if(NFCSTATUS_SUCCESS == status)
{
- phHciNfc_Notify_Event(psHciContext, pHwRef,
- NFC_NOTIFY_EVENT,
- &event_info);
+ phHciNfc_Notify_Event(psHciContext, pHwRef,
+ evt,
+ pInfo);
}
}
return status;
}
-#if defined (SEND_DATA_EVENT)
-static
NFCSTATUS
-phHciNfc_CE_B_ProcessData(
- phHciNfc_sContext_t *psHciContext,
- void *pHwRef,
- uint8_t *pData,
- uint8_t length
- )
+phHciNfc_CE_B_SendData (
+ phHciNfc_sContext_t *psHciContext,
+ void *pHwRef,
+ phHciNfc_XchgInfo_t *sData
+ )
{
- NFCSTATUS status = NFCSTATUS_SUCCESS;
+ NFCSTATUS status = NFCSTATUS_SUCCESS;
- static uint8_t send_data[] = {0x6D, 0x80};
- status = phHciNfc_CE_B_SendData_Event(
- (void *)psHciContext, pHwRef,
- send_data, sizeof(send_data));
+ if( (NULL == psHciContext) || (NULL == pHwRef) ||
+ (NULL == sData) || (0 == sData->tx_length) || (CE_MAX_SEND_BUFFER_LEN < sData->tx_length))
+ {
+ status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
+ }
+ else if(NULL == psHciContext->p_ce_b_info)
+ {
+ status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
+ }
+ else
+ {
+ phHciNfc_CE_B_Info_t *ps_ce_b_info = (phHciNfc_CE_B_Info_t *)
+ psHciContext->p_ce_b_info ;
+ phHciNfc_Pipe_Info_t *p_pipe_info = ps_ce_b_info->p_pipe_info;
+
+ if(NULL == p_pipe_info )
+ {
+ status = PHNFCSTVAL(CID_NFC_HCI,
+ NFCSTATUS_INVALID_HCI_INFORMATION);
+ }
+ else
+ {
+ if (NFCSTATUS_SUCCESS == status)
+ {
+ phHciNfc_HCP_Packet_t *hcp_packet = NULL;
+ phHciNfc_HCP_Message_t *hcp_message = NULL;
+ uint16_t length = HCP_HEADER_LEN;
+ uint8_t pipeid = 0,
+ i = 0;
+
+ HCI_PRINT_BUFFER("HCI CE Send Data: ", sData->tx_buffer, sData->tx_length);
+
+ psHciContext->tx_total = 0 ;
+ pipeid = p_pipe_info->pipe.pipe_id;
+ hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
+ hcp_message = &(hcp_packet->msg.message);
+
+ /* Construct the HCP Frame */
+ phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
+ (uint8_t) pipeid, (uint8_t)HCP_MSG_TYPE_EVENT,
+ (uint8_t)CE_B_EVT_NFC_SEND_DATA);
+
+ phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
+ i, sData->tx_buffer,
+ sData->tx_length);
+
+ length =(uint16_t)(length + i + sData->tx_length);
+
+ p_pipe_info->sent_msg_type = (uint8_t)HCP_MSG_TYPE_EVENT;
+ p_pipe_info->prev_msg = CE_B_EVT_NFC_SEND_DATA;
+ psHciContext->tx_total = length;
+ /* Send the Constructed HCP packet to the lower layer */
+ status = phHciNfc_Send_HCP( psHciContext, pHwRef);
+ p_pipe_info->prev_status = status;
+ }
+ }
+ }
return status;
}
-#endif /* #if defined (SEND_DATA_EVENT) */
+/**Receive complete handler*/
+void phHal4Nfc_CE_B_RecvCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo)
+{
+ pphHal4Nfc_TransceiveCallback_t pUpperRecvCb = NULL;
+ NFCSTATUS RecvStatus = ((phNfc_sTransactionInfo_t *)pInfo)->status;
+ /*allocate TrcvContext if not already allocated.Required since
+ Receive complete can occur before any other send /receive calls.*/
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo= (pphHal4Nfc_TrcvCtxtInfo_t)
+ phOsalNfc_GetMemory((uint32_t)
+ (sizeof(phHal4Nfc_TrcvCtxtInfo_t)));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo,0,
+ sizeof(phHal4Nfc_TrcvCtxtInfo_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus
+ = NFCSTATUS_PENDING;
+ }
+ }
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
+ RecvStatus = PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else
+ {
+ /*Allocate 4K buffer to copy the received data into*/
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer
+ = (uint8_t *)phOsalNfc_GetMemory(
+ PH_HAL4NFC_MAX_RECEIVE_BUFFER
+ );
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer)
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,
+ 0);
+ RecvStatus = NFCSTATUS_INSUFFICIENT_RESOURCES;
+ }
+ else /*memset*/
+ {
+ (void)memset(
+ Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer,
+ 0,
+ PH_HAL4NFC_MAX_RECEIVE_BUFFER
+ );
+ }
+ }
+
+ if(RecvStatus != NFCSTATUS_INSUFFICIENT_RESOURCES)
+ {
+ /*Copy the data*/
+ (void)memcpy(
+ (Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.buffer
+ + Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength),
+ ((phNfc_sTransactionInfo_t *)pInfo)->buffer,
+ ((phNfc_sTransactionInfo_t *)pInfo)->length
+ );
+ /*Update P2PRecvLength,this also acts as the offset to append more
+ received bytes*/
+ Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength
+ += ((phNfc_sTransactionInfo_t *)pInfo)->length;
+ Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData.length
+ = Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength;
+ }
+
+ if(RecvStatus != NFCSTATUS_MORE_INFORMATION)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->P2PRecvLength = 0;
+ Hal4Ctxt->Hal4NextState = (eHal4StateTransaction
+ == Hal4Ctxt->Hal4NextState?eHal4StateInvalid:Hal4Ctxt->Hal4NextState);
+ if(NFCSTATUS_PENDING == Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus)
+ {
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb)
+ {
+ pUpperRecvCb = (pphHal4Nfc_TransceiveCallback_t)Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperRecvData
+ = &(Hal4Ctxt->psTrcvCtxtInfo->sLowerRecvData);
+ (*pUpperRecvCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice,
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperRecvData,
+ RecvStatus
+ );
+ }
+ else
+ {
+ /*Receive data buffer is complete with data & P2P receive has
+ not yet been called*/
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus
+ = NFCSTATUS_SUCCESS;
+ }
+ }
+ }
+ }
+ return;
+}
+
+/**
+* unblock any pending callback functions.
+*/
+NFCSTATUS
+phLibNfc_Mgt_Unblock_Cb_CE_B_14443_4( )
+{
+ NFCSTATUS RetVal = NFCSTATUS_NOT_INITIALISED;
+ if(gpphLibContext!=NULL && (gpphLibContext->psHwReference)!=NULL && (gpphLibContext->psHwReference->hal_context)!=NULL)
+ {
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ Hal4Ctxt = gpphLibContext->psHwReference->hal_context;
+ if(Hal4Ctxt->rem_dev_list[0]!=NULL &&
+ Hal4Ctxt->rem_dev_list[0]->SessionOpened==TRUE &&
+ Hal4Ctxt->rem_dev_list[0]->RemDevType == phNfc_eISO14443_B_PCD
+ )
+ {
+ phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)(Hal4Ctxt->psHciHandle));
+ phHciNfc_NfcIP_Info_t *p_nfcipinfo= (phHciNfc_NfcIP_Info_t *) psHciContext->p_nfcip_info ;
+ p_nfcipinfo->rem_nfcip_tgt_info.RemDevType = phHal_eISO14443_B_PCD;
+ phHciNfc_CE_B_Info_t *ps_ce_b_info=NULL;
+ static phHal_sEventInfo_t event_info;
+ void * pInfo = &event_info;
+
+ ps_ce_b_info = (phHciNfc_CE_B_Info_t *)psHciContext->p_ce_b_info ;
+
+ /* Variable was set but never used (ARM warning) */
+ PHNFC_UNUSED_VARIABLE(ps_ce_b_info);
+
+ psHciContext->host_rf_type = phHal_eISO14443_B_PICC;
+ event_info.eventHost = phHal_eHostController;
+ event_info.eventSource = phHal_eISO14443_B_PICC;
+ event_info.eventInfo.pRemoteDevInfo = &(p_nfcipinfo->rem_nfcip_tgt_info);
+ event_info.eventType = NFC_EVT_DEACTIVATED;
+ phHciNfc_Notify_Event(psHciContext, gpphLibContext->psHwReference,
+ NFC_NOTIFY_EVENT,
+ pInfo);
+ RetVal = NFCSTATUS_SUCCESS;
+ }
+ }
+ return RetVal;
+}
+
+
+/**
+* Interface to configure Card Emulation configurations.
+*/
+NFCSTATUS
+phLibNfc_Mgt_SetCE_B_14443_4_ConfigParams(
+ uint8_t emulate,
+ pphLibNfc_RspCb_t pConfigRspCb,
+ void* pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /* LibNfc Initialized or not */
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }/* Check for valid parameters */
+ else if((NULL == pConfigRspCb)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if(TRUE == gpphLibContext->status.GenCb_pending_status)
+ { /*Previous callback is pending */
+ RetVal = NFCSTATUS_BUSY;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk !=
+ gpphLibContext->LibNfcState.next_state)
+ {
+ phHal_uConfig_t uConfig;
+ uConfig.emuConfig.emuType = NFC_HOST_CE_B_EMULATION;
+ uConfig.emuConfig.config.hostEmuCfg_B.enableEmulation = emulate;
+ if(emulate==FALSE)
+ {
+ //de-activate any pending commands
+ phLibNfc_Mgt_Unblock_Cb_CE_B_14443_4();
+ }
+ RetVal = phHal4Nfc_ConfigParameters(
+ gpphLibContext->psHwReference,
+ NFC_EMULATION_CONFIG,
+ &uConfig,
+ phLibNfc_Mgt_SetCE_B_14443_4_ConfigParams_Cb,
+ (void *)gpphLibContext
+ );
+ }
+ else
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb= NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /* save the context and callback for later use */
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb = pConfigRspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ /* Next state is configured */
+ gpphLibContext->LibNfcState.next_state =eLibNfcHalStateConfigReady;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+/**
+* Response callback for CE configurations.
+*/
+static void phLibNfc_Mgt_SetCE_B_14443_4_ConfigParams_Cb(void *context,
+ NFCSTATUS status)
+{
+ pphLibNfc_RspCb_t pClientCb=NULL;
+ void *pUpperLayerContext=NULL;
+ /* Check for the context returned by below layer */
+ if((phLibNfc_LibContext_t *)context != gpphLibContext)
+ { /*wrong context returned*/
+ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1);
+ }
+ else
+ {
+ if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
+ { /*shutdown called before completion of this api allow
+ shutdown to happen */
+ phLibNfc_Pending_Shutdown();
+ status = NFCSTATUS_SHUTDOWN;
+ }
+ else
+ {
+ gpphLibContext->status.GenCb_pending_status = FALSE;
+ if(NFCSTATUS_SUCCESS != status)
+ {
+ status = NFCSTATUS_FAILED;
+ }
+ else
+ {
+ status = NFCSTATUS_SUCCESS;
+ }
+ }
+ /*update the current state */
+ phLibNfc_UpdateCurState(status,gpphLibContext);
+
+ pClientCb = gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb;
+ pUpperLayerContext = gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCntx;
+
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCb = NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCntx = NULL;
+ if (NULL != pClientCb)
+ {
+ /* Notify to upper layer status of configure operation */
+ pClientCb(pUpperLayerContext, status);
+ }
+ }
+ return;
+}
+
+
+/* Transfer the user data to the another NfcIP device from the host.
+ * pTransferCallback is called, when all steps in the transfer sequence are
+ * completed.*/
+NFCSTATUS
+phHal4Nfc_CE_B_Receive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psRecvInfo,
+ pphHal4Nfc_TransceiveCallback_t pReceiveCallback,
+ void *pContext
+ )
+{
+ NFCSTATUS RetStatus = NFCSTATUS_PENDING;
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ /*NULL checks*/
+ if((NULL == psHwReference)
+ ||( NULL == pReceiveCallback)
+ ||( NULL == psRecvInfo))
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_INVALID_PARAMETER);
+ }
+ /*Check initialised state*/
+ else if((NULL == psHwReference->hal_context)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4CurrentState
+ < eHal4StateOpenAndReady)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4NextState
+ == eHal4StateClosed))
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
+ }
+ else
+ {
+ Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)psHwReference->hal_context;
+ if(NFC_EVT_ACTIVATED == Hal4Ctxt->sTgtConnectInfo.EmulationState)
+ {
+ /*Following condition gets satisfied only on target side,if receive
+ is not already called*/
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo= (pphHal4Nfc_TrcvCtxtInfo_t)
+ phOsalNfc_GetMemory((uint32_t)
+ (sizeof(phHal4Nfc_TrcvCtxtInfo_t)));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo,0,
+ sizeof(phHal4Nfc_TrcvCtxtInfo_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus = NFCSTATUS_PENDING;
+ }
+ }
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_NoMemory,0);
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else /*Store callback & Return status pending*/
+ {
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+ /*Register upper layer callback*/
+ Hal4Ctxt->psTrcvCtxtInfo->pUpperTranceiveCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb = (pphHal4Nfc_ReceiveCallback_t)pReceiveCallback;
+ if(NFCSTATUS_PENDING !=
+ Hal4Ctxt->psTrcvCtxtInfo->RecvDataBufferStatus)
+ {
+ /**Create a timer to send received data in the callback*/
+ if(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ == PH_OSALNFC_INVALID_TIMER_ID)
+ {
+ PHDBG_INFO("HAL4: Transaction Timer Create for Receive");
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = phOsalNfc_Timer_Create();
+ }
+ if(Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ == PH_OSALNFC_INVALID_TIMER_ID)
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,
+ NFCSTATUS_INSUFFICIENT_RESOURCES);
+ }
+ else/*start the timer*/
+ {
+ phOsalNfc_Timer_Start(
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId,
+ PH_HAL4NFC_CE_RECV_CB_TIMEOUT,
+ phHal4Nfc_CE_RecvTimerCb,
+ NULL
+ );
+ }
+ }
+ }
+ }
+ else/*deactivated*/
+ {
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_DESELECTED);
+ }
+ }
+ return RetStatus;
+}
+
+/**
+* Interface used to transceive data from target to reader during CE communication
+*/
+NFCSTATUS
+phLibNfc_RemoteDev_CE_B_Transceive(
+ phNfc_sData_t * pTransferData,
+ pphLibNfc_TransceiveCallback_t pTransceive_RspCb,
+ void *pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /*Check Lib Nfc stack is initilized*/
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }
+ else if (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateRelease)
+ {
+ RetVal = NFCSTATUS_DESELECTED;
+ }
+ /*Check application has sent the valid parameters*/
+ else if((NULL == pTransferData)
+ || (NULL == pTransceive_RspCb)
+ || (NULL == pTransferData->buffer)
+ || (0 == pTransferData->length)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if((TRUE == gpphLibContext->status.GenCb_pending_status)
+ ||(NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb))
+ {
+ /*Previous callback is pending or local device is Initiator
+ then don't allow */
+ RetVal = NFCSTATUS_REJECTED;
+ }
+ else if((NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb))
+ {
+ RetVal =NFCSTATUS_BUSY ;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk ==
+ gpphLibContext->LibNfcState.next_state)
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb = NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ else
+ {
+ if(gpphLibContext->psTransInfo!=NULL)
+ {
+ (void)memset(gpphLibContext->psTransInfo,
+ 0,
+ sizeof(phLibNfc_sTransceiveInfo_t));
+
+ gpphLibContext->psTransInfo->addr =UNKNOWN_BLOCK_ADDRESS;
+ /*pointer to send data */
+ gpphLibContext->psTransInfo->sSendData.buffer =
+ pTransferData->buffer;
+ /*size of send data*/
+ gpphLibContext->psTransInfo->sSendData.length =
+ pTransferData->length;
+
+ /*Call Hal4 Send API and register callback with it*/
+ PHDBG_INFO("LibNfc:CE send In Progress");
+ RetVal= phHal4Nfc_CE_B_Transceive(
+ gpphLibContext->psHwReference,
+ &(gpphLibContext->sNfcIp_Context.TransactInfoRole),
+ gpphLibContext->psTransInfo->sSendData,
+ (pphHal4Nfc_TransceiveCallback_t) phLibNfc_RemoteDev_CE_B_Receive_Cb,
+ (void *)gpphLibContext
+ );
+ }
+ }
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /* Update next state to transaction */
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb= (pphLibNfc_Receive_RspCb_t) pTransceive_RspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb= NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx = pContext;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateTransaction;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+
+/* Transfer the user data to reader device from the host.
+ * pTransferCallback is called, when all steps in the transfer sequence are
+ * completed.*/
+NFCSTATUS
+phHal4Nfc_CE_B_Transceive(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_TransceiveCallback_t pTransceiveCallback,
+ void *pContext
+ )
+{
+ NFCSTATUS RetStatus = NFCSTATUS_PENDING;
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ /*NULL checks*/
+ if((NULL == psHwReference)
+ ||( NULL == pTransceiveCallback )
+ || (NULL == psTransferInfo)
+ )
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_INVALID_PARAMETER);
+ }
+ /*Check initialised state*/
+ else if((NULL == psHwReference->hal_context)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4CurrentState
+ < eHal4StateOpenAndReady)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4NextState
+ == eHal4StateClosed))
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
+ }
+ else
+ {
+ Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)psHwReference->hal_context;
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_FAILED);
+ }
+ /*Check Activated*/
+ else if(NFC_EVT_ACTIVATED == Hal4Ctxt->sTgtConnectInfo.EmulationState)
+ {
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+ /*Register upper layer callback*/
+ Hal4Ctxt->psTrcvCtxtInfo->pUpperTranceiveCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PRecvCb = (pphHal4Nfc_ReceiveCallback_t)pTransceiveCallback;
+ PHDBG_INFO("NfcIP1 Send");
+ /*allocate buffer to store senddata received from upper layer*/
+ if (NULL == Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData = (phNfc_sData_t *)
+ phOsalNfc_GetMemory(sizeof(phNfc_sData_t));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData, 0,
+ sizeof(phNfc_sData_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ }
+ }
+
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->buffer
+ = sTransferData.buffer;
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ = sTransferData.length;
+ /*If data size is less than MAX_SEND_LEN ,no chaining is required*/
+ Hal4Ctxt->psTrcvCtxtInfo->
+ XchangeInfo.params.nfc_info.more_info = FALSE;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length
+ = (uint8_t)sTransferData.length;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_buffer
+ = sTransferData.buffer;
+
+ PHDBG_INFO("HAL4:Calling Hci_Send_data()");
+
+ RetStatus = phHciNfc_CE_B_SendData (
+ (phHciNfc_sContext_t *)Hal4Ctxt->psHciHandle,
+ psHwReference,
+ &(Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo)
+ );
+
+ /*check return status*/
+ if (NFCSTATUS_PENDING == RetStatus)
+ {
+ /*Set P2P_Send_In_Progress to defer any disconnect call until
+ Send complete occurs*/
+ Hal4Ctxt->psTrcvCtxtInfo->P2P_Send_In_Progress = TRUE;
+ Hal4Ctxt->Hal4NextState = eHal4StateTransaction;
+ /*No of bytes remaining for next send*/
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ -= Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length;
+ }
+ }
+ else/*Deactivated*/
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_DESELECTED);
+ }
+ }
+ return RetStatus;
+}
+
+/**
+* Interface used to receive data from initiator at target side during P2P
+* communication.
+*/
+NFCSTATUS phLibNfc_RemoteDev_CE_B_Receive(
+ pphLibNfc_TransceiveCallback_t pReceiveRspCb,
+ void *pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /*Check Lib Nfc is initialized*/
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }/*Check application has sent valid parameters*/
+ else if (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateRelease)
+ {
+ RetVal = NFCSTATUS_DESELECTED;
+ }
+ else if((NULL == pReceiveRspCb)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if((TRUE == gpphLibContext->status.GenCb_pending_status)
+ ||(NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb))
+ {
+ /*Previous callback is pending or if initiator uses this api */
+ RetVal = NFCSTATUS_REJECTED;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk ==
+ gpphLibContext->LibNfcState.next_state)
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb = NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ else
+ {
+ /*Call below layer receive and register the callback with it*/
+ PHDBG_INFO("LibNfc:CE Receive In Progress");
+ RetVal =phHal4Nfc_CE_B_Receive(
+ gpphLibContext->psHwReference,
+ (phHal4Nfc_TransactInfo_t*)gpphLibContext->psTransInfo,
+ (pphHal4Nfc_TransceiveCallback_t)phLibNfc_RemoteDev_CE_B_Receive_Cb,
+ (void *)gpphLibContext
+ );
+ }
+
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /*Update the Next state as Transaction*/
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb= (pphHal4Nfc_ReceiveCallback_t) pReceiveRspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateTransaction;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+
+/**
+* Response callback for Remote Device Receive.
+*/
+static void phLibNfc_RemoteDev_CE_B_Receive_Cb(
+ void *context,
+ phHal_sRemoteDevInformation_t *ConnectedDevice,
+ phNfc_sData_t *rec_rsp_data,
+ NFCSTATUS status
+ )
+{
+ pphLibNfc_TransceiveCallback_t pClientCb=NULL;
+
+ phLibNfc_LibContext_t *pLibNfc_Ctxt = (phLibNfc_LibContext_t *)context;
+ void *pUpperLayerContext=NULL;
+
+ /* Check for the context returned by below layer */
+ if(pLibNfc_Ctxt != gpphLibContext)
+ { /*wrong context returned*/
+ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1);
+ }
+ else
+ {
+ pClientCb = (pphLibNfc_TransceiveCallback_t) gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb;
+ pUpperLayerContext = gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx;
+
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb = NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpRxCntx = NULL;
+ gpphLibContext->status.GenCb_pending_status = FALSE;
+ if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
+ { /*shutdown called before completion of P2P receive allow
+ shutdown to happen */
+ phLibNfc_Pending_Shutdown();
+ status = NFCSTATUS_SHUTDOWN;
+ }
+ else if(eLibNfcHalStateRelease == gpphLibContext->LibNfcState.next_state)
+ {
+ status = NFCSTATUS_ABORTED;
+ }
+ else
+ {
+ if((NFCSTATUS_SUCCESS != status) &&
+ (PHNFCSTATUS(status) != NFCSTATUS_MORE_INFORMATION ) )
+ {
+ /*During CE receive operation initiator was removed
+ from RF field of target*/
+ status = NFCSTATUS_DESELECTED;
+ }
+ else
+ {
+ status = NFCSTATUS_SUCCESS;
+ }
+ }
+ /* Update current state */
+ phLibNfc_UpdateCurState(status,gpphLibContext);
+
+ if (NULL != pClientCb)
+ {
+ /*Notify to upper layer status and No. of bytes
+ actually received */
+ pClientCb(pUpperLayerContext, (uint32_t)ConnectedDevice, rec_rsp_data, status);
+ }
+ }
+ return;
+}
+
+
+/* Transfer the user data to a reader device from the host.
+ * pTransferCallback is called, when all steps in the transfer sequence are
+ * completed.*/
+NFCSTATUS
+phHal4Nfc_CE_B_Send(
+ phHal_sHwReference_t *psHwReference,
+ phHal4Nfc_TransactInfo_t *psTransferInfo,
+ phNfc_sData_t sTransferData,
+ pphHal4Nfc_SendCallback_t pSendCallback,
+ void *pContext
+ )
+{
+ NFCSTATUS RetStatus = NFCSTATUS_PENDING;
+ phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+ /*NULL checks*/
+ if((NULL == psHwReference)
+ ||( NULL == pSendCallback )
+ || (NULL == psTransferInfo)
+ )
+ {
+ phOsalNfc_RaiseException(phOsalNfc_e_PrecondFailed,1);
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_INVALID_PARAMETER);
+ }
+ /*Check initialised state*/
+ else if((NULL == psHwReference->hal_context)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4CurrentState
+ < eHal4StateOpenAndReady)
+ || (((phHal4Nfc_Hal4Ctxt_t *)
+ psHwReference->hal_context)->Hal4NextState
+ == eHal4StateClosed))
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_NOT_INITIALISED);
+ }
+ else
+ {
+ Hal4Ctxt = (phHal4Nfc_Hal4Ctxt_t *)psHwReference->hal_context;
+ if(NULL == Hal4Ctxt->psTrcvCtxtInfo)
+ {
+ RetStatus= PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_FAILED);
+ }
+ /*Check Activated*/
+ else if(NFC_EVT_ACTIVATED == Hal4Ctxt->sTgtConnectInfo.EmulationState)
+ {
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
+ /*Register upper layer callback*/
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb = pSendCallback;
+ PHDBG_INFO("NfcIP1 Send");
+ /*allocate buffer to store senddata received from upper layer*/
+ if (NULL == Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData = (phNfc_sData_t *)
+ phOsalNfc_GetMemory(sizeof(phNfc_sData_t));
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData)
+ {
+ (void)memset(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData, 0,
+ sizeof(phNfc_sData_t));
+ Hal4Ctxt->psTrcvCtxtInfo->TransactionTimerId
+ = PH_OSALNFC_INVALID_TIMER_ID;
+ }
+ }
+
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->buffer
+ = sTransferData.buffer;
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ = sTransferData.length;
+ /*If data size is less than MAX_SEND_LEN ,no chaining is required*/
+ Hal4Ctxt->psTrcvCtxtInfo->
+ XchangeInfo.params.nfc_info.more_info = FALSE;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length
+ = (uint8_t)sTransferData.length;
+ Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_buffer
+ = sTransferData.buffer;
+
+ PHDBG_INFO("HAL4:Calling Hci_Send_data()");
+
+ RetStatus = phHciNfc_CE_B_SendData (
+ (phHciNfc_sContext_t *)Hal4Ctxt->psHciHandle,
+ psHwReference,
+ &(Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo)
+ );
+
+ /*check return status*/
+ if (NFCSTATUS_PENDING == RetStatus)
+ {
+ /*Set P2P_Send_In_Progress to defer any disconnect call until
+ Send complete occurs*/
+ Hal4Ctxt->psTrcvCtxtInfo->P2P_Send_In_Progress = TRUE;
+ Hal4Ctxt->Hal4NextState = eHal4StateTransaction;
+ /*No of bytes remaining for next send*/
+ Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
+ -= Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length;
+ }
+ }
+ else/*Deactivated*/
+ {
+ RetStatus = PHNFCSTVAL(CID_NFC_HAL ,NFCSTATUS_DESELECTED);
+ }
+ }
+ return RetStatus;
+}
+
+/**
+* Interface used to send data from target to reader during CE communication
+*/
+NFCSTATUS
+phLibNfc_RemoteDev_CE_B_Send(
+ phNfc_sData_t * pTransferData,
+ pphLibNfc_RspCb_t pSendRspCb,
+ void *pContext
+ )
+{
+ NFCSTATUS RetVal = NFCSTATUS_FAILED;
+ /*Check Lib Nfc stack is initilized*/
+ if((NULL == gpphLibContext)||
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ {
+ RetVal = NFCSTATUS_NOT_INITIALISED;
+ }
+ else if (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateRelease)
+ {
+ RetVal = NFCSTATUS_DESELECTED;
+ }
+ /*Check application has sent the valid parameters*/
+ else if((NULL == pTransferData)
+ || (NULL == pSendRspCb)
+ || (NULL == pTransferData->buffer)
+ || (0 == pTransferData->length)
+ || (NULL == pContext))
+ {
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
+ }
+ else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
+ {
+ RetVal = NFCSTATUS_SHUTDOWN;
+ }
+ else if((TRUE == gpphLibContext->status.GenCb_pending_status)
+ ||(NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpRxCb))
+ {
+ /*Previous callback is pending or local device is Initiator
+ then don't allow */
+ RetVal = NFCSTATUS_REJECTED;
+ }/*Check for Discovered initiator handle and handle sent by application */
+ else if((NULL!=gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb))
+ {
+ RetVal =NFCSTATUS_BUSY ;
+ }
+ else
+ {
+ if(eLibNfcHalStatePresenceChk ==
+ gpphLibContext->LibNfcState.next_state)
+ {
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb = NULL;
+ RetVal = NFCSTATUS_PENDING;
+ }
+ else
+ {
+ if(gpphLibContext->psTransInfo!=NULL)
+ {
+ (void)memset(gpphLibContext->psTransInfo,
+ 0,
+ sizeof(phLibNfc_sTransceiveInfo_t));
+
+ gpphLibContext->psTransInfo->addr =UNKNOWN_BLOCK_ADDRESS;
+ /*pointer to send data */
+ gpphLibContext->psTransInfo->sSendData.buffer =
+ pTransferData->buffer;
+ /*size of send data*/
+ gpphLibContext->psTransInfo->sSendData.length =
+ pTransferData->length;
+
+ /*Call Hal4 Send API and register callback with it*/
+ PHDBG_INFO("LibNfc:CE send In Progress");
+ RetVal= phHal4Nfc_CE_B_Send(
+ gpphLibContext->psHwReference,
+ &(gpphLibContext->sNfcIp_Context.TransactInfoRole),
+ gpphLibContext->psTransInfo->sSendData,
+ (pphLibNfc_RspCb_t)
+ phLibNfc_RemoteDev_CE_B_Send_Cb,
+ (void *)gpphLibContext
+ );
+ }
+ }
+ if(NFCSTATUS_PENDING == RetVal)
+ {
+ /* Update next state to transaction */
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb= pSendRspCb;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx = pContext;
+ gpphLibContext->status.GenCb_pending_status=TRUE;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateTransaction;
+ }
+ else
+ {
+ RetVal = NFCSTATUS_FAILED;
+ }
+ }
+ return RetVal;
+}
+
+/*
+* Response callback for Remote Device Send.
+*/
+static void phLibNfc_RemoteDev_CE_B_Send_Cb(
+ void *Context,
+ NFCSTATUS status
+ )
+{
+ pphLibNfc_RspCb_t pClientCb=NULL;
+ phLibNfc_LibContext_t *pLibNfc_Ctxt = (phLibNfc_LibContext_t *)Context;
+ void *pUpperLayerContext=NULL;
+
+ /* Check for the context returned by below layer */
+ if(pLibNfc_Ctxt != gpphLibContext)
+ { /*wrong context returned*/
+ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1);
+ }
+ else
+ {
+ if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
+ { /*shutdown called before completion p2p send allow
+ shutdown to happen */
+ phLibNfc_Pending_Shutdown();
+ status = NFCSTATUS_SHUTDOWN;
+ }
+ else if(eLibNfcHalStateRelease == gpphLibContext->LibNfcState.next_state)
+ {
+ status = NFCSTATUS_ABORTED;
+ }
+ else
+ {
+ gpphLibContext->status.GenCb_pending_status = FALSE;
+ if((NFCSTATUS_SUCCESS != status) &&
+ (PHNFCSTATUS(status) != NFCSTATUS_MORE_INFORMATION ) )
+ {
+ /*During p2p send operation initator was not present in RF
+ field of target*/
+ status = NFCSTATUS_DESELECTED;
+ }
+ else
+ {
+ status = NFCSTATUS_SUCCESS;
+ }
+ }
+ /* Update current state */
+ phLibNfc_UpdateCurState(status,gpphLibContext);
+
+ pClientCb = gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb;
+ pUpperLayerContext = gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx;
+
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCb = NULL;
+ gpphLibContext->sNfcIp_Context.pClientNfcIpTxCntx = NULL;
+ if (NULL != pClientCb)
+ {
+ /* Notify to upper layer status and No. of bytes
+ actually written or send to initiator */
+ pClientCb(pUpperLayerContext, status);
+ }
+ }
+ return;
+}
+
+/**Send complete handler*/
+void phHal4Nfc_CE_B_SendCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo)
+{
+ pphHal4Nfc_SendCallback_t pUpperSendCb = NULL;
+ NFCSTATUS SendStatus = ((phNfc_sCompletionInfo_t *)pInfo)->status;
+ pphHal4Nfc_DiscntCallback_t pUpperDisconnectCb = NULL;
+ Hal4Ctxt->psTrcvCtxtInfo->P2P_Send_In_Progress = FALSE;
+
+ /*Send status Success or Pending disconnect in HAl4*/
+ if((SendStatus != NFCSTATUS_SUCCESS)
+ ||(NFC_INVALID_RELEASE_TYPE != Hal4Ctxt->sTgtConnectInfo.ReleaseType))
+ {
+ Hal4Ctxt->Hal4NextState = eHal4StateInvalid;
+ /*Update Status*/
+ SendStatus = (NFCSTATUS)(NFC_INVALID_RELEASE_TYPE !=
+ Hal4Ctxt->sTgtConnectInfo.ReleaseType?NFCSTATUS_RELEASED:SendStatus);
+ /*Callback For Target Send*/
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb)
+ {
+ pUpperSendCb = Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb = NULL;
+ (*pUpperSendCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ SendStatus
+ );
+ }
+ /*Issue Pending disconnect from HAl4*/
+ if(NFC_INVALID_RELEASE_TYPE != Hal4Ctxt->sTgtConnectInfo.ReleaseType)
+ {
+ SendStatus = phHal4Nfc_Disconnect_Execute(gpphHal4Nfc_Hwref);
+ if((NFCSTATUS_PENDING != SendStatus) &&
+ (NULL != Hal4Ctxt->sTgtConnectInfo.pUpperDisconnectCb))
+ {
+ pUpperDisconnectCb =
+ Hal4Ctxt->sTgtConnectInfo.pUpperDisconnectCb;
+ Hal4Ctxt->sTgtConnectInfo.pUpperDisconnectCb = NULL;
+ (*pUpperDisconnectCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerDisconnectCtxt,
+ Hal4Ctxt->sTgtConnectInfo.psConnectedDevice,
+ SendStatus
+ );/*Notify disconnect failed to upper layer*/
+ }
+ }
+ }
+ else
+ {
+ Hal4Ctxt->psTrcvCtxtInfo->NumberOfBytesSent = 0;
+ /*Callback For Target Send*/
+ if(NULL != Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb)
+ {
+ pUpperSendCb = Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb;
+ Hal4Ctxt->psTrcvCtxtInfo->pP2PSendCb = NULL;
+ (*pUpperSendCb)(
+ Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt,
+ SendStatus
+ );
+ }
+ }
+ return;
+}
#endif /* #if defined (HOST_EMULATION) */
diff --git a/src/phHciNfc_CE_B.h b/src/phHciNfc_CE_B.h
index e34e2db..9de7526 100644..100755
--- a/src/phHciNfc_CE_B.h
+++ b/src/phHciNfc_CE_B.h
@@ -78,7 +78,7 @@ typedef enum phHciNfc_CE_B_Seq{
HOST_CE_B_ATQB_SEQ,
HOST_CE_B_ENABLE_SEQ,
HOST_CE_B_DISABLE_SEQ,
- HOST_CE_B_PIPE_CLOSE,
+ HOST_CE_B_PIPE_CLOSE,
HOST_CE_B_PIPE_DELETE
}phHciNfc_CE_B_Seq_t;
@@ -89,7 +89,7 @@ typedef struct phHciNfc_CE_B_Info{
/* Pointer to the card emulation B pipe information */
phHciNfc_Pipe_Info_t *p_pipe_info;
uint8_t pipe_id;
-
+
} phHciNfc_CE_B_Info_t;
/*
@@ -101,7 +101,7 @@ typedef struct phHciNfc_CE_B_Info{
*
* This function Allocates the resources of the card emulation B management
* gate Information Structure.
- *
+ *
*/
extern
NFCSTATUS
@@ -112,7 +112,7 @@ phHciNfc_CE_B_Init_Resources(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_B_Get_PipeID function gives the pipe id of the card
+* The phHciNfc_CE_B_Get_PipeID function gives the pipe id of the card
* emulation B gate
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
@@ -135,13 +135,13 @@ phHciNfc_CE_B_Get_PipeID(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_B_Update_PipeInfo function updates the pipe_id of the card
+* The phHciNfc_CE_B_Update_PipeInfo function updates the pipe_id of the card
* emulation B gate management Structure.
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
* context Structure.
* \param[in] pipeID pipeID of the card emulation A gate
-* \param[in] pPipeInfo Update the pipe Information of the reader
+* \param[in] pPipeInfo Update the pipe Information of the reader
* A gate
*
* \retval NFCSTATUS_SUCCESS Function execution is successful.
@@ -167,35 +167,6 @@ phHciNfc_CE_B_Update_PipeInfo(
* context Structure.
* \param[in] pHwRef pHwRef is the Information of
* the Device Interface Link
-* \param[in] pipeID pipeID of the card emulation B gate
-* \param[in] pPipeInfo Update the pipe Information of the card
-* emulation B gate
-*
-* \retval NFCSTATUS_SUCCESS Function execution is successful.
-* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
-* could not be interpreted properly.
-*
-*/
-#ifdef CE_B_SEND_EVENT
-extern
-NFCSTATUS
-phHciNfc_CE_B_SendData_Event(
- void *psContext,
- void *pHwRef,
- uint8_t *pEvent,
- uint8_t length
- );
-#endif /* #ifdef CE_B_SEND_EVENT */
-
-/**
-* \ingroup grp_hci_nfc
-*
-* The phHciNfc_CE_B_Mode function sends data to the set the card emulation mode
-*
-* \param[in] psHciContext psHciContext is the pointer to HCI Layer
-* context Structure.
-* \param[in] pHwRef pHwRef is the Information of
-* the Device Interface Link
* \param[in] enable_type type to enable
*
* \retval NFCSTATUS_SUCCESS Function execution is successful.
@@ -203,6 +174,7 @@ phHciNfc_CE_B_SendData_Event(
* could not be interpreted properly.
*
*/
+extern
NFCSTATUS
phHciNfc_CE_B_Mode(
void *psHciHandle,
@@ -213,7 +185,7 @@ phHciNfc_CE_B_Mode(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_B_Initialise function opens the CE B and set all the
+* The phHciNfc_CE_B_Initialise function opens the CE B and set all the
* required parameters for CE B
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
@@ -226,7 +198,7 @@ phHciNfc_CE_B_Mode(
* could not be interpreted properly.
*
*/
-extern
+extern
NFCSTATUS
phHciNfc_CE_B_Initialise(
phHciNfc_sContext_t *psHciContext,
@@ -236,7 +208,7 @@ phHciNfc_CE_B_Initialise(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_B_Initialise function close the CE B and reset all the
+* The phHciNfc_CE_B_Initialise function close the CE B and reset all the
* required parameters to default value of CE B
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
@@ -249,7 +221,7 @@ phHciNfc_CE_B_Initialise(
* could not be interpreted properly.
*
*/
-extern
+extern
NFCSTATUS
phHciNfc_CE_B_Release(
phHciNfc_sContext_t *psHciContext,
@@ -259,12 +231,12 @@ phHciNfc_CE_B_Release(
/**
* \ingroup grp_hci_nfc
*
-* The phHciNfc_CE_B_Update_Seq function to update CE B sequence depending on the
+* The phHciNfc_CE_B_Update_Seq function to update CE B sequence depending on the
* specified \ref seq_type
*
* \param[in] psHciContext psHciContext is the pointer to HCI Layer
* context Structure.
-* \param[in] seq_type sequence type specified in
+* \param[in] seq_type sequence type specified in
* \ref phHciNfc_eSeqType_t
*
* \retval NFCSTATUS_SUCCESS Function execution is successful.
@@ -272,7 +244,7 @@ phHciNfc_CE_B_Release(
* could not be interpreted properly.
*
*/
-extern
+extern
NFCSTATUS
phHciNfc_CE_B_Update_Seq(
phHciNfc_sContext_t *psHciContext,
diff --git a/src/phHciNfc_Generic.c b/src/phHciNfc_Generic.c
index 875e295..6dcc823 100644..100755
--- a/src/phHciNfc_Generic.c
+++ b/src/phHciNfc_Generic.c
@@ -28,7 +28,7 @@
* $Date: Tue Jun 8 09:31:49 2010 $ *
* $Author: ing04880 $ *
* $Revision: 1.108 $ *
-* $Aliases: NFC_FRI1.1_WK1023_R35_1 $
+* $Aliases: NFC_FRI1.1_WK1023_R35_1 $
* *
* =========================================================================== *
*/
@@ -66,12 +66,12 @@ uint32_t nxp_nfc_hci_response_timeout = NXP_NFC_HCI_TIMEOUT;
*/
-#if (NXP_NFC_HCI_TIMER == 1)
+#if (NXP_NFC_HCI_TIMER == 1)
#define NXP_HCI_RESPONSE_TIMEOUT (NXP_NFC_HCI_TIMEOUT)
#include <phOsalNfc_Timer.h>
-/** \internal HCI Response Timer to detect the
+/** \internal HCI Response Timer to detect the
* Stalled HCI Response */
static uint32_t hci_resp_timer_id = NXP_INVALID_TIMER_ID;
static phHciNfc_sContext_t *gpsHciContext= NULL;
@@ -200,7 +200,7 @@ phHciNfc_Process_Command (
static
void
-phHciNfc_Reset_Pipe_MsgInfo(
+phHciNfc_Reset_Pipe_MsgInfo(
phHciNfc_Pipe_Info_t *p_pipe_info
);
@@ -222,7 +222,7 @@ phHciNfc_Build_HCPHeader(
/**
* \ingroup grp_hci_nfc
*
- * The phHciNfc_Receive_HCP function receive the HCI Host Control Packet
+ * The phHciNfc_Receive_HCP function receive the HCI Host Control Packet
* Frames from the device.
*
* \param[in] psHciContext psHciContext is the context of
@@ -282,7 +282,7 @@ phHciNfc_Response_Timeout (
void *p_upper_context =
gpsHciContext->p_upper_context;
phHal_sHwReference_t *pHwRef = gpsHciContext->p_hw_ref;
- uint32_t i = 0;
+ uint32_t i = 0;
HCI_DEBUG(" HCI TIMEOUT: HCI Response Timeout Occurred in %X Timer\n"
@@ -290,15 +290,15 @@ phHciNfc_Response_Timeout (
/* Stop the Response Timer */
phOsalNfc_Timer_Stop( hci_resp_timer_id );
- comp_info.status = PHNFCSTVAL(CID_NFC_HCI,
- NFCSTATUS_BOARD_COMMUNICATION_ERROR);
+ comp_info.status = PHNFCSTVAL(CID_NFC_HCI,
+ NFCSTATUS_BOARD_COMMUNICATION_ERROR);
/* Roll Back to the Select State */
phHciNfc_FSM_Rollback(gpsHciContext);
- for(i=0;i < PHHCINFC_MAX_PIPE; i++)
- {
- phHciNfc_Reset_Pipe_MsgInfo(gpsHciContext->p_pipe_list[i]);
- }
+ for(i=0;i < PHHCINFC_MAX_PIPE; i++)
+ {
+ phHciNfc_Reset_Pipe_MsgInfo(gpsHciContext->p_pipe_list[i]);
+ }
/* Notify the Error/Success Scenario to the upper layer */
phHciNfc_Notify( p_upper_notify, p_upper_context,
@@ -495,7 +495,7 @@ phHciNfc_Response_Timeout (
static
void
-phHciNfc_Reset_Pipe_MsgInfo(
+phHciNfc_Reset_Pipe_MsgInfo(
phHciNfc_Pipe_Info_t *p_pipe_info
)
{
@@ -517,7 +517,7 @@ phHciNfc_Release_Lower(
void *pHwRef
)
{
- phNfc_sLowerIF_t *plower_if =
+ phNfc_sLowerIF_t *plower_if =
&(psHciContext->lower_interface);
NFCSTATUS status = NFCSTATUS_SUCCESS;
@@ -559,7 +559,7 @@ phHciNfc_Release_Lower(
phNfc_sLowerIF_t *plower_if = &(psHciContext->lower_interface);
- if( (NULL != plower_if)
+ if( (NULL != plower_if)
&& (NULL != plower_if->send)
)
{
@@ -571,7 +571,7 @@ phHciNfc_Release_Lower(
#if (NXP_NFC_HCI_TIMER == 1)
- if (
+ if (
(TRUE != psHciContext->tx_hcp_chaining)
&& (TRUE == psHciContext->response_pending)
&& ( NXP_INVALID_TIMER_ID != hci_resp_timer_id )
@@ -624,7 +624,7 @@ phHciNfc_Receive(
{
plower_if = &(psHciContext->lower_interface);
- if( (NULL != plower_if)
+ if( (NULL != plower_if)
&& (NULL != plower_if->receive)
)
{
@@ -675,13 +675,13 @@ phHciNfc_Receive(
psHciContext->tx_hcp_frgmnt_index = HCP_ZERO_LEN ;
chain_bit = HCP_CHAINBIT_BEGIN;
/* Increment the Fragment index to skip the HCP Header */
- psHciContext->tx_hcp_frgmnt_index++;
+ psHciContext->tx_hcp_frgmnt_index++;
psHciContext->tx_hcp_chaining = TRUE ;
tx_length = PHHCINFC_MAX_PACKET_DATA ;
}
else if ( psHciContext->tx_remain > PHHCINFC_MAX_PACKET_DATA )
{
- /* Intermediate Chained HCI Frames */
+ /* Intermediate Chained HCI Frames */
tx_length = PHHCINFC_MAX_PACKET_DATA ;
}
else
@@ -691,11 +691,11 @@ phHciNfc_Receive(
tx_length = psHciContext->tx_remain ;
psHciContext->tx_hcp_chaining = FALSE ;
}
-
+
/* Build the HCP Header to have Chaining Enabled */
phHciNfc_Build_HCPHeader(tx_data, chain_bit , pipe_id );
- phHciNfc_Append_HCPFrame((uint8_t *)tx_data->msg.payload, hcp_index,
+ phHciNfc_Append_HCPFrame((uint8_t *)tx_data->msg.payload, hcp_index,
(&psHciContext->send_buffer[psHciContext->tx_hcp_frgmnt_index])
, tx_length );
}
@@ -708,13 +708,13 @@ phHciNfc_Receive(
psHciContext->tx_remain = tx_length ;
}
-
+
/* Include the Skipped HCP Header Byte */
tx_length++;
status = phHciNfc_Send ( (void *) psHciContext, pHwRef,
(uint8_t *)tx_data, tx_length );
-
+
return status;
}
@@ -757,7 +757,7 @@ phHciNfc_Receive(
{
/* Copy the obtained fragment and receive the next fragment */
phHciNfc_Append_HCPFrame(
- psHciContext->recv_buffer, hcp_index,
+ psHciContext->recv_buffer, hcp_index,
(uint8_t *)&pdata[HCP_MESSAGE_LEN],
(length - HCP_MESSAGE_LEN) );
psHciContext->rx_hcp_frgmnt_index =(uint16_t)
@@ -768,14 +768,14 @@ phHciNfc_Receive(
{
psHciContext->rx_hcp_chaining = TRUE ;
/* Copy the obtained fragment and receive the next fragment */
- phHciNfc_Append_HCPFrame(psHciContext->recv_buffer,
+ phHciNfc_Append_HCPFrame(psHciContext->recv_buffer,
hcp_index, pdata, length);
psHciContext->rx_hcp_frgmnt_index = ( hcp_index + length ) ;
}
status = phHciNfc_Receive ( (void *) psHciContext, pHwRef,
pdata, length);
- }
+ }
else
{
if(TRUE == psHciContext->rx_hcp_chaining)
@@ -784,11 +784,11 @@ phHciNfc_Receive(
psHciContext->rx_hcp_chaining = FALSE ;
/* Copy the Remaining buffer to the RX_BUFFER */
phHciNfc_Append_HCPFrame(
- psHciContext->recv_buffer, hcp_index,
+ psHciContext->recv_buffer, hcp_index,
(uint8_t *)&pdata[HCP_MESSAGE_LEN],
(length - HCP_MESSAGE_LEN) );
/* If there is chaining done the return the same data */
- psHciContext->rx_total =
+ psHciContext->rx_total =
(hcp_index + length - HCP_MESSAGE_LEN);
psHciContext->rx_hcp_frgmnt_index = FALSE ;
}
@@ -838,13 +838,13 @@ phHciNfc_Receive(
}
else
{
- status = phHciNfc_Receive_HCP( psHciContext, pHwRef, pdata, length );
+ status = phHciNfc_Receive_HCP( psHciContext, pHwRef, pdata, length );
}/* End of the Valid Data Handling */
if( NFCSTATUS_SUCCESS == status )
{
packet = (phHciNfc_HCP_Packet_t *)psHciContext->recv_buffer;
- length =
+ length =
#ifdef ONE_BYTE_LEN
(uint8_t)
#endif
@@ -926,7 +926,7 @@ phHciNfc_Receive(
}
#endif /* (NXP_NFC_HCI_TIMER == 1) */
-
+
if (pipe_id >= PHHCINFC_MAX_PIPE )
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION);
@@ -1133,8 +1133,8 @@ static
/* psHciContext->hci_transact_state = NFC_TRANSACT_SEND_COMPLETE;*/
/* Receive the Response Packet */
- status = phHciNfc_Receive( psHciContext, pHwRef,
- (uint8_t *)(&psHciContext->rx_packet),
+ status = phHciNfc_Receive( psHciContext, pHwRef,
+ (uint8_t *)(&psHciContext->rx_packet),
sizeof(phHciNfc_HCP_Packet_t) );
/* HCI_DEBUG("HCI Lower Layer Send Completion After Receive,\
@@ -1142,7 +1142,7 @@ static
}
else
{
- if(
+ if(
/* #define EVENT_NOTIFY */
#ifndef EVENT_NOTIFY
( NFCSTATUS_SUCCESS == status )
@@ -1259,10 +1259,10 @@ phHciNfc_Build_HCPMessage(
phHciNfc_HCP_Message_t *hcp_message = NULL;
hcp_message = &(hcp_packet->msg.message);
- /* Set the type to the provided message type in the HCP Message Header */
+ /* Set the type to the provided message type in the HCP Message Header */
hcp_message->msg_header = (uint8_t) SET_BITS8(hcp_message->msg_header,HCP_MSG_TYPE_OFFSET,
HCP_MSG_TYPE_LEN, msg_type);
- /* Set the instruction to the kind of instruction in the HCP Message Header */
+ /* Set the instruction to the kind of instruction in the HCP Message Header */
hcp_message->msg_header = (uint8_t) SET_BITS8(hcp_message->msg_header,HCP_MSG_INSTRUCTION_OFFSET,
HCP_MSG_INSTRUCTION_LEN, instruction);
/* hcp_message->msg_header = hcp_message->msg_header | temp ; */
@@ -1278,10 +1278,10 @@ phHciNfc_Build_HCPHeader(
uint8_t pipe_id
)
{
- /* Set the Chaining bit to the default type */
+ /* Set the Chaining bit to the default type */
hcp_packet->hcp_header = (uint8_t) SET_BITS8(hcp_packet->hcp_header,
HCP_CHAINBIT_OFFSET, HCP_CHAINBIT_LEN, chainbit);
- /* Populate the Pipe ID to the HCP Header */
+ /* Populate the Pipe ID to the HCP Header */
hcp_packet->hcp_header = (uint8_t) SET_BITS8(hcp_packet->hcp_header,HCP_PIPEID_OFFSET,
HCP_PIPEID_LEN, pipe_id);
@@ -1290,7 +1290,7 @@ phHciNfc_Build_HCPHeader(
/*!
* \brief Builds the HCP Frame Packet.
*
- * This function builds the HCP Frame in the HCP packet format to send to the
+ * This function builds the HCP Frame in the HCP packet format to send to the
* connected reader device.
*/
@@ -1326,9 +1326,9 @@ void
)
{
uint16_t src_index = 0;
- if( (NULL != src_data)
+ if( (NULL != src_data)
/* && (hcp_index >= 0) */
- && (src_len > 0)
+ && (src_len > 0)
)
{
for(src_index=0; src_index < src_len ; src_index++)
@@ -1343,7 +1343,7 @@ void
/*!
* \brief Sends the Generic HCI Commands to the connected reader device.
*
- * This function Sends the Generic HCI Command frames in the HCP packet format to the
+ * This function Sends the Generic HCI Command frames in the HCP packet format to the
* connected reader device.
*/
@@ -1373,7 +1373,7 @@ void
}
else
{
- p_pipe_info = (phHciNfc_Pipe_Info_t *)
+ p_pipe_info = (phHciNfc_Pipe_Info_t *)
psHciContext->p_pipe_list[pipe_id];
psHciContext->tx_total = 0 ;
length += HCP_HEADER_LEN ;
@@ -1381,7 +1381,7 @@ void
{
case ANY_SET_PARAMETER:
{
-
+
hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
/* Construct the HCP Frame */
phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
@@ -1469,7 +1469,7 @@ phHciNfc_Set_Param (
p_pipe_info->param_info = (uint8_t *)p_param;
p_pipe_info->param_length = param_length;
p_pipe_info->reg_index = reg_index;
- status = phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
+ status = phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
(uint8_t)p_pipe_info->pipe.pipe_id,
(uint8_t)ANY_SET_PARAMETER);
p_pipe_info->prev_status = status;
@@ -1513,8 +1513,8 @@ phHciNfc_Send_Complete (
HCI_PRINT("HCI Send Completion....\n");
if ( (NULL != psContext)
- && (NULL != pInfo)
- && (NULL != pHwRef)
+ && (NULL != pInfo)
+ && (NULL != pHwRef)
)
{
phHciNfc_sContext_t *psHciContext = (phHciNfc_sContext_t *)psContext;
@@ -1532,8 +1532,8 @@ phHciNfc_Send_Complete (
}
else
{
- HCI_DEBUG("HCI Send Completion... Length = %02X\n", length);
- /* To complete the send complete with the send
+ HCI_DEBUG("HCI Send Completion... Length = %02X\n", length);
+ /* To complete the send complete with the send
* or receive with chaining.
*/
if( (TRUE == psHciContext->tx_hcp_chaining)
@@ -1582,8 +1582,8 @@ phHciNfc_Send_Complete (
/* psHciContext->hci_transact_state = NFC_TRANSACT_SEND_COMPLETE;*/
/* Receive the Response Packet */
- status = phHciNfc_Receive( psHciContext, pHwRef,
- (uint8_t *)(&psHciContext->rx_packet),
+ status = phHciNfc_Receive( psHciContext, pHwRef,
+ (uint8_t *)(&psHciContext->rx_packet),
sizeof(phHciNfc_HCP_Packet_t) );
/* HCI_DEBUG("HCI Lower Layer Send Completion After Receive,\
@@ -1599,8 +1599,8 @@ phHciNfc_Send_Complete (
else
{
status = phHciNfc_Resume_Sequence(psHciContext, pHwRef );
- }
- }
+ }
+ }
} /* End of status != Success */
@@ -1621,8 +1621,8 @@ phHciNfc_Receive_Complete (
HCI_PRINT("HCI Receive Completion....\n");
if ( (NULL != psContext)
- && (NULL != pInfo)
- && (NULL != pHwRef)
+ && (NULL != pInfo)
+ && (NULL != pHwRef)
)
{
phHciNfc_sContext_t *psHciContext = (phHciNfc_sContext_t *)psContext;
@@ -1678,7 +1678,7 @@ phHciNfc_Tag_Notify(
void *pInfo
)
{
- phNfc_sCompletionInfo_t *psCompInfo =
+ phNfc_sCompletionInfo_t *psCompInfo =
(phNfc_sCompletionInfo_t *)pInfo;
pphNfcIF_Notification_CB_t p_upper_notify = psHciContext->p_upper_notify;
void *pcontext = psHciContext->p_upper_context;
@@ -1727,7 +1727,7 @@ phHciNfc_Target_Select_Notify(
void *pInfo
)
{
- phNfc_sCompletionInfo_t *psCompInfo =
+ phNfc_sCompletionInfo_t *psCompInfo =
(phNfc_sCompletionInfo_t *)pInfo;
pphNfcIF_Notification_CB_t p_upper_notify = psHciContext->p_upper_notify;
void *pcontext = psHciContext->p_upper_context;
@@ -1779,7 +1779,7 @@ phHciNfc_Release_Notify(
void *pInfo
)
{
- phNfc_sCompletionInfo_t *psCompInfo =
+ phNfc_sCompletionInfo_t *psCompInfo =
(phNfc_sCompletionInfo_t *)pInfo;
pphNfcIF_Notification_CB_t p_upper_notify = psHciContext->p_upper_notify;
void *pcontext = psHciContext->p_upper_context;
@@ -1801,8 +1801,8 @@ phHciNfc_Notify_Event(
NFCSTATUS status = NFCSTATUS_SUCCESS;
if ( (NULL != psContext)
- && (NULL != pInfo)
- && (NULL != pHwRef)
+ && (NULL != pInfo)
+ && (NULL != pHwRef)
)
{
phHciNfc_sContext_t *psHciContext = (phHciNfc_sContext_t *)psContext;
@@ -1812,7 +1812,7 @@ phHciNfc_Notify_Event(
{
case NFC_NOTIFY_INIT_COMPLETED:
{
- phNfc_sCompletionInfo_t *psCompInfo =
+ phNfc_sCompletionInfo_t *psCompInfo =
(phNfc_sCompletionInfo_t *)pInfo;
if(NFCSTATUS_SUCCESS == psCompInfo->status)
{
@@ -1884,14 +1884,14 @@ phHciNfc_Notify_Event(
if (NFCSTATUS_SUCCESS != status)
{
- status = phHciNfc_ReaderMgmt_Deselect(
- psHciContext, pHwRef, phHal_eISO14443_A_PICC, FALSE);
+ status = phHciNfc_ReaderMgmt_Deselect(
+ psHciContext, pHwRef, phHal_eISO14443_A_PICC, FALSE);
}
}
else
{
#ifdef SW_RELEASE_TARGET
- /*status = phHciNfc_ReaderMgmt_Deselect(
+ /*status = phHciNfc_ReaderMgmt_Deselect(
psHciContext, pHwRef, phHal_eISO14443_A_PICC, FALSE); */
psHciContext->target_release = TRUE;
#else
@@ -1900,29 +1900,42 @@ phHciNfc_Notify_Event(
}
break;
}
- /* To Notify the Target Released Notification
+ /* To Notify the Target Released Notification
* to the Above Layer */
case NFC_NOTIFY_TARGET_RELEASED:
- /* To Notify the NFC Secure Element Transaction
+ /* To Notify the NFC Secure Element Transaction
* Information to the Above Layer */
/* case NFC_NOTIFY_TRANSACTION: */
- /* To Notify the Generic Events To the Upper
+ /* To Notify the Generic Events To the Upper
* Layer */
case NFC_NOTIFY_EVENT:
- /* To Notify the Data Receive Notification
+ /* To Notify the Data Receive Notification
* to the Above Layer */
+ case NFC_NOTIFY_CE_A_RECV_EVENT:
+ case NFC_NOTIFY_CE_B_RECV_EVENT:
case NFC_NOTIFY_RECV_EVENT:
{
- phNfc_sCompletionInfo_t *psCompInfo =
- (phNfc_sCompletionInfo_t *)pInfo;
+ phNfc_sCompletionInfo_t *psCompInfo =
+ (phNfc_sCompletionInfo_t *)pInfo;
- if (((TRUE == psHciContext->event_pending) ||
+ if (((TRUE == psHciContext->event_pending) ||
(NFCSTATUS_RF_TIMEOUT == psCompInfo->status))
&& ( hciState_Transact == psHciContext->hci_state.next_state))
{
/* Rollback due to Transmission Error */
phHciNfc_FSM_Rollback(psHciContext);
}
+ if(((phHal_sEventInfo_t *)pInfo)->eventType == NFC_EVT_DEACTIVATED)
+ {
+ //reset HCI state
+ phHciNfc_FSM_Rollback(psHciContext);
+ }
+ else if(((phHal_sEventInfo_t *)pInfo)->eventType == NFC_EVT_ACTIVATED)
+ {
+ //update the HCI state
+ phHciNfc_FSM_Update(psHciContext,hciState_Transact);
+ }
+
psHciContext->event_pending = FALSE;
phHciNfc_Notify(psHciContext->p_upper_notify,
psHciContext->p_upper_context, pHwRef,
@@ -1951,7 +1964,7 @@ phHciNfc_Notify_Event(
case phHal_eUnknown_DevType:
default:
{
- status = PHNFCSTVAL(CID_NFC_HCI,
+ status = PHNFCSTVAL(CID_NFC_HCI,
NFCSTATUS_INVALID_PARAMETER);
break;
}
@@ -2003,10 +2016,10 @@ phHciNfc_Notify_Event(
}
case NFC_NOTIFY_DEVICE_ERROR:
{
- phNfc_sCompletionInfo_t *psCompInfo =
+ phNfc_sCompletionInfo_t *psCompInfo =
(phNfc_sCompletionInfo_t *)pInfo;
- psCompInfo->status = ( NFCSTATUS_BOARD_COMMUNICATION_ERROR
+ psCompInfo->status = ( NFCSTATUS_BOARD_COMMUNICATION_ERROR
!= PHNFCSTATUS(psCompInfo->status))?
NFCSTATUS_BOARD_COMMUNICATION_ERROR:
psCompInfo->status ;
@@ -2033,13 +2046,13 @@ phHciNfc_Notify_Event(
case NFC_NOTIFY_ERROR:
default:
{
- phNfc_sCompletionInfo_t *psCompInfo =
+ phNfc_sCompletionInfo_t *psCompInfo =
(phNfc_sCompletionInfo_t *)pInfo;
#if (NXP_NFC_HCI_TIMER == 1)
if (( NFCSTATUS_BOARD_COMMUNICATION_ERROR == PHNFCSTATUS(psCompInfo->status))
- && ( NXP_INVALID_TIMER_ID != hci_resp_timer_id ))
+ && ( NXP_INVALID_TIMER_ID != hci_resp_timer_id ))
{
HCI_DEBUG(" HCI : Response Timer Stop, Status:%02X",
psCompInfo->status);
@@ -2049,7 +2062,7 @@ phHciNfc_Notify_Event(
#endif /* (NXP_NFC_HCI_TIMER == 1) */
- phHciNfc_Error_Sequence( psHciContext, pHwRef,
+ phHciNfc_Error_Sequence( psHciContext, pHwRef,
psCompInfo->status, NULL, 0);
break;
}
diff --git a/src/phHciNfc_Pipe.c b/src/phHciNfc_Pipe.c
index e7edc50..0a0d0a5 100644..100755
--- a/src/phHciNfc_Pipe.c
+++ b/src/phHciNfc_Pipe.c
@@ -27,7 +27,7 @@
* $Date: Tue Aug 18 10:12:39 2009 $ *
* $Author: ing04880 $ *
* $Revision: 1.42 $ *
-* $Aliases: 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 $
+* $Aliases: 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 $
* *
* =========================================================================== *
*/
@@ -104,7 +104,7 @@ static phHciNfc_GateID_t host_gate_list[] = {
#endif
phHciNfc_NfcWIMgmtGate,
phHciNfc_SwpMgmtGate,
-#if defined(HOST_EMULATION) && ( NXP_UICC_CE_RIGHTS < 0x01 )
+#if defined(HOST_EMULATION) /*&& ( NXP_UICC_CE_RIGHTS < 0x01 )*/
phHciNfc_CETypeAGate,
phHciNfc_CETypeBGate,
#endif
@@ -158,11 +158,11 @@ phHciNfc_Create_Pipe(
(*ppPipeHandle)->pipe.source.host_id = (uint8_t) phHciNfc_TerminalHostID;
/* The Source Gate is same as the Destination Gate */
- (*ppPipeHandle)->pipe.source.gate_id =
+ (*ppPipeHandle)->pipe.source.gate_id =
((phHciNfc_Gate_Info_t *)destination)->gate_id;
- (*ppPipeHandle)->pipe.dest.host_id =
+ (*ppPipeHandle)->pipe.dest.host_id =
((phHciNfc_Gate_Info_t *)destination)->host_id;
- (*ppPipeHandle)->pipe.dest.gate_id =
+ (*ppPipeHandle)->pipe.dest.gate_id =
((phHciNfc_Gate_Info_t *)destination)->gate_id;
/* if( hciMode_Override == psHciContext->hci_mode ) */
@@ -195,7 +195,7 @@ phHciNfc_Update_Pipe(
NFCSTATUS status = NFCSTATUS_SUCCESS;
- for (pipe_index = 0;
+ for (pipe_index = 0;
(pipe_index + HCI_DYNAMIC_PIPE_ID) <=
(uint8_t)(sizeof(host_gate_list)/sizeof(phHciNfc_GateID_t) );
pipe_index++)
@@ -210,24 +210,24 @@ phHciNfc_Update_Pipe(
p_pipe_info->pipe.source.host_id = (uint8_t) phHciNfc_TerminalHostID;
/* The Source Gate is same as the Destination Gate */
- p_pipe_info->pipe.source.gate_id =
+ p_pipe_info->pipe.source.gate_id =
host_gate_list[pipe_index];
- p_pipe_info->pipe.dest.host_id =
+ p_pipe_info->pipe.dest.host_id =
phHciNfc_HostControllerID;
- p_pipe_info->pipe.dest.gate_id =
+ p_pipe_info->pipe.dest.gate_id =
host_gate_list[pipe_index];
/* The Pipe ID is unknown until it is assigned */
p_pipe_info->pipe.pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
/* Initialise the Resources for the particular Gate */
- status = phHciNfc_Create_All_Pipes(psHciContext,
+ status = phHciNfc_Create_All_Pipes(psHciContext,
pHwRef, p_pipe_seq );
if( NFCSTATUS_SUCCESS == status )
{
uint8_t pipe_id = (uint8_t)(pipe_index + HCI_DYNAMIC_PIPE_ID);
- status = phHciNfc_Update_PipeInfo( psHciContext, p_pipe_seq ,
+ status = phHciNfc_Update_PipeInfo( psHciContext, p_pipe_seq ,
pipe_id, p_pipe_info );
if( NFCSTATUS_SUCCESS == status )
{
@@ -287,9 +287,9 @@ phHciNfc_Delete_Pipe(
NFCSTATUS status=NFCSTATUS_SUCCESS;
NFCSTATUS cmd_status = NFCSTATUS_SUCCESS;
- if( (NULL == psHciContext)
- || (NULL == pHwRef)
- || (NULL == pPipeHandle)
+ if( (NULL == psHciContext)
+ || (NULL == pHwRef)
+ || (NULL == pPipeHandle)
)
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
@@ -422,7 +422,7 @@ phHciNfc_CE_Pipes_OP(
/*!
* \brief Creates the Pipes of all the Supported Gates .
*
- * This function Creates the pipes for all the supported gates
+ * This function Creates the pipes for all the supported gates
*/
NFCSTATUS
@@ -435,7 +435,7 @@ phHciNfc_Create_All_Pipes(
NFCSTATUS status = NFCSTATUS_SUCCESS;
phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
- if( (NULL == psHciContext) || (NULL == pHwRef)
+ if( (NULL == psHciContext) || (NULL == pHwRef)
|| (NULL == p_pipe_seq) )
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
@@ -709,11 +709,57 @@ phHciNfc_Create_All_Pipes(
{
status = phHciNfc_Create_Pipe( psHciContext, pHwRef,
&id_dest, &p_pipe_info);
+#ifndef HOST_EMULATION
status = ((NFCSTATUS_PENDING == status )?
NFCSTATUS_SUCCESS : status);
+#endif
+ }
+ break;
+ }
+#ifdef HOST_EMULATION
+ case PIPE_CARD_A_CREATE:
+ {
+ phHciNfc_Gate_Info_t id_dest;
+
+ id_dest.host_id = (uint8_t)phHciNfc_HostControllerID;
+ id_dest.gate_id = (uint8_t)phHciNfc_CETypeAGate;
+
+ status = phHciNfc_CE_A_Init_Resources ( psHciContext );
+ if((status == NFCSTATUS_SUCCESS)
+#ifdef ESTABLISH_SESSION
+ && (hciMode_Session != psHciContext->hci_mode)
+#endif
+ )
+ {
+ status = phHciNfc_Create_Pipe( psHciContext, pHwRef,
+ &id_dest, &p_pipe_info);
+ /*status = ((NFCSTATUS_PENDING == status )?
+ NFCSTATUS_SUCCESS : status);*/
}
break;
}
+ case PIPE_CARD_B_CREATE:
+ {
+ phHciNfc_Gate_Info_t id_dest;
+
+ id_dest.host_id = (uint8_t)phHciNfc_HostControllerID;
+ id_dest.gate_id = (uint8_t)phHciNfc_CETypeBGate;
+
+ status = phHciNfc_CE_B_Init_Resources ( psHciContext );
+ if((status == NFCSTATUS_SUCCESS)
+#ifdef ESTABLISH_SESSION
+ && (hciMode_Session != psHciContext->hci_mode)
+#endif
+ )
+ {
+ status = phHciNfc_Create_Pipe( psHciContext, pHwRef,
+ &id_dest, &p_pipe_info);
+ status = ((NFCSTATUS_PENDING == status )?
+ NFCSTATUS_SUCCESS : status);
+ }
+ break;
+ }
+ #endif //HOST_EMULATION
/* case PIPE_MGMT_END : */
default:
{
@@ -731,7 +777,7 @@ phHciNfc_Create_All_Pipes(
/*!
* \brief Deletes the Pipes of all the Supported Gates .
*
- * This function Deletes the pipes for all the supported gates
+ * This function Deletes the pipes for all the supported gates
*/
NFCSTATUS
@@ -787,8 +833,8 @@ phHciNfc_Update_PipeInfo(
phHciNfc_GateID_t gate_id = phHciNfc_UnknownGate;
NFCSTATUS status = NFCSTATUS_SUCCESS;
- if(
- (NULL == psHciContext) || (NULL == pPipeSeq)
+ if(
+ (NULL == psHciContext) || (NULL == pPipeSeq)
|| ( NULL == pPipeInfo )
)
{
@@ -806,7 +852,7 @@ phHciNfc_Update_PipeInfo(
pipe_id, pPipeInfo);
if(NFCSTATUS_SUCCESS == status)
{
- *pPipeSeq = PIPE_PN544MGMT_CREATE;
+ *pPipeSeq = PIPE_PN544MGMT_CREATE;
}
break;
}
@@ -853,7 +899,7 @@ phHciNfc_Update_PipeInfo(
#elif defined(ENABLE_P2P)
*pPipeSeq = PIPE_NFC_INITIATOR_CREATE;
/* #if defined(ENABLE_P2P) */
- /*lint -e{91} suppress "Line exceeds"*/
+ /*lint -e{91} suppress "Line exceeds"*/
#elif !defined(TYPE_B) && !defined(TYPE_FELICA) && !defined(TYPE_JEWEL) && !defined(TYPE_ISO15693) && !defined(ENABLE_P2P)
*pPipeSeq = PIPE_WI_CREATE;
#endif
@@ -879,7 +925,7 @@ phHciNfc_Update_PipeInfo(
#elif defined(ENABLE_P2P)
*pPipeSeq = PIPE_NFC_INITIATOR_CREATE;
/* #if defined(ENABLE_P2P) */
- /*lint -e{91} suppress "Line exceeds"*/
+ /*lint -e{91} suppress "Line exceeds"*/
#elif !defined(TYPE_FELICA) && !defined(TYPE_JEWEL) && !defined(TYPE_ISO15693) && !defined(ENABLE_P2P)
*pPipeSeq = PIPE_WI_CREATE;
#endif
@@ -937,7 +983,7 @@ phHciNfc_Update_PipeInfo(
pipe_id, pPipeInfo);
if(NFCSTATUS_SUCCESS == status)
{
-
+
#ifdef ENABLE_P2P
*pPipeSeq = PIPE_NFC_INITIATOR_CREATE;
#else
@@ -987,7 +1033,11 @@ phHciNfc_Update_PipeInfo(
pipe_id, pPipeInfo);
if(NFCSTATUS_SUCCESS == status)
{
+#ifdef HOST_EMULATION
+ *pPipeSeq = PIPE_CARD_A_CREATE;
+#else
*pPipeSeq = PIPE_DELETE_ALL;
+#endif
}
break;
}
@@ -1024,7 +1074,7 @@ phHciNfc_Update_PipeInfo(
{
status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_HCI_GATE_NOT_SUPPORTED );
break;
- }
+ }
/*End of the default Switch Case */
} /*End of the Index Switch */
@@ -1053,7 +1103,7 @@ phHciNfc_Open_Pipe(
NFCSTATUS status = NFCSTATUS_SUCCESS;
NFCSTATUS cmd_status = NFCSTATUS_SUCCESS;
- if( (NULL == psHciContext)
+ if( (NULL == psHciContext)
|| ( NULL == pHwRef )
|| ( NULL == pPipeHandle )
)
@@ -1067,7 +1117,7 @@ phHciNfc_Open_Pipe(
if ( pipe_id <= PHHCINFC_MAX_PIPE)
{
- cmd_status = phHciNfc_Send_Generic_Cmd( psHciContext,pHwRef,
+ cmd_status = phHciNfc_Send_Generic_Cmd( psHciContext,pHwRef,
pipe_id, ANY_OPEN_PIPE);
status = ( (cmd_status == NFCSTATUS_PENDING)?
NFCSTATUS_SUCCESS : cmd_status);
@@ -1096,7 +1146,7 @@ phHciNfc_Close_Pipe(
NFCSTATUS status = NFCSTATUS_SUCCESS;
NFCSTATUS cmd_status = NFCSTATUS_SUCCESS;
- if( (NULL == psHciContext)
+ if( (NULL == psHciContext)
|| ( NULL == pHwRef )
|| ( NULL == pPipeHandle )
)
@@ -1111,7 +1161,7 @@ phHciNfc_Close_Pipe(
if( (uint8_t)HCI_UNKNOWN_PIPE_ID > pipe_id)
{
cmd_status = phHciNfc_Send_Generic_Cmd(
- psHciContext, pHwRef, pipe_id,
+ psHciContext, pHwRef, pipe_id,
ANY_CLOSE_PIPE );
status = ((cmd_status == NFCSTATUS_PENDING)?
diff --git a/src/phHciNfc_Sequence.c b/src/phHciNfc_Sequence.c
index 1ef7265..604f9bc 100644..100755
--- a/src/phHciNfc_Sequence.c
+++ b/src/phHciNfc_Sequence.c
@@ -29,7 +29,7 @@
* $Date: Tue Jun 8 09:33:46 2010 $ *
* $Author: ing04880 $ *
* $Revision: 1.85 $ *
-* $Aliases: NFC_FRI1.1_WK1023_R35_1 $
+* $Aliases: NFC_FRI1.1_WK1023_R35_1 $
* *
* =========================================================================== *
*/
@@ -59,6 +59,8 @@
#include <phHciNfc_WI.h>
#include <phOsalNfc.h>
+#include <phHciNfc_CE_A.h>
+#include <phHciNfc_CE_B.h>
/*
################################################################################
****************************** Macro Definitions *******************************
@@ -121,7 +123,7 @@ phHciNfc_Config_Sequence(
/**
* \ingroup grp_hci_nfc
*
- * The phHciNfc_Connect_Sequence function sequence selects the
+ * The phHciNfc_Connect_Sequence function sequence selects the
* discovered target for performing the transaction.
*
* \param[in] psHciContext psHciContext is the context of
@@ -146,7 +148,7 @@ phHciNfc_Transact_Sequence(
/**
* \ingroup grp_hci_nfc
*
- * The phHciNfc_Info_Sequence function sequence selects the
+ * The phHciNfc_Info_Sequence function sequence selects the
* discovered target for performing the transaction.
*
* \param[in] psHciContext psHciContext is the context of
@@ -212,15 +214,15 @@ phHciNfc_Pending_Sequence(
################################################################################
*/
-NFCSTATUS
-phHciNfc_FSM_Validate(
- phHciNfc_sContext_t *psHciContext,
- phHciNfc_eState_t state,
+NFCSTATUS
+phHciNfc_FSM_Validate(
+ phHciNfc_sContext_t *psHciContext,
+ phHciNfc_eState_t state,
uint8_t validate_type
)
{
NFCSTATUS status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_STATE);
- phHciNfc_eState_t cur_state = (phHciNfc_eState_t)
+ phHciNfc_eState_t cur_state = (phHciNfc_eState_t)
psHciContext->hci_state.cur_state;
switch(validate_type)
@@ -244,7 +246,7 @@ phHciNfc_FSM_Validate(
{
/* Specifies the Starting of the init Sequence */
case hciState_Initialise:
- /* Initialise to Perform Test on
+ /* Initialise to Perform Test on
the Antenna/SWP Link */
case hciState_Test:
{
@@ -298,16 +300,16 @@ phHciNfc_FSM_Validate(
{
/* Restart the Wheel */
case hciState_Initialise:
- /* Select the next Tag in the Field or
- * already Selected Tag Again
+ /* Select the next Tag in the Field or
+ * already Selected Tag Again
*/
/* Configuring the Memory */
case hciState_IO:
case hciState_Select:
/* Configuring the Discovery/Emulation */
case hciState_Config:
- /* Re-Activate the Target or
- * Discover the next target
+ /* Re-Activate the Target or
+ * Discover the next target
*/
case hciState_Reactivate:
/* Connect the Discovered Target */
@@ -336,8 +338,8 @@ phHciNfc_FSM_Validate(
/* Configuring the Memory */
case hciState_IO:
case hciState_Config:
- /* Re-Activate the Target or
- * Discover the next target
+ /* Re-Activate the Target or
+ * Discover the next target
*/
case hciState_Reactivate:
/* Intermediate Transceive State */
@@ -363,7 +365,7 @@ phHciNfc_FSM_Validate(
{
/* Releasing from the Emulation/Target Mode */
case hciState_Initialise:
- /* Occurence of the Tag Discovered Event
+ /* Occurence of the Tag Discovered Event
* after the Disconnect Operation
*/
case hciState_Select:
@@ -413,14 +415,14 @@ phHciNfc_FSM_Validate(
{
switch(next_state)
{
- /* Discovery Resume after connect failure
+ /* Discovery Resume after connect failure
after the disconnect */
case hciState_Initialise:
/* Configuring the Memory */
case hciState_IO:
/* Configuring the Discovery/Emulation */
case hciState_Config:
- /* Occurence of the Tag Discovered Event
+ /* Occurence of the Tag Discovered Event
* after the Disconnect Operation
*/
case hciState_Select:
@@ -478,11 +480,11 @@ phHciNfc_FSM_Update(
{
NFCSTATUS status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_STATE);
- HCI_DEBUG(" HCI: Current State --> %02u \n",
+ HCI_DEBUG(" HCI: Current State --> %02u \n",
psHciContext->hci_state.cur_state );
- HCI_DEBUG(" HCI: Transition Before FSM Update --> %02u \n",
+ HCI_DEBUG(" HCI: Transition Before FSM Update --> %02u \n",
psHciContext->hci_state.transition );
- HCI_DEBUG(" HCI: Next State Before FSM Update --> %02u \n",
+ HCI_DEBUG(" HCI: Next State Before FSM Update --> %02u \n",
psHciContext->hci_state.next_state );
status = phHciNfc_FSM_Validate(psHciContext, next_state, NFC_FSM_NEXT );
@@ -491,12 +493,12 @@ phHciNfc_FSM_Update(
psHciContext->hci_state.next_state = (uint8_t) next_state;
psHciContext->hci_state.transition = NFC_FSM_IN_PROGRESS;
psHciContext->response_pending = FALSE;
- HCI_DEBUG(" HCI: Next State After FSM Update --> %02u \n",
+ HCI_DEBUG(" HCI: Next State After FSM Update --> %02u \n",
psHciContext->hci_state.next_state );
}
else
{
- HCI_DEBUG(" HCI: FSM - Invalid next state --> %02u \n",
+ HCI_DEBUG(" HCI: FSM - Invalid next state --> %02u \n",
next_state );
}
@@ -513,19 +515,19 @@ phHciNfc_FSM_Complete(
HCI_DEBUG("HCI: In Function: %s \n", __FUNCTION__);
- HCI_DEBUG(" HCI: Transition Before FSM Complete --> %02u \n",
+ HCI_DEBUG(" HCI: Transition Before FSM Complete --> %02u \n",
psHciContext->hci_state.transition );
-
- HCI_DEBUG(" HCI: Current State Before FSM Complete --> %02u \n",
+
+ HCI_DEBUG(" HCI: Current State Before FSM Complete --> %02u \n",
psHciContext->hci_state.cur_state );
- HCI_DEBUG(" HCI: Next State Before FSM Complete --> %02u \n",
+ HCI_DEBUG(" HCI: Next State Before FSM Complete --> %02u \n",
psHciContext->hci_state.next_state );
if( (NFC_FSM_IN_PROGRESS == psHciContext->hci_state.transition)
)
{
- psHciContext->hci_state.cur_state =
+ psHciContext->hci_state.cur_state =
psHciContext->hci_state.next_state ;
psHciContext->hci_state.transition = NFC_FSM_COMPLETE ;
psHciContext->hci_state.next_state = (uint8_t) hciState_Unknown ;
@@ -535,7 +537,7 @@ phHciNfc_FSM_Complete(
status = NFCSTATUS_SUCCESS;
}
- HCI_DEBUG(" HCI: Current State After FSM Complete --> %02u \n",
+ HCI_DEBUG(" HCI: Current State After FSM Complete --> %02u \n",
psHciContext->hci_state.cur_state );
return status;
@@ -608,7 +610,7 @@ phHciNfc_Pending_Sequence(
if(TRUE == psHciContext->target_release)
{
#ifdef SW_RELEASE_TARGET
- status = phHciNfc_ReaderMgmt_Deselect(
+ status = phHciNfc_ReaderMgmt_Deselect(
psHciContext, pHwRef, phHal_eISO14443_A_PICC, TRUE);
if(NFCSTATUS_PENDING == status )
{
@@ -646,9 +648,9 @@ phHciNfc_Error_Sequence(
HCI_DEBUG ("HCI : Error Status : %04X\n", error_status);
- HCI_DEBUG(" HCI: Current HCI State --> %02u \n",
+ HCI_DEBUG(" HCI: Current HCI State --> %02u \n",
psHciContext->hci_state.cur_state );
- HCI_DEBUG(" HCI: Next HCI State --> %02u \n",
+ HCI_DEBUG(" HCI: Next HCI State --> %02u \n",
psHciContext->hci_state.next_state );
@@ -663,8 +665,8 @@ phHciNfc_Error_Sequence(
phNfc_sCompletionInfo_t comp_info={FALSE,0, NULL};
phHciNfc_Release_Lower( psHciContext, pHwRef );
- /* Release all the resources and
- * Notify the Receive Error Scenario to the Upper Layer
+ /* Release all the resources and
+ * Notify the Receive Error Scenario to the Upper Layer
*/
comp_info.status = error_status ;
phHciNfc_Release_Notify (psHciContext, pHwRef,
@@ -708,13 +710,13 @@ phHciNfc_Error_Sequence(
}
case hciState_Test:
{
- status = phHciNfc_Test_Sequence( psHciContext, pHwRef , error_status,
+ status = phHciNfc_Test_Sequence( psHciContext, pHwRef , error_status,
(uint8_t *)pdata, length );
break;
}
case hciState_IO:
{
- status = phHciNfc_IO_Sequence( psHciContext, pHwRef , error_status,
+ status = phHciNfc_IO_Sequence( psHciContext, pHwRef , error_status,
(uint8_t *)pdata, length );
break;
}
@@ -749,11 +751,11 @@ phHciNfc_Error_Sequence(
NFC_NOTIFY_DISCOVERY_ERROR, &comp_info);
#if 0
- /* Polling Wheel will be restarted by the upper layer
+ /* Polling Wheel will be restarted by the upper layer
* to Rediscover again */
if(NFCSTATUS_SUCCESS == status)
{
- status = phHciNfc_ReaderMgmt_Deselect(
+ status = phHciNfc_ReaderMgmt_Deselect(
psHciContext, pHwRef, phHal_eISO14443_A_PICC, FALSE);
}
phHciNfc_FSM_Rollback(psHciContext);
@@ -799,7 +801,7 @@ phHciNfc_Error_Sequence(
/* Notify the General failure to the upper layer */
phNfc_sCompletionInfo_t comp_info={FALSE,0, NULL};
- /* psHciContext->host_rf_type = phHal_eUnknown_DevType;
+ /* psHciContext->host_rf_type = phHal_eUnknown_DevType;
status = phHciNfc_ReaderMgmt_Update_Sequence(
psHciContext, INFO_SEQ );
psHciContext->p_target_info = NULL;
@@ -847,8 +849,8 @@ phHciNfc_Error_Sequence(
phNfc_sCompletionInfo_t comp_info={FALSE,0, NULL};
phHciNfc_Release_Lower( psHciContext, pHwRef );
- /* Release all the resources and
- * Notify the Receive Error Scenario to the Upper Layer
+ /* Release all the resources and
+ * Notify the Receive Error Scenario to the Upper Layer
*/
comp_info.status = error_status ;
phHciNfc_Release_Notify (psHciContext, pHwRef,
@@ -948,7 +950,7 @@ phHciNfc_Resume_Sequence(
{
phNfc_sCompletionInfo_t comp_info={FALSE,0, NULL};
- /* Update to the Intialise state as the discovery wheel is
+ /* Update to the Intialise state as the discovery wheel is
* restarted.
*/
status = phHciNfc_FSM_Complete(psHciContext);
@@ -997,7 +999,7 @@ phHciNfc_Resume_Sequence(
}
case hciState_Transact:
{
- status = phHciNfc_Transact_Sequence(
+ status = phHciNfc_Transact_Sequence(
psHciContext, pHwRef );
break;
}
@@ -1067,11 +1069,11 @@ phHciNfc_Initialise_Sequence(
#ifdef ESTABLISH_SESSION
if( hciMode_Session == psHciContext->hci_mode)
{
- /* TODO: Initialise Link Management
+ /* TODO: Initialise Link Management
Gate Resources */
NFCSTATUS info_status = NFCSTATUS_SUCCESS;
PHNFC_UNUSED_VARIABLE(info_status);
- info_status = phHciNfc_IDMgmt_Update_Sequence(
+ info_status = phHciNfc_IDMgmt_Update_Sequence(
psHciContext, INFO_SEQ );
if(NFCSTATUS_SUCCESS == info_status)
@@ -1125,7 +1127,7 @@ phHciNfc_Initialise_Sequence(
#if defined( ESTABLISH_SESSION )
NFCSTATUS info_status = NFCSTATUS_SUCCESS;
PHNFC_UNUSED_VARIABLE(info_status);
- info_status = phHciNfc_IDMgmt_Update_Sequence(
+ info_status = phHciNfc_IDMgmt_Update_Sequence(
psHciContext, INFO_SEQ );
if(NFCSTATUS_SUCCESS == info_status)
@@ -1172,7 +1174,7 @@ phHciNfc_Initialise_Sequence(
{
NFCSTATUS reset_status = NFCSTATUS_SUCCESS;
PHNFC_UNUSED_VARIABLE(reset_status);
- reset_status = phHciNfc_EmuMgmt_Update_Seq(
+ reset_status = phHciNfc_EmuMgmt_Update_Seq(
psHciContext, RESET_SEQ );
psHciContext->hci_seq = EMULATION_INIT_SEQ;
}
@@ -1209,7 +1211,7 @@ phHciNfc_Initialise_Sequence(
}
case PL_STOP_SEQ:
{
- status = phHciNfc_ReaderMgmt_Disable_Discovery(
+ status = phHciNfc_ReaderMgmt_Disable_Discovery(
psHciContext, pHwRef );
if(NFCSTATUS_SUCCESS == status)
{
@@ -1229,8 +1231,8 @@ phHciNfc_Initialise_Sequence(
uint8_t activate_enable = FALSE;
uint8_t rdr_enable = TRUE;
- status = phHciNfc_ReaderA_Update_Info(
- psHciContext, HCI_READER_A_ENABLE,
+ status = phHciNfc_ReaderA_Update_Info(
+ psHciContext, HCI_READER_A_ENABLE,
&rdr_enable);
if(status == NFCSTATUS_SUCCESS)
{
@@ -1257,7 +1259,7 @@ phHciNfc_Initialise_Sequence(
{
NFCSTATUS info_status = NFCSTATUS_SUCCESS;
PHNFC_UNUSED_VARIABLE(info_status);
- info_status = phHciNfc_EmuMgmt_Update_Seq(
+ info_status = phHciNfc_EmuMgmt_Update_Seq(
psHciContext, INFO_SEQ );
if(NFCSTATUS_SUCCESS == info_status)
@@ -1381,11 +1383,11 @@ phHciNfc_Release_Sequence(
{
case PL_STOP_SEQ:
{
- status = phHciNfc_ReaderMgmt_Disable_Discovery(
+ status = phHciNfc_ReaderMgmt_Disable_Discovery(
psHciContext, pHwRef );
if(NFCSTATUS_SUCCESS == status)
{
- (void)phHciNfc_EmuMgmt_Update_Seq(
+ (void)phHciNfc_EmuMgmt_Update_Seq(
psHciContext, REL_SEQ );
psHciContext->hci_seq = EMULATION_REL_SEQ;
status = NFCSTATUS_PENDING;
@@ -1397,7 +1399,7 @@ phHciNfc_Release_Sequence(
status = phHciNfc_EmuMgmt_Release( psHciContext,pHwRef );
if(NFCSTATUS_SUCCESS == status)
{
- (void)phHciNfc_DevMgmt_Update_Sequence(
+ (void)phHciNfc_DevMgmt_Update_Sequence(
psHciContext, REL_SEQ );
psHciContext->hci_seq = ADMIN_REL_SEQ;
status = NFCSTATUS_PENDING;
@@ -1471,11 +1473,11 @@ phHciNfc_Release_Sequence(
}
case HCI_END_SEQ:
{
- pphNfcIF_Notification_CB_t p_upper_notify =
+ pphNfcIF_Notification_CB_t p_upper_notify =
psHciContext->p_upper_notify;
- phNfc_sLowerIF_t *plower_if =
+ phNfc_sLowerIF_t *plower_if =
&(psHciContext->lower_interface);
- void *pcontext =
+ void *pcontext =
psHciContext->p_upper_context;
phNfc_sCompletionInfo_t comp_info;
@@ -1531,7 +1533,7 @@ phHciNfc_Config_Sequence(
if(TARGET_GENERAL_SEQ == psHciContext->hci_seq)
{
status = phHciNfc_NfcIP_SetATRInfo( psHciContext,
- pHwRef, NFCIP_TARGET,
+ pHwRef, NFCIP_TARGET,
psHciContext->p_config_params);
if( NFCSTATUS_PENDING != status )
{
@@ -1549,7 +1551,7 @@ phHciNfc_Config_Sequence(
if (NFCSTATUS_PENDING != status)
{
/* Roll Back to its Current State as Configuration is Complete */
- phHciNfc_FSM_Rollback(psHciContext);
+ phHciNfc_FSM_Rollback(psHciContext);
HCI_PRINT(" NFC-IP(P2P) Configuration Completed. \n");
comp_info.status = status;
@@ -1567,7 +1569,7 @@ phHciNfc_Config_Sequence(
case SMX_WI_CFG:
{
/* Roll Back to its Current State as Configuration is Complete */
- phHciNfc_FSM_Rollback(psHciContext);
+ phHciNfc_FSM_Rollback(psHciContext);
HCI_DEBUG(" %s Configuration Completed. \n",
((SMX_WI_CFG == psHciContext->config_type)?
@@ -1587,12 +1589,12 @@ phHciNfc_Config_Sequence(
case UICC_SWP_CFG:
#if 0
{
- phHal_sEmulationCfg_t *p_emulation_cfg =
+ phHal_sEmulationCfg_t *p_emulation_cfg =
(phHal_sEmulationCfg_t * )
psHciContext->p_config_params;
if (NULL != p_emulation_cfg)
{
- phHal_sUiccEmuCfg_t *uicc_config =
+ phHal_sUiccEmuCfg_t *uicc_config =
&p_emulation_cfg->config.uiccEmuCfg;
if( TRUE == uicc_config->enableUicc )
{
@@ -1614,11 +1616,11 @@ phHciNfc_Config_Sequence(
}
default:
{
- status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE);
+ status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE);
break;
}
}
-
+
return status;
}
@@ -1634,7 +1636,7 @@ phHciNfc_PollLoop_Sequence(
psHciContext->p_config_params;
if (NULL != p_poll_config)
{
- uint8_t speed =
+ uint8_t speed =
p_poll_config->NfcIP_Mode;
uint8_t targetSpeed =
p_poll_config->NfcIP_Target_Mode;
@@ -1653,7 +1655,7 @@ phHciNfc_PollLoop_Sequence(
#elif defined (ENABLE_P2P) && defined (NFCIP_TGT_DISABLE_CFG)
psHciContext->hci_seq = PL_TGT_DISABLE_SEQ;
#else
- psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
+ psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
#endif
status = NFCSTATUS_PENDING;
@@ -1663,11 +1665,11 @@ phHciNfc_PollLoop_Sequence(
#if defined (ENABLE_P2P) && defined (TARGET_SPEED)
case TARGET_SPEED_SEQ:
{
-#define NFCIP_ACTIVE_SHIFT 0x03U
-#define NFCIP_PASSIVE_MASK 0x07U
+#define NFCIP_ACTIVE_SHIFT 0x03U
+#define NFCIP_PASSIVE_MASK 0x07U
uint8_t mode = targetSpeed;
HCI_DEBUG("Setting target mode to 0x%02X", mode);
- status =
+ status =
phHciNfc_NfcIP_SetMode( psHciContext, pHwRef, NFCIP_TARGET,
(uint8_t) mode );
if(NFCSTATUS_PENDING == status)
@@ -1677,7 +1679,7 @@ phHciNfc_PollLoop_Sequence(
#elif defined (NFCIP_TGT_DISABLE_CFG)
psHciContext->hci_seq = PL_TGT_DISABLE_SEQ;
#else
- psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
+ psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
#endif
status = NFCSTATUS_PENDING;
}
@@ -1688,7 +1690,7 @@ phHciNfc_PollLoop_Sequence(
case INITIATOR_SPEED_SEQ:
{
HCI_DEBUG("Setting initiator mode to 0x%02X", speed);
- status =
+ status =
phHciNfc_NfcIP_SetMode( psHciContext, pHwRef, NFCIP_INITIATOR,
(uint8_t) (speed & DEFAULT_NFCIP_INITIATOR_MODE_SUPPORT));
if(NFCSTATUS_PENDING == status)
@@ -1696,7 +1698,7 @@ phHciNfc_PollLoop_Sequence(
#if defined (NFCIP_TGT_DISABLE_CFG)
psHciContext->hci_seq = PL_TGT_DISABLE_SEQ;
#else
- psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
+ psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
#endif
status = NFCSTATUS_PENDING;
}
@@ -1711,7 +1713,7 @@ phHciNfc_PollLoop_Sequence(
(uint8_t)PL_DISABLE_TARGET, &p_poll_config->NfcIP_Tgt_Disable );
if(NFCSTATUS_SUCCESS == status)
{
- psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
+ psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
status = NFCSTATUS_PENDING;
}
break;
@@ -1719,27 +1721,27 @@ phHciNfc_PollLoop_Sequence(
#endif
case PL_CONFIG_PHASE_SEQ:
{
- phHal_sPollDevInfo_t *p_poll_info =
+ phHal_sPollDevInfo_t *p_poll_info =
&(p_poll_config->PollDevInfo.PollCfgInfo);
- p_poll_info->EnableIso14443A =
+ p_poll_info->EnableIso14443A =
( (p_poll_info->EnableIso14443A)
- || ( speed & (uint8_t)phHal_ePassive106 )
+ || ( speed & (uint8_t)phHal_ePassive106 )
);
- p_poll_info->EnableFelica212 =
+ p_poll_info->EnableFelica212 =
( (p_poll_info->EnableFelica212)
- || ( speed & (uint8_t)phHal_ePassive212 )
+ || ( speed & (uint8_t)phHal_ePassive212 )
);
- p_poll_info->EnableFelica424 =
+ p_poll_info->EnableFelica424 =
( (p_poll_info->EnableFelica424)
- || ( speed & (uint8_t)phHal_ePassive424 )
+ || ( speed & (uint8_t)phHal_ePassive424 )
);
/* Configure the Polling Loop Gate Parameters */
status = phHciNfc_PollLoop_Cfg( psHciContext, pHwRef,
(uint8_t)PL_RD_PHASES, NULL );
if(NFCSTATUS_SUCCESS == status)
{
- if(((~(PL_RD_PHASES_DISABLE)) &
+ if(((~(PL_RD_PHASES_DISABLE)) &
p_poll_config->PollDevInfo.PollEnabled)!= 0)
{
psHciContext->hci_seq = READER_ENABLE_SEQ;
@@ -1755,25 +1757,25 @@ phHciNfc_PollLoop_Sequence(
}
case READER_ENABLE_SEQ:
{
- status =
- phHciNfc_ReaderMgmt_Enable_Discovery(
+ status =
+ phHciNfc_ReaderMgmt_Enable_Discovery(
psHciContext, pHwRef );
if(NFCSTATUS_SUCCESS == status)
{
/* psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ; */
- psHciContext->hci_seq = HCI_END_SEQ;
+ psHciContext->hci_seq = HCI_END_SEQ;
status = NFCSTATUS_PENDING;
}
break;
}
case READER_DISABLE_SEQ:
{
- status = phHciNfc_ReaderMgmt_Disable_Discovery(
+ status = phHciNfc_ReaderMgmt_Disable_Discovery(
psHciContext, pHwRef );
if(NFCSTATUS_SUCCESS == status)
{
- if((~(PL_RD_PHASES_DISABLE) &
+ if((~(PL_RD_PHASES_DISABLE) &
p_poll_config->PollDevInfo.PollEnabled)!= 0)
{
psHciContext->hci_seq = PL_DURATION_SEQ;
@@ -1785,7 +1787,7 @@ phHciNfc_PollLoop_Sequence(
#elif defined (ENABLE_P2P) && defined (NFCIP_TGT_DISABLE_CFG)
psHciContext->hci_seq = PL_TGT_DISABLE_SEQ;
#else
- psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
+ psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ;
#endif
/* psHciContext->hci_seq = HCI_END_SEQ; */
}
@@ -1802,14 +1804,14 @@ phHciNfc_PollLoop_Sequence(
/* status = phHciNfc_FSM_Complete ( psHciContext );*/
phHciNfc_FSM_Rollback ( psHciContext );
/* Poll Configuration Notification to the Upper Layer */
- if((~(PL_RD_PHASES_DISABLE) &
+ if((~(PL_RD_PHASES_DISABLE) &
p_poll_config->PollDevInfo.PollEnabled)!= 0)
{
comp_info.status = status;
phHciNfc_Notify(psHciContext->p_upper_notify,
psHciContext->p_upper_context, pHwRef,
NFC_NOTIFY_POLL_ENABLED, &comp_info);
- }
+ }
else
{
comp_info.status = status;
@@ -1909,7 +1911,7 @@ phHciNfc_EmulationCfg_Sequence(
#endif
case EMULATION_CONFIG_SEQ:
{
- status = phHciNfc_Emulation_Cfg(psHciContext, pHwRef,
+ status = phHciNfc_Emulation_Cfg(psHciContext, pHwRef,
psHciContext->config_type);
if(NFCSTATUS_SUCCESS == status)
{
@@ -1940,7 +1942,7 @@ phHciNfc_EmulationCfg_Sequence(
psHciContext->hci_seq = HCI_END_SEQ;
if (UICC_SWP_CFG == psHciContext->config_type)
{
- (void)phHciNfc_SWP_Update_Sequence(psHciContext,
+ (void)phHciNfc_SWP_Update_Sequence(psHciContext,
CONFIG_SEQ );
}
status = NFCSTATUS_PENDING;
@@ -1952,7 +1954,7 @@ phHciNfc_EmulationCfg_Sequence(
/* fall through */
case HCI_END_SEQ:
{
- phHciNfc_FSM_Rollback(psHciContext);
+ phHciNfc_FSM_Rollback(psHciContext);
HCI_PRINT(" Emulation Configuration Completed. \n");
@@ -1973,7 +1975,7 @@ phHciNfc_EmulationCfg_Sequence(
NFC_CE_B_CFG; */
}/* End of the Emulation Config info Check */
-
+
return status;
}
@@ -1994,7 +1996,7 @@ phHciNfc_SmartMx_Mode_Sequence(
{
case READER_DISABLE_SEQ:
{
- status = phHciNfc_ReaderMgmt_Disable_Discovery(
+ status = phHciNfc_ReaderMgmt_Disable_Discovery(
psHciContext, pHwRef );
if(NFCSTATUS_SUCCESS == status)
{
@@ -2006,7 +2008,7 @@ phHciNfc_SmartMx_Mode_Sequence(
}
case EMULATION_CONFIG_SEQ:
{
- status = phHciNfc_WI_Configure_Mode(
+ status = phHciNfc_WI_Configure_Mode(
psHciContext, pHwRef,psHciContext->smx_mode );
if(NFCSTATUS_SUCCESS == status)
{
@@ -2030,13 +2032,13 @@ phHciNfc_SmartMx_Mode_Sequence(
}
case READER_ENABLE_SEQ:
{
- status =
- phHciNfc_ReaderMgmt_Enable_Discovery(
+ status =
+ phHciNfc_ReaderMgmt_Enable_Discovery(
psHciContext, pHwRef );
if(NFCSTATUS_SUCCESS == status)
{
/* psHciContext->hci_seq = PL_CONFIG_PHASE_SEQ; */
- psHciContext->hci_seq = HCI_END_SEQ;
+ psHciContext->hci_seq = HCI_END_SEQ;
status = NFCSTATUS_PENDING;
}
break;
@@ -2055,14 +2057,14 @@ phHciNfc_SmartMx_Mode_Sequence(
psHciContext->p_xchg_info = NULL;
}
/* Poll Configuration Notification to the Upper Layer */
- if((~(PL_RD_PHASES_DISABLE) &
+ if((~(PL_RD_PHASES_DISABLE) &
p_poll_config->PollDevInfo.PollEnabled)!= 0)
{
comp_info.status = status;
phHciNfc_Notify(psHciContext->p_upper_notify,
psHciContext->p_upper_context, pHwRef,
NFC_NOTIFY_POLL_ENABLED, &comp_info);
- }
+ }
else
{
comp_info.status = status;
@@ -2130,7 +2132,7 @@ phHciNfc_Connect_Sequence(
case READER_SELECT_SEQ:
{
/* If the Target is Mifare then it should fall through */
- if(( phHal_eMifare_PICC != target_type )
+ if(( phHal_eMifare_PICC != target_type )
&&(phHal_eISO14443_3A_PICC != target_type)
#ifdef TYPE_B
&& ( phHal_eISO14443_B_PICC != target_type )
@@ -2217,7 +2219,7 @@ phHciNfc_Disconnect_Sequence(
{
case READER_UICC_DISPATCH_SEQ:
{
- status = phHciNfc_ReaderMgmt_UICC_Dispatch(
+ status = phHciNfc_ReaderMgmt_UICC_Dispatch(
psHciContext, pHwRef, target_type );
psHciContext->hci_seq = READER_DESELECT_SEQ;
if(NFCSTATUS_PENDING == status)
@@ -2230,7 +2232,7 @@ phHciNfc_Disconnect_Sequence(
{
re_poll = (uint8_t) ( NULL != psHciContext->p_config_params )?
*((uint8_t *)psHciContext->p_config_params):FALSE;
- status = phHciNfc_ReaderMgmt_Deselect(
+ status = phHciNfc_ReaderMgmt_Deselect(
psHciContext, pHwRef, target_type, re_poll);
if(NFCSTATUS_PENDING == status)
{
@@ -2296,7 +2298,7 @@ phHciNfc_Transact_Sequence(
uint8_t transact_result = NFC_NOTIFY_ERROR;
/* Roll Back to Connect State as Transceive is Complete */
- phHciNfc_FSM_Rollback(psHciContext);
+ phHciNfc_FSM_Rollback(psHciContext);
switch (psHciContext->host_rf_type)
{
@@ -2315,9 +2317,9 @@ phHciNfc_Transact_Sequence(
if(ZERO != psHciContext->rx_index)
{
transact_info.status = NFCSTATUS_SUCCESS;
- transact_info.buffer =
+ transact_info.buffer =
&psHciContext->recv_buffer[psHciContext->rx_index];
- transact_info.length =
+ transact_info.length =
psHciContext->rx_total - psHciContext->rx_index;
transact_result = NFC_NOTIFY_TRANSCEIVE_COMPLETED;
}
@@ -2336,15 +2338,31 @@ phHciNfc_Transact_Sequence(
#endif
{
transact_info.status = NFCSTATUS_SUCCESS;
- transact_info.buffer =
+ transact_info.buffer =
&psHciContext->recv_buffer[psHciContext->rx_index];
- transact_info.length =
+ transact_info.length =
psHciContext->rx_total - psHciContext->rx_index;
transact_result = NFC_NOTIFY_TRANSCEIVE_COMPLETED;
HCI_PRINT(" HCI Transceive operation Completed. \n");
psHciContext->p_xchg_info = NULL ;
break;
}
+#if defined(HOST_EMULATION)
+ case phHal_eISO14443_A_PICC:
+ {
+ HCI_PRINT(" HCI Send operation Completed. \n");
+ transact_info.status = NFCSTATUS_SUCCESS;
+ transact_result = NFC_NOTIFY_SEND_CE_A_COMPLETED;
+ break;
+ }
+ case phHal_eISO14443_B_PICC:
+ {
+ HCI_PRINT(" HCI Send operation Completed. \n");
+ transact_info.status = NFCSTATUS_SUCCESS;
+ transact_result = NFC_NOTIFY_SEND_CE_B_COMPLETED;
+ break;
+ }
+#endif
#if defined(ENABLE_P2P)
case phHal_eNfcIP1_Initiator:
case phHal_eNfcIP1_Target:
@@ -2358,7 +2376,7 @@ phHciNfc_Transact_Sequence(
case phHal_eUnknown_DevType:
default:
{
- transact_info.status =
+ transact_info.status =
PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
break;
}
@@ -2416,7 +2434,7 @@ phHciNfc_Info_Sequence(
case phHal_eUnknown_DevType:
default:
{
- status =
+ status =
PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
break;
}
@@ -2452,7 +2470,7 @@ phHciNfc_Test_Sequence(
}
else
{
- status = phHciNfc_DevMgmt_Get_Test_Result(
+ status = phHciNfc_DevMgmt_Get_Test_Result(
psHciContext, &test_result );
}
comp_info.info = &test_result;
diff --git a/src/phLibNfc.h b/src/phLibNfc.h
index 6111a93..51bc73c 100644..100755
--- a/src/phLibNfc.h
+++ b/src/phLibNfc.h
@@ -56,8 +56,8 @@ extern const unsigned char *nxp_nfc_full_version;
/**
*\ingroup grp_lib_nfc
-*
-*\brief Defines Testmode Init configuration values
+*
+*\brief Defines Testmode Init configuration values
*/
typedef enum
@@ -70,8 +70,8 @@ typedef enum
/**
*\ingroup grp_lib_nfc
-*
-*\brief Defines Secure Element configurable states
+*
+*\brief Defines Secure Element configurable states
*/
typedef enum
@@ -99,7 +99,7 @@ typedef enum
*
*\brief Defines Ndef Card Offset.
*/
-typedef enum
+typedef enum
{
phLibNfc_Ndef_EBegin = 0x01, /**< Start from Beginning position */
phLibNfc_Ndef_ECurrent /**< Start from Current position */
@@ -115,8 +115,8 @@ typedef enum
* This mode is also called as card emulation mode.when secure element mode is set
* to this mode,external reader can communicate with this SE.
*
-*\b WiredMode: Wired mode is used to communicate with the Secure Element internally.
-* No RF field is generated. In this mode, PN544 acts as reader and discovers
+*\b WiredMode: Wired mode is used to communicate with the Secure Element internally.
+* No RF field is generated. In this mode, PN544 acts as reader and discovers
* SmartMX as MIFARE tag.External reader cannot access any of the SE's in this mode.
* This mode is applicable to only SmartMX secure element.
*
@@ -144,7 +144,7 @@ typedef enum
typedef enum
{
phLibNfc_SE_LowPowerMode_Off= 0x01, /**< Indicates no SE to be selected in low power mode */
- phLibNfc_SE_LowPowerMode_On = 0x02 /**< Indicates requested SE to be selected in low power mode */
+ phLibNfc_SE_LowPowerMode_On = 0x02 /**< Indicates requested SE to be selected in low power mode */
} phLibNfc_SE_LowPowerMode_t;
@@ -155,24 +155,34 @@ typedef enum
*/
typedef union phLibNfc_uSeEvtInfo
{
- phNfc_sUiccInfo_t UiccEvtInfo; /**< Indicates UICC event info for Evt_Transaction event */
+ phNfc_sUiccInfo_t UiccEvtInfo; /**< Indicates UICC event info for Evt_Transaction event */
}phLibNfc_uSeEvtInfo_t;
/**
* \ingroup grp_lib_nfc
*
+*\brief Defines card emulation event info .
+*/
+typedef union phLibNfc_uCeEvtInfo
+{
+ phNfc_sUiccInfo_t UiccEvtInfo; /**< Indicates UICC event info for Evt_Transaction event */
+}phLibNfc_uCeEvtInfo_t;
+
+/**
+* \ingroup grp_lib_nfc
+*
*\brief Types of SE transaction events sent to SE notification handler .
*/
typedef enum
{
- phLibNfc_eSE_EvtStartTransaction=0x00, /**< Indicates transaction started on
+ phLibNfc_eSE_EvtStartTransaction=0x00, /**< Indicates transaction started on
secure element */
phLibNfc_eSE_EvtEndTransaction=0x01, /**<Indicates transaction ended on secure
element*/
- phLibNfc_eSE_EvtTypeTransaction=0x02, /**<Indicates external reader trying to access secure element */
-
+ phLibNfc_eSE_EvtTypeTransaction=0x02, /**<Indicates external reader trying to access secure element */
+
phLibNfc_eSE_EvtConnectivity, /**<This event notifies the terminal host that it shall
- send a connectivity event from UICC as defined in
+ send a connectivity event from UICC as defined in
ETSI TS 102 622 V7.4.0 */
phLibNfc_eSE_EvtFieldOn, // consider using phLibNfc_eSE_EvtConnectivity
phLibNfc_eSE_EvtFieldOff,
@@ -187,6 +197,25 @@ typedef enum
/**
* \ingroup grp_lib_nfc
*
+*\brief Types of CE transaction events sent to CE notification handler .
+*/
+typedef enum
+{
+ phLibNfc_eCE_A_EvtActivated=0x00, /**< Indicates activation on
+ emulated card */
+ phLibNfc_eCE_A_EvtDeActivated=0x01, /**< Indicates de activation
+ emulated card */
+ phLibNfc_eCE_B_EvtActivated=0x02, /**< Indicates activation on
+ emulated card */
+ phLibNfc_eCE_B_EvtDeActivated=0x03, /**< Indicates de activation
+ emulated card */
+ phLibNfc_eCE_EvtFieldOn, // consider using phLibNfc_eSE_EvtConnectivity
+ phLibNfc_eCE_EvtFieldOff
+} phLibNfc_eCE_EvtType_t;
+
+/**
+* \ingroup grp_lib_nfc
+*
*\brief Defines possible registration details for notifications.
*/
typedef phNfc_sSupProtocol_t phLibNfc_Registry_Info_t;
@@ -211,7 +240,7 @@ typedef phNfc_sData_t phLibNfc_AID;
*
*\brief Remote Device Info definition .
*/
-typedef phNfc_sRemoteDevInformation_t phLibNfc_sRemoteDevInformation_t;
+typedef phNfc_sRemoteDevInformation_t phLibNfc_sRemoteDevInformation_t;
/**
* \ingroup grp_lib_nfc
*/
@@ -226,13 +255,13 @@ typedef phNfc_sTransceiveInfo_t phLibNfc_sTransceiveInfo_t;
/**
* \ingroup grp_lib_nfc
*
-*\brief Automatic Device Discovery Definition.
+*\brief Automatic Device Discovery Definition.
*/
typedef phNfc_sADD_Cfg_t phLibNfc_sADD_Cfg_t;
/**
*\ingroup grp_lib_nfc
*
-*\brief Release mode definition.
+*\brief Release mode definition.
*/
typedef phNfc_eReleaseType_t phLibNfc_eReleaseType_t;
@@ -276,7 +305,7 @@ typedef phLibNfc_sSupportedTagInfo_t phLibNfc_sNDEFMappingInfo_t;
*\brief Defines supported tag types for NDEF formatting feature.
*/
-typedef phLibNfc_sSupportedTagInfo_t phLibNfc_sTagFormattingInfo_t;
+typedef phLibNfc_sSupportedTagInfo_t phLibNfc_sTagFormattingInfo_t;
/**
* \ingroup grp_lib_nfc
@@ -285,7 +314,7 @@ typedef phLibNfc_sSupportedTagInfo_t phLibNfc_sTagFormattingInfo_t;
*/
typedef struct StackCapabilities
-{
+{
phLibNfc_sDeviceCapabilities_t psDevCapabilities;
phLibNfc_sNDEFMappingInfo_t psMappingCapabilities;
phLibNfc_sTagFormattingInfo_t psFormatCapabilities;
@@ -319,7 +348,7 @@ typedef struct phLibNfc_RemoteDev
typedef phNfc_sNfcIPCfg_t phLibNfc_sNfcIPCfg_t;
/**
-*\ingroup grp_lib_nfc
+*\ingroup grp_lib_nfc
*\brief NDEF registration structure definition.
*/
typedef struct phLibNfc_Ndef_SrchType
@@ -330,8 +359,8 @@ typedef struct phLibNfc_Ndef_SrchType
} phLibNfc_Ndef_SrchType_t;
/**
-*\ingroup grp_lib_nfc
-* \brief NDEF information structure definition. \n
+*\ingroup grp_lib_nfc
+* \brief NDEF information structure definition. \n
*/
typedef struct phLibNfc_Ndef_Info
{
@@ -340,20 +369,20 @@ typedef struct phLibNfc_Ndef_Info
uint8_t *pNdefMessage; /**< Pointer to raw NDEF Data buffer */
uint32_t NdefRecordCount; /**< Number of NDEF records pointed by pNdefRecord */
phFriNfc_NdefRecord_t *pNdefRecord; /**< Pointer to the NDEF Records contained within the NDEF message */
-
+
} phLibNfc_Ndef_Info_t;
-/* As per NFC forum specification, the card can be in either of the below mentioned states
- INVALID - means card is NOT NFC forum specified tag. NDEF FORMAT can only be performed for
+/* As per NFC forum specification, the card can be in either of the below mentioned states
+ INVALID - means card is NOT NFC forum specified tag. NDEF FORMAT can only be performed for
the factory cards, other cards may or may not be formatted for NDEF FORMAT function.
- INITIALISED - means card is NFC forum specified tag. But, in this state
- the user has to first call NDEF WRITE, because in INITIALISED state, there
- wont be any data i.e.,ACTUAL NDEF FILE SIZE is 0. After the first
+ INITIALISED - means card is NFC forum specified tag. But, in this state
+ the user has to first call NDEF WRITE, because in INITIALISED state, there
+ wont be any data i.e.,ACTUAL NDEF FILE SIZE is 0. After the first
NDEF WRITE, NDEF READ and WRITE functions can be called any number of times.
- READ WRITE - means card is NFC forum specified tag. User can use both
+ READ WRITE - means card is NFC forum specified tag. User can use both
NDEF READ and WRITE functions
- READ ONLY - means card is NFC forum specified tag. User can only use
- NDEF READ. NDEF WRITE function will not work.
+ READ ONLY - means card is NFC forum specified tag. User can only use
+ NDEF READ. NDEF WRITE function will not work.
*/
#define PHLIBNFC_NDEF_CARD_INVALID 0x00U
#define PHLIBNFC_NDEF_CARD_INITIALISED 0x01U
@@ -369,7 +398,7 @@ typedef struct phLibNfc_ChkNdef_Info
{
uint8_t NdefCardState; /**< Card state information */
uint32_t ActualNdefMsgLength; /**< Indicates Actual length of NDEF Message in Tag */
- uint32_t MaxNdefMsgLength; /**< Indicates Maximum Ndef Message length that Tag can hold*/
+ uint32_t MaxNdefMsgLength; /**< Indicates Maximum Ndef Message length that Tag can hold*/
} phLibNfc_ChkNdef_Info_t;
/**
@@ -391,13 +420,13 @@ typedef phFriNfc_LlcpTransport_sSocketOptions_t phLibNfc_Llcp_sSocketOptions_t;
*
*\brief Response callback for connect request.
*
-* Callback type used to indicate a Connect request Successful or Failure indication to
+* Callback type used to indicate a Connect request Successful or Failure indication to
* LibNfc client.
*
* \param[in] pContext Context passed in the connect request before.
-* \param[in] hRemoteDev Handle to remote device on which connect was requested.
+* \param[in] hRemoteDev Handle to remote device on which connect was requested.
* \param[in] psRemoteDevInfo contains updated remote device details.For few tags
-* like ISO-14443A details like historical bytes gets updated
+* like ISO-14443A details like historical bytes gets updated
* only after connecting to target.Once connect is successful
* \b psRemoteDevInfo gets updated.
*
@@ -409,10 +438,10 @@ typedef phFriNfc_LlcpTransport_sSocketOptions_t phLibNfc_Llcp_sSocketOptions_t;
*
*/
-typedef void (*pphLibNfc_ConnectCallback_t) (void* pContext,
- phLibNfc_Handle hRemoteDev,
+typedef void (*pphLibNfc_ConnectCallback_t) (void* pContext,
+ phLibNfc_Handle hRemoteDev,
phLibNfc_sRemoteDevInformation_t* psRemoteDevInfo,
- NFCSTATUS Status
+ NFCSTATUS Status
);
/**
@@ -420,11 +449,11 @@ typedef void (*pphLibNfc_ConnectCallback_t) (void* pContext,
*
*\brief Response callback for disconnect request.
*
-* Callback type used to provide a disconnect Success or Failure indication to
+* Callback type used to provide a disconnect Success or Failure indication to
* LibNfc client.
*
* \param[in] pContext Context passed in the disconnect request before.
-* \param[in] hRemoteDev Handle to remote device on which disconnect is requested.
+* \param[in] hRemoteDev Handle to remote device on which disconnect is requested.
* \param[in] status Status of the response callback.
*
* \param NFCSTATUS_SUCCESS Disconnect operation successful.
@@ -440,7 +469,7 @@ typedef void (*pphLibNfc_DisconnectCallback_t)(void* pContext,
*
*\brief Response callback for IOCTL request.
*
-* Callback type to inform success or failure of the Ioctl request
+* Callback type to inform success or failure of the Ioctl request
* made by LibNfc client. It may optionally contain response data
* depending on the Ioctl command type issued.
@@ -452,14 +481,14 @@ typedef void (*pphLibNfc_DisconnectCallback_t)(void* pContext,
* \param NFCSTATUS_TARGET_LOST Ioctl operation failed because target is lost.
* \param NFCSTATUS_SHUTDOWN Ioctl operation failed because Shutdown in progress.
*
-*\param[in,out] pOutParam contains Ioctl command specific response buffer and size
-* of the buffer.This buffer address will be same as
+*\param[in,out] pOutParam contains Ioctl command specific response buffer and size
+* of the buffer.This buffer address will be same as
* pOutParam sent in \ref phLibNfc_Mgt_IoCtl.
*
*/
-typedef void (*pphLibNfc_IoctlCallback_t) (void* pContext,
+typedef void (*pphLibNfc_IoctlCallback_t) (void* pContext,
phNfc_sData_t* pOutParam,
NFCSTATUS Status
);
@@ -471,13 +500,13 @@ typedef void (*pphLibNfc_IoctlCallback_t) (void* pContext,
*
*\brief Response callback for Transceive request.
*
-* This callback type is used to provide received data and it's size to the
-* LibNfc client in \ref phNfc_sData_t format ,when LibNfc client has performed
-* a Transceive operation on a tag or when the device acts as an Initiator during a
+* This callback type is used to provide received data and it's size to the
+* LibNfc client in \ref phNfc_sData_t format ,when LibNfc client has performed
+* a Transceive operation on a tag or when the device acts as an Initiator during a
* P2P transactions.
*
* \param[in] pContext LibNfc client context passed in the corresponding request before.
-* \param[in] hRemoteDev Handle to remote device on transceive is performed.
+* \param[in] hRemoteDev Handle to remote device on transceive is performed.
* \param[in] pResBuffer Response buffer of type \ref phNfc_sData_t.
* \param[in] status Status of the response callback.
*
@@ -490,7 +519,7 @@ typedef void (*pphLibNfc_IoctlCallback_t) (void* pContext,
typedef void (*pphLibNfc_TransceiveCallback_t)( void* pContext,
phLibNfc_Handle hRemoteDev,
phNfc_sData_t* pResBuffer,
- NFCSTATUS Status
+ NFCSTATUS Status
);
/**
@@ -500,7 +529,7 @@ typedef void (*pphLibNfc_TransceiveCallback_t)( void* pContext,
*
* Generic callback definition used as callback type in few APIs below.
*
-* \note : Status and error codes for this type of callback are documented in respective APIs
+* \note : Status and error codes for this type of callback are documented in respective APIs
* wherever it is used.
*
* \param[in] pContext LibNfc client context passed in the corresponding request
@@ -515,7 +544,7 @@ typedef void(*pphLibNfc_RspCb_t) (void* pContext,NFCSTATUS Status);
*
* This call back is used by check ndef api.
*
-* \note : Status and error codes for this type of callback are documented in API
+* \note : Status and error codes for this type of callback are documented in API
*
* \param[in] pContext LibNfc client context passed in the corresponding request
* before.
@@ -544,8 +573,8 @@ typedef void(*pphLibNfc_ChkNdefRspCb_t)(void* pContext,
*Subsequent operations on discovered target shall be performed using target specific handle
*\b hTargetDev.
*
-* \param[in] pContext Client context passed in the corresponding
-* request before.The context is handled by client
+* \param[in] pContext Client context passed in the corresponding
+* request before.The context is handled by client
* only.
*
* \param[in] psRemoteDevList Remote Device list contains discovered target details.
@@ -553,8 +582,8 @@ typedef void(*pphLibNfc_ChkNdefRspCb_t)(void* pContext,
* List size depends on no of remote devices discovered.
*
* \param[in] uNofRemoteDev Indicates no of remote devices discovered .
-* In case more than one target discovered,\b psRemoteDevList contains
-* multiple target details.
+* In case more than one target discovered,\b psRemoteDevList contains
+* multiple target details.
*
* \param[in] Status Status of the response callback.
*
@@ -562,11 +591,11 @@ typedef void(*pphLibNfc_ChkNdefRspCb_t)(void* pContext,
* \param NFCSTATUS_MULTIPLE_TARGETS multiple targets found.
* \param NFCSTATUS_MULTI_PROTOCOLS Target found supports multiple protocols.
* \param NFCSTATUS_SHUTDOWN Registration failed because shutdown in progress.
-* \param NFCSTATUS_DESELECTED initiator issued disconnect or intiator
+* \param NFCSTATUS_DESELECTED initiator issued disconnect or intiator
* physically removed from the RF field.
*
-*\note: multiple tag detection is possible only within same technology but not across
-* different technologies.
+*\note: multiple tag detection is possible only within same technology but not across
+* different technologies.
*/
typedef void (*phLibNfc_NtfRegister_RspCb_t)(
void* pContext,
@@ -574,13 +603,13 @@ typedef void (*phLibNfc_NtfRegister_RspCb_t)(
uint8_t uNofRemoteDev,
NFCSTATUS Status
);
-
+
/**
* \ingroup grp_lib_nfc
* \brief Response Callback for secure element mode settings.
*
* This callback type is used to provide information on requested secure element is
-* activated or not to LibNfcClient.
+* activated or not to LibNfcClient.
*
* \param[in] pContext LibNfc client context passed in the activation request.
*
@@ -595,10 +624,10 @@ typedef void (*phLibNfc_NtfRegister_RspCb_t)(
typedef void(*pphLibNfc_SE_SetModeRspCb_t)(
void* pContext,
phLibNfc_Handle hSecureElement,
- NFCSTATUS Status
+ NFCSTATUS Status
);
/**
-* \ingroup grp_lib_nfc
+* \ingroup grp_lib_nfc
* \brief Notification callback for \ref phLibNfc_SE_NtfRegister().
*
* A function of this type is called when external reader tries to access SE.
@@ -625,16 +654,44 @@ typedef void (*pphLibNfc_SE_NotificationCb_t) (void* pCon
NFCSTATUS Status
);
+/**
+* \ingroup grp_lib_nfc
+* \brief Notification callback for \ref phLibNfc_CE_NtfRegister().
+*
+* A function of this type is called when external reader tries to access SE.
+*
+*\param[in] pContext LibNfc client context passed in the SE notification register request.
+* The context is Handled by client only.
+* \param[in] EventType Event type of secure element transaction
+*
+* \param[in] handle to connected device if connected Event type of secure element transaction
+*
+*\param[in] pAppID Application identifier to be accessed on SE .
+* Sent when available from SE otherwise empty.
+*
+*\param[in] Status Indicates API status.
+* \param NFCSTATUS_SUCCESS Notification handler registered sucessfully.
+* \param NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \param NFCSTATUS_FAILED set mode operation failed.
+*
+*
+*/
+typedef void (*pphLibNfc_CE_NotificationCb_t) (void* pContext,
+ phLibNfc_eCE_EvtType_t EventType,
+ uint32_t handle,
+ NFCSTATUS Status
+ );
+
/**
*\ingroup grp_lib_nfc
*\brief Receive callback definition.
*
-* This callback type is used to provide received data and it's size to the
-* LibNfc client in \ref phNfc_sData_t format ,when LibNfc client has performed
-* when the device acts as a Target during P2P communication
+* This callback type is used to provide received data and it's size to the
+* LibNfc client in \ref phNfc_sData_t format ,when LibNfc client has performed
+* when the device acts as a Target during P2P communication
*
-* \param[in] pContext LibNfc client context passed in the corresponding
+* \param[in] pContext LibNfc client context passed in the corresponding
* request before.
* \param[in] pRecvBufferInfo Response buffer of type \ref phNfc_sData_t.
* \param[in] status Status of the response callback.
@@ -647,7 +704,7 @@ typedef void (*pphLibNfc_SE_NotificationCb_t) (void* pCon
* closed and send and receive requests not allowed any more
* unless new session is started.
*/
-typedef void (*pphLibNfc_Receive_RspCb_t)(void* pContext,
+typedef void (*pphLibNfc_Receive_RspCb_t)(void* pContext,
phNfc_sData_t* pRecvBufferInfo,
NFCSTATUS status
);
@@ -660,7 +717,7 @@ typedef void (*pphLibNfc_Receive_RspCb_t)(void* pContext,
*
* \b Note :Once this type callback is notified,discovery wheel is stopped.
*In order to restart discovery process again it is important to disconnect
-*from current tag.LibNfc client shall disconnect explicitly using
+*from current tag.LibNfc client shall disconnect explicitly using
*\ref phLibNfc_RemoteDev_Disconnect() interface.
*
*\param[in] pContext Pointer to context previously provided by the user
@@ -676,11 +733,11 @@ typedef void (*pphLibNfc_Receive_RspCb_t)(void* pContext,
*/
-typedef void (*pphLibNfc_Ndef_Search_RspCb_t) ( void* pContext,
+typedef void (*pphLibNfc_Ndef_Search_RspCb_t) ( void* pContext,
phLibNfc_Ndef_Info_t* psNdefInfo,
phLibNfc_Handle hRemoteDevice,
NFCSTATUS Status
- );
+ );
/**
@@ -796,7 +853,7 @@ typedef void (*pphLibNfc_LlcpSocketSendCb_t) ( void* pContext,
* sends the HANDLE to the caller.
*
* \param[in] psConfig Driver configuration details as provided
- * by the upper layer.
+ * by the upper layer.
* \param[in,out] ppDriverHandle pointer to which valid Handle to driver
* interface is assigned.
*
@@ -824,7 +881,7 @@ NFCSTATUS phLibNfc_Mgt_ConfigureDriver (pphLibNfc_sConfig_t psConfig,
*
* \brief Release configuration for the given driver Interface.
*
- * \copydoc page_reg Release all that has been
+ * \copydoc page_reg Release all that has been
* initialised in \b phLibNfc_Mgt_ConfigureDriver function (Synchronous function).
*
* \param[in] pDriverHandle Link information of the hardware
@@ -838,13 +895,13 @@ NFCSTATUS phLibNfc_Mgt_ConfigureDriver (pphLibNfc_sConfig_t psConfig,
*LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
- *LibNfcClient<-LibNfc [label="pInitCb"];
+ *LibNfcClient<-LibNfc [label="pInitCb"];
*--- [label="Perform feature operations "];
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_DeInitialize()",URL="\ref phLibNfc_Mgt_DeInitialize"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
- *LibNfcClient<-LibNfc [label="pDeInitCb"];
+ *LibNfcClient<-LibNfc [label="pDeInitCb"];
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_UnConfigureDriver()",URL="\ref phLibNfc_Mgt_UnConfigureDriver"];
- *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
+ *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
*\endmsc
*/
NFCSTATUS phLibNfc_Mgt_UnConfigureDriver (void * pDriverHandle
@@ -912,7 +969,7 @@ int phLibNfc_GetMifareRawTimeout();
*
* \retval NFCSTATUS_ALREADY_INITIALISED Stack is already initialized.
* \retval NFCSTATUS_PENDING Init sequence has been successfully
-* started and result will be conveyed via
+* started and result will be conveyed via
* callback notification.
* \retval NFCSTATUS_INVALID_PARAMETER The parameter could not be properly
* interpreted.
@@ -953,10 +1010,10 @@ NFCSTATUS phLibNfc_Mgt_Initialize (void * pDriverHandle,
*
* \retval NFCSTATUS_SUCCESS Device stack is already De-Initialized.
* \retval NFCSTATUS_PENDING De-Initialization sequence has been successfully
-* started and result is conveyed via callback
+* started and result is conveyed via callback
* notification.
*
-* \retval NFCSTATUS_INVALID_PARAMETER The parameter could not be properly
+* \retval NFCSTATUS_INVALID_PARAMETER The parameter could not be properly
* interpreted.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
@@ -968,11 +1025,11 @@ NFCSTATUS phLibNfc_Mgt_Initialize (void * pDriverHandle,
*LibNfcClient,LibNfc;
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
-*LibNfcClient<-LibNfc [label="pInitCb"];
+*LibNfcClient<-LibNfc [label="pInitCb"];
*--- [label="Perform feature operations "];
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_DeInitialize()",URL="\ref phLibNfc_Mgt_DeInitialize"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
-*LibNfcClient<-LibNfc [label="pDeInitCb"];
+*LibNfcClient<-LibNfc [label="pDeInitCb"];
*\endmsc
*/
NFCSTATUS phLibNfc_Mgt_DeInitialize(void * pDriverHandle,
@@ -985,16 +1042,16 @@ NFCSTATUS phLibNfc_Mgt_DeInitialize(void * pDriverHandle,
* \brief Get list of available Secure Elements.
*
* This function retrieves list of secure elements locally connected.
-* during LibNfc initialization these SEs enumerated from lower stack and maintained
+* during LibNfc initialization these SEs enumerated from lower stack and maintained
* in LibNfc library.Once libNfc client queries using this interface,
-* same details exposed to LibNfc client.
+* same details exposed to LibNfc client.
* LibNfc client shall pass empty list of size \ref PHLIBNFC_MAXNO_OF_SE .
-* Once SE list is available, libNfc client can perform operation on specific SE
+* Once SE list is available, libNfc client can perform operation on specific SE
* using SE handle.
* The handle given in the \ref phLibNfc_SE_List_t structure stays valid until
-* shutdown is called.
+* shutdown is called.
*
-*\note In case no SE's found, API still returns \ref NFCSTATUS_SUCCESS with \b uSE_count
+*\note In case no SE's found, API still returns \ref NFCSTATUS_SUCCESS with \b uSE_count
set to zero.Value zero indicates none of the SE's connected to PN544 hardware.
* \param[in,out] pSE_List contains list of SEs with SE details in \ref phLibNfc_SE_List_t format.
@@ -1013,7 +1070,7 @@ set to zero.Value zero indicates none of the SE's connected to PN544 hardware.
*LibNfcClient,LibNfc;
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
-*LibNfcClient<-LibNfc [label="pInitCb"];
+*LibNfcClient<-LibNfc [label="pInitCb"];
*--- [label="Now SE list can be retrieved"];
*\endmsc
*/
@@ -1043,17 +1100,17 @@ NFCSTATUS phLibNfc_SE_GetSecureElementList(phLibNfc_SE_List_t* pSE_List,
* 2.When SmartMX SE configured in Wired Mode ,LibNfc client shall restart discovery process.
* SmartMX gets detected as MIFARE tag.
* 3.To exit wired mode ,LibNfc client has to disconnect with release type as "NFC_SMARTMX_RELEASE".
-*
+*
*
*\b c)If mode is \ref phLibNfc_SE_ActModeOff
-*This means SE is off mode .It can not be accessed any more in wired or virtual mode.
+*This means SE is off mode .It can not be accessed any more in wired or virtual mode.
*internal reader any more.communicate with internal reader and only
-*PN544 can communicate in reader mode and external reader can not
+*PN544 can communicate in reader mode and external reader can not
*communicate with it.This mode is applicable both SE types ( UICC and SmartMX)
*
* \param[in] hSE_Handle Secure Element Handle .
* \param[in] eActivation_mode Indicates SE mode to be configured.
-*
+*
*
*
* \param[in] pphLibNfc_SE_setModeRspCb_t pointer to response callback.
@@ -1068,7 +1125,7 @@ NFCSTATUS phLibNfc_SE_GetSecureElementList(phLibNfc_SE_List_t* pSE_List,
* \retval NFCSTATUS_INVALID_HANDLE Invalid Handle.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be properly interpreted.
-* \retval NFCSTATUS_REJECTED Invalid request.(Ex: If wired mode settings called using
+* \retval NFCSTATUS_REJECTED Invalid request.(Ex: If wired mode settings called using
* UICC SE handle ,this error code seen).
* \retval NFCSTATUS_FAILED Request failed.
*
@@ -1084,9 +1141,9 @@ NFCSTATUS phLibNfc_SE_GetSecureElementList(phLibNfc_SE_List_t* pSE_List,
*LibNfcClient=>LibNfc [label="phLibNfc_SE_SetMode(hSE_Handle,)",URL="\ref phLibNfc_SE_SetMode"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
*LibNfcClient<-LibNfc [label="pSE_SetMode_Rsp_cb"];
-*\endmsc
+*\endmsc
*/
-NFCSTATUS phLibNfc_SE_SetMode ( phLibNfc_Handle hSE_Handle,
+NFCSTATUS phLibNfc_SE_SetMode ( phLibNfc_Handle hSE_Handle,
phLibNfc_eSE_ActivationMode eActivation_mode,
pphLibNfc_SE_SetModeRspCb_t pSE_SetMode_Rsp_cb,
void * pContext
@@ -1115,7 +1172,7 @@ NFCSTATUS phLibNfc_SE_SetMode ( phLibNfc_Handle hSE_Handle,
*LibNfcClient,LibNfc;
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
-*LibNfcClient<-LibNfc [label="pInitCb"];
+*LibNfcClient<-LibNfc [label="pInitCb"];
*--- [label="Perform feature operations "];
*
*LibNfcClient=>LibNfc [label="phLibNfc_SE_NtfRegister()",URL="\ref phLibNfc_SE_NtfRegister"];
@@ -1123,17 +1180,58 @@ LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
*--- [label="Registration sucessfull"];
*
*--- [label="In case external reader performs transactions,callback is notified as shown below"];
-*LibNfcClient<-LibNfc [label="pSE_NotificationCb"];
+*LibNfcClient<-LibNfc [label="pSE_NotificationCb"];
*\endmsc
*/
NFCSTATUS phLibNfc_SE_NtfRegister (pphLibNfc_SE_NotificationCb_t pSE_NotificationCb,
void * pContext
);
+
+/**
+* \ingroup grp_lib_nfc
+* \brief Registers notification handler to handle secure element specific events.
+*
+* This function registers handler to report SE specific transaction events.
+* Possible different types of events are as defined in \ref phLibNfc_eSE_EvtType_t.
+
+* \param[in] pSE_NotificationCb pointer to notification callback.
+* \param[in] pContext Client context which will be included in
+* callback when the request is completed.
+*
+*\retval NFCSTATUS_SUCCESS Registration Sucessful.
+*\retval NFSCSTATUS_SHUTDOWN Shutdown in progress.
+*\retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+*\retval NFCSTATUS_FAILED Request failed.
+*
+*
+*\msc
+*LibNfcClient,LibNfc;
+*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
+*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
+*LibNfcClient<-LibNfc [label="pInitCb"];
+*--- [label="Perform feature operations "];
+*
+*LibNfcClient=>LibNfc [label="phLibNfc_SE_NtfRegister()",URL="\ref phLibNfc_SE_NtfRegister"];
+LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
+*--- [label="Registration sucessfull"];
+*
+*--- [label="In case external reader performs transactions,callback is notified as shown below"];
+*LibNfcClient<-LibNfc [label="pSE_NotificationCb"];
+*\endmsc
+*/
+
+NFCSTATUS phLibNfc_CE_NtfRegister (pphLibNfc_CE_NotificationCb_t pCE_NotificationCb,
+ void * pContext
+ );
+
+
/**
* \ingroup grp_lib_nfc
*\brief This function unregister the registered listener for SE event.
-* This function unregisters the listener which has been registered with \ref
+* This function unregisters the listener which has been registered with \ref
* phLibNfc_SE_NtfRegister.
*
*\retval NFCSTATUS_SUCCESS Unregistration successful.
@@ -1144,7 +1242,7 @@ NFCSTATUS phLibNfc_SE_NtfRegister (pphLibNfc_SE_NotificationCb_t pSE_Notifica
*LibNfcClient,LibNfc;
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
-*LibNfcClient<-LibNfc [label="pInitCb"];
+*LibNfcClient<-LibNfc [label="pInitCb"];
*--- [label="Perform feature operations "];
*LibNfcClient=>LibNfc [label="phLibNfc_SE_NtfRegister()",URL="\ref phLibNfc_SE_NtfRegister"];
LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
@@ -1152,7 +1250,7 @@ LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
*
*--- [label="In case external reader performs transactions,callback is notified as shown below"];
*
-*LibNfcClient<-LibNfc [label="pSE_NotificationCb"];
+*LibNfcClient<-LibNfc [label="pSE_NotificationCb"];
*--- [label="Unregister SE notification handler in case required "];
*LibNfcClient=>LibNfc [label="phLibNfc_SE_NtfUnregister()",URL="\ref phLibNfc_SE_NtfUnregister"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
@@ -1162,42 +1260,73 @@ LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
NFCSTATUS phLibNfc_SE_NtfUnregister(void);
/**
+* \ingroup grp_lib_nfc
+*\brief This function unregister the registered listener for CE event.
+* This function unregisters the listener which has been registered with \ref
+* phLibNfc_SE_NtfRegister.
+*
+*\retval NFCSTATUS_SUCCESS Unregistration successful.
+*\retval NFSCSTATUS_SHUTDOWN Shutdown in progress.
+*\retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+*\retval NFCSTATUS_FAILED Request failed.
+*\msc
+*LibNfcClient,LibNfc;
+*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
+*LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
+*LibNfcClient<-LibNfc [label="pInitCb"];
+*--- [label="Perform feature operations "];
+*LibNfcClient=>LibNfc [label="phLibNfc_SE_NtfRegister()",URL="\ref phLibNfc_CE_NtfRegister"];
+LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
+*--- [label="Registration sucessfull"];
+*
+*--- [label="In case external reader performs transactions,callback is notified as shown below"];
+*
+*LibNfcClient<-LibNfc [label="pCE_NotificationCb"];
+*--- [label="Unregister CE notification handler in case required "];
+*LibNfcClient=>LibNfc [label="phLibNfc_SE_NtfUnregister()",URL="\ref phLibNfc_CE_NtfUnregister"];
+*LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
+
+*\endmsc
+*/
+NFCSTATUS phLibNfc_CE_NtfUnregister(void);
+
+/**
*\ingroup grp_lib_nfc
-* \brief IOCTL interface.
+* \brief IOCTL interface.
*
-* The I/O Control function allows the caller to configure specific
-* functionality provided by the lower layer.Each feature is accessible via a
+* The I/O Control function allows the caller to configure specific
+* functionality provided by the lower layer.Each feature is accessible via a
* specific IOCTL Code.
*
* \param[in] pDriverHandle Interface handle.This parameter is valid only for firmware download feature.
* for other IOCTL features this parameter is not relevent.
*
-* \param[in] IoctlCode Control code for the operation.
-* This value identifies the specific
+* \param[in] IoctlCode Control code for the operation.
+* This value identifies the specific
* operation to be performed.For more details on supported
* IOCTL codes refer to \ref grp_lib_ioctl.
-*\param[in,out] pInParam Pointer to any input data structure
-* containing data which is interpreted
-* based on IoCtl code and the length of
+*\param[in,out] pInParam Pointer to any input data structure
+* containing data which is interpreted
+* based on IoCtl code and the length of
* the data.
*
-*\param[in,out] pOutParam Pointer to output buffer details to hold
+*\param[in,out] pOutParam Pointer to output buffer details to hold
* Ioctl specific response buffer and size of
* the buffer.This buffer will be updated and
* sent back as part of of callback details.
-*
-*\param[in] pIoCtl_Rsp_cb Response callback registered by the caller.
-*
+*
+*\param[in] pIoCtl_Rsp_cb Response callback registered by the caller.
+*
* \param[in] pContext Client context which will be included in
* callback when the request is completed.
*
*
*\retval NFCSTATUS_PENDING Update in pending state. RspCB will be
-* called later.
+* called later.
*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
-* could not be properly interpreted.
+* could not be properly interpreted.
*
-\retval NFCSTATUS_BUFFER_TOO_SMALL The buffer supplied by the caller is to
+\retval NFCSTATUS_BUFFER_TOO_SMALL The buffer supplied by the caller is to
*\retval NFSCSTATUS_SHUTDOWN Shutdown in progress.
*\retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
@@ -1217,26 +1346,26 @@ NFCSTATUS phLibNfc_SE_NtfUnregister(void);
*/
NFCSTATUS phLibNfc_Mgt_IoCtl (void* pDriverHandle,
uint16_t IoctlCode,
- phNfc_sData_t* pInParam,
+ phNfc_sData_t* pInParam,
phNfc_sData_t* pOutParam,
pphLibNfc_IoctlCallback_t pIoCtl_Rsp_cb,
- void* pContext
+ void* pContext
);
/**
* \ingroup grp_lib_nfc
* \brief This interface registers notification handler for target discovery.
*
-* This function allows libNfc client to register for notifications based technology
+* This function allows libNfc client to register for notifications based technology
* type it is interested to discover. In case application is interested in multiples technology
* discovery,it can enable respective bits in \b pRegistryInfo . when Registered type target
* is discovered in RF field ,LibNfc notifies registered notification callback.
*
-* \note In case this API is called multiple times ,most recent request registry details will be used
+* \note In case this API is called multiple times ,most recent request registry details will be used
*for registration.
-*
+*
*\param[in] pRegistryInfo structure contains bitwise registry information.
-* Specific technology type discovery can be registered if
+* Specific technology type discovery can be registered if
* corresponding bit is enabled.In case bit is disabled
* it indicates specific technology type unregistered.
*
@@ -1263,7 +1392,7 @@ NFCSTATUS phLibNfc_Mgt_IoCtl (void* pDriverHandle,
*\endmsc
*/
-NFCSTATUS phLibNfc_RemoteDev_NtfRegister(
+NFCSTATUS phLibNfc_RemoteDev_NtfRegister(
phLibNfc_Registry_Info_t* pRegistryInfo,
phLibNfc_NtfRegister_RspCb_t pNotificationHandler,
void* pContext
@@ -1274,17 +1403,17 @@ NFCSTATUS phLibNfc_RemoteDev_NtfRegister(
* \ingroup grp_lib_nfc
* \brief Configure Discovery Modes.
*
-*This function is used to configure ,start and stop the discovery wheel.
-*Configuration includes
+*This function is used to configure ,start and stop the discovery wheel.
+*Configuration includes
*<br><br>a)Enabling/disabling of Reader phases for A,B and F technologies.
*<br>b)Configuring NFC-IP1 Initiator Speed and duration of the Emulation phase .
*
*Discovery wheel configuration based on discovery mode selected is as below.
-*<br><br>1.If discovery Mode is set as \ref NFC_DISCOVERY_CONFIG then previous configurations
+*<br><br>1.If discovery Mode is set as \ref NFC_DISCOVERY_CONFIG then previous configurations
* over written by new configurations passed in \ref phLibNfc_sADD_Cfg_t and Discovery wheel
*restarts with new configurations.
-*<br><br>2.If discovery Mode is set as \ref NFC_DISCOVERY_START or \ref NFC_DISCOVERY_STOP then
-* discovery parameters passed in \ref phLibNfc_sADD_Cfg_t will not be considered and previous
+*<br><br>2.If discovery Mode is set as \ref NFC_DISCOVERY_START or \ref NFC_DISCOVERY_STOP then
+* discovery parameters passed in \ref phLibNfc_sADD_Cfg_t will not be considered and previous
*configurations still holds good.
*<br><br>3.If discovery Mode is set as \ref NFC_DISCOVERY_RESUME discovery mode starts the discovery
*wheel from where it is stopped previously.
@@ -1292,28 +1421,28 @@ NFCSTATUS phLibNfc_RemoteDev_NtfRegister(
*\b Note: Config types \b NFC_DISCOVERY_START, \b NFC_DISCOVERY_STOP and \b NFC_DISCOVERY_RESUME
* are not supported currently. It is for future use.
*
-* \param[in] DiscoveryMode Discovery Mode allows to choose between:
+* \param[in] DiscoveryMode Discovery Mode allows to choose between:
* discovery configuration and start, stop
* discovery and start discovery (with last
-* set configuration).For mode details refer to
-\ref phNfc_eDiscoveryConfigMode_t.
-* \param[in] sADDSetup Includes Enable/Disable discovery for
+* set configuration).For mode details refer to
+\ref phNfc_eDiscoveryConfigMode_t.
+* \param[in] sADDSetup Includes Enable/Disable discovery for
* each protocol A,B and F.
* Details refer to \ref phNfc_sADD_Cfg_t.
-* \param[in] pConfigDiscovery_RspCb is called once the discovery wheel
-* configuration is complete.
+* \param[in] pConfigDiscovery_RspCb is called once the discovery wheel
+* configuration is complete.
* \param[in] pContext Client context which will be included in
* callback when the request is completed.
-*
*
-*\retval NFCSTATUS_PENDING Discovery request is in progress and result
+*
+*\retval NFCSTATUS_PENDING Discovery request is in progress and result
* will be notified via callback later.
-*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be properly interpreted.
*\retval NFCSTATUS_NOT_INITIALISED Indicates stack is not initialized.
*\retval NFCSTATUS_INSUFFICIENT_RESOURCES Insufficient resource.(Ex: insufficient memory)
*\retval NFCSTATUS_BUSY already discovery in progress
-* or it is already discovered Target and
+* or it is already discovered Target and
* connected.
*\retval NFSCSTATUS_SHUTDOWN Shutdown in progress.
*\retval NFCSTATUS_FAILED Request failed.
@@ -1323,7 +1452,7 @@ NFCSTATUS phLibNfc_RemoteDev_NtfRegister(
* to call \ref phLibNfc_RemoteDev_Connect before any transaction can be performed
* with the discovered target. Even if the LibNfc client is not
* interested in using any of the discovered targets \ref phLibNfc_RemoteDev_Connect
-* and \ref phLibNfc_RemoteDev_Disconnect should be called to restart the Discovery
+* and \ref phLibNfc_RemoteDev_Disconnect should be called to restart the Discovery
* wheel.
* \sa \ref phLibNfc_RemoteDev_Connect, phLibNfc_RemoteDev_Disconnect.
@@ -1331,7 +1460,7 @@ NFCSTATUS phLibNfc_RemoteDev_NtfRegister(
*LibNfcClient,LibNfc;
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_Initialize()",URL="\ref phLibNfc_Mgt_Initialize"];
*LibNfcClient<-LibNfc [label="pInitCb()",URL="\ref pphLibNfc_RspCb_t()"];
-*LibNfcClient=>LibNfc [label="phLibNfc_RemoteDev_NtfRegister()",URL="\ref
+*LibNfcClient=>LibNfc [label="phLibNfc_RemoteDev_NtfRegister()",URL="\ref
phLibNfc_RemoteDev_NtfRegister"];
*LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
*LibNfcClient=>LibNfc [label="phLibNfc_Mgt_ConfigureDiscovery()",URL="\ref phLibNfc_Mgt_ConfigureDiscovery"];
@@ -1350,7 +1479,7 @@ phLibNfc_RemoteDev_NtfRegister"];
* \param NFCSTATUS_FAILED Request failed.
*/
-NFCSTATUS phLibNfc_Mgt_ConfigureDiscovery (phLibNfc_eDiscoveryConfigMode_t DiscoveryMode,
+NFCSTATUS phLibNfc_Mgt_ConfigureDiscovery (phLibNfc_eDiscoveryConfigMode_t DiscoveryMode,
phLibNfc_sADD_Cfg_t sADDSetup,
pphLibNfc_RspCb_t pConfigDiscovery_RspCb,
void* pContext
@@ -1363,10 +1492,10 @@ NFCSTATUS phLibNfc_Mgt_ConfigureDiscovery (phLibNfc_eDiscoveryConfigMode_t Disc
*
* This function is called to connect to discovered target.
* Once notification handler notified sucessfully discovered targets will be available in
-* \ref phLibNfc_RemoteDevList_t .Remote device list contains valid handles for discovered
+* \ref phLibNfc_RemoteDevList_t .Remote device list contains valid handles for discovered
* targets .Using this interface LibNfc client can connect to one out of 'n' discovered targets.
* A new session is started after connect operation is successful.The session ends with a
-* successful disconnect operation.Connect operation on an already connected tag Reactivates
+* successful disconnect operation.Connect operation on an already connected tag Reactivates
* the Tag.This Feature is not Valid for Jewel/Topaz Tags ,and hence a second connect if issued
* without disconnecting a Jewel/Topaz tag always Fails.
*
@@ -1374,7 +1503,7 @@ NFCSTATUS phLibNfc_Mgt_ConfigureDiscovery (phLibNfc_eDiscoveryConfigMode_t Disc
*
* \param[in] hRemoteDevice Handle of the target device obtained during discovery process.
*
-* \param[in] pNotifyConnect_RspCb Client response callback to be to be
+* \param[in] pNotifyConnect_RspCb Client response callback to be to be
* notified to indicate status of the request.
*
* \param[in] pContext Client context which will be included in
@@ -1382,7 +1511,7 @@ NFCSTATUS phLibNfc_Mgt_ConfigureDiscovery (phLibNfc_eDiscoveryConfigMode_t Disc
*
*\retval NFCSTATUS_PENDING Request initiated, result will be informed via
* callback.
-*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be properly interpreted.
*\retval NFCSTATUS_TARGET_LOST Indicates target is lost.
*\retval NFSCSTATUS_SHUTDOWN shutdown in progress.
@@ -1421,13 +1550,13 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(phLibNfc_Handle hRemoteDevic
*
* This function is called only if there are more than one remote device is detected.
* Once notification handler notified sucessfully discovered targets will be available in
-* \ref phLibNfc_RemoteDevList_t .Remote device list contains valid handles for discovered
+* \ref phLibNfc_RemoteDevList_t .Remote device list contains valid handles for discovered
* targets .Using this interface LibNfc client can connect to one out of 'n' discovered targets.
* A new session is started after connect operation is successful.
-* Similarly, if the user wants to connect to another handle. Libnfc client can select the handle and
+* Similarly, if the user wants to connect to another handle. Libnfc client can select the handle and
* the previously connected device is replaced by present handle. The session ends with a
-* successful disconnect operation.
-* Re-Connect operation on an already connected tag Reactivates the Tag. This Feature is not
+* successful disconnect operation.
+* Re-Connect operation on an already connected tag Reactivates the Tag. This Feature is not
* Valid for Jewel/Topaz Tags ,and hence a second re-connect if issued
* without disconnecting a Jewel/Topaz tag always Fails.
*
@@ -1435,7 +1564,7 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(phLibNfc_Handle hRemoteDevic
*
* \param[in] hRemoteDevice Handle of the target device obtained during discovery process.
*
-* \param[in] pNotifyReConnect_RspCb Client response callback to be to be
+* \param[in] pNotifyReConnect_RspCb Client response callback to be to be
* notified to indicate status of the request.
*
* \param[in] pContext Client context which will be included in
@@ -1443,7 +1572,7 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(phLibNfc_Handle hRemoteDevic
*
*\retval NFCSTATUS_PENDING Request initiated, result will be informed via
* callback.
-*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be properly interpreted.
*\retval NFCSTATUS_TARGET_LOST Indicates target is lost.
*\retval NFSCSTATUS_SHUTDOWN shutdown in progress.
@@ -1472,7 +1601,7 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(phLibNfc_Handle hRemoteDevic
*
*\endmsc
*/
-NFCSTATUS
+NFCSTATUS
phLibNfc_RemoteDev_ReConnect (
phLibNfc_Handle hRemoteDevice,
pphLibNfc_ConnectCallback_t pNotifyReConnect_RspCb,
@@ -1484,27 +1613,27 @@ phLibNfc_RemoteDev_ReConnect (
* \ingroup grp_lib_nfc
* \brief This interface allows to perform Read/write operation on remote device.
*
-* This function allows to send data to and receive data
-* from the target selected by libNfc client.It is also used by the
+* This function allows to send data to and receive data
+* from the target selected by libNfc client.It is also used by the
* NFCIP1 Initiator while performing a transaction with the NFCIP1 target.
-* The LibNfc client has to provide the handle of the target and the
+* The LibNfc client has to provide the handle of the target and the
* command in order to communicate with the selected remote device.
*
*
-*\param[in] hRemoteDevice handle of the remote device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice handle of the remote device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
-* \param[in] psTransceiveInfo Information required by transceive is concealed in
-* this structure.It contains send,receive buffers
+* \param[in] psTransceiveInfo Information required by transceive is concealed in
+* this structure.It contains send,receive buffers
* and command specific details.
*
*
-* \param[in] pTransceive_RspCb Callback function for returning the received response
+* \param[in] pTransceive_RspCb Callback function for returning the received response
* or error.
* \param[in] pContext Client context which will be included in
* callback when the request is completed.
*
-* \retval NFCSTATUS_PENDING Request initiated, result will be informed through
+* \retval NFCSTATUS_PENDING Request initiated, result will be informed through
* the callback.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could
* not be properly interpreted or invalid.
@@ -1546,24 +1675,24 @@ NFCSTATUS phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteD
*\ingroup grp_lib_nfc
*\brief Allows to disconnect from already connected target.
*
-* The function allows to disconnect from from already connected target. This
-* function closes the session opened during connect operation.The status of discovery
-* wheel after disconnection is determined by the \ref phLibNfc_eReleaseType_t parameter.
+* The function allows to disconnect from from already connected target. This
+* function closes the session opened during connect operation.The status of discovery
+* wheel after disconnection is determined by the \ref phLibNfc_eReleaseType_t parameter.
* it is also used to switch from wired to virtual mode in case the discovered
-* device is SmartMX in wired mode.
+* device is SmartMX in wired mode.
*
-*\param[in] hRemoteDevice handle of the target device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice handle of the target device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
-* \param[in] ReleaseType Release mode to be used while
+* \param[in] ReleaseType Release mode to be used while
* disconnecting from target.Refer \ref phLibNfc_eReleaseType_t
* for possible release types.
-*\param[in] pDscntCallback Client response callback to be to be notified
+*\param[in] pDscntCallback Client response callback to be to be notified
to indicate status of the request.
* \param[in] pContext Client context which will be included in
* callback when the request is completed.
-*\retval NFCSTATUS_PENDING Request initiated, result will be informed through
+*\retval NFCSTATUS_PENDING Request initiated, result will be informed through
the callback.
*\retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not be
* properly interpreted.
@@ -1602,7 +1731,7 @@ NFCSTATUS phLibNfc_RemoteDev_Disconnect( phLibNfc_Handle hRemote
phLibNfc_eReleaseType_t ReleaseType,
pphLibNfc_DisconnectCallback_t pDscntCallback,
void* pContext
- );
+ );
@@ -1612,7 +1741,7 @@ NFCSTATUS phLibNfc_RemoteDev_Disconnect( phLibNfc_Handle hRemote
*
* This function unregisters the listener which has been registered with
* phLibNfc_RemoteDev_NtfUnregister() before. After this call the callback
-* function won't be called anymore. If nothing is registered the
+* function won't be called anymore. If nothing is registered the
* function still succeeds
* \retval NFCSTATUS_SUCCESS callback unregistered.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -1641,8 +1770,8 @@ NFCSTATUS phLibNfc_RemoteDev_NtfUnregister(void);
* tag is present in RF field or not.
*
*
-*\param[in] hRemoteDevice handle of the target device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice handle of the target device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
* \param[in] pPresenceChk_RspCb callback function called on completion of the
* presence check or in case an error has occurred.
@@ -1699,15 +1828,15 @@ NFCSTATUS phLibNfc_RemoteDev_CheckPresence( phLibNfc_Handle hRemoteDevice,
*\brief Allows to check connected tag is NDEF compliant or not.
* This function allows to validate connected tag is NDEF compliant or not.
*
-*\param[in] hRemoteDevice handle of the remote device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice handle of the remote device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
-*\param[in] pCheckNdef_RspCb Response callback defined by the caller.
+*\param[in] pCheckNdef_RspCb Response callback defined by the caller.
*\param[in] pContext Client context which will be included in
* callback when the request is completed.
*
* \retval NFCSTATUS_PENDING The action has been successfully triggered.
-* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function
+* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function
* is invalid.
* \retval NFCSTATUS_TARGET_LOST Indicates target is lost
* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
@@ -1739,7 +1868,7 @@ NFCSTATUS phLibNfc_RemoteDev_CheckPresence( phLibNfc_Handle hRemoteDevice,
* \param[in] status Status of the response callback.
*
* \param NFCSTATUS_SUCCESS Successful and tag is NDEF compliant .
-* \param NFCSTATUS_TARGET_LOST NDEF check operation is failed because of target is ** lost.
+* \param NFCSTATUS_TARGET_LOST NDEF check operation is failed because of target is ** lost.
* \param NFCSTATUS_SHUTDOWN Shutdown in progress.
* \param NFCSTATUS_ABORTED Aborted due to disconnect operation in between.
* \param NFCSTATUS_FAILED Request failed.
@@ -1752,26 +1881,26 @@ NFCSTATUS phLibNfc_Ndef_CheckNdef(phLibNfc_Handle hRemoteDevice,
/**
* \ingroup grp_lib_nfc
* \brief Read NDEF message from a Tag.
-* This function reads an NDEF message from already connected tag.
-* the NDEF message is read starting after the position of the last read operation
+* This function reads an NDEF message from already connected tag.
+* the NDEF message is read starting after the position of the last read operation
* of the same tag during current session.
* If it's FALSE the NDEF message is read from starting of the NDEF message.
-* If the call returns with NFCSTATUS_PENDING , a response callback pNdefRead_RspCb is
+* If the call returns with NFCSTATUS_PENDING , a response callback pNdefRead_RspCb is
* called ,when the read operation is complete.
*
*\note Before issuing NDEF read operation LibNfc client should perform NDEF check operation
* using \ref phLibNfc_Ndef_CheckNdef interface.
-* If the call back error code is NFCSTATUS_FAILED then the LIBNFC client has to do the
+* If the call back error code is NFCSTATUS_FAILED then the LIBNFC client has to do the
* phLibNfc_RemoteDev_CheckPresence to find , its communication error or target lost.
*
-*\param[in] hRemoteDevice handle of the remote device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice handle of the remote device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
* \param[in] psRd Pointer to the read buffer info.
-* \param[in] Offset Reading Offset : phLibNfc_Ndef_EBegin means from the
-* beginning, phLibNfc_Ndef_ECurrent means from the
-* current offset.
-* \param[in] pNdefRead_RspCb Response callback defined by the caller.
+* \param[in] Offset Reading Offset : phLibNfc_Ndef_EBegin means from the
+* beginning, phLibNfc_Ndef_ECurrent means from the
+* current offset.
+* \param[in] pNdefRead_RspCb Response callback defined by the caller.
* \param[in] pContext Client context which will be included in
* callback when the request is completed.
*
@@ -1780,13 +1909,13 @@ NFCSTATUS phLibNfc_Ndef_CheckNdef(phLibNfc_Handle hRemoteDevice,
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress
* \retval NFCSTATUS_INVALID_HANDLE Target handle is invalid
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
-* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
* be properly interpreted.
-* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
+* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
* \retval NFCSTATUS_FAILED Read operation failed since tag does not contain NDEF data.
* \retval NFCSTATUS_NON_NDEF_COMPLIANT Tag is not Ndef Compliant.
-* \param NFCSTATUS_REJECTED Rejected due to NDEF read issued on non
-* ,or Ndef check has not been performed
+* \param NFCSTATUS_REJECTED Rejected due to NDEF read issued on non
+* ,or Ndef check has not been performed
* before the readNDEF tag.
*
*\msc
@@ -1830,27 +1959,27 @@ NFCSTATUS phLibNfc_Ndef_Read(phLibNfc_Handle hRemoteDevice,
* \brief Write NDEF data to NFC tag.
*
* This function allows the client to write a NDEF data to already connected NFC tag.
-* Function writes a complete NDEF message to a tag. If a NDEF message already
+* Function writes a complete NDEF message to a tag. If a NDEF message already
* exists in the tag, it will be overwritten. When the transaction is complete,
* a notification callback is notified.
-*
+*
*\note Before issuing NDEF write operation LibNfc client should perform NDEF check operation
* using \ref phLibNfc_Ndef_CheckNdef interface.
*
-*\param[in] hRemoteDevice handle of the remote device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice handle of the remote device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
-*\param[in] psWr Ndef Buffer to write. If NdefMessageLen is set to 0
+*\param[in] psWr Ndef Buffer to write. If NdefMessageLen is set to 0
* and pNdefMessage = NULL, the NFC library will erase
* tag internally.
-*\param[in] pNdefWrite_RspCb Response callback defined by the caller.
+*\param[in] pNdefWrite_RspCb Response callback defined by the caller.
*\param[in] pContext Client context which will be included in
* callback when the request is completed.
*
*\note If \ref phNfc_sData_t.NdefMessageLen is 0 bytes, this function will erase all
*current NDEF data present in the tag. Any non-zero length buffer size
*will attempt to write NEDF data onto the tag.
-* If the call back error code is NFCSTATUS_FAILED then the LIBNFC client has to do the
+* If the call back error code is NFCSTATUS_FAILED then the LIBNFC client has to do the
* phLibNfc_RemoteDev_CheckPresence to find , its communication error or target lost.
*
*
@@ -1858,11 +1987,11 @@ NFCSTATUS phLibNfc_Ndef_Read(phLibNfc_Handle hRemoteDevice,
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
* \retval NFCSTATUS_INVALID_HANDLE Target handle is invalid.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
-* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
* be properly interpreted.
* \retval NFCSTATUS_NON_NDEF_COMPLIANT Tag is not Ndef Compliant.
-* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
-* \retval NFCSTATUS_REJECTED Rejected due to NDEF write issued without
+* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
+* \retval NFCSTATUS_REJECTED Rejected due to NDEF write issued without
* performing a CheckNdef().
* \retval NFCSTATUS_FAILED operation failed.
*
@@ -1911,21 +2040,21 @@ NFCSTATUS phLibNfc_Ndef_Write (phLibNfc_Handle hRemoteDevice,
* \brief Format target.
*
* This function allows the LibNfc client to perform NDEF formating operation on discovered target.
-This function formats given target
+This function formats given target
*
-*\note
+*\note
* <br>1. Prior to formating it is recommended to perform NDEF check using \ref phLibNfc_Ndef_CheckNdef interface.
* <br>2. formatting feature supported only for MIFARE Std,MIFARE UL and Desfire tag types.
-* If the call back error code is NFCSTATUS_FAILED then the LIBNFC client has to do the
+* If the call back error code is NFCSTATUS_FAILED then the LIBNFC client has to do the
* phLibNfc_RemoteDev_CheckPresence to find , its communication error or target lost.
*
-*\param[in] hRemoteDevice handle of the remote device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice handle of the remote device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
*\param[in] pScrtKey info containing the secret key data
-* and Secret key buffer length.
+* and Secret key buffer length.
*
-*\param[in] pNdefformat_RspCb Response callback defined by the caller.
+*\param[in] pNdefformat_RspCb Response callback defined by the caller.
*\param[in] pContext Client context which will be included in
* callback when the request is completed.
*
@@ -1934,9 +2063,9 @@ This function formats given target
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
* \retval NFCSTATUS_INVALID_HANDLE Target handle is invalid.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
-* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
* be properly interpreted.
-* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
+* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
* \retval NFCSTATUS_FAILED operation failed.
* \retval NFCSTATUS_REJECTED Tag is already formatted one.
*
@@ -1972,7 +2101,7 @@ This function formats given target
*/
NFCSTATUS phLibNfc_RemoteDev_FormatNdef(phLibNfc_Handle hRemoteDevice,
- phNfc_sData_t* pScrtKey,
+ phNfc_sData_t* pScrtKey,
pphLibNfc_RspCb_t pNdefformat_RspCb,
void* pContext
);
@@ -2053,7 +2182,7 @@ NFCSTATUS phLibNfc_ConvertToReadOnlyNdef (phLibNfc_Handle hRemoteDevice,
/**
* \ingroup grp_lib_nfc
* \brief <b>Search for NDEF Record type</b>.
-*
+*
* This function allows LibNfc client to search NDEF content based on TNF value and type \n
*
*This API allows to find NDEF records based on RTD (Record Type Descriptor) info.
@@ -2061,17 +2190,17 @@ NFCSTATUS phLibNfc_ConvertToReadOnlyNdef (phLibNfc_Handle hRemoteDevice,
*In case there is match LibNfc notifies LibNfc client with NDEF information details.
*LibNfc client can search a new NDEF registration type once the previous call is handled.
*
-*\param[in] hRemoteDevice Handle of the remote device.This handle to be
-* same as as handle obtained for specific remote device
+*\param[in] hRemoteDevice Handle of the remote device.This handle to be
+* same as as handle obtained for specific remote device
* during device discovery.
*\param[in] psSrchTypeList List of NDEF records to be looked in based on TNF value and type.
* For NDEF search type refer to \ref phLibNfc_Ndef_SrchType.
* If this set to NULL then it means that libNfc client interested in
* all possible NDEF records.
*
-*\param[in] uNoSrchRecords Indicates no of NDEF records in requested list as mentioned
+*\param[in] uNoSrchRecords Indicates no of NDEF records in requested list as mentioned
* in psSrchTypeList.
-*\param[in] pNdefNtfRspCb Response callback defined by the caller.
+*\param[in] pNdefNtfRspCb Response callback defined by the caller.
*\param[in] pContext Client context which will be included in
* callback when callback is notified.
*
@@ -2080,11 +2209,11 @@ NFCSTATUS phLibNfc_ConvertToReadOnlyNdef (phLibNfc_Handle hRemoteDevice,
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_INVALID_HANDLE Target handle is invalid.
-* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters could not
* be properly interpreted.
-* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
+* \retval NFCSTATUS_TARGET_NOT_CONNECTED The Remote Device is not connected.
* \retval NFCSTATUS_FAILED operation failed.
-* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
*
* \retval NFCSTATUS_ABORTED Aborted due to disconnect request in between.
*\msc
@@ -2111,12 +2240,12 @@ NFCSTATUS phLibNfc_ConvertToReadOnlyNdef (phLibNfc_Handle hRemoteDevice,
* \param[in] status Status of the response callback.
*
*/
-NFCSTATUS phLibNfc_Ndef_SearchNdefContent(
+NFCSTATUS phLibNfc_Ndef_SearchNdefContent(
phLibNfc_Handle hRemoteDevice,
- phLibNfc_Ndef_SrchType_t* psSrchTypeList,
+ phLibNfc_Ndef_SrchType_t* psSrchTypeList,
uint8_t uNoSrchRecords,
- pphLibNfc_Ndef_Search_RspCb_t pNdefNtfRspCb,
- void * pContext
+ pphLibNfc_Ndef_Search_RspCb_t pNdefNtfRspCb,
+ void * pContext
);
@@ -2126,22 +2255,22 @@ NFCSTATUS phLibNfc_Ndef_SearchNdefContent(
* \ingroup grp_lib_nfc
* \brief <b> Interface used to receive data from initiator at target side during P2P communication</b>.
*
-*This function Allows the NFC-IP1 target to retrieve data/commands coming from the
-*Initiator.Once this function is called by LibNfc client on target side it waits for
+*This function Allows the NFC-IP1 target to retrieve data/commands coming from the
+*Initiator.Once this function is called by LibNfc client on target side it waits for
*receiving data from initiator.It is used by libNfc client which acts as target during P2P
*communication.
*
-*\note : Once this API is called,its mandatory to wait for receive
-*\ref pphLibNfc_Receive_RspCb_t callback notification,before calling any other
+*\note : Once this API is called,its mandatory to wait for receive
+*\ref pphLibNfc_Receive_RspCb_t callback notification,before calling any other
*API.Only function allowed is \ref phLibNfc_Mgt_DeInitialize.
*
* \param[in] hRemoteDevice Peer handle obtained during device discovery process.
-*
-* \param[in] pReceiveRspCb Callback function called after receiving
-* the data or in case an error has
+*
+* \param[in] pReceiveRspCb Callback function called after receiving
+* the data or in case an error has
* has occurred.
*
-* \param[in] pContext Upper layer context to be returned
+* \param[in] pContext Upper layer context to be returned
* in the callback.
*
* \retval NFCSTATUS_PENDING Receive operation is in progress.
@@ -2151,13 +2280,13 @@ NFCSTATUS phLibNfc_Ndef_SearchNdefContent(
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
-* initiator issued disconnect or intiator
+* initiator issued disconnect or intiator
* physically removed from the RF field.
*
*\retval NFCSTATUS_REJECTED Indicates invalid request.
*\retval NFCSTATUS_FAILED Request failed.
*
-*\msc
+*\msc
*P2PInitiatorClient,InitiatorLibNfc,P2PTargetLibNfc,P2PTargetClient;
*--- [label="stack is intialised and P2P notification handler registered alredy"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_Mgt_SetP2P_ConfigParams()",URL="\ref phLibNfc_Mgt_SetP2P_ConfigParams"];
@@ -2167,7 +2296,7 @@ NFCSTATUS phLibNfc_Ndef_SearchNdefContent(
*P2PInitiatorClient<<InitiatorLibNfc [label="NFCSTATUS_PENDING"];
*P2PInitiatorClient<-InitiatorLibNfc [label="pConfigRspCb()",URL="\ref pphLibNfc_RspCb_t"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_Mgt_ConfigureDiscovery()",URL="\ref phLibNfc_Mgt_ConfigureDiscovery"];
-*P2PTargetClient<<P2PTargetLibNfc [label="NFCSTATUS_PENDING"];
+*P2PTargetClient<<P2PTargetLibNfc [label="NFCSTATUS_PENDING"];
*P2PTargetClient<-P2PTargetLibNfc [label="pConfigDiscovery_RspCb",URL="\ref pphLibNfc_RspCb_t"];
*P2PInitiatorClient=>InitiatorLibNfc [label="phLibNfc_Mgt_ConfigureDiscovery()",URL="\ref phLibNfc_Mgt_ConfigureDiscovery"];
*P2PInitiatorClient<<InitiatorLibNfc [label="NFCSTATUS_PENDING"];
@@ -2181,7 +2310,7 @@ NFCSTATUS phLibNfc_Ndef_SearchNdefContent(
*--- [label="On connect target must be immediately ready to receive data from initiator"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_RemoteDev_Receive()",URL="\ref phLibNfc_RemoteDev_Receive"];
*--- [label="Now target waits to receive data from intiator"];
-*--- [label="Send data from initiator now"];
+*--- [label="Send data from initiator now"];
*P2PInitiatorClient=>InitiatorLibNfc [label="phLibNfc_RemoteDev_Transceive()",URL="\ref phLibNfc_RemoteDev_Transceive "];
*P2PInitiatorClient<-InitiatorLibNfc [label="pTransceive_RspCb",URL="\ref pphLibNfc_TransceiveCallback_t"];
*--- [label="Now data arrived at target side"];
@@ -2197,19 +2326,131 @@ NFCSTATUS phLibNfc_Ndef_SearchNdefContent(
* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
* or intiator removed physically from the RF field.
* This status code reported,to indicate P2P session
-* closed and send and receive requests not allowed
+* closed and send and receive requests not allowed
* any more unless new session is started.
* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
-* initiator issued disconnect or intiator
+* initiator issued disconnect or intiator
* physically removed from the RF field.
*/
-extern
-NFCSTATUS
+extern
+NFCSTATUS
phLibNfc_RemoteDev_Receive( phLibNfc_Handle hRemoteDevice,
pphLibNfc_Receive_RspCb_t pReceiveRspCb,
void* pContext
);
+/**
+* \ingroup grp_lib_nfc
+* \brief <b> Interface used to receive data from reader at target side during communication</b>.
+*
+*This function Allows the target to retrieve data/commands coming from the
+*Reader.Once this function is called by LibNfc client on target side it waits for
+*receiving data from initiator.It is used by libNfc client which acts as target during P2P
+*communication.
+*
+*\note : Once this API is called,its mandatory to wait for receive
+*\ref pphLibNfc_Receive_RspCb_t callback notification,before calling any other
+*API.Only function allowed is \ref phLibNfc_Mgt_DeInitialize.
+*
+* \param[in] pReceiveRspCb Callback function called after receiving
+* the data or in case an error has
+* has occurred.
+*
+* \param[in] pContext Upper layer context to be returned
+* in the callback.
+*
+* \retval NFCSTATUS_PENDING Receive operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
+* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*
+*\retval NFCSTATUS_REJECTED Indicates invalid request.
+*\retval NFCSTATUS_FAILED Request failed.
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS Receive operation successful.
+* \param NFCSTATUS_SHUTDOWN Receive operation failed because Shutdown in progress.
+* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
+* or intiator removed physically from the RF field.
+* This status code reported,to indicate P2P session
+* closed and send and receive requests not allowed
+* any more unless new session is started.
+* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*/
+extern
+NFCSTATUS
+phLibNfc_RemoteDev_CE_A_Receive(
+ pphLibNfc_TransceiveCallback_t pReceiveRspCb,
+ void* pContext
+ );
+
+/**
+* \ingroup grp_lib_nfc
+* \brief <b> Interface used to receive data from reader at target side during communication</b>.
+*
+*This function Allows the target to retrieve data/commands coming from the
+*Reader.Once this function is called by LibNfc client on target side it waits for
+*receiving data from initiator.It is used by libNfc client which acts as target during P2P
+*communication.
+*
+*\note : Once this API is called,its mandatory to wait for receive
+*\ref pphLibNfc_Receive_RspCb_t callback notification,before calling any other
+*API.Only function allowed is \ref phLibNfc_Mgt_DeInitialize.
+*
+* \param[in] pReceiveRspCb Callback function called after receiving
+* the data or in case an error has
+* has occurred.
+*
+* \param[in] pContext Upper layer context to be returned
+* in the callback.
+*
+* \retval NFCSTATUS_PENDING Receive operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
+* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*
+*\retval NFCSTATUS_REJECTED Indicates invalid request.
+*\retval NFCSTATUS_FAILED Request failed.
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS Receive operation successful.
+* \param NFCSTATUS_SHUTDOWN Receive operation failed because Shutdown in progress.
+* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
+* or intiator removed physically from the RF field.
+* This status code reported,to indicate P2P session
+* closed and send and receive requests not allowed
+* any more unless new session is started.
+* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*/
+extern
+NFCSTATUS
+phLibNfc_RemoteDev_CE_B_Receive(
+ pphLibNfc_TransceiveCallback_t pReceiveRspCb,
+ void* pContext
+ );
+
@@ -2218,20 +2459,20 @@ phLibNfc_RemoteDev_Receive( phLibNfc_Handle hRemoteDevice,
* \ingroup grp_lib_nfc
* \brief <b>Interface used to send data from target to initiator during P2P communication</b>.
*
-*This function Allows the NFC-IP1 target to send data to Initiator,in response to packet received
-*from initiator during P2P communication.It is must prior to send request target has received
+*This function Allows the NFC-IP1 target to send data to Initiator,in response to packet received
+*from initiator during P2P communication.It is must prior to send request target has received
*data from initiator using \ref phLibNfc_RemoteDev_Receive interface.
*
*
* \param[in] hRemoteDevice Peer handle obtained during device discovery process.
*
-* \param[in] pTransferData Data and the length of the data to be
+* \param[in] pTransferData Data and the length of the data to be
* transferred.
-* \param[in] pSendRspCb Callback function called on completion
-* of the NfcIP sequence or in case an
+* \param[in] pSendRspCb Callback function called on completion
+* of the NfcIP sequence or in case an
* error has occurred.
*
-* \param[in] pContext Upper layer context to be returned in
+* \param[in] pContext Upper layer context to be returned in
* the callback.
*
** \retval NFCSTATUS_PENDING Send operation is in progress.
@@ -2240,14 +2481,14 @@ phLibNfc_RemoteDev_Receive( phLibNfc_Handle hRemoteDevice,
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
-* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
-* initiator issued disconnect or intiator
+* initiator issued disconnect or intiator
* physically removed from the RF field.
*\retval NFCSTATUS_REJECTED Indicates invalid request.
*\retval NFCSTATUS_FAILED Request failed.
*
-*\msc
+*\msc
*P2PInitiatorClient,InitiatorLibNfc,P2PTargetLibNfc,P2PTargetClient;
*--- [label="stack is intialised and P2P notification handler registered alredy"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_Mgt_SetP2P_ConfigParams()",URL="\ref phLibNfc_Mgt_SetP2P_ConfigParams"];
@@ -2257,7 +2498,7 @@ phLibNfc_RemoteDev_Receive( phLibNfc_Handle hRemoteDevice,
*P2PInitiatorClient<<InitiatorLibNfc [label="NFCSTATUS_PENDING"];
*P2PInitiatorClient<-InitiatorLibNfc [label="pConfigRspCb()",URL="\ref pphLibNfc_RspCb_t"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_Mgt_ConfigureDiscovery()",URL="\ref phLibNfc_Mgt_ConfigureDiscovery"];
-*P2PTargetClient<<P2PTargetLibNfc [label="NFCSTATUS_PENDING"];
+*P2PTargetClient<<P2PTargetLibNfc [label="NFCSTATUS_PENDING"];
*P2PTargetClient<-P2PTargetLibNfc [label="pConfigDiscovery_RspCb",URL="\ref pphLibNfc_RspCb_t"];
*P2PInitiatorClient=>InitiatorLibNfc [label="phLibNfc_Mgt_ConfigureDiscovery()",URL="\ref phLibNfc_Mgt_ConfigureDiscovery"];
*P2PInitiatorClient<<InitiatorLibNfc [label="NFCSTATUS_PENDING"];
@@ -2271,7 +2512,7 @@ phLibNfc_RemoteDev_Receive( phLibNfc_Handle hRemoteDevice,
*--- [label="On connect target must be immediately ready to receive data from initiator"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_RemoteDev_Receive()",URL="\ref phLibNfc_RemoteDev_Receive"];
*--- [label="Now target waits to receive data from intiator"];
-*--- [label="Send data from initiator now"];
+*--- [label="Send data from initiator now"];
*P2PInitiatorClient=>InitiatorLibNfc [label="phLibNfc_RemoteDev_Transceive()",URL="\ref phLibNfc_RemoteDev_Transceive "];
*--- [label="Now data arrived at target side"];
*P2PTargetClient<-P2PTargetLibNfc [label="pReceiveRspCb",URL="\ref pphLibNfc_Receive_RspCb_t"];
@@ -2291,16 +2532,16 @@ phLibNfc_RemoteDev_Receive( phLibNfc_Handle hRemoteDevice,
* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
* or intiator removed physically from the RF field.
* This status code reported,to indicate P2P session
-* closed and send and receive requests not allowed
+* closed and send and receive requests not allowed
* any more unless new session is started.
* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
-* initiator issued disconnect or intiator
+* initiator issued disconnect or intiator
* physically removed from the RF field.
*
*
*/
-extern
-NFCSTATUS
+extern
+NFCSTATUS
phLibNfc_RemoteDev_Send(phLibNfc_Handle hRemoteDevice,
phNfc_sData_t* pTransferData,
pphLibNfc_RspCb_t pSendRspCb,
@@ -2309,8 +2550,238 @@ phLibNfc_RemoteDev_Send(phLibNfc_Handle hRemoteDevice,
/**
* \ingroup grp_lib_nfc
+* \brief <b>Interface used to send data from A target to reader during communication</b>.
+*
+*This function Allows the A type target to send data to Initiator,in response to packet received
+*from reader during CE communication.It is must prior to send request target has received
+*data from initiator using \ref phLibNfc_RemoteDev_Receive interface.
+*
+*
+* \param[in] pTransferData Data and the length of the data to be
+* transferred.
+* \param[in] pSendRspCb Callback function called on completion
+* of the NfcIP sequence or in case an
+* error has occurred.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+** \retval NFCSTATUS_PENDING Send operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*\retval NFCSTATUS_REJECTED Indicates invalid request.
+*\retval NFCSTATUS_FAILED Request failed.
+*
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS Send operation successful.
+* \param NFCSTATUS_SHUTDOWN Send operation failed because Shutdown in progress.
+* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
+* or intiator removed physically from the RF field.
+* This status code reported,to indicate P2P session
+* closed and send and receive requests not allowed
+* any more unless new session is started.
+* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*
+*
+*/
+extern
+NFCSTATUS
+phLibNfc_RemoteDev_CE_A_Send(
+ phNfc_sData_t* pTransferData,
+ pphLibNfc_RspCb_t pSendRspCb,
+ void* pContext
+ );
+
+/**
+* \ingroup grp_lib_nfc
+* \brief <b>Interface used to send data from A target to reader during communication</b>.
+*
+*This function Allows the B type target to send data to Initiator,in response to packet received
+*from reader during CE communication.It is must prior to send request target has received
+*data from initiator using \ref phLibNfc_RemoteDev_Receive interface.
+*
+*
+* \param[in] pTransferData Data and the length of the data to be
+* transferred.
+* \param[in] pSendRspCb Callback function called on completion
+* of the NfcIP sequence or in case an
+* error has occurred.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+** \retval NFCSTATUS_PENDING Send operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*\retval NFCSTATUS_REJECTED Indicates invalid request.
+*\retval NFCSTATUS_FAILED Request failed.
+*
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS Send operation successful.
+* \param NFCSTATUS_SHUTDOWN Send operation failed because Shutdown in progress.
+* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
+* or intiator removed physically from the RF field.
+* This status code reported,to indicate P2P session
+* closed and send and receive requests not allowed
+* any more unless new session is started.
+* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*
+*
+*/
+extern
+NFCSTATUS
+phLibNfc_RemoteDev_CE_B_Send(
+ phNfc_sData_t* pTransferData,
+ pphLibNfc_RspCb_t pSendRspCb,
+ void* pContext
+ );
+
+/**
+* \ingroup grp_lib_nfc
+* \brief <b>Interface used to transceive data from A target to reader during communication</b>.
+*
+*This function Allows the A type target to send data to Initiator,in response to packet received
+*from reader during CE communication.It is must prior to send request target has received
+*data from initiator using \ref phLibNfc_RemoteDev_Receive interface.
+*
+*
+* \param[in] pTransferData Data and the length of the data to be
+* transferred.
+* \param[in] pRecvRspCb Callback function called on completion
+* of the NfcIP sequence or in case an
+* error has occurred.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+** \retval NFCSTATUS_PENDING Send operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*\retval NFCSTATUS_REJECTED Indicates invalid request.
+*\retval NFCSTATUS_FAILED Request failed.
+*
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS Send operation successful.
+* \param NFCSTATUS_SHUTDOWN Send operation failed because Shutdown in progress.
+* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
+* or intiator removed physically from the RF field.
+* This status code reported,to indicate P2P session
+* closed and send and receive requests not allowed
+* any more unless new session is started.
+* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*
+*
+*/
+extern
+NFCSTATUS
+phLibNfc_RemoteDev_CE_A_Transceive(
+ phNfc_sData_t * pTransferData,
+ pphLibNfc_TransceiveCallback_t pTransceive_RspCb,
+ void *pContext
+ );
+/**
+* \ingroup grp_lib_nfc
+* \brief <b>Interface used to transceive data from B target to reader during communication</b>.
+*
+*This function Allows the B type target to send data to Initiator,in response to packet received
+*from reader during CE communication.It is must prior to send request target has received
+*data from initiator using \ref phLibNfc_RemoteDev_Receive interface.
+*
+*
+* \param[in] pTransferData Data and the length of the data to be
+* transferred.
+* \param[in] pRecvRspCb Callback function called on completion
+* of the NfcIP sequence or in case an
+* error has occurred.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+** \retval NFCSTATUS_PENDING Send operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_INVALID_DEVICE The device has been disconnected meanwhile.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+* \retval NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*\retval NFCSTATUS_REJECTED Indicates invalid request.
+*\retval NFCSTATUS_FAILED Request failed.
+*
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS Send operation successful.
+* \param NFCSTATUS_SHUTDOWN Send operation failed because Shutdown in progress.
+* \param NFCSTATUS_ABORTED Aborted due to initiator issued disconnect request.
+* or intiator removed physically from the RF field.
+* This status code reported,to indicate P2P session
+* closed and send and receive requests not allowed
+* any more unless new session is started.
+* \param NFCSTATUS_DESELECTED Receive operation is not possible due to
+* initiator issued disconnect or intiator
+* physically removed from the RF field.
+*
+*
+*/
+extern
+NFCSTATUS
+phLibNfc_RemoteDev_CE_B_Transceive(
+ phNfc_sData_t * pTransferData,
+ pphLibNfc_TransceiveCallback_t pTransceive_RspCb,
+ void *pContext
+ );
+/**
+* \ingroup grp_lib_nfc
* \brief <b>Interface to configure P2P and intiator mode configurations</b>.
-* The setting will be typically take effect for the next cycle of the relevant
+* The setting will be typically take effect for the next cycle of the relevant
* phase of discovery. For optional configuration internal defaults will be
* used in case the configuration is not set.
*
@@ -2319,10 +2790,10 @@ phLibNfc_RemoteDev_Send(phLibNfc_Handle hRemoteDevice,
* \param[in] pConfigInfo Union containing P2P configuration details as
* in \ref phLibNfc_sNfcIPCfg_t.
*
-* \param[in] pConfigRspCb This callback has to be called once LibNfc
+* \param[in] pConfigRspCb This callback has to be called once LibNfc
* completes the Configuration.
*
-* \param[in] pContext Upper layer context to be returned in
+* \param[in] pContext Upper layer context to be returned in
* the callback.
*
*
@@ -2331,9 +2802,9 @@ phLibNfc_RemoteDev_Send(phLibNfc_Handle hRemoteDevice,
* could not be properly interpreted.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
-* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
*
-*\msc
+*\msc
*P2PInitiatorClient,InitiatorLibNfc,P2PTargetLibNfc,P2PTargetClient;
*--- [label="stack is intialised and P2P notification handler registered alredy"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_Mgt_SetP2P_ConfigParams()",URL="\ref phLibNfc_Mgt_SetP2P_ConfigParams"];
@@ -2342,7 +2813,7 @@ phLibNfc_RemoteDev_Send(phLibNfc_Handle hRemoteDevice,
*P2PInitiatorClient=>InitiatorLibNfc [label="phLibNfc_Mgt_SetP2P_ConfigParams()",URL="\ref phLibNfc_Mgt_SetP2P_ConfigParams"];
*P2PInitiatorClient<<InitiatorLibNfc [label="NFCSTATUS_PENDING"];
*P2PTargetClient=>P2PTargetLibNfc [label="phLibNfc_Mgt_ConfigureDiscovery()",URL="\ref phLibNfc_Mgt_ConfigureDiscovery"];
-*P2PTargetClient<<P2PTargetLibNfc [label="NFCSTATUS_PENDING"];
+*P2PTargetClient<<P2PTargetLibNfc [label="NFCSTATUS_PENDING"];
*P2PTargetClient<-P2PTargetLibNfc [label="pConfigDiscovery_RspCb",URL="\ref pphLibNfc_RspCb_t"];
*P2PInitiatorClient=>InitiatorLibNfc [label="phLibNfc_Mgt_ConfigureDiscovery()",URL="\ref phLibNfc_Mgt_ConfigureDiscovery"];
*P2PInitiatorClient<<InitiatorLibNfc [label="NFCSTATUS_PENDING"];
@@ -2371,12 +2842,114 @@ extern NFCSTATUS phLibNfc_Mgt_SetP2P_ConfigParams( phLibNfc_sNfcIPCfg_t* pCo
void* pContext
);
+
+/**
+* \ingroup grp_lib_nfc
+* \brief <b>Interface to break any existing pending callbacks for card emulation</b>.
+* \retval NFCSTATUS_SUCCESS Config operation succeeded.
+* \retval NFCSTATUS_NOT_INITIALISED There was no callback in progress.
+*
+*/
+
+extern NFCSTATUS phLibNfc_Mgt_Unblock_Cb_CE_A_14443_4( );
+
+/**
+* \ingroup grp_lib_nfc
+* \brief <b>Interface to break any existing pending callbacks for card emulation</b>.
+* \retval NFCSTATUS_SUCCESS Config operation succeeded.
+* \retval NFCSTATUS_NOT_INITIALISED There was no callback in progress.
+*
+*/
+
+extern NFCSTATUS phLibNfc_Mgt_Unblock_Cb_CE_B_14443_4( );
+
+/**
+* \ingroup grp_lib_nfc
+* \brief <b>Interface to configure Card Emulation mode configurations</b>.
+* The setting will be typically take effect for the next cycle of the relevant
+* phase of discovery. For optional configuration internal defaults will be
+* used in case the configuration is not set.
+*
+*\note Currently general bytes configuration supported.
+*
+* \param[in] bool turn on or off (TRUE/FALSE)
+*
+* \param[in] pConfigRspCb This callback has to be called once LibNfc
+* completes the Configuration.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+*
+* \retval NFCSTATUS_PENDING Config operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS configuration operation is successful.
+* \param NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \param NFCSTATUS_FAILED Request failed.
+*
+*/
+extern NFCSTATUS phLibNfc_Mgt_SetCE_A_14443_4_ConfigParams(
+ uint8_t emulate,
+ pphLibNfc_RspCb_t pConfigRspCb,
+ void* pContext
+ );
+/**
+* \ingroup grp_lib_nfc
+* \brief <b>Interface to configure Card Emulation mode configurations</b>.
+* The setting will be typically take effect for the next cycle of the relevant
+* phase of discovery. For optional configuration internal defaults will be
+* used in case the configuration is not set.
+*
+*\note Currently general bytes configuration supported.
+*
+* \param[in] bool turn on or off (TRUE/FALSE)
+*
+* \param[in] pConfigRspCb This callback has to be called once LibNfc
+* completes the Configuration.
+*
+* \param[in] pContext Upper layer context to be returned in
+* the callback.
+*
+*
+* \retval NFCSTATUS_PENDING Config operation is in progress.
+* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
+* could not be properly interpreted.
+* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
+* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \retval NFCSTATUS_BUSY Previous request in progress can not accept new request.
+*
+*\note Response callback parameters details for this interface are as listed below.
+*
+* \param[in] pContext LibNfc client context passed in the corresponding request before.
+* \param[in] status Status of the response callback.
+*
+* \param NFCSTATUS_SUCCESS configuration operation is successful.
+* \param NFCSTATUS_SHUTDOWN Shutdown in progress.
+* \param NFCSTATUS_FAILED Request failed.
+*
+*/
+extern NFCSTATUS phLibNfc_Mgt_SetCE_B_14443_4_ConfigParams(
+ uint8_t emulate,
+ pphLibNfc_RspCb_t pConfigRspCb,
+ void* pContext
+ );
+
/**
* \ingroup grp_lib_nfc
* \brief <b>Interface to stack capabilities</b>.
*
* LibNfc client can query to retrieve stack capabilities.Stack capabilities contains
-* <br><br>a).Device capabilities which contains details like protocols supported,
+* <br><br>a).Device capabilities which contains details like protocols supported,
* Hardware,Firmware and model-id version details .For details refer to \ref phNfc_sDeviceCapabilities_t.
* <br><br>b).NDEF mapping related info. This info helps in identifying supported tags for NDEF mapping feature.
* <br><br>c).NDEF formatting related info. This info helps in identifying supported tags for NDEF formatting feature.
@@ -2384,7 +2957,7 @@ extern NFCSTATUS phLibNfc_Mgt_SetP2P_ConfigParams( phLibNfc_sNfcIPCfg_t* pCo
* \param[in] phLibNfc_StackCapabilities Contains device capabilities and NDEF mapping and formatting feature
support for different tag types.
*
-* \param[in] pContext Upper layer context to be returned in
+* \param[in] pContext Upper layer context to be returned in
* the callback.
*
*
@@ -2488,7 +3061,7 @@ extern NFCSTATUS phLibNfc_Llcp_CheckLlcp( phLibNfc_Handle hRemoteDe
* This function launches the link activation process on a remote LLCP-compliant peer. The link status
* notification will be sent by the corresponding callback given in the phLibNfc_Llcp_CheckLlcp function.
* If the activation fails, the deactivated status will be notified, even if the link is already in a
-* deactivated state.
+* deactivated state.
*
* \param[in] hRemoteDevice Peer handle obtained during device discovery process.
*
@@ -2579,7 +3152,7 @@ extern NFCSTATUS phLibNfc_Llcp_GetRemoteInfo( phLibNfc_Handle
* \ingroup grp_lib_nfc
* \brief <b>Create a socket on a LLCP-connected device</b>.
*
-* This function creates a socket for a given LLCP link. Sockets can be of two types :
+* This function creates a socket for a given LLCP link. Sockets can be of two types :
* connection-oriented and connectionless. If the socket is connection-oriented, the caller
* must provide a working buffer to the socket in order to handle incoming data. This buffer
* must be large enough to fit the receive window (RW * MIU), the remaining space being
@@ -2692,7 +3265,7 @@ extern NFCSTATUS phLibNfc_Llcp_Close( phLibNfc_Handle hSocket );
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be properly interpreted.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -2717,7 +3290,7 @@ extern NFCSTATUS phLibNfc_Llcp_SocketGetLocalOptions( phLibNfc_Handle
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be properly interpreted.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -2741,7 +3314,7 @@ extern NFCSTATUS phLibNfc_Llcp_SocketGetRemoteOptions( phLibNfc_Handle
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
* could not be properly interpreted.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_ALREADY_REGISTERED The selected SAP is already bound to another
socket.
@@ -2801,7 +3374,7 @@ extern NFCSTATUS phLibNfc_Llcp_Listen( phLibNfc_Handle hSocket,
* \param[in] psWorkingBuffer A working buffer to be used by the library.
* \param[in] pErr_Cb The callback to be called each time the accepted socket
* is in error.
-* \param[in] pAccept_RspCb The callback to be called when the Accept operation
+* \param[in] pAccept_RspCb The callback to be called when the Accept operation
* is completed.
* \param[in] pContext Upper layer context to be returned in the callback.
*
@@ -2832,7 +3405,7 @@ extern NFCSTATUS phLibNfc_Llcp_Accept( phLibNfc_Handle hSocket,
* is implicitly closed when the function is called.
*
* \param[in] hSocket Socket handle obtained in the listening callback.
-* \param[in] pReject_RspCb The callback to be called when the Reject operation
+* \param[in] pReject_RspCb The callback to be called when the Reject operation
* is completed.
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
@@ -2866,7 +3439,7 @@ extern NFCSTATUS phLibNfc_Llcp_Reject( phLibNfc_Handle hRemoteD
* could not be properly interpreted.
* \retval NFCSTATUS_PENDING Connection operation is in progress,
* pConnect_RspCb will be called upon completion.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -2899,7 +3472,7 @@ extern NFCSTATUS phLibNfc_Llcp_Connect( phLibNfc_Handle hRemoteD
* could not be properly interpreted.
* \retval NFCSTATUS_PENDING Connection operation is in progress,
* pConnect_RspCb will be called upon completion.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -2920,7 +3493,7 @@ extern NFCSTATUS phLibNfc_Llcp_ConnectByUri( phLibNfc_Handle hRe
* This function initiates the disconnection of a previously connected socket.
*
* \param[in] hSocket Socket handle obtained during socket creation.
-* \param[in] pDisconnect_RspCb The callback to be called when the
+* \param[in] pDisconnect_RspCb The callback to be called when the
* operation is completed.
* \param[in] pContext Upper layer context to be returned in
* the callback.
@@ -2930,7 +3503,7 @@ extern NFCSTATUS phLibNfc_Llcp_ConnectByUri( phLibNfc_Handle hRe
* could not be properly interpreted.
* \retval NFCSTATUS_PENDING Disconnection operation is in progress,
* pDisconnect_RspCb will be called upon completion.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -2952,11 +3525,11 @@ extern NFCSTATUS phLibNfc_Llcp_Disconnect( phLibNfc_Handle hR
* are available. If no data is available, the function will be pending until
* more data comes, and the response will be sent by the callback. This function
* can only be called on a connection-oriented socket.
-*
+*
*
* \param[in] hSocket Socket handle obtained during socket creation.
* \param[in] psBuffer The buffer receiving the data.
-* \param[in] pRecv_RspCb The callback to be called when the
+* \param[in] pRecv_RspCb The callback to be called when the
* operation is completed.
* \param[in] pContext Upper layer context to be returned in
* the callback.
@@ -2966,7 +3539,7 @@ extern NFCSTATUS phLibNfc_Llcp_Disconnect( phLibNfc_Handle hR
* could not be properly interpreted.
* \retval NFCSTATUS_PENDING Reception operation is in progress,
* pRecv_RspCb will be called upon completion.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -2986,11 +3559,11 @@ extern NFCSTATUS phLibNfc_Llcp_Recv( phLibNfc_Handle hRemoteDevice,
*
* This function is the same as phLibNfc_Llcp_Recv, except that the callback includes
* the source SAP. This functions can only be called on a connectionless socket.
-*
+*
*
* \param[in] hSocket Socket handle obtained during socket creation.
* \param[in] psBuffer The buffer receiving the data.
-* \param[in] pRecv_RspCb The callback to be called when the
+* \param[in] pRecv_RspCb The callback to be called when the
* operation is completed.
* \param[in] pContext Upper layer context to be returned in
* the callback.
@@ -3000,7 +3573,7 @@ extern NFCSTATUS phLibNfc_Llcp_Recv( phLibNfc_Handle hRemoteDevice,
* could not be properly interpreted.
* \retval NFCSTATUS_PENDING Reception operation is in progress,
* pRecv_RspCb will be called upon completion.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -3021,11 +3594,11 @@ extern NFCSTATUS phLibNfc_Llcp_RecvFrom( phLibNfc_Handle hRemo
* This function is used to write data on a socket. This function
* can only be called on a connection-oriented socket which is already
* in a connected state.
-*
+*
*
* \param[in] hSocket Socket handle obtained during socket creation.
* \param[in] psBuffer The buffer containing the data to send.
-* \param[in] pSend_RspCb The callback to be called when the
+* \param[in] pSend_RspCb The callback to be called when the
* operation is completed.
* \param[in] pContext Upper layer context to be returned in
* the callback.
@@ -3035,7 +3608,7 @@ extern NFCSTATUS phLibNfc_Llcp_RecvFrom( phLibNfc_Handle hRemo
* could not be properly interpreted.
* \retval NFCSTATUS_PENDING Reception operation is in progress,
* pSend_RspCb will be called upon completion.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -3055,12 +3628,12 @@ extern NFCSTATUS phLibNfc_Llcp_Send( phLibNfc_Handle hRemoteDevice,
*
* This function is used to write data on a socket to a given destination SAP.
* This function can only be called on a connectionless socket.
-*
+*
*
* \param[in] hSocket Socket handle obtained during socket creation.
* \param[in] nSap The destination SAP.
* \param[in] psBuffer The buffer containing the data to send.
-* \param[in] pSend_RspCb The callback to be called when the
+* \param[in] pSend_RspCb The callback to be called when the
* operation is completed.
* \param[in] pContext Upper layer context to be returned in
* the callback.
@@ -3070,7 +3643,7 @@ extern NFCSTATUS phLibNfc_Llcp_Send( phLibNfc_Handle hRemoteDevice,
* could not be properly interpreted.
* \retval NFCSTATUS_PENDING Reception operation is in progress,
* pSend_RspCb will be called upon completion.
-* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
+* \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
* a valid type to perform the requsted operation.
* \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
* \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
@@ -3091,14 +3664,14 @@ extern NFCSTATUS phLibNfc_Llcp_SendTo( phLibNfc_Handle hRemoteDevi
* \brief Initializes \ DeInitialize the NFC library for testmode.
*
*
-*\brief This function initializes / DeInitialize NFC library and its underlying layers
+*\brief This function initializes / DeInitialize NFC library and its underlying layers
* in test mode. As part of this interface underlying layers gets configured.
* Once phLibNfc_TstMode_On is successful ,NFC library ready in testmode using IOCTL.
* After using test IOCTLs ,Test mode should be DeInit using phLibNfc_TstMode_Off.
-*\note This API should be used only for test IOCTL codes.
+*\note This API should be used only for test IOCTL codes.
*
* \param[in] pDriverHandle Driver Handle currently application is using.
-* \param[in] pTestModeCb The init callback is called by the LibNfc when
+* \param[in] pTestModeCb The init callback is called by the LibNfc when
* Configure test mode completed or there is an error
* in initialization.
*
@@ -3107,7 +3680,7 @@ extern NFCSTATUS phLibNfc_Llcp_SendTo( phLibNfc_Handle hRemoteDevi
*
* \retval NFCSTATUS_ALREADY_INITIALISED Stack is already initialized.
* \retval NFCSTATUS_PENDING Init sequence has been successfully
-* started and result will be conveyed via
+* started and result will be conveyed via
* callback notification.
* \retval NFCSTATUS_INVALID_PARAMETER The parameter could not be properly
* interpreted.
@@ -3135,7 +3708,7 @@ NFCSTATUS phLibNfc_Mgt_ConfigureTestMode(void *pDriverHandle,
*
* LibNfc client can reset the stack.
*
-* \param[in] pContext Upper layer context to be returned in
+* \param[in] pContext Upper layer context to be returned in
* the callback.
*
*
diff --git a/src/phLibNfc_Internal.h b/src/phLibNfc_Internal.h
index c136032..baf028a 100644..100755
--- a/src/phLibNfc_Internal.h
+++ b/src/phLibNfc_Internal.h
@@ -41,13 +41,14 @@
#include <phFriNfc_LlcpTransport.h>
#include <phOsalNfc_Timer.h>
#include <phLibNfc_SE.h>
+#include <phHciNfc_CE.h>
#include <phFriNfc_NdefReg.h>
#include <phLibNfc.h>
#include <phLibNfc_initiator.h>
#include <phLibNfc_ndef_raw.h>
#include <phNfcLlcpTypes.h>
-/**Maximum number of Records.Presently set to a realistic value of 128
+/**Maximum number of Records.Presently set to a realistic value of 128
Configurable upto 1K*/
#define MAX_NO_OF_RECORDS 128U
#define CHK_NDEF_NOT_DONE 0x02U
@@ -209,6 +210,7 @@ typedef struct phLibNfc_LibContext
Status_t status;
phHal_sEmulationCfg_t sCardEmulCfg;
phLibNfc_SeCtxt_t sSeContext;
+ phLibNfc_CeCtxt_t sCeContext;
phNfc_sState_t LibNfcState;
phHal_sDevInputParam_t *psDevInputParam;
diff --git a/src/phLibNfc_initiator.c b/src/phLibNfc_initiator.c
index 6bd48b8..e666668 100644..100755
--- a/src/phLibNfc_initiator.c
+++ b/src/phLibNfc_initiator.c
@@ -62,7 +62,7 @@
*/
/* Target discvovery notification callback */
-STATIC void phLibNfc_NotificationRegister_Resp_Cb (
+STATIC void phLibNfc_NotificationRegister_Resp_Cb (
void *context,
phHal_eNotificationType_t type,
phHal4Nfc_NotificationInfo_t info,
@@ -71,21 +71,21 @@ STATIC void phLibNfc_NotificationRegister_Resp_Cb (
/*Remote device connect response callback*/
STATIC void phLibNfc_RemoteDev_Connect_Cb(
- void *pContext,
+ void *pContext,
phHal_sRemoteDevInformation_t *pRmtdev_info,
NFCSTATUS status
);
#ifdef RECONNECT_SUPPORT
-STATIC
-void
+STATIC
+void
phLibNfc_config_discovery_con_failure_cb (
void *context,
NFCSTATUS status);
#endif /* #ifdef RECONNECT_SUPPORT */
/*Remote device disconnect response callback*/
-STATIC void phLibNfc_RemoteDev_Disconnect_cb(
+STATIC void phLibNfc_RemoteDev_Disconnect_cb(
void *context,
phHal_sRemoteDevInformation_t *reg_handle,
NFCSTATUS status
@@ -111,7 +111,7 @@ STATIC void phLibNfc_Mgt_SetP2P_ConfigParams_Cb(
* Response to target discovery.
*/
STATIC
-void phLibNfc_NotificationRegister_Resp_Cb (
+void phLibNfc_NotificationRegister_Resp_Cb (
void *context,
phHal_eNotificationType_t type,
phHal4Nfc_NotificationInfo_t info,
@@ -125,8 +125,8 @@ void phLibNfc_NotificationRegister_Resp_Cb (
uint8_t tag_disc_flg = 0;
phLibNfc_NtfRegister_RspCb_t pClientCb=NULL;
pClientCb =gpphLibContext->CBInfo.pClientNtfRegRespCB;
- PHNFC_UNUSED_VARIABLE(context);
-
+ PHNFC_UNUSED_VARIABLE(context);
+
if(( type != NFC_DISCOVERY_NOTIFICATION )
&&(PHNFCSTATUS(status)!=NFCSTATUS_DESELECTED))
@@ -137,184 +137,184 @@ void phLibNfc_NotificationRegister_Resp_Cb (
{
return;
}
- else
- {
- DeviceIndx=0;DeviceIndx1=0;
- while(DeviceIndx < info.psDiscoveryInfo->NumberOfDevices)
- {
- switch(info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx]->RemDevType)
- {
- case phHal_eMifare_PICC:
- {
- /*Mifare Tag discovered*/
- sak_byte = info.psDiscoveryInfo->
- ppRemoteDevInfo[DeviceIndx]->RemoteDevInfo.Iso14443A_Info.Sak;
- if((TRUE == gpphLibContext->RegNtfType.MifareUL)&& (sak_byte==0x00))
- {
- /*Copy the tag related info*/
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
-
- if((TRUE == gpphLibContext->RegNtfType.MifareStd)&&
- (((sak_byte & 0x18)==0x08)||((sak_byte & 0x18)==0x18) ||
+ else
+ {
+ DeviceIndx=0;DeviceIndx1=0;
+ while(DeviceIndx < info.psDiscoveryInfo->NumberOfDevices)
+ {
+ switch(info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx]->RemDevType)
+ {
+ case phHal_eMifare_PICC:
+ {
+ /*Mifare Tag discovered*/
+ sak_byte = info.psDiscoveryInfo->
+ ppRemoteDevInfo[DeviceIndx]->RemoteDevInfo.Iso14443A_Info.Sak;
+ if((TRUE == gpphLibContext->RegNtfType.MifareUL)&& (sak_byte==0x00))
+ {
+ /*Copy the tag related info*/
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+
+ if((TRUE == gpphLibContext->RegNtfType.MifareStd)&&
+ (((sak_byte & 0x18)==0x08)||((sak_byte & 0x18)==0x18) ||
(sak_byte == 0x01)))
- {
- /*Copy the tag related info*/
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1]=
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
-
- }break;
- case phHal_eISO14443_A_PICC:
- {
- /*ISO 14443-A type tag discovered*/
- if(TRUE == gpphLibContext->RegNtfType.ISO14443_4A)
- {
- /*Copy the ISO type A tag info*/
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }break;
- case phHal_eISO14443_3A_PICC:
- {
- /*ISO 14443-A type tag discovered*/
- if(TRUE == gpphLibContext->RegNtfType.MifareUL)
- {
- /*Copy the ISO type A tag info*/
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }break;
- case phHal_eISO14443_B_PICC:
- {
- /*ISO 14443-B type tag Discovered */
- if(TRUE == gpphLibContext->RegNtfType.ISO14443_4B)
- {
- /*Copy the Type B tag info */
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }break;
- case phHal_eFelica_PICC:
- {
- /*Felica Type Tag Discovered */
- if(TRUE == gpphLibContext->RegNtfType.Felica)
- {
- /*Copy the Felica tag info */
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }break;
- case phHal_eJewel_PICC:
- {
- /*Jewel Type Tag Discovered */
- if(TRUE == gpphLibContext->RegNtfType.Jewel)
- {
- /*Copy the Felica tag info */
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }
- break;
- case phHal_eISO15693_PICC:
- {
- /*Jewel Type Tag Discovered */
- if(TRUE == gpphLibContext->RegNtfType.ISO15693)
- {
- /*Copy the Felica tag info */
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }
- break;
- case phHal_eNfcIP1_Target:
- {
- if(TRUE == gpphLibContext->RegNtfType.NFC)
- {
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
- gpphLibContext->Discov_handle[DeviceIndx1] =
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }
- break;
- case phHal_eNfcIP1_Initiator:
- {
- if(TRUE == gpphLibContext->RegNtfType.NFC)
- {
- gpphLibContext->LibNfcState.cur_state=eLibNfcHalStateConnect;
- gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
- info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
- (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo;
- gpphLibContext->sNfcIp_Context.Rem_Initiator_Handle=
- gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
- DeviceIndx1++;
- tag_disc_flg++;
- }
- }
- break;
- default :
- {
- break;
- }
- }
- DeviceIndx++;
- }
- }
+ {
+ /*Copy the tag related info*/
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1]=
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+
+ }break;
+ case phHal_eISO14443_A_PICC:
+ {
+ /*ISO 14443-A type tag discovered*/
+ if(TRUE == gpphLibContext->RegNtfType.ISO14443_4A)
+ {
+ /*Copy the ISO type A tag info*/
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }break;
+ case phHal_eISO14443_3A_PICC:
+ {
+ /*ISO 14443-A type tag discovered*/
+ if(TRUE == gpphLibContext->RegNtfType.MifareUL)
+ {
+ /*Copy the ISO type A tag info*/
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }break;
+ case phHal_eISO14443_B_PICC:
+ {
+ /*ISO 14443-B type tag Discovered */
+ if(TRUE == gpphLibContext->RegNtfType.ISO14443_4B)
+ {
+ /*Copy the Type B tag info */
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }break;
+ case phHal_eFelica_PICC:
+ {
+ /*Felica Type Tag Discovered */
+ if(TRUE == gpphLibContext->RegNtfType.Felica)
+ {
+ /*Copy the Felica tag info */
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }break;
+ case phHal_eJewel_PICC:
+ {
+ /*Jewel Type Tag Discovered */
+ if(TRUE == gpphLibContext->RegNtfType.Jewel)
+ {
+ /*Copy the Felica tag info */
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }
+ break;
+ case phHal_eISO15693_PICC:
+ {
+ /*Jewel Type Tag Discovered */
+ if(TRUE == gpphLibContext->RegNtfType.ISO15693)
+ {
+ /*Copy the Felica tag info */
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }
+ break;
+ case phHal_eNfcIP1_Target:
+ {
+ if(TRUE == gpphLibContext->RegNtfType.NFC)
+ {
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx].psRemoteDevInfo;
+ gpphLibContext->Discov_handle[DeviceIndx1] =
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }
+ break;
+ case phHal_eNfcIP1_Initiator:
+ {
+ if(TRUE == gpphLibContext->RegNtfType.NFC)
+ {
+ gpphLibContext->LibNfcState.cur_state=eLibNfcHalStateConnect;
+ gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo=
+ info.psDiscoveryInfo->ppRemoteDevInfo[DeviceIndx];
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev =
+ (uint32_t)gpphLibContext->psRemoteDevList[DeviceIndx1].psRemoteDevInfo;
+ gpphLibContext->sNfcIp_Context.Rem_Initiator_Handle=
+ gpphLibContext->psRemoteDevList[DeviceIndx1].hTargetDev;
+ DeviceIndx1++;
+ tag_disc_flg++;
+ }
+ }
+ break;
+ default :
+ {
+ break;
+ }
+ }
+ DeviceIndx++;
+ }
+ }
if((tag_disc_flg >0 )&&(status != NFCSTATUS_FAILED))
{
@@ -336,10 +336,10 @@ void phLibNfc_NotificationRegister_Resp_Cb (
if (NULL != pClientCb)
{
pClientCb(
- (void*)gpphLibContext->CBInfo.pClientNtfRegRespCntx,
+ (void*)gpphLibContext->CBInfo.pClientNtfRegRespCntx,
gpphLibContext->psRemoteDevList,
gpphLibContext->dev_cnt,
- status
+ status
);
}
@@ -387,19 +387,19 @@ void phLibNfc_NotificationRegister_Resp_Cb (
/**
* This interface registers notification handler for target discovery.
*/
-NFCSTATUS
-phLibNfc_RemoteDev_NtfRegister(
+NFCSTATUS
+phLibNfc_RemoteDev_NtfRegister(
phLibNfc_Registry_Info_t* pRegistryInfo,
phLibNfc_NtfRegister_RspCb_t pNotificationHandler,
void *pContext
)
{
NFCSTATUS RetVal = NFCSTATUS_SUCCESS;
-
+
/*Check for valid parameters*/
if((NULL == pNotificationHandler)
- || (NULL == pContext)
+ || (NULL == pContext)
||(NULL== pRegistryInfo))
{
RetVal= NFCSTATUS_INVALID_PARAMETER;
@@ -418,32 +418,32 @@ phLibNfc_RemoteDev_NtfRegister(
}
else
{
-
+
PHDBG_INFO("LibNfc:Registering Notification Handler");
-
-
+
+
(void) memcpy(&(gpphLibContext->RegNtfType),pRegistryInfo,
sizeof(phLibNfc_Registry_Info_t));
- /* Register Discovery Notification Handler*/
-
- /*Register for NFCIP1 target type*/
- RetVal = phHal4Nfc_RegisterNotification(
+ /* Register Discovery Notification Handler*/
+
+ /*Register for NFCIP1 target type*/
+ RetVal = phHal4Nfc_RegisterNotification(
gpphLibContext->psHwReference,
eRegisterP2PDiscovery,
phLibNfc_NotificationRegister_Resp_Cb,
(void*)gpphLibContext
);
- /*Register for Tag discovery*/
- RetVal = phHal4Nfc_RegisterNotification(
+ /*Register for Tag discovery*/
+ RetVal = phHal4Nfc_RegisterNotification(
gpphLibContext->psHwReference,
eRegisterTagDiscovery,
phLibNfc_NotificationRegister_Resp_Cb,
(void*)gpphLibContext
- );
+ );
gpphLibContext->CBInfo.pClientNtfRegRespCB = pNotificationHandler;
gpphLibContext->CBInfo.pClientNtfRegRespCntx = pContext;
/*Register notification handler with below layer*/
-
+
}
return RetVal;
}
@@ -474,7 +474,7 @@ NFCSTATUS phLibNfc_RemoteDev_NtfUnregister(void)
eRegisterP2PDiscovery,
gpphLibContext);
- RetVal = phHal4Nfc_UnregisterNotification(
+ RetVal = phHal4Nfc_UnregisterNotification(
gpphLibContext->psHwReference,
eRegisterTagDiscovery,
gpphLibContext);
@@ -488,7 +488,7 @@ NFCSTATUS phLibNfc_RemoteDev_NtfUnregister(void)
#ifdef RECONNECT_SUPPORT
-NFCSTATUS
+NFCSTATUS
phLibNfc_RemoteDev_ReConnect (
phLibNfc_Handle hRemoteDevice,
pphLibNfc_ConnectCallback_t pNotifyReConnect_RspCb,
@@ -498,11 +498,11 @@ phLibNfc_RemoteDev_ReConnect (
NFCSTATUS ret_val = NFCSTATUS_FAILED;
phLibNfc_sRemoteDevInformation_t *psRemoteDevInfo = NULL;
- if ((NULL == gpphLibContext)
- || (eLibNfcHalStateShutdown ==
+ if ((NULL == gpphLibContext)
+ || (eLibNfcHalStateShutdown ==
gpphLibContext->LibNfcState.cur_state))
{
- ret_val = NFCSTATUS_NOT_INITIALISED;
+ ret_val = NFCSTATUS_NOT_INITIALISED;
}
else if ((NULL == pContext)
|| (NULL == pNotifyReConnect_RspCb)
@@ -510,7 +510,7 @@ phLibNfc_RemoteDev_ReConnect (
{
/* Check valid parameters */
ret_val = NFCSTATUS_INVALID_PARAMETER;
- }
+ }
/* Check valid lib nfc State */
else if (gpphLibContext->LibNfcState.next_state
== eLibNfcHalStateShutdown)
@@ -522,22 +522,22 @@ phLibNfc_RemoteDev_ReConnect (
ret_val = NFCSTATUS_TARGET_NOT_CONNECTED;
}
else if ((gpphLibContext->Discov_handle[0] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[1] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[2] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[3] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[4] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[5] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[6] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[7] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[8] != hRemoteDevice)
- && (gpphLibContext->Discov_handle[9] != hRemoteDevice))
+ && (gpphLibContext->Discov_handle[1] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[2] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[3] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[4] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[5] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[6] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[7] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[8] != hRemoteDevice)
+ && (gpphLibContext->Discov_handle[9] != hRemoteDevice))
{
ret_val = NFCSTATUS_INVALID_HANDLE;
}
else
{
psRemoteDevInfo = (phLibNfc_sRemoteDevInformation_t *)hRemoteDevice;
-
+
/* Call the HAL connect*/
ret_val = phHal4Nfc_Connect (gpphLibContext->psHwReference,
psRemoteDevInfo,
@@ -546,17 +546,17 @@ phLibNfc_RemoteDev_ReConnect (
if (NFCSTATUS_PENDING == ret_val)
{
- /* If HAL Connect is pending update the LibNFC state machine
+ /* If HAL Connect is pending update the LibNFC state machine
and store the CB pointer and Context,
mark the General CB pending status is TRUE */
gpphLibContext->CBInfo.pClientConnectCb = pNotifyReConnect_RspCb;
gpphLibContext->CBInfo.pClientConCntx = pContext;
gpphLibContext->status.GenCb_pending_status = TRUE;
- gpphLibContext->LibNfcState.next_state = eLibNfcHalStateConnect;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateConnect;
gpphLibContext->Prev_Connected_handle = gpphLibContext->Connected_handle;
- gpphLibContext->Connected_handle = hRemoteDevice;
+ gpphLibContext->Connected_handle = hRemoteDevice;
}
else if (NFCSTATUS_INVALID_REMOTE_DEVICE == PHNFCSTATUS(ret_val))
{
@@ -567,7 +567,7 @@ phLibNfc_RemoteDev_ReConnect (
{
/* Lower layer returns internal error code return NFCSTATUS_FAILED*/
ret_val = NFCSTATUS_FAILED;
- }
+ }
}
return ret_val;
@@ -576,7 +576,7 @@ phLibNfc_RemoteDev_ReConnect (
/**
-* Connect to a single Remote Device
+* Connect to a single Remote Device
*/
NFCSTATUS phLibNfc_RemoteDev_Connect(
phLibNfc_Handle hRemoteDevice,
@@ -587,18 +587,18 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(
NFCSTATUS RetVal = NFCSTATUS_FAILED;
phLibNfc_sRemoteDevInformation_t *psRemoteDevInfo;
-
+
if((NULL == gpphLibContext) ||
- (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
+ (gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
{
- RetVal = NFCSTATUS_NOT_INITIALISED;
+ RetVal = NFCSTATUS_NOT_INITIALISED;
}/* Check valid parameters*/
else if((NULL == pContext)
|| (NULL == pNotifyConnect_RspCb)
|| (NULL == (void*)hRemoteDevice))
{
RetVal= NFCSTATUS_INVALID_PARAMETER;
- }
+ }
/* Check valid lib nfc State*/
else if(gpphLibContext->LibNfcState.next_state
== eLibNfcHalStateShutdown)
@@ -606,19 +606,19 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(
RetVal= NFCSTATUS_SHUTDOWN;
}
else if((gpphLibContext->Discov_handle[0] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[1] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[2] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[3] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[4] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[5] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[6] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[7] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[8] != hRemoteDevice)&&
- (gpphLibContext->Discov_handle[9] != hRemoteDevice))
+ (gpphLibContext->Discov_handle[1] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[2] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[3] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[4] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[5] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[6] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[7] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[8] != hRemoteDevice)&&
+ (gpphLibContext->Discov_handle[9] != hRemoteDevice))
{
RetVal= NFCSTATUS_INVALID_HANDLE;
}
- else if ((hRemoteDevice != gpphLibContext->Connected_handle)
+ else if ((hRemoteDevice != gpphLibContext->Connected_handle)
&& (0 != gpphLibContext->Connected_handle))
{
RetVal = NFCSTATUS_FAILED;
@@ -626,7 +626,7 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(
else
{
psRemoteDevInfo = (phLibNfc_sRemoteDevInformation_t*)hRemoteDevice;
-
+
/* Call the HAL connect*/
RetVal = phHal4Nfc_Connect(gpphLibContext->psHwReference,
psRemoteDevInfo,
@@ -634,15 +634,15 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(
(void* )gpphLibContext);
if(RetVal== NFCSTATUS_PENDING)
{
- /* If HAL Connect is pending update the LibNFC state machine
+ /* If HAL Connect is pending update the LibNFC state machine
and store the CB pointer and Context,
mark the General CB pending status is TRUE*/
gpphLibContext->CBInfo.pClientConnectCb = pNotifyConnect_RspCb;
gpphLibContext->CBInfo.pClientConCntx = pContext;
gpphLibContext->status.GenCb_pending_status=TRUE;
- gpphLibContext->LibNfcState.next_state = eLibNfcHalStateConnect;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateConnect;
gpphLibContext->Prev_Connected_handle = gpphLibContext->Connected_handle;
- gpphLibContext->Connected_handle = hRemoteDevice;
+ gpphLibContext->Connected_handle = hRemoteDevice;
}
else if(PHNFCSTATUS(RetVal) == NFCSTATUS_INVALID_REMOTE_DEVICE)
{
@@ -653,21 +653,21 @@ NFCSTATUS phLibNfc_RemoteDev_Connect(
{
/* Lower layer returns internal error code return NFCSTATUS_FAILED*/
RetVal = NFCSTATUS_FAILED;
- }
+ }
}
return RetVal;
}
#ifdef RECONNECT_SUPPORT
-STATIC
-void
+STATIC
+void
phLibNfc_config_discovery_con_failure_cb (
void *context,
NFCSTATUS status)
{
- if((phLibNfc_LibContext_t *)context == gpphLibContext)
+ if((phLibNfc_LibContext_t *)context == gpphLibContext)
{ /*check for same context*/
- pphLibNfc_ConnectCallback_t ps_client_con_cb =
+ pphLibNfc_ConnectCallback_t ps_client_con_cb =
gpphLibContext->CBInfo.pClientConnectCb;
if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
@@ -713,7 +713,7 @@ phLibNfc_config_discovery_con_failure_cb (
if (NULL != ps_client_con_cb)
{
gpphLibContext->CBInfo.pClientConnectCb = NULL;
- /* Call the upper layer callback*/
+ /* Call the upper layer callback*/
ps_client_con_cb (gpphLibContext->CBInfo.pClientConCntx,
0, NULL, status);
}
@@ -724,7 +724,7 @@ phLibNfc_config_discovery_con_failure_cb (
status = NFCSTATUS_FAILED;
}
-
+
}
#endif /* #ifdef RECONNECT_SUPPORT */
/**
@@ -744,14 +744,14 @@ STATIC void phLibNfc_RemoteDev_Connect_Cb(
/* Mark General Callback pending status as false*/
gpphLibContext->status.GenCb_pending_status = FALSE;
-
+
/* Check the shutdown is called during the lower layer Connect in process,
If yes call shutdown call and return NFCSTATUS_SHUTDOWN */
if((eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state))
- {
+ {
phLibNfc_Pending_Shutdown();
- Connect_status = NFCSTATUS_SHUTDOWN;
-
+ Connect_status = NFCSTATUS_SHUTDOWN;
+
}
else if(PHNFCSTATUS(status)==NFCSTATUS_SUCCESS)
{
@@ -761,7 +761,7 @@ STATIC void phLibNfc_RemoteDev_Connect_Cb(
gpphLibContext->LibNfcState.next_state = eLibNfcHalStateConnect;
Connect_status = NFCSTATUS_SUCCESS;
}
- else
+ else
{ /* if(PHNFCSTATUS(status)==NFCSTATUS_INVALID_REMOTE_DEVICE) */
/* If remote device is invalid return as TARGET LOST to upper layer*/
/* If error code is other than SUCCESS return NFCSTATUS_TARGET_LOST */
@@ -771,7 +771,7 @@ STATIC void phLibNfc_RemoteDev_Connect_Cb(
gpphLibContext->ndef_cntx.is_ndef = CHK_NDEF_NOT_DONE;
/* Update the Current Sate*/
phLibNfc_UpdateCurState(Connect_status,(phLibNfc_LibContext_t *)pContext);
- /* Call the upper layer callback*/
+ /* Call the upper layer callback*/
gpphLibContext->CBInfo.pClientConnectCb(
gpphLibContext->CBInfo.pClientConCntx,
(uint32_t)pRmtdev_info,
@@ -802,7 +802,7 @@ NFCSTATUS phLibNfc_RemoteDev_Disconnect( phLibNfc_Handle hRemote
(gpphLibContext->LibNfcState.cur_state
== eLibNfcHalStateShutdown))
{
- RetVal = NFCSTATUS_NOT_INITIALISED;
+ RetVal = NFCSTATUS_NOT_INITIALISED;
}
else if((NULL == pContext) ||
(NULL == pDscntCallback)||(hRemoteDevice == 0))
@@ -833,17 +833,17 @@ NFCSTATUS phLibNfc_RemoteDev_Disconnect( phLibNfc_Handle hRemote
||((gpphLibContext->sSeContext.eActivatedMode != phLibNfc_SE_ActModeWired)&&
(ReleaseType == NFC_SMARTMX_RELEASE)))
{ /* Previous disconnect callback is pending */
- RetVal = NFCSTATUS_REJECTED;
+ RetVal = NFCSTATUS_REJECTED;
}
#ifndef LLCP_CHANGES
else if(eLibNfcHalStateTransaction == gpphLibContext->LibNfcState.next_state)
{ /* Previous Transaction is Pending*/
- RetVal = NFCSTATUS_BUSY;
+ RetVal = NFCSTATUS_BUSY;
PHDBG_INFO("LibNfc:Transaction is Pending");
}
#endif /* #ifdef LLCP_CHANGES */
else
- {
+ {
gpphLibContext->ReleaseType = ReleaseType;
psRemoteDevInfo = (phLibNfc_sRemoteDevInformation_t*)hRemoteDevice;
RetVal = phHal4Nfc_Disconnect(gpphLibContext->psHwReference,
@@ -859,15 +859,15 @@ NFCSTATUS phLibNfc_RemoteDev_Disconnect( phLibNfc_Handle hRemote
gpphLibContext->CBInfo.pClientDConCntx = pContext;
/* Mark general callback pending status as TRUE and update the state*/
gpphLibContext->status.GenCb_pending_status=TRUE;
- gpphLibContext->LibNfcState.next_state = eLibNfcHalStateRelease;
-
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateRelease;
+
}
else
{
- /*If lower layer returns other than pending
+ /*If lower layer returns other than pending
(internal error codes) return NFCSTATUS_FAILED */
RetVal = NFCSTATUS_FAILED;
- }
+ }
}
}
return RetVal;
@@ -884,7 +884,7 @@ STATIC void phLibNfc_RemoteDev_Disconnect_cb(
NFCSTATUS DisCnct_status = NFCSTATUS_SUCCESS;
pphLibNfc_DisconnectCallback_t pUpper_NtfCb = NULL;
void *pUpper_Context = NULL;
-
+
/* Copy the upper layer Callback and context*/
pUpper_NtfCb = gpphLibContext->CBInfo.pClientDisConnectCb;
pUpper_Context = gpphLibContext->CBInfo.pClientDConCntx;
@@ -898,10 +898,10 @@ STATIC void phLibNfc_RemoteDev_Disconnect_cb(
else
{
/* Mark the General callback pending status FALSE */
- gpphLibContext->status.GenCb_pending_status = FALSE;
+ gpphLibContext->status.GenCb_pending_status = FALSE;
gpphLibContext->CBInfo.pClientDisConnectCb = NULL;
gpphLibContext->CBInfo.pClientDConCntx = NULL;
-
+
gpphLibContext->ndef_cntx.is_ndef = CHK_NDEF_NOT_DONE;
gpphLibContext->LastTrancvSuccess = FALSE;
/*Reset Connected handle */
@@ -928,21 +928,21 @@ STATIC void phLibNfc_RemoteDev_Disconnect_cb(
phOsalNfc_FreeMemory(gpphLibContext->psBufferedAuth);
gpphLibContext->psBufferedAuth = NULL;
}
- }
+ }
/* Check DeInit is called or not */
if(eLibNfcHalStateShutdown == gpphLibContext->LibNfcState.next_state)
{
- /*call shutdown and return status as NFCSTATUS_SHUTDOWN */
+ /*call shutdown and return status as NFCSTATUS_SHUTDOWN */
phLibNfc_Pending_Shutdown();
- DisCnct_status = NFCSTATUS_SHUTDOWN;
+ DisCnct_status = NFCSTATUS_SHUTDOWN;
}
else if(NFCSTATUS_SUCCESS == status)
{
- DisCnct_status = NFCSTATUS_SUCCESS;
- gpphLibContext->LibNfcState.next_state = eLibNfcHalStateRelease;
+ DisCnct_status = NFCSTATUS_SUCCESS;
+ gpphLibContext->LibNfcState.next_state = eLibNfcHalStateRelease;
}
else
- {
+ {
DisCnct_status = NFCSTATUS_FAILED;
phLibNfc_UpdateCurState(DisCnct_status,(phLibNfc_LibContext_t *)context);
}
@@ -964,9 +964,9 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
)
{
NFCSTATUS RetVal = NFCSTATUS_SUCCESS;
-
+
/*Check for valid parameter */
-
+
if((NULL == gpphLibContext) ||
(gpphLibContext->LibNfcState.cur_state
== eLibNfcHalStateShutdown))
@@ -980,19 +980,19 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
|| (NULL == psTransceiveInfo->sSendData.buffer)
|| (NULL == pContext))
{
- RetVal= NFCSTATUS_INVALID_PARAMETER;
+ RetVal= NFCSTATUS_INVALID_PARAMETER;
}
/* Check the state for DeInit is called or not,if yes return NFCSTATUS_SHUTDOWN*/
else if(gpphLibContext->LibNfcState.next_state
== eLibNfcHalStateShutdown)
- {
+ {
RetVal= NFCSTATUS_SHUTDOWN;
}/* If there is no handle connected return NFCSTATUS_TARGET_NOT_CONNECTED*/
else if(gpphLibContext->Connected_handle==0)
{
RetVal=NFCSTATUS_TARGET_NOT_CONNECTED;
}/* If the given handle is not the connected handle return NFCSTATUS_INVALID_HANDLE */
- else if(gpphLibContext->Connected_handle!= hRemoteDevice )
+ else if(gpphLibContext->Connected_handle!= hRemoteDevice )
{
RetVal=NFCSTATUS_INVALID_HANDLE;
} /*If the transceive is called before finishing the previous transceive function
@@ -1003,7 +1003,7 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
((phHal_sRemoteDevInformation_t*)hRemoteDevice)->RemDevType))
{
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))
@@ -1011,15 +1011,25 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
RetVal= NFCSTATUS_BUSY;
}
#endif /* #ifdef LLCP_TRANSACT_CHANGES */
+#if defined (HOST_EMULATION)
+ else if(((phHal_sRemoteDevInformation_t*)hRemoteDevice)->RemDevType == phHal_eISO14443_A_PCD)
+ {
+ RetVal = phLibNfc_RemoteDev_CE_A_Transceive(&psTransceiveInfo->sSendData,pTransceive_RspCb,pContext);
+ }
+ else if(((phHal_sRemoteDevInformation_t*)hRemoteDevice)->RemDevType == phHal_eISO14443_B_PCD)
+ {
+ RetVal = phLibNfc_RemoteDev_CE_B_Transceive(&psTransceiveInfo->sSendData,pTransceive_RspCb,pContext);
+ }
+#endif //HOST_EMULATION
else
{
gpphLibContext->ndef_cntx.eLast_Call = RawTrans;
- (void)memcpy((void *)(gpphLibContext->psTransInfo),
- (void *)psTransceiveInfo,
+ (void)memcpy((void *)(gpphLibContext->psTransInfo),
+ (void *)psTransceiveInfo,
sizeof(phLibNfc_sTransceiveInfo_t));
- /* Check the given Mifare command is supported or not ,
+ /* Check the given Mifare command is supported or not ,
If not return NFCSTATUS_COMMAND_NOT_SUPPORTED */
- if( (((phHal_sRemoteDevInformation_t*)hRemoteDevice)->RemDevType ==
+ if( (((phHal_sRemoteDevInformation_t*)hRemoteDevice)->RemDevType ==
phHal_eMifare_PICC)&&
( gpphLibContext->psTransInfo->cmd.MfCmd != phHal_eMifareRaw ) &&
( gpphLibContext->psTransInfo->cmd.MfCmd != phHal_eMifareAuthentA ) &&
@@ -1035,12 +1045,12 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
( gpphLibContext->psTransInfo->cmd.MfCmd != phHal_eMifareWriteSector ))
{
RetVal = NFCSTATUS_COMMAND_NOT_SUPPORTED;
- }
+ }
if(eLibNfcHalStatePresenceChk !=
gpphLibContext->LibNfcState.next_state)
{
PHDBG_INFO("LibNfc:Transceive In Progress");
- if((((phHal_sRemoteDevInformation_t*)hRemoteDevice)->RemDevType ==
+ if((((phHal_sRemoteDevInformation_t*)hRemoteDevice)->RemDevType ==
phHal_eMifare_PICC) && (((phHal_sRemoteDevInformation_t*)
hRemoteDevice)->RemoteDevInfo.Iso14443A_Info.Sak != 0)&&
(phHal_eMifareAuthentA == gpphLibContext->psTransInfo->cmd.MfCmd))
@@ -1060,28 +1070,28 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
phOsalNfc_FreeMemory(gpphLibContext->psBufferedAuth);
}
gpphLibContext->psBufferedAuth
- =(phLibNfc_sTransceiveInfo_t *)
+ =(phLibNfc_sTransceiveInfo_t *)
phOsalNfc_GetMemory(sizeof(phLibNfc_sTransceiveInfo_t));
gpphLibContext->psBufferedAuth->addr = psTransceiveInfo->addr;
gpphLibContext->psBufferedAuth->cmd = psTransceiveInfo->cmd;
- gpphLibContext->psBufferedAuth->sSendData.length
+ gpphLibContext->psBufferedAuth->sSendData.length
= psTransceiveInfo->sSendData.length;
- gpphLibContext->psBufferedAuth->sRecvData.length
- = psTransceiveInfo->sRecvData.length;
+ gpphLibContext->psBufferedAuth->sRecvData.length
+ = psTransceiveInfo->sRecvData.length;
gpphLibContext->psBufferedAuth->sSendData.buffer
= (uint8_t *)
phOsalNfc_GetMemory(
gpphLibContext->psTransInfo->sSendData.length);
-
+
(void)memcpy((void *)
- (gpphLibContext->psBufferedAuth->sSendData.buffer),
- (void *)psTransceiveInfo->sSendData.buffer,
+ (gpphLibContext->psBufferedAuth->sSendData.buffer),
+ (void *)psTransceiveInfo->sSendData.buffer,
psTransceiveInfo->sSendData.length);
-
+
gpphLibContext->psBufferedAuth->sRecvData.buffer
= (uint8_t *)
phOsalNfc_GetMemory(
- gpphLibContext->psTransInfo->sRecvData.length);
+ gpphLibContext->psTransInfo->sRecvData.length);
}
/*Call the lower layer Transceive function */
RetVal = phHal4Nfc_Transceive( gpphLibContext->psHwReference,
@@ -1102,19 +1112,19 @@ phLibNfc_RemoteDev_Transceive(phLibNfc_Handle hRemoteDevice,
/*Update the state machine*/
gpphLibContext->LibNfcState.next_state = eLibNfcHalStateTransaction;
}
- }
+ }
else
{
gpphLibContext->status.GenCb_pending_status = FALSE;
RetVal = NFCSTATUS_FAILED;
- }
+ }
}
return RetVal;
}
/**
* Response for Remote device transceive.
*/
-STATIC
+STATIC
void phLibNfc_RemoteDev_Transceive_Cb(void *context,
phHal_sRemoteDevInformation_t *pRmtdev_info,
phNfc_sData_t *response,
@@ -1144,7 +1154,7 @@ void phLibNfc_RemoteDev_Transceive_Cb(void *context,
trans_status = NFCSTATUS_SHUTDOWN;
}
/* If Disconnect is called return NFCSTATUS_ABORTED */
- else if(eLibNfcHalStateRelease ==
+ else if(eLibNfcHalStateRelease ==
gpphLibContext->LibNfcState.next_state)
{
trans_status = NFCSTATUS_ABORTED;
@@ -1153,15 +1163,15 @@ void phLibNfc_RemoteDev_Transceive_Cb(void *context,
else if( NFCSTATUS_SUCCESS == status)
{
trans_status = NFCSTATUS_SUCCESS;
- }
+ }
else if((PHNFCSTATUS(status) != NFCSTATUS_SUCCESS) &&
- (phHal_eMifare_PICC == pRmtdev_info->RemDevType) &&
+ (phHal_eMifare_PICC == pRmtdev_info->RemDevType) &&
(0x00 != pRmtdev_info->RemoteDevInfo.Iso14443A_Info.Sak))
{
gpphLibContext->LastTrancvSuccess = FALSE;
trans_status = NFCSTATUS_FAILED;
/* card type is mifare 1k/4k, then reconnect */
- trans_status = phHal4Nfc_Connect(gpphLibContext->psHwReference,
+ trans_status = phHal4Nfc_Connect(gpphLibContext->psHwReference,
pRmtdev_info,
(pphHal4Nfc_ConnectCallback_t)
phLibNfc_Reconnect_Mifare_Cb,
@@ -1181,9 +1191,9 @@ void phLibNfc_RemoteDev_Transceive_Cb(void *context,
/*Update the state machine */
phLibNfc_UpdateCurState(status,gpphLibContext);
gpphLibContext->LibNfcState.next_state = eLibNfcHalStateConnect;
- if(NFCSTATUS_PENDING != trans_status)
+ if(NFCSTATUS_PENDING != trans_status)
{
- /* Tranceive over */
+ /* Tranceive over */
PHDBG_INFO("LibNfc:TXRX Callback-Update the Transceive responce");
if (NULL != pUpper_TagNtfCb)
{
@@ -1192,31 +1202,31 @@ void phLibNfc_RemoteDev_Transceive_Cb(void *context,
gpphLibContext->LastTrancvSuccess = TRUE;
pUpper_Context = gpphLibContext->CBInfo.pClientTranseCntx;
trans_resp->buffer = response->buffer;
- trans_resp->length = response->length;
+ trans_resp->length = response->length;
/* Notify the upper layer */
PHDBG_INFO("LibNfc:Transceive Complete");
/* Notify the Transceive Completion to upper layer */
gpphLibContext->CBInfo.pClientTransceiveCb(pUpper_Context,
- (uint32_t)pRmtdev_info,
+ (uint32_t)pRmtdev_info,
trans_resp,
trans_status);
}
else
{
gpphLibContext->LastTrancvSuccess = FALSE;
- pUpper_Context = gpphLibContext->CBInfo.pClientTranseCntx;
- trans_resp->length = 0;
+ pUpper_Context = gpphLibContext->CBInfo.pClientTranseCntx;
+ trans_resp->length = 0;
/* Notify the upper layer */
PHDBG_INFO("LibNfc:Transceive Complete");
/* Notify the Transceive Completion to upper layer */
gpphLibContext->CBInfo.pClientTransceiveCb(pUpper_Context,
- (uint32_t)pRmtdev_info,
+ (uint32_t)pRmtdev_info,
trans_resp,
trans_status);
}
}
}
-
+
}
else
{ /*exception: wrong context pointer returned*/
@@ -1228,15 +1238,15 @@ void phLibNfc_RemoteDev_Transceive_Cb(void *context,
/**
* Interface to configure P2P configurations.
*/
-NFCSTATUS
-phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t* pConfigInfo,
- pphLibNfc_RspCb_t pConfigRspCb,
- void* pContext
+NFCSTATUS
+phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t* pConfigInfo,
+ pphLibNfc_RspCb_t pConfigRspCb,
+ void* pContext
)
{
NFCSTATUS RetVal = NFCSTATUS_FAILED;
/* LibNfc Initialized or not */
- if((NULL == gpphLibContext)||
+ if((NULL == gpphLibContext)||
(gpphLibContext->LibNfcState.cur_state == eLibNfcHalStateShutdown))
{
RetVal = NFCSTATUS_NOT_INITIALISED;
@@ -1249,8 +1259,8 @@ phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t* pConfigInfo,
else if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown)
{
RetVal = NFCSTATUS_SHUTDOWN;
- }
- else if(TRUE == gpphLibContext->status.GenCb_pending_status)
+ }
+ else if(TRUE == gpphLibContext->status.GenCb_pending_status)
{ /*Previous callback is pending */
RetVal = NFCSTATUS_BUSY;
}
@@ -1259,7 +1269,7 @@ phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t* pConfigInfo,
if(eLibNfcHalStatePresenceChk !=
gpphLibContext->LibNfcState.next_state)
{
- phHal_uConfig_t uConfig;
+ phHal_uConfig_t uConfig;
/* copy General bytes of Max length = 48 bytes */
(void)memcpy((void *)&(uConfig.nfcIPConfig.generalBytes),
(void *)pConfigInfo->generalBytes,
@@ -1267,13 +1277,13 @@ phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t* pConfigInfo,
/* also copy the General Bytes length*/
uConfig.nfcIPConfig.generalBytesLength = pConfigInfo->generalBytesLength;
- RetVal = phHal4Nfc_ConfigParameters(
+ RetVal = phHal4Nfc_ConfigParameters(
gpphLibContext->psHwReference,
NFC_P2P_CONFIG,
&uConfig,
phLibNfc_Mgt_SetP2P_ConfigParams_Cb,
(void *)gpphLibContext
- );
+ );
}
else
{
@@ -1287,8 +1297,8 @@ phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t* pConfigInfo,
gpphLibContext->sNfcIp_Context.pClientNfcIpCfgCntx = pContext;
gpphLibContext->status.GenCb_pending_status=TRUE;
/* Next state is configured */
- gpphLibContext->LibNfcState.next_state =eLibNfcHalStateConfigReady;
- }
+ gpphLibContext->LibNfcState.next_state =eLibNfcHalStateConfigReady;
+ }
else
{
RetVal = NFCSTATUS_FAILED;
@@ -1302,7 +1312,7 @@ phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t* pConfigInfo,
STATIC void phLibNfc_Mgt_SetP2P_ConfigParams_Cb(void *context,
NFCSTATUS status)
{
- pphLibNfc_RspCb_t pClientCb=NULL;
+ pphLibNfc_RspCb_t pClientCb=NULL;
void *pUpperLayerContext=NULL;
/* Check for the context returned by below layer */
if((phLibNfc_LibContext_t *)context != gpphLibContext)
@@ -1315,13 +1325,13 @@ STATIC void phLibNfc_Mgt_SetP2P_ConfigParams_Cb(void *context,
{ /*shutdown called before completion of this api allow
shutdown to happen */
phLibNfc_Pending_Shutdown();
- status = NFCSTATUS_SHUTDOWN;
+ status = NFCSTATUS_SHUTDOWN;
}
else
{
gpphLibContext->status.GenCb_pending_status = FALSE;
if(NFCSTATUS_SUCCESS != status)
- {
+ {
status = NFCSTATUS_FAILED;
}
else
@@ -1342,7 +1352,7 @@ STATIC void phLibNfc_Mgt_SetP2P_ConfigParams_Cb(void *context,
/* Notify to upper layer status of configure operation */
pClientCb(pUpperLayerContext, status);
}
- }
+ }
return;
}