summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/phHal4Nfc_P2P.c19
-rw-r--r--src/phHal4Nfc_Reader.c10
-rw-r--r--src/phHciNfc_NfcIPMgmt.c24
-rw-r--r--src/phHciNfc_NfcIPMgmt.h2
4 files changed, 34 insertions, 21 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,
diff --git a/src/phHal4Nfc_Reader.c b/src/phHal4Nfc_Reader.c
index 5a91e85..f27bb09 100644
--- a/src/phHal4Nfc_Reader.c
+++ b/src/phHal4Nfc_Reader.c
@@ -558,7 +558,7 @@ NFCSTATUS phHal4Nfc_Transceive(
Hal4Ctxt->sUpperLayerInfo.psUpperLayerCtxt = pContext;
/*Register upper layer callback*/
Hal4Ctxt->psTrcvCtxtInfo->pUpperTranceiveCb = pTrcvCallback;
- if(PH_HAL4NFC_MAX_SEND_LEN
+ if(psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.MaxFrameLength
>= psTransceiveInfo->sSendData.length)
{
Hal4Ctxt->psTrcvCtxtInfo->
@@ -577,17 +577,17 @@ NFCSTATUS phHal4Nfc_Transceive(
Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_buffer
= Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->buffer;
Hal4Ctxt->psTrcvCtxtInfo->XchangeInfo.tx_length
- = PH_HAL4NFC_MAX_SEND_LEN;
+ = psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
#if 0
Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->buffer
- += PH_HAL4NFC_MAX_SEND_LEN;
+ += psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
#else
Hal4Ctxt->psTrcvCtxtInfo->NumberOfBytesSent
- += PH_HAL4NFC_MAX_SEND_LEN;
+ += psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
#endif
/*Number of bytes remaining for next send*/
Hal4Ctxt->psTrcvCtxtInfo->psUpperSendData->length
- -= PH_HAL4NFC_MAX_SEND_LEN;
+ -= psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.MaxFrameLength;
}
Hal4Ctxt->Hal4NextState = eHal4StateTransaction;
#ifdef TRANSACTION_TIMER
diff --git a/src/phHciNfc_NfcIPMgmt.c b/src/phHciNfc_NfcIPMgmt.c
index 06ef2a8..ed26ba3 100644
--- a/src/phHciNfc_NfcIPMgmt.c
+++ b/src/phHciNfc_NfcIPMgmt.c
@@ -1407,15 +1407,25 @@ phHciNfc_NfcIP_InfoUpdate(
(*reg_value & NFCIP_COMM_FACTOR);
p_nfcipinfo->max_frame_len = NFCIP_DATA_RATE_CALC(*reg_value);
- if (NULL != psHciContext->p_target_info)
+ if (p_nfcipinfo->max_frame_len > NFCIP_MAX_DEP_REQ_HDR_LEN)
{
- phHal_sNfcIPInfo_t *p_remtgt_info = NULL;
- /* This is given to user */
- p_remtgt_info =
- &(psHciContext->p_target_info->RemoteDevInfo.NfcIP_Info);
- p_remtgt_info->MaxFrameLength = p_nfcipinfo->max_frame_len;
- p_remtgt_info->Nfcip_Datarate = (phHalNfc_eDataRate_t)
+ p_nfcipinfo->max_frame_len -= NFCIP_MAX_DEP_REQ_HDR_LEN;
+
+ if (NULL != psHciContext->p_target_info)
+ {
+ phHal_sNfcIPInfo_t *p_remtgt_info = NULL;
+ /* This is given to user */
+ p_remtgt_info =
+ &(psHciContext->p_target_info->RemoteDevInfo.NfcIP_Info);
+ p_remtgt_info->MaxFrameLength = p_nfcipinfo->max_frame_len;
+ p_remtgt_info->Nfcip_Datarate = (phHalNfc_eDataRate_t)
p_nfcipinfo->initiator_speed;
+ }
+ }
+ else
+ {
+ status = PHNFCSTVAL(CID_NFC_HCI,
+ NFCSTATUS_INVALID_HCI_RESPONSE);
}
}
else
diff --git a/src/phHciNfc_NfcIPMgmt.h b/src/phHciNfc_NfcIPMgmt.h
index 38bbe43..00e4b7b 100644
--- a/src/phHciNfc_NfcIPMgmt.h
+++ b/src/phHciNfc_NfcIPMgmt.h
@@ -68,7 +68,7 @@
/* LENGTH definition */
#define NFCIP_ATR_MAX_LENGTH PHHAL_MAX_ATR_LENGTH
#define NFCIP_NFCID_LENGTH PHHAL_MAX_UID_LENGTH
-
+#define NFCIP_MAX_DEP_REQ_HDR_LEN 0x05
typedef enum phHciNfc_eNfcIPType{
NFCIP_INVALID = 0x00U,