void phNciNfc_PrintRfDiscoverNtfDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bIndex = 4; PHNCINFC_VALIDATE_PACKET_LENGTH(4, wLen); PH_LOG_NCI_INFO_X32MSG("RF Discovery ID:", (uint32_t)pBuff[0]); PH_LOG_NCI_INFO_STR("RF Protocol: %!NCI_RF_PROTOCOL!", pBuff[1]); PH_LOG_NCI_INFO_STR("RF Technology and Mode: %!NCI_RF_TECH_MODE!", pBuff[2]); PH_LOG_NCI_INFO_X32MSG("Length of RF Technology Specific Parameters:", (uint32_t)pBuff[3]); if (pBuff[3] > 0) { phNciNfc_PrintRfTechSpecificParameters((phNciNfc_RfTechMode_t)pBuff[2], &pBuff[4], pBuff[3]); bIndex += pBuff[3]; } PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex, wLen); switch (pBuff[bIndex]) { case 0: case 1: PH_LOG_NCI_INFO_STR("Notification Type: Last Notification"); break; case 2: PH_LOG_NCI_INFO_STR("Notification Type: More Notification to follow"); break; default: PH_LOG_NCI_INFO_STR("Notification Type: RFU"); break; } }
void phNciNfc_PrintCoreResetRspDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(3, wLen); PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", pBuff[0]); PH_LOG_NCI_INFO_X32MSG("NCI Version:", (uint32_t)pBuff[1]); PH_LOG_NCI_INFO_STR("Configuration Status: %!NCI_RESET_TYPE!", pBuff[2]); }
void phNciNfc_PrintRfDiscoverSelectCmdDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(3, wLen); PH_LOG_NCI_INFO_X32MSG("RF Discovery ID:", (uint32_t)pBuff[0]); PH_LOG_NCI_INFO_STR("RF Protocol: %!NCI_RF_PROTOCOL!", pBuff[1]); PH_LOG_NCI_INFO_STR("RF Interface: %!NCI_RF_INTERFACE!", pBuff[2]); }
__forceinline void phNciNfc_PrintRfTechSpecificParameters(phNciNfc_RfTechMode_t eTechMode, uint8_t *pBuff, uint8_t bLen) { uint16_t wSensRsp; uint8_t bIndex = 0; if (eTechMode == phNciNfc_NFCA_Poll) { wSensRsp = (uint16_t)pBuff[bIndex] + ((uint16_t)pBuff[bIndex+1] << 8); PH_LOG_NCI_INFO_X32MSG("SENS_RES Response:", (uint32_t)wSensRsp); bIndex += sizeof(uint16_t); PH_LOG_NCI_INFO_X32MSG("NFCID1 Length:", (uint32_t)pBuff[bIndex]); if (pBuff[bIndex] > 0) { PH_LOG_NCI_INFO_HEXDUMP("NFCID1: %!HEXDUMP!", WppLogHex(&pBuff[bIndex+1], pBuff[bIndex])); } bIndex += (pBuff[bIndex] + 1); PH_LOG_NCI_INFO_X32MSG("SEL_RES Response Length:", (uint32_t)pBuff[bIndex]); if (pBuff[bIndex] > 0) { PH_LOG_NCI_INFO_HEXDUMP("SEL_RES Response: %!HEXDUMP!", WppLogHex(&pBuff[bIndex+1], pBuff[bIndex])); } } else if (eTechMode == phNciNfc_NFCB_Poll) { PH_LOG_NCI_INFO_X32MSG("SENSB_RES Response Length:", (uint32_t)pBuff[bIndex]); if (pBuff[bIndex] > 0) { PH_LOG_NCI_INFO_HEXDUMP("SENSB_RES Response: %!HEXDUMP!", WppLogHex(&pBuff[bIndex+1], pBuff[bIndex])); } } else if (eTechMode == phNciNfc_NFCF_Poll) { if (pBuff[bIndex] == 1) { PH_LOG_NCI_INFO_STR("Bit Rate: 212 kbps"); } else if (pBuff[bIndex] == 2) { PH_LOG_NCI_INFO_STR("Bit Rate: 424 kbps"); } else { PH_LOG_NCI_INFO_STR("Bit Rate: RFU"); } bIndex++; PH_LOG_NCI_INFO_X32MSG("SENSF_RES Response Length:", (uint32_t)pBuff[bIndex]); if (pBuff[bIndex] > 0) { PH_LOG_NCI_INFO_HEXDUMP("SENSF_RES Response: %!HEXDUMP!", WppLogHex(&pBuff[bIndex+1], pBuff[bIndex])); } } else if (eTechMode == phNciNfc_NFCF_Listen) { PH_LOG_NCI_INFO_X32MSG("Local NFCID2 Length:", (uint32_t)pBuff[bIndex]); if (pBuff[bIndex] > 0) { PH_LOG_NCI_INFO_HEXDUMP("Local NFCID2: %!HEXDUMP!", WppLogHex(&pBuff[bIndex+1], pBuff[bIndex])); } } else { PH_LOG_NCI_INFO_HEXDUMP("RF Technology Specific Parameters: %!HEXDUMP!", WppLogHex(pBuff, bLen)); } }
void phNciNfc_PrintCoreConnCreateCmdDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount = 0, bIndex = 0; uint8_t bSize, bNumParams; phNciNfc_DestType_t eDestinationType; PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); eDestinationType = (phNciNfc_DestType_t)pBuff[bIndex++]; bNumParams = pBuff[bIndex++]; PH_LOG_NCI_INFO_STR("Destination Type: %!NCI_CONN_DEST_TYPE!", eDestinationType); PH_LOG_NCI_INFO_X32MSG("Number of Destination-Specific Parameters:", (uint32_t)bNumParams); for (bCount = 0; bCount < bNumParams; bCount++) { bSize = (1 + pBuff[bIndex+1]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+bSize, wLen); PH_LOG_NCI_INFO_X32MSG("Type:", (uint32_t)pBuff[bIndex]); PH_LOG_NCI_INFO_X32MSG("Length:", (uint32_t)pBuff[bIndex+1]); if (pBuff[bIndex] == 0x00) { PH_LOG_NCI_INFO_X32MSG("RF Discovery ID:", (uint32_t)pBuff[bIndex+2]); PH_LOG_NCI_INFO_STR("RF Protocol: %!NCI_RF_PROTOCOL!", pBuff[bIndex+3]); } else if (pBuff[bIndex] == 0x01) { PH_LOG_NCI_INFO_X32MSG("NFCEE ID:", (uint32_t)pBuff[bIndex+2]); PH_LOG_NCI_INFO_STR("NFCEE Protocol: %!NCI_NFCEE_INTERFACE!", pBuff[bIndex+3]); } bIndex += bSize; } }
void phNciNfc_PrintCoreSetConfigRspDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount, bIndex = 0; uint8_t bSize, bStatus, bNumParams; PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); bStatus = pBuff[bIndex++]; PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", bStatus); if (bStatus != PH_NCINFC_STATUS_OK) { PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); bNumParams = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Num of Parameters:",(uint32_t)bNumParams); for (bCount = 0; bCount < bNumParams; bCount++) { bSize = (pBuff[bIndex] == PHNCINFC_TLVUTIL_NXP_PROP_ID1) ? 2 : 1; PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+bSize, wLen); if (pBuff[bIndex] < PHNCINFC_TLVUTIL_NXP_PROP_ID1) { PH_LOG_NCI_INFO_STR("ID: %!NCI_CONFIG_PARAM_ID!", pBuff[bIndex]); } else if (pBuff[bIndex] == PHNCINFC_TLVUTIL_NXP_PROP_ID1) { PH_LOG_NCI_INFO_STR("ID: %!NXP_CONFIG_PARAM_ID!", pBuff[bIndex+1]); } bIndex += bSize; } } }
NFCSTATUS phNciNfc_CoreRecvMgrDeRegisterCb(void *pCtx, pphNciNfc_CoreRegInfo_t pRegInfo, phNciNfc_NciCoreMsgType_t eMsgType) { NFCSTATUS wStatus = NFCSTATUS_INVALID_PARAMETER; pphNciNfc_CoreContext_t pCoreCtx = (pphNciNfc_CoreContext_t)pCtx; void *pRegList = NULL; PH_LOG_NCI_FUNC_ENTRY(); if((NULL != pCoreCtx) && (NULL != pRegInfo)) { if(NULL != pRegInfo->pNotifyCb) { wStatus = NFCSTATUS_SUCCESS; switch(eMsgType) { case phNciNfc_e_NciCoreMsgTypeCntrlRsp: pRegList = (void *) pCoreCtx->tRspCtx.aRspRegList; PH_LOG_NCI_INFO_STR("De-registering response message call back..."); break; case phNciNfc_e_NciCoreMsgTypeCntrlNtf: pRegList = (void *) pCoreCtx->tNtfCtx.aNtfRegList; PH_LOG_NCI_INFO_STR("De-registering notification message call back..."); break; case phNciNfc_e_NciCoreMsgTypeData: pRegList = (void *) pCoreCtx->tDataCtx.aDataRegList; PH_LOG_NCI_INFO_STR("De-registering data message call back..."); break; default: PH_LOG_NCI_WARN_STR("Invalid message type"); wStatus = NFCSTATUS_INVALID_PARAMETER; break; } if(NFCSTATUS_SUCCESS == wStatus) { wStatus = phNciNfc_CoreDeRegister(pRegList,pRegInfo,eMsgType); } } else { PH_LOG_NCI_WARN_STR("Invalid call back function pointer to register"); } } else { PH_LOG_NCI_WARN_STR("Invalid input parameters"); } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }
static NFCSTATUS phNciNfc_ProcessResetRsp(void *pContext, NFCSTATUS Status) { NFCSTATUS wStatus = Status; pphNciNfc_Context_t pNciContext = pContext; PH_LOG_NCI_FUNC_ENTRY(); if(NULL != pNciContext) { if((NFCSTATUS_RESPONSE_TIMEOUT != Status) && (pNciContext->RspBuffInfo.wLen == 3)) { /*Check Status Byte*/ if (pNciContext->RspBuffInfo.pBuff[0] == PH_NCINFC_STATUS_OK) { /* Nfcc supported Nci version */ pNciContext->ResetInfo.NciVer = pNciContext->RspBuffInfo.pBuff[1]; if((pNciContext->ResetInfo.NciVer & PH_NCINFC_VERSION_MAJOR_MASK) <= (PH_NCINFC_VERSION & PH_NCINFC_VERSION_MAJOR_MASK)) { /* Update Reset type */ if(pNciContext->RspBuffInfo.pBuff[2] == phNciNfc_ResetType_KeepConfig) { PH_LOG_NCI_INFO_STR("Nfcc reseted to 'phNciNfc_ResetType_KeepConfig'"); pNciContext->ResetInfo.ResetTypeRsp = phNciNfc_ResetType_KeepConfig; }else { PH_LOG_NCI_INFO_STR("Nfcc reseted to 'phNciNfc_ResetType_ResetConfig'"); pNciContext->ResetInfo.ResetTypeRsp = phNciNfc_ResetType_ResetConfig; } wStatus = NFCSTATUS_SUCCESS; }else { PH_LOG_NCI_INFO_STR("Unsupported NCI version 0x%02x", pNciContext->ResetInfo.NciVer); wStatus = NFCSTATUS_FAILED; } }else { wStatus = NFCSTATUS_FAILED; } }else { wStatus = NFCSTATUS_FAILED; } }else { wStatus = NFCSTATUS_INVALID_PARAMETER; } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }
void phNciNfc_PrintNfceeDiscoverCmdDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); if (pBuff[0] == 0x00) { PH_LOG_NCI_INFO_STR("Discovery Action: Disable discovery of NFCEE"); } else if (pBuff[0] == 0x01) { PH_LOG_NCI_INFO_STR("Discovery Action: Enable discovery of NFCEE"); } else { PH_LOG_NCI_INFO_STR("Discovery Action: RFU"); } }
void phNciNfc_PrintCoreGetConfigRspDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount = 0, bIndex = 0; uint8_t bSize, bStatus, bNumParams; PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); bStatus = pBuff[bIndex++]; bNumParams = pBuff[bIndex++]; PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", bStatus); PH_LOG_NCI_INFO_X32MSG("Number of Parameters:", (uint32_t)bNumParams); for (bCount = 0; bCount < bNumParams; bCount++) { bSize = (PHNCINFC_TLVUTIL_NXP_PROP_ID1 == pBuff[bIndex]) ? (pBuff[bIndex + 2] + 3) : (pBuff[bIndex + 1] + 2); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+bSize, wLen); if (pBuff[bIndex] < PHNCINFC_TLVUTIL_NXP_PROP_ID1) { PH_LOG_NCI_INFO_STR("ID: %!NCI_CONFIG_PARAM_ID!", pBuff[bIndex]); PH_LOG_NCI_INFO_X32MSG("Length:", (uint32_t)pBuff[bIndex + 1]); if (pBuff[bIndex + 1] > 0) { if (pBuff[bIndex + 1] == 1) { PH_LOG_NCI_INFO_X32MSG("Value:", (uint32_t)pBuff[bIndex + 2]); } else { PH_LOG_NCI_INFO_HEXDUMP("Value: %!HEXDUMP!", WppLogHex((void*)&pBuff[bIndex + 2], (uint16_t)pBuff[bIndex + 1])); } } } else if (pBuff[bIndex] == PHNCINFC_TLVUTIL_NXP_PROP_ID1) { PH_LOG_NCI_INFO_STR("ID: %!NXP_CONFIG_PARAM_ID!", pBuff[bIndex + 1]); PH_LOG_NCI_INFO_X32MSG("Length:", (uint32_t)pBuff[bIndex + 2]); if (pBuff[bIndex + 2] == 1) { PH_LOG_NCI_INFO_X32MSG("Value:", (uint32_t)pBuff[bIndex + 3]); } else if (pBuff[bIndex + 2] > 0) { PH_LOG_NCI_INFO_HEXDUMP("Value: %!HEXDUMP!", WppLogHex((void*)&pBuff[bIndex + 3], (uint16_t)pBuff[bIndex + 2])); } } bIndex += bSize; } }
void phNciNfc_PrintNfceeModeSetCmdDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); PH_LOG_NCI_INFO_X32MSG("NFCEE ID:", (uint32_t)pBuff[0]); if (pBuff[1] == 0x00) { PH_LOG_NCI_INFO_STR("NFCEE Mode: Disable the connected NFCEE"); } else if (pBuff[1] == 0x01) { PH_LOG_NCI_INFO_STR("NFCEE Mode: Enable the connected NFCEE"); } else { PH_LOG_NCI_INFO_STR("NFCEE Mode: RFU"); } }
void phNciNfc_PrintRfParamUpdateCmdDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount = 0, bIndex = 0; uint8_t bSize, bNumParams; PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); bNumParams = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Number of Parameters:", (uint32_t)bNumParams); for (bCount = 0; bCount < bNumParams; bCount++) { bSize = (2 + pBuff[bIndex+1]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+bSize, wLen); PH_LOG_NCI_INFO_STR("ID: %!NCI_RF_PARAMETER_ID!", pBuff[bIndex]); PH_LOG_NCI_INFO_X32MSG("Length:", (uint32_t)pBuff[bIndex+1]); if (pBuff[bIndex+1] == 1) { PH_LOG_NCI_INFO_X32MSG("Value:", (uint32_t)pBuff[bIndex+2]); } else { PH_LOG_NCI_INFO_HEXDUMP("Value: %!HEXDUMP!", WppLogHex((void*)&pBuff[bIndex+2], (uint16_t)pBuff[bIndex+1])); } bIndex += bSize; } }
NFCSTATUS phNciNfc_SetConnCredentials(void *psNciContext) { NFCSTATUS wStatus = NFCSTATUS_SUCCESS; pphNciNfc_Context_t psNciCtxt = (pphNciNfc_Context_t )psNciContext; PH_LOG_NCI_FUNC_ENTRY(); if(NULL == psNciCtxt) { wStatus = PHNFCSTVAL(CID_NFC_NCI, NFCSTATUS_INVALID_PARAMETER); PH_LOG_NCI_CRIT_STR(" Invalid Context Param.."); } else { /* Update Static conn info with conn details & device handle */ wStatus = phNciNfc_UpdateConnDestInfo(psNciCtxt->tActvDevIf.pDevInfo->bRfDiscId, phNciNfc_e_REMOTE_NFC_ENDPOINT, psNciCtxt->tActvDevIf.pDevInfo); if(NFCSTATUS_SUCCESS == wStatus) { PH_LOG_NCI_INFO_STR("Conn Credentials updated successfully.."); } else { PH_LOG_NCI_CRIT_STR("Conn Credentials update failed!!.."); } } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }
static NFCSTATUS phNciNfc_SendCb(void* pContext, void *pInfo, NFCSTATUS wStatus) { NFCSTATUS wStat = wStatus; pphNciNfc_Context_t pNciContext = pContext; UNUSED(pInfo); PH_LOG_NCI_FUNC_ENTRY(); if(NULL != pNciContext) { /* Opening a dummy read request inorder not to loose data sent from remote device */ (void )phNciNfc_DummyReadReq((void *)pNciContext); if(NULL != pNciContext->IfNtf) { pNciContext->IfNtf(pNciContext->IfNtfCtx,wStat,NULL); } if(NULL != pNciContext->tTranscvCtxt.tSendPld.pBuff) { PH_LOG_NCI_INFO_STR("De-allocating Send Request Payload Buffer..."); phOsalNfc_FreeMemory(pNciContext->tTranscvCtxt.tSendPld.pBuff); pNciContext->tTranscvCtxt.tSendPld.pBuff = NULL; pNciContext->tTranscvCtxt.tSendPld.wLen = 0; } } else { PH_LOG_NCI_CRIT_STR("Invalid context received from RecvMgrHdlr!"); } PH_LOG_NCI_FUNC_EXIT(); return wStat; }
static NFCSTATUS phNciNfc_ResetNtfCb(void* pContext, void *pInfo, NFCSTATUS status) { pphNciNfc_Context_t pNciCtx = (pphNciNfc_Context_t )pContext; pphNciNfc_TransactInfo_t pTransInfo = pInfo; NFCSTATUS wStatus; wStatus = status; PH_LOG_NCI_FUNC_ENTRY(); if((NULL != pNciCtx) && (NULL != pTransInfo)) { /* Reset notification received, take necessary action */ PH_LOG_NCI_INFO_STR("Received RESET notification from NFCC"); /* Reset Sender statemachine */ (void )phNciNfc_CoreResetSenderStateMachine(&pNciCtx->NciCoreContext); (void )phTmlNfc_WriteAbort(pNciCtx->NciCoreContext.pHwRef); if(NULL != pNciCtx->tRegListInfo.pResetNtfCb) { pNciCtx->tRegListInfo.pResetNtfCb(pNciCtx->tRegListInfo.ResetNtfCtxt, eNciNfc_NciResetNtf,NULL,NFCSTATUS_SUCCESS); } } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }
void phNciNfc_PrintRfT3tPollingNtfDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount = 0, bIndex = 0; uint8_t bStatus, bSize, bNumResponses; PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); bStatus = pBuff[bIndex++]; PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", bStatus); if (bStatus == PH_NCINFC_STATUS_OK) { PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); bNumResponses = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Number of Responses:", (uint32_t)bNumResponses); for (bCount = 0; bCount < bNumResponses; bCount++) { bSize = (1 + pBuff[bIndex]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+bSize, wLen); if (pBuff[bIndex] > 0) { PH_LOG_NCI_INFO_HEXDUMP("SENSF_RES: %!HEXDUMP!", WppLogHex(&pBuff[bIndex+1], pBuff[bIndex])); } bIndex += bSize; } } }
static NFCSTATUS phNciNfc_CompleteReleaseSequence(void *pContext, NFCSTATUS wStatus) { pphNciNfc_Context_t pNciCtx = pContext; pphNciNfc_IfNotificationCb_t pUpperLayerCb = NULL; void *pUpperLayerCtx = NULL; PH_LOG_NCI_FUNC_ENTRY(); if(NULL != pNciCtx) { pUpperLayerCb = pNciCtx->IfNtf; pUpperLayerCtx = pNciCtx->IfNtfCtx; pNciCtx->IfNtf = NULL; pNciCtx->IfNtfCtx = NULL; wStatus = phNciNfc_ReleaseNciHandle(); if(NULL != pUpperLayerCb) { PH_LOG_NCI_INFO_STR("Invoking upper layer call back function"); pUpperLayerCb(pUpperLayerCtx, wStatus, NULL); } } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }
static NFCSTATUS phNciNfc_SeSendCb(void* pContext, void *pInfo, NFCSTATUS wStatus) { NFCSTATUS wStat = wStatus; pphNciNfc_Context_t pNciContext = pContext; UNUSED(pInfo); PH_LOG_NCI_FUNC_ENTRY(); if(NULL != pNciContext) { if(NULL != pNciContext->tTranscvCtxt.tSendPld.pBuff) { PH_LOG_NCI_INFO_STR("De-allocating Send Request Payload Buffer..."); phOsalNfc_FreeMemory(pNciContext->tTranscvCtxt.tSendPld.pBuff); pNciContext->tTranscvCtxt.tSendPld.pBuff = NULL; pNciContext->tTranscvCtxt.tSendPld.wLen = 0; } phNciNfc_Notify(pNciContext, wStatus, NULL); } else { PH_LOG_NCI_CRIT_STR("Invalid context received from RecvMgrHdlr!"); } PH_LOG_NCI_FUNC_EXIT(); return wStat; }
void phNciNfc_PrintRfIntfActivatedNtfDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(7, wLen); PH_LOG_NCI_INFO_X32MSG("RF Discovery ID:", (uint32_t)pBuff[0]); PH_LOG_NCI_INFO_STR("RF Interface: %!NCI_RF_INTERFACE!", pBuff[1]); PH_LOG_NCI_INFO_STR("RF Protocol: %!NCI_RF_PROTOCOL!", pBuff[2]); PH_LOG_NCI_INFO_STR("RF Technology and Mode: %!NCI_RF_TECH_MODE!", pBuff[3]); PH_LOG_NCI_INFO_X32MSG("Max Data Packet Payload Size:", (uint32_t)pBuff[4]); PH_LOG_NCI_INFO_X32MSG("Initial Number of Credits:", (uint32_t)pBuff[5]); PH_LOG_NCI_INFO_X32MSG("Length of RF Technology Specific Parameters:", (uint32_t)pBuff[6]); if (pBuff[6] > 0) { phNciNfc_PrintRfTechSpecificParameters((phNciNfc_RfTechMode_t)pBuff[3], &pBuff[7], pBuff[6]); } }
void phNciNfc_PrintRfNfceeDiscoveryReqNtfDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount, bIndex = 0; uint8_t bSize, bNumEntries; PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); bNumEntries = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Number of Information Entries:", (uint32_t)bNumEntries); PH_LOG_NCI_INFO_STR("Information Entries:"); for (bCount = 0; bCount < bNumEntries; bCount++) { bSize = (2 + pBuff[bIndex+1]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+bSize, wLen); switch (pBuff[bIndex]) { case 0x00: PH_LOG_NCI_INFO_STR("Request is to add following discovery"); if (3 == pBuff[bIndex+1]) { PH_LOG_NCI_INFO_X32MSG("NFCEE ID", pBuff[bIndex+2]); PH_LOG_NCI_INFO_STR("RF Technology and Mode %!NCI_RF_TECH_MODE!", pBuff[bIndex+3]); PH_LOG_NCI_INFO_STR("RF Protocol %!NCI_RF_PROTOCOL!", pBuff[bIndex+4]); } else { PH_LOG_NCI_INFO_STR("Invalid length!"); } break; case 0x01: PH_LOG_NCI_INFO_STR("Request is to remove following discovery"); if (3 == pBuff[bIndex+1]) { PH_LOG_NCI_INFO_X32MSG("NFCEE ID", pBuff[bIndex+2]); PH_LOG_NCI_INFO_STR("RF Technology and Mode %!NCI_RF_TECH_MODE!", pBuff[bIndex+3]); PH_LOG_NCI_INFO_STR("RF Protocol %!NCI_RF_PROTOCOL!", pBuff[bIndex+4]); } else { PH_LOG_NCI_INFO_STR("Invalid length!"); } break; default: PH_LOG_NCI_INFO_X32MSG("Invalid or Proprietary TLV Type!", pBuff[bIndex]); break; } bIndex += bSize; } }
static NFCSTATUS phNciNfc_CoreRegister(void *pRegList, pphNciNfc_CoreRegInfo_t pRegInfo, phNciNfc_NciCoreMsgType_t eMsgType) { uint8_t bIndex = 0; uint8_t bGetEmptySlot = 1; NFCSTATUS wStatus = NFCSTATUS_FAILED; pphNciNfc_CoreRegRspNtfInfo_t pRegRspNtfList = NULL; pphNciNfc_CoreRegDataInfo_t pRegDataList = NULL; PH_LOG_NCI_FUNC_ENTRY(); if(phNciNfc_e_NciCoreMsgTypeCntrlRsp == eMsgType) { /* Force registration (over-write resposnse/data call back entry if any exist) */ bIndex = 0; wStatus = NFCSTATUS_SUCCESS; } else { /* Get a free slot in the list */ wStatus = phNciNfc_CoreGetIndex(bGetEmptySlot,pRegList,pRegInfo,eMsgType,&bIndex); } if(NFCSTATUS_SUCCESS == wStatus) { switch(eMsgType) { case phNciNfc_e_NciCoreMsgTypeCntrlRsp: case phNciNfc_e_NciCoreMsgTypeCntrlNtf: pRegRspNtfList = (pphNciNfc_CoreRegRspNtfInfo_t)pRegList; pRegRspNtfList[bIndex].bEnabled = pRegInfo->bEnabled; pRegRspNtfList[bIndex].bGid = pRegInfo->bGid; pRegRspNtfList[bIndex].bOid = pRegInfo->bOid; pRegRspNtfList[bIndex].pContext = pRegInfo->pContext; pRegRspNtfList[bIndex].pNotifyCb = pRegInfo->pNotifyCb; break; case phNciNfc_e_NciCoreMsgTypeData: pRegDataList = (pphNciNfc_CoreRegDataInfo_t)pRegList; pRegDataList[bIndex].bEnabled = pRegInfo->bEnabled; pRegDataList[bIndex].bConnId = pRegInfo->bConnId; pRegDataList[bIndex].pContext = pRegInfo->pContext; pRegDataList[bIndex].pNotifyCb = pRegInfo->pNotifyCb; break; default: break; } PH_LOG_NCI_INFO_STR("Registration success"); } else { PH_LOG_NCI_CRIT_STR("No free slots available, registraiton failed!"); } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }
void phNciNfc_PrintCoreConnCreateRspDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", pBuff[0]); if (pBuff[0] == PH_NCINFC_STATUS_OK) { PHNCINFC_VALIDATE_PACKET_LENGTH(4, wLen); PH_LOG_NCI_INFO_X32MSG("Max Data Packet Payload Size:", (uint32_t)pBuff[1]); if (pBuff[2] != 0xFF) { PH_LOG_NCI_INFO_X32MSG("Initial Numer of Credits:", (uint32_t)pBuff[2]); } else { PH_LOG_NCI_INFO_STR("Data flow control is not used"); } PH_LOG_NCI_INFO_X32MSG("Conn ID:", (uint32_t)pBuff[3]); } }
void phNciNfc_PrintNfceeDiscoverRspDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", pBuff[0]); if (pBuff[0] == PH_NCINFC_STATUS_OK) { PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); PH_LOG_NCI_INFO_X32MSG("Number of NFCEEs:", (uint32_t)pBuff[1]); } }
NFCSTATUS phNciNfc_GetConnId( void *pDevHandle, uint8_t *pConnId ) { NFCSTATUS status = NFCSTATUS_FAILED; uint8_t bConnListIdx; PH_LOG_NCI_FUNC_ENTRY(); *pConnId = INVALID_CONN_ID; if( (NULL == pConnId) || (NULL == pDevHandle) ) { status = PHNFCSTVAL(CID_NFC_NCI, NFCSTATUS_INVALID_PARAMETER); PH_LOG_NCI_INFO_STR(" Invalid Params.."); } else { for(bConnListIdx = 0; bConnListIdx < (MAX_LOGICAL_CONNS+1) ; bConnListIdx++) { if(pDevHandle == gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnListIdx].pActvDevHandle) { if(TRUE == gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnListIdx].bIfActive) { *pConnId = gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnListIdx].tConn.bConnId; status = NFCSTATUS_SUCCESS; } else { PH_LOG_NCI_INFO_STR(" Interface not active for this connection"); } break; } } } PH_LOG_NCI_FUNC_EXIT(); return status; }
void phNciNfc_PrintRfSetListenModeRoutingCmdDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount = 0, bIndex = 0; uint8_t bSize, bMore, bNumEntries; PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); bMore = pBuff[bIndex++]; bNumEntries = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("More:", (uint32_t)bMore); PH_LOG_NCI_INFO_X32MSG("Number of Routing Entries:", (uint32_t)bNumEntries); for (bCount = 0; bCount < bNumEntries; bCount++) { bSize = (2 + pBuff[bIndex+1]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+bSize, wLen); PH_LOG_NCI_INFO_STR("Type: %!NCI_LISTEN_MODE_RTNG_TYPE!", pBuff[bIndex]); PH_LOG_NCI_INFO_X32MSG("Length:", (uint32_t)pBuff[bIndex+1]); switch (pBuff[bIndex]) { case 0x00: PH_LOG_NCI_INFO_X32MSG("Route:", (uint32_t)pBuff[bIndex+2]); PH_LOG_NCI_INFO_X32MSG("Power State:", (uint32_t)pBuff[bIndex + 3]); PH_LOG_NCI_INFO_STR("Technology: %!NCI_RF_TECHNOLOGY!", pBuff[bIndex+4]); break; case 0x01: PH_LOG_NCI_INFO_X32MSG("Route:", (uint32_t)pBuff[bIndex+2]); PH_LOG_NCI_INFO_X32MSG("Power State:", (uint32_t)pBuff[bIndex+3]); PH_LOG_NCI_INFO_STR("Protocol: %!NCI_RF_PROTOCOL!", pBuff[bIndex+4]); break; case 0x02: PH_LOG_NCI_INFO_X32MSG("Route:", (uint32_t)pBuff[bIndex+2]); PH_LOG_NCI_INFO_X32MSG("Power State:", (uint32_t)pBuff[bIndex + 3]); PH_LOG_NCI_INFO_HEXDUMP("AID: %!HEXDUMP!", WppLogHex((void*)&pBuff[bIndex+4], (uint16_t)pBuff[bIndex+1]-2)); break; } bIndex += bSize; } }
void phNciNfc_PrintRfParamUpdateRspDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount, bIndex = 0; uint8_t bStatus, bNumParams; PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); bStatus = pBuff[bIndex++]; PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", bStatus); if (bStatus != PH_NCINFC_STATUS_OK) { PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); bNumParams = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Number of Parameters:", (uint32_t)bNumParams); for (bCount = 0; bCount < bNumParams; bCount++) { PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); PH_LOG_NCI_INFO_STR("ID: %!NCI_RF_PARAMETER_ID!", pBuff[bIndex++]); } } }
NFCSTATUS phNciNfc_NfcILstnInit( void *psContext, pphNciNfc_RemoteDevInformation_t pRemDevInf, uint8_t *pBuff, uint16_t wLen ) { NFCSTATUS wStatus = NFCSTATUS_SUCCESS; pphNciNfc_Context_t psNciCtxt = (pphNciNfc_Context_t)psContext; PH_LOG_NCI_FUNC_ENTRY(); if((NULL == psNciCtxt) || (0 == wLen) || (NULL == pBuff) || (NULL == pRemDevInf)) { wStatus = NFCSTATUS_INVALID_PARAMETER; PH_LOG_NCI_INFO_STR("Invalid input parameters"); } else { /* Update Target specific info */ switch(pRemDevInf->eRFTechMode) { case phNciNfc_NFCA_Listen: case phNciNfc_NFCA_Active_Listen: wStatus = phNciNfc_NfcDepLstnRdrAInit(pRemDevInf,pBuff,wLen); break; case phNciNfc_NFCF_Listen: case phNciNfc_NFCF_Active_Listen: wStatus = phNciNfc_NfcDepLstnRdrFInit(pRemDevInf,pBuff,wLen); break; default: PH_LOG_NCI_INFO_STR("Rf Technology and mode not supported"); wStatus = NFCSTATUS_FAILED; break; } } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }
void phNciNfc_PrintRfNfceeActionNtfDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(3, wLen); PH_LOG_NCI_INFO_X32MSG("NFCEE ID:", (uint32_t)pBuff[0]); PH_LOG_NCI_INFO_STR("Trigger: %!NCI_NFCEE_TRIGGER_TYPE!", pBuff[1]); PH_LOG_NCI_INFO_X32MSG("Supporting Data Length:", (uint32_t)pBuff[2]); if (pBuff[2] > 0) { PHNCINFC_VALIDATE_PACKET_LENGTH(3 + pBuff[2], wLen); PH_LOG_NCI_INFO_HEXDUMP("Supporting Data: %!HEXDUMP!", WppLogHex(&pBuff[3], pBuff[2])); } }
void phNciNfc_LogConnMgmtDeInit() { if(gphNciNfc_ConnMgmtInt.tCWTimerIf.TimerStatus == 1) { PH_LOG_NCI_INFO_STR("Stopping Credit await timer.."); (void)phOsalNfc_Timer_Stop(gphNciNfc_ConnMgmtInt.tCWTimerIf.dwTimerId); (void)phOsalNfc_Timer_Delete(gphNciNfc_ConnMgmtInt.tCWTimerIf.dwTimerId); } phOsalNfc_SetMemory(&gphNciNfc_ConnMgmtInt, 0x00, sizeof(phNciNfc_LogConnMgmt_Int_t)); }
NFCSTATUS phNciNfc_GetConnMaxPldSz( uint8_t bConnId, uint8_t *pMaxPldSz ) { NFCSTATUS wStatus = NFCSTATUS_FAILED; uint8_t bConnListIdx; PH_LOG_NCI_FUNC_ENTRY(); if(NULL == pMaxPldSz) { wStatus = PHNFCSTVAL(CID_NFC_NCI, NFCSTATUS_INVALID_PARAMETER); PH_LOG_NCI_INFO_STR(" Invalid Params.."); } else { for(bConnListIdx = 0; bConnListIdx < (MAX_LOGICAL_CONNS+1) ; bConnListIdx++) { if(bConnId == gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnListIdx].tConn.bConnId) { if((TRUE == gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnListIdx].bIfActive) || (CONNTYPE_STATIC == gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnListIdx].tConn.bConnId)) { *pMaxPldSz = gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnListIdx].tConn.bMaxDpldSize; wStatus = NFCSTATUS_SUCCESS; } else { PH_LOG_NCI_INFO_STR(" Interface not active for this connection"); } break; } } } PH_LOG_NCI_FUNC_EXIT(); return wStatus; }