summaryrefslogtreecommitdiffstats
path: root/src/phHal4Nfc_P2P.c
diff options
context:
space:
mode:
authorSunil Jogi <sunil.jogi@nxp.com>2012-01-24 11:11:38 -0800
committerMartijn Coenen <maco@google.com>2012-01-27 12:17:34 -0800
commit32060a1ad89a5791039bf4a7e89db6cbc3e669d0 (patch)
treec4530293f616745716d137091b349a307d0b1fe2 /src/phHal4Nfc_P2P.c
parent7b187e70a5f0ffc021cc06a9f1a2bf2c0f8f8767 (diff)
downloadexternal_libnfc-nxp-32060a1ad89a5791039bf4a7e89db6cbc3e669d0.zip
external_libnfc-nxp-32060a1ad89a5791039bf4a7e89db6cbc3e669d0.tar.gz
external_libnfc-nxp-32060a1ad89a5791039bf4a7e89db6cbc3e669d0.tar.bz2
Adding support for handling maximum length supported by peer
Support for chaining is added based on maximum length supported by and passed in ATS by peer and maximum length supported by the device. Change-Id: I8f9f8468ff8ac9d3579bc8b6afbe3e2072e56de8
Diffstat (limited to 'src/phHal4Nfc_P2P.c')
-rw-r--r--src/phHal4Nfc_P2P.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/phHal4Nfc_P2P.c b/src/phHal4Nfc_P2P.c
index 99c5978..eee22b0 100644
--- a/src/phHal4Nfc_P2P.c
+++ b/src/phHal4Nfc_P2P.c
@@ -33,6 +33,7 @@
#include <phOsalNfc_Timer.h>
#include <phHciNfc.h>
#include <phNfcConfig.h>
+
/* ------------------------------- Macros ------------------------------------*/
#ifdef _WIN32
@@ -66,6 +67,7 @@ phHal4Nfc_Send(
{
NFCSTATUS RetStatus = NFCSTATUS_PENDING;
phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL;
+
/*NULL checks*/
if((NULL == psHwReference)
||( NULL == pSendCallback )
@@ -123,8 +125,9 @@ phHal4Nfc_Send(
= sTransferData.buffer;
Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
= sTransferData.length;
- /*If data size is less than MAX_SEND_LEN ,no chaining is required*/
- if(PH_HAL4NFC_MAX_SEND_LEN >= sTransferData.length)
+
+ /* If data size is less than Peer's Max frame length, then no chaining is required */
+ if(Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.NfcIP_Info.MaxFrameLength >= sTransferData.length)
{
Hal4Ctxt->psTrcvCtxtInfo->
XchangeInfo.params.nfc_info.more_info = FALSE;
@@ -138,11 +141,11 @@ phHal4Nfc_Send(
Hal4Ctxt->psTrcvCtxtInfo->
XchangeInfo.params.nfc_info.more_info = TRUE;
Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length
- = PH_HAL4NFC_MAX_SEND_LEN;
+ = Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_buffer
= sTransferData.buffer;
Hal4Ctxt->psTrcvCtxtInfo->NumberOfBytesSent
- += PH_HAL4NFC_MAX_SEND_LEN;
+ += Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
}
PHDBG_INFO("HAL4:Calling Hci_Send_data()");
RetStatus = phHciNfc_Send_Data (
@@ -380,7 +383,7 @@ void phHal4Nfc_SendCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo)
/*More info remaining in send buffer.continue with sending remaining
bytes*/
if(Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
- > PH_HAL4NFC_MAX_SEND_LEN)
+ > Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.NfcIP_Info.MaxFrameLength)
{
/*Set more info*/
Hal4Ctxt->psTrcvCtxtInfo->
@@ -391,11 +394,11 @@ void phHal4Nfc_SendCompleteHandler(phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt,void *pInfo)
= (Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->buffer
+ Hal4Ctxt->psTrcvCtxtInfo->NumberOfBytesSent);
Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length
- = PH_HAL4NFC_MAX_SEND_LEN;
+ = Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
Hal4Ctxt->psTrcvCtxtInfo->NumberOfBytesSent
- += PH_HAL4NFC_MAX_SEND_LEN;
+ += Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
- -= PH_HAL4NFC_MAX_SEND_LEN;
+ -= Hal4Ctxt->rem_dev_list[0]->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
PHDBG_INFO("Hal4:Calling Hci_senddata() from sendcompletehandler1");
SendStatus = phHciNfc_Send_Data (
Hal4Ctxt->psHciHandle,