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_PrintNfceeDiscoverNtfDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bIndex = 0, bCount = 0; PHNCINFC_VALIDATE_PACKET_LENGTH(3, wLen); PH_LOG_NCI_INFO_X32MSG("NFCEE ID:", (uint32_t)pBuff[bIndex++]); switch (pBuff[bIndex++]) { case 0x00: PH_LOG_NCI_INFO_STR("NFCEE Status: NFCEE connected and enabled"); break; case 0x01: PH_LOG_NCI_INFO_STR("NFCEE Status: NFCEE connected and disabled"); break; case 0x02: PH_LOG_NCI_INFO_STR("NFCEE Status: NFCEE removed"); break; default: PH_LOG_NCI_INFO_STR("NFCEE Status: RFU"); break; } bCount = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Number of Protocols Information Entries", (uint32_t)bCount); PH_LOG_NCI_INFO_STR("Supported NFCEE Protocols"); for (; bCount > 0; bCount--) { PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); PH_LOG_NCI_INFO_STR("NFCEE Interface/Protocol: %!NCI_NFCEE_INTERFACE!", pBuff[bIndex++]); } PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); PH_LOG_NCI_INFO_X32MSG("Number of TLVs are", (uint32_t)pBuff[bIndex++]); }
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++]); } } }
void phNciNfc_PrintRfDiscoverMapCmdDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount = 0, bIndex = 0, bNumConfigs; PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); bNumConfigs = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Number of Mapping Configurations:", (uint32_t)bNumConfigs); for (bCount = 0; bCount < bNumConfigs; bCount++, bIndex += 3) { PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+3, wLen); PH_LOG_NCI_INFO_STR("RF Protocol: %!NCI_RF_PROTOCOL!", pBuff[bIndex]); if (pBuff[bIndex+1] & 0x1) { PH_LOG_NCI_INFO_STR("RF Interface is mapped to the RF Protocol in Poll Mode"); } if (pBuff[bIndex+1] & 0x2) { PH_LOG_NCI_INFO_STR("RF Interface is mapped to the RF Protocol in Listen Mode"); } PH_LOG_NCI_INFO_STR("RF Interface: %!NCI_RF_INTERFACE!", pBuff[bIndex+2]); } }
void phNciNfc_PrintCoreGetConfigCmdDescription(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 = (PHNCINFC_TLVUTIL_NXP_PROP_ID1 == pBuff[bIndex]) ? 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; } }
void phNciNfc_PrintPacketDescription( pphNciNfc_sCoreHeaderInfo_t pHeaderInfo, uint8_t *pBuff, uint16_t wLen, uint8_t bLogDataMessages) { PH_LOG_NCI_FUNC_ENTRY(); PH_LOG_NCI_INFO_STR("NCI Packet Details:"); PH_LOG_NCI_INFO_STR("===================================================="); switch (pHeaderInfo->eMsgType) { case phNciNfc_e_NciCoreMsgTypeData: { PH_LOG_NCI_INFO_STR("Message type: Data"); PH_LOG_NCI_INFO_X32MSG("Conn ID:",(uint32_t)pHeaderInfo->bConn_ID); PH_LOG_NCI_INFO_X32MSG("Payload Length:", (uint32_t)wLen); } break; case phNciNfc_e_NciCoreMsgTypeCntrlCmd: { PH_LOG_NCI_INFO_STR("Message type: Command"); PH_LOG_NCI_INFO_STR("GID: %!phNciNfc_CoreGid!", pHeaderInfo->Group_ID); switch (pHeaderInfo->Group_ID) { case phNciNfc_e_CoreNciCoreGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreNciCoreCmdOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_NciCoreResetCmdOid: phNciNfc_PrintCoreResetCmdDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreInitCmdOid: phNciNfc_PrintCoreInitCmdDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreSetConfigCmdOid: phNciNfc_PrintCoreSetConfigCmdDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreGetConfigCmdOid: phNciNfc_PrintCoreGetConfigCmdDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreConnCreateCmdOid: phNciNfc_PrintCoreConnCreateCmdDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreConnCloseCmdOid: phNciNfc_PrintCoreConnCloseCmdDescription(pBuff, wLen); break; } break; case phNciNfc_e_CoreRfMgtGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreRfMgtCmdOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_RfMgtRfDiscoverMapCmdOid: phNciNfc_PrintRfDiscoverMapCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfSetRoutingCmdOid: phNciNfc_PrintRfSetListenModeRoutingCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfGetRoutingCmdOid: phNciNfc_PrintRfGetListenModeRoutingCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDiscoverCmdOid: phNciNfc_PrintRfDiscoverCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDiscSelectCmdOid: phNciNfc_PrintRfDiscoverSelectCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDeactivateCmdOid: phNciNfc_PrintRfDeactivateCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfT3tPollingCmdOid: phNciNfc_PrintRfT3tPollingCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfParamUpdateCmdOid: phNciNfc_PrintRfParamUpdateCmdDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfIsoDepPresChkCmdOid: phNciNfc_PrintRfIsoDepPresChkCmdDescription(pBuff, wLen); break; } break; case phNciNfc_e_CoreNfceeMgtGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreNfceeMgtCmdOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_NfceeMgtNfceeDiscCmdOid: phNciNfc_PrintNfceeDiscoverCmdDescription(pBuff, wLen); break; case phNciNfc_e_NfceeMgtModeSetCmdOid: phNciNfc_PrintNfceeModeSetCmdDescription(pBuff, wLen); break; } break; case phNciNfc_e_CorePropGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CorePropCmdOid_t!", pHeaderInfo->Opcode_ID.Val); break; case phNciNfc_e_CoreInvalidGid: default: PH_LOG_NCI_INFO_X32MSG("OID:",(uint32_t)pHeaderInfo->Opcode_ID.Val); } } break; case phNciNfc_e_NciCoreMsgTypeCntrlRsp: { PH_LOG_NCI_INFO_STR("Message type: Response"); PH_LOG_NCI_INFO_STR("GID: %!phNciNfc_CoreGid!", pHeaderInfo->Group_ID); switch (pHeaderInfo->Group_ID) { case phNciNfc_e_CoreNciCoreGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreNciCoreRspOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_NciCoreResetRspOid: phNciNfc_PrintCoreResetRspDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreInitRspOid: phNciNfc_PrintCoreInitRspDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreSetConfigRspOid: phNciNfc_PrintCoreSetConfigRspDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreGetConfigRspOid: phNciNfc_PrintCoreGetConfigRspDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreDhConnRspOid: phNciNfc_PrintCoreConnCreateRspDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreConnCloseRspOid: phNciNfc_PrintCoreConnCloseRspDescription(pBuff, wLen); break; } break; case phNciNfc_e_CoreRfMgtGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreRfMgtRspOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_RfMgtRfDiscoverMapRspOid: phNciNfc_PrintRfDiscoverMapRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfSetRoutingRspOid: phNciNfc_PrintRfSetListenModeRoutingRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfGetRoutingRspOid: phNciNfc_PrintRfGetListenModeRoutingRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDiscoverRspOid: phNciNfc_PrintRfDiscoverRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDiscSelectRspOid: phNciNfc_PrintRfDiscoverSelectRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDeactivateRspOid: phNciNfc_PrintRfDeactivateRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfT3tPollingRspOid: phNciNfc_PrintRfT3tPollingRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfParamUpdateRspOid: phNciNfc_PrintRfParamUpdateRspDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfIsoDepPresChkRspOid: phNciNfc_PrintRfIsoDepPresChkRspDescription(pBuff, wLen); break; } break; case phNciNfc_e_CoreNfceeMgtGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreNfceeMgtRspOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_NfceeMgtNfceeDiscRspOid: phNciNfc_PrintNfceeDiscoverRspDescription(pBuff, wLen); break; case phNciNfc_e_NfceeMgtModeSetRspOid: phNciNfc_PrintNfceeModeSetRspDescription(pBuff, wLen); break; } break; case phNciNfc_e_CorePropGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CorePropRspOid_t!", pHeaderInfo->Opcode_ID.Val); break; case phNciNfc_e_CoreInvalidGid: default: PH_LOG_NCI_INFO_X32MSG("OID:",(uint32_t)pHeaderInfo->Opcode_ID.Val); break; } } break; case phNciNfc_e_NciCoreMsgTypeCntrlNtf: { PH_LOG_NCI_INFO_STR("Message type: Notification Message"); PH_LOG_NCI_INFO_STR("GID: %!phNciNfc_CoreGid!", pHeaderInfo->Group_ID); switch (pHeaderInfo->Group_ID) { case phNciNfc_e_CoreNciCoreGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreNciCoreNtfOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_NciCoreResetNtfOid: phNciNfc_PrintCoreResetNtfDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreConnCreditNtfOid: phNciNfc_PrintCoreConnCreditsNtfDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreGenericErrNtfOid: phNciNfc_PrintCoreGenericErrorNtfDescription(pBuff, wLen); break; case phNciNfc_e_NciCoreInterfaceErrNtfOid: phNciNfc_PrintCoreInterfaceErrorNtfDescription(pBuff, wLen); break; } break; case phNciNfc_e_CoreRfMgtGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreRfMgtNtfOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_RfMgtRfGetListenModeRoutingNtfOid: phNciNfc_PrintRfGetListenModeRoutingNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDiscoverNtfOid: phNciNfc_PrintRfDiscoverNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfIntfActivatedNtfOid: phNciNfc_PrintRfIntfActivatedNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfDeactivateNtfOid: phNciNfc_PrintRfDeactivateNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfFieldInfoNtfOid: phNciNfc_PrintRfFieldInfoNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfT3tPollingNtfOid: phNciNfc_PrintRfT3tPollingNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfNfceeActionNtfOid: phNciNfc_PrintRfNfceeActionNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfNfceeDiscoveryReqNtfOid: phNciNfc_PrintRfNfceeDiscoveryReqNtfDescription(pBuff, wLen); break; case phNciNfc_e_RfMgtRfIsoDepPresChkNtfOid: phNciNfc_PrintRfIsoDepPresChkNtfDescription(pBuff, wLen); break; } break; case phNciNfc_e_CoreNfceeMgtGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CoreNfceeMgtNtfOid_t!", pHeaderInfo->Opcode_ID.Val); switch (pHeaderInfo->Opcode_ID.Val) { case phNciNfc_e_NfceeMgtNfceeDiscNtfOid: phNciNfc_PrintNfceeDiscoverNtfDescription(pBuff, wLen); break; } break; case phNciNfc_e_CorePropGid: PH_LOG_NCI_INFO_STR("OID: %!phNciNfc_CorePropNtfOid_t!", pHeaderInfo->Opcode_ID.Val); break; case phNciNfc_e_CoreInvalidGid: default: PH_LOG_NCI_INFO_X32MSG("OID:",(uint32_t)pHeaderInfo->Opcode_ID.Val); break; } } break; default: { PH_LOG_NCI_INFO_STR("Message type: Invalid Message"); } break; } if (pHeaderInfo->eMsgType == phNciNfc_e_NciCoreMsgTypeData) { if (bLogDataMessages) { PH_LOG_NCI_INFO_HEXDUMP("Payload: %!HEXDUMP!", WppLogHex(pBuff, wLen)); } } else { PH_LOG_NCI_INFO_HEXDUMP("Payload: %!HEXDUMP!", WppLogHex(pBuff, wLen)); } PH_LOG_NCI_INFO_STR("===================================================="); PH_LOG_NCI_FUNC_EXIT(); }
void phNciNfc_PrintCoreInterfaceErrorNtfDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", pBuff[0]); PH_LOG_NCI_INFO_X32MSG("Conn ID:", (uint32_t)pBuff[1]); }
void phNciNfc_PrintCoreResetNtfDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(2, wLen); PH_LOG_NCI_INFO_X32MSG("Reason Code:", (uint32_t)pBuff[0]); PH_LOG_NCI_INFO_STR("Configuration Status: %!NCI_RESET_TYPE!", pBuff[1]); }
void phNciNfc_PrintCoreInitRspDescription(uint8_t *pBuff, uint16_t wLen) { uint8_t bCount = 0, bIndex = 0, bStatus, bNumInterfaces; uint16_t wMaxRoutingTableSize, wMaxSizeLargeParam; phNciNfc_sCoreNfccFeatures_t tNfccFeatures; PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); bStatus = pBuff[bIndex++]; PH_LOG_NCI_INFO_STR("Status: %!NCI_STATUS!", bStatus); if (bStatus == PH_NCINFC_STATUS_OK) { PH_LOG_NCI_INFO_STR("Discovery Configuration Mode:"); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+4, wLen); tNfccFeatures.DiscConfSuprt = pBuff[bIndex++]; tNfccFeatures.RoutingType = pBuff[bIndex++]; tNfccFeatures.PwrOffState = pBuff[bIndex++]; tNfccFeatures.Byte3 = pBuff[bIndex++]; if (tNfccFeatures.DiscConfSuprt & 0x01) { PH_LOG_NCI_INFO_STR("Discovery Frequency supported"); } else { PH_LOG_NCI_INFO_STR("Discovery Frequency value is ignored"); } if ((tNfccFeatures.DiscConfSuprt & 0x06) == 0x00) { PH_LOG_NCI_INFO_STR("DH is the only entity that configures the NFCC"); } else { PH_LOG_NCI_INFO_STR("NFCC can receive configurations from the DH and other NFCEEs"); } PH_LOG_NCI_INFO_STR("Technology based routing %s", (tNfccFeatures.RoutingType & 0x02) ? "supported" : "not supported"); PH_LOG_NCI_INFO_STR("Protocol based routing %s", (tNfccFeatures.RoutingType & 0x04) ? "supported" : "not supported"); PH_LOG_NCI_INFO_STR("AID based routing %s", (tNfccFeatures.RoutingType & 0x08) ? "supported" : "not supported"); PH_LOG_NCI_INFO_STR("Battery Off state %s", (tNfccFeatures.PwrOffState & 0x01) ? "supported" : "not supported"); PH_LOG_NCI_INFO_STR("Switched Off state %s", (tNfccFeatures.PwrOffState & 0x02) ? "supported" : "not supported"); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); bNumInterfaces = pBuff[bIndex++]; PH_LOG_NCI_INFO_X32MSG("Number of Supported RF Interfaces:", (uint32_t)bNumInterfaces); for (bCount = 0; bCount < bNumInterfaces; bCount++) { PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); PH_LOG_NCI_INFO_STR("RF Interface: %!NCI_RF_INTERFACE!", pBuff[bIndex++]); } PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); PH_LOG_NCI_INFO_X32MSG("Max Logical Connections:",(uint32_t)pBuff[bIndex++]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+2, wLen); wMaxRoutingTableSize = ((uint16_t)pBuff[bIndex] + ((uint16_t)pBuff[bIndex+1] << 8)); PH_LOG_NCI_INFO_X32MSG("Max Routing Table Size:", (uint32_t)wMaxRoutingTableSize); bIndex += 2; PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); PH_LOG_NCI_INFO_X32MSG("Max Control Packet Payload Size:", (uint32_t)pBuff[bIndex++]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+2, wLen); wMaxSizeLargeParam = ((uint16_t)pBuff[bIndex] + ((uint16_t)pBuff[bIndex+1] << 8)); PH_LOG_NCI_INFO_X32MSG("Max Size for Large Parameters:", (uint32_t)wMaxSizeLargeParam); bIndex += 2; PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+1, wLen); PH_LOG_NCI_INFO_X32MSG("Manufacturer ID:", (uint32_t)pBuff[bIndex++]); PHNCINFC_VALIDATE_PACKET_LENGTH(bIndex+4, wLen); for (bCount = 0; bCount < 4; bCount++) { PH_LOG_NCI_INFO_STR("Manufacturer Specific Info Byte%d: 0x%x", (uint32_t)bCount+1, (uint32_t)pBuff[bIndex++]); } } }
void phNciNfc_PrintCoreConnCloseCmdDescription(uint8_t *pBuff, uint16_t wLen) { PHNCINFC_VALIDATE_PACKET_LENGTH(1, wLen); PH_LOG_NCI_INFO_X32MSG("Conn ID:", (uint32_t)pBuff[0]); }
NFCSTATUS phNciNfc_ProcessConnCreditNtf( void *psContext, void *pInfo, NFCSTATUS wStatus ) { NFCSTATUS status = NFCSTATUS_SUCCESS; pphNciNfc_CoreContext_t pCoreCtx = (pphNciNfc_CoreContext_t)psContext; pphNciNfc_TransactInfo_t pTransInfo = (pphNciNfc_TransactInfo_t)pInfo; phNciNfc_CoreGid_t tNtfGid; phNciNfc_CoreNciCoreNtfOid_t tNtfOid; uint8_t bConnIdx; uint8_t bNewCredits = 0; uint8_t bNumOfEntries; uint8_t bEntrIdx; UNUSED(psContext); PH_LOG_NCI_FUNC_ENTRY(); if( (NULL == pTransInfo) || (NULL == pCoreCtx) || (NULL == pTransInfo->pbuffer) ||(0 == pTransInfo->wLength) || (PH_NCINFC_STATUS_OK != wStatus) ) { status = PHNFCSTVAL(CID_NFC_NCI, NFCSTATUS_FAILED); PH_LOG_NCI_INFO_STR(" Conn Notification invalid.."); } else { tNtfGid = pCoreCtx->tReceiveInfo.HeaderInfo.Group_ID; tNtfOid = pCoreCtx->tReceiveInfo.HeaderInfo.Opcode_ID.OidType.NciCoreNtfOid; if(phNciNfc_e_CoreNciCoreGid == tNtfGid) { if(phNciNfc_e_NciCoreConnCreditNtfOid == tNtfOid) { PH_LOG_NCI_INFO_STR(" Core ConnCredits Notification received.."); bNumOfEntries = pTransInfo->pbuffer[0]; for(bEntrIdx = 0; bEntrIdx < bNumOfEntries; bEntrIdx++) { status = phNciNfc_GetConnIndex(pTransInfo->pbuffer[1], &bConnIdx); if(NFCSTATUS_SUCCESS == status) { gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnIdx].tConn.bNumCredits += pTransInfo->pbuffer[2]; if(gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnIdx].tConn.bNumCredits > MAX_CREDITS_LIMIT) { gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnIdx].tConn.bNumCredits = MAX_CREDITS_LIMIT; PH_LOG_NCI_INFO_STR(" Credits Limit xceeded for this Conn, Ignoring notif value .."); } else { PH_LOG_NCI_INFO_STR(" Credits updated for ConnId: 0x%x to 0x%x", gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnIdx].tConn.bConnId, gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnIdx].tConn.bNumCredits); } bNewCredits = gphNciNfc_ConnMgmtInt.tConnInfo.tConnList[bConnIdx].tConn.bNumCredits; } else { PH_LOG_NCI_INFO_X32MSG( " Failed to get Conn details for index..",bConnIdx); } } } else { status = PHNFCSTVAL(CID_NFC_NCI, NFCSTATUS_INVALID_PARAMETER); PH_LOG_NCI_INFO_STR(" Invalid Oid received.."); } } else { status = PHNFCSTVAL(CID_NFC_NCI, NFCSTATUS_INVALID_PARAMETER); PH_LOG_NCI_INFO_STR(" Invalid Gid received.."); } } PH_LOG_NCI_INFO_STR("Credits awaited: %d, timerstatus: %d", gphNciNfc_ConnMgmtInt.bCreditsAwaited, gphNciNfc_ConnMgmtInt.tCWTimerIf.TimerStatus); /* Invoke the registered CB function if waiting for credits */ if(TRUE == gphNciNfc_ConnMgmtInt.bCreditsAwaited) { 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); gphNciNfc_ConnMgmtInt.tCWTimerIf.TimerStatus = 0; gphNciNfc_ConnMgmtInt.tCWTimerIf.dwTimerId = 0; } gphNciNfc_ConnMgmtInt.bCreditsAwaited = FALSE; if(NULL != gphNciNfc_ConnMgmtInt.pCrdtsNotify) { (void)(gphNciNfc_ConnMgmtInt.pCrdtsNotify)((gphNciNfc_ConnMgmtInt.pContext),bNewCredits,status); } else { PH_LOG_NCI_WARN_STR("No CB registered for credits availability!!"); } } PH_LOG_NCI_FUNC_EXIT(); return status; }
void phNciNfc_GetRfDevType(uint8_t bRespVal, uint8_t bRespLen, pphNciNfc_RemoteDevInformation_t pRemDevInf, phNciNfc_RFDevType_t *pDevType) { PH_LOG_NCI_FUNC_ENTRY(); if((NULL != pRemDevInf) && (NULL != pDevType)) { /* Technology and mode of local device (NFCC) */ if(phNciNfc_NFCA_Poll == pRemDevInf->eRFTechMode) { /* If length of select response is '0', remote device is of 'Jewel' type */ if(0 != bRespLen) { if((phNciNfc_e_RfInterfacesNFCDEP_RF == pRemDevInf->eRfIf) && (phNciNfc_e_RfProtocolsNfcDepProtocol == pRemDevInf->eRFProtocol)) { /* Remote device is a P2P Target */ *pDevType = phNciNfc_eNfcIP1_Target; } else { PH_LOG_NCI_INFO_X32MSG("SAK Received",(SEL_RESP_CONFIG_MASK & bRespVal)); switch(bRespVal & SEL_RESP_CONFIG_MASK) { /* Ref: section 4.8.2 of [DIGITAL] */ case 0: /* Configured for Type 2 Tag Platform */ { *pDevType = phNciNfc_eMifareUL_PICC; PH_LOG_NCI_INFO_STR(" MifareUL tag detected.."); break; } case MIFARE_1K_SAK: case MIFARE_1K_SAK88: case MIFARE_1K_SAK28: case MIFARE_1K_CLASSIC_SAK: { if((phNciNfc_e_RfInterfacesISODEP_RF == pRemDevInf->eRfIf) && (phNciNfc_e_RfProtocolsIsoDepProtocol == pRemDevInf->eRFProtocol)) { /* Remote device is a phNciNfc_eISO14443_4A_PICC*/ *pDevType = phNciNfc_eISO14443_4A_PICC; PH_LOG_NCI_INFO_STR("4A tag detected.."); } else { *pDevType = phNciNfc_eMifare1k_PICC; PH_LOG_NCI_INFO_STR(" Mifare1k tag detected.."); } } break; case MIFARE_4K_SAK: case MIFARE_4K_SAK38: case MIFARE_4K_SAK98: case MIFARE_4K_SAKB8: { *pDevType = phNciNfc_eMifare4k_PICC; PH_LOG_NCI_INFO_STR(" Mifare4k tag detected.."); } break; case MIFARE_MINI_SAK: { *pDevType = phNciNfc_eMifareMini_PICC; PH_LOG_NCI_INFO_STR(" Mifare Mini tag detected.."); } break; case 0x24: case 0x20: /* Configured for Type 4A Tag Platform */ case 0x60: /* FIXME: Workaround to enable CE when ISODEP & NFCDEP is enabled */ case 0x68: { *pDevType = phNciNfc_eISO14443_4A_PICC; PH_LOG_NCI_INFO_STR(" 4A tag detected.."); break; } default: { *pDevType = phNciNfc_eUnknown_DevType; PH_LOG_NCI_INFO_STR(" Unknown tag detected.."); break; } } } } else { /* Type 1 Tag type [TODO?] Temporary type assigned below */ *pDevType = phNciNfc_eJewel_PICC; PH_LOG_NCI_INFO_STR(" Type 1 Tag detected.."); } } else if((phNciNfc_NFCA_Active_Listen == pRemDevInf->eRFTechMode) || (phNciNfc_NFCF_Active_Listen == pRemDevInf->eRFTechMode) || (phNciNfc_NFCA_Listen == pRemDevInf->eRFTechMode)) { if((phNciNfc_e_RfInterfacesNFCDEP_RF == pRemDevInf->eRfIf) && (phNciNfc_e_RfProtocolsNfcDepProtocol == pRemDevInf->eRFProtocol)) { /* Remote device is a P2P Initiator */ *pDevType = phNciNfc_eNfcIP1_Initiator; } else { PH_LOG_NCI_CRIT_STR("Nfc-A Listen mode notification - unknown"); } } else if(phNciNfc_NFCB_Poll == pRemDevInf->eRFTechMode) { if(bRespVal & 0x01) { PH_LOG_NCI_INFO_STR(" 4B tag detected.."); *pDevType = phNciNfc_eISO14443_4B_PICC; } else { /* Todo:- Non ISO14443 B card detected,exact name to be updated */ *pDevType = phNciNfc_eUnknown_DevType; } } else if((phNciNfc_NFCF_Poll == pRemDevInf->eRFTechMode) || (phNciNfc_NFCF_Active_Poll == pRemDevInf->eRFTechMode)) { if(phNciNfc_e_RfProtocolsNfcDepProtocol == pRemDevInf->eRFProtocol) { /* Remote device is a P2P Target */ *pDevType = phNciNfc_eNfcIP1_Target; } } else if((phNciNfc_NFCA_Active_Poll == pRemDevInf->eRFTechMode) ) { if(phNciNfc_e_RfProtocolsNfcDepProtocol == pRemDevInf->eRFProtocol) { /* Remote device is a P2P Target */ *pDevType = phNciNfc_eNfcIP1_Target; } } else { /* Other types */ } } else { PH_LOG_NCI_CRIT_STR("Invalid Input Parameter"); } PH_LOG_NCI_FUNC_EXIT(); }