static NFCSTATUS phLibNfc_IoctlSetRfCfgProc(void* pContext, NFCSTATUS status, void* pInfo) { NFCSTATUS wStatus = NFCSTATUS_SUCCESS; UNUSED(pContext); UNUSED(status); UNUSED(pInfo); PH_LOG_LIBNFC_FUNC_ENTRY(); PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
static void phLibNfc_Ioctl_Mgmt_CB(void *context, phNfc_sData_t *pOutData, NFCSTATUS status) { NFCSTATUS wStatus = NFCSTATUS_INVALID_PARAMETER; phLibNfc_Ioctl_Cntx_t *pIoctlCtx = (phLibNfc_Ioctl_Cntx_t *)context; PH_LOG_LIBNFC_FUNC_ENTRY(); if((NULL != pIoctlCtx) && (pIoctlCtx == &gphLibNfc_IoctlCtx)) { switch(pIoctlCtx->IoctlCode) { case PHLIBNFC_ENABLE_DTA_MODE: { wStatus = status; PH_LOG_LIBNFC_INFO_STR("Ioctl DTA mode Complete"); } break; case PHLIBNFC_DISABLE_DTA_MODE: { wStatus = status; PH_LOG_LIBNFC_INFO_STR("Ioctl DTA mode Complete"); } break; case PHLIBNFC_SET_RAW_CONFIG: { wStatus = status; PH_LOG_LIBNFC_INFO_STR("Ioctl set raw config complete"); } break; default: { } break; } if(NULL != pIoctlCtx->CliRspCb) { pIoctlCtx->CliRspCb(pIoctlCtx->pCliCntx,pOutData,wStatus); pIoctlCtx->CliRspCb = NULL; pIoctlCtx->pCliCntx = NULL; } } PH_LOG_LIBNFC_FUNC_EXIT(); return ; }
static NFCSTATUS phLibNfc_GetNfccFeatures(void *pNciHandle) { phNciNfc_NfccFeatures_t tNfccFeatures; NFCSTATUS wStatus = NFCSTATUS_SUCCESS; PH_LOG_LIBNFC_FUNC_ENTRY(); wStatus = phNciNfc_GetNfccFeatures(pNciHandle,&tNfccFeatures); if(NFCSTATUS_SUCCESS != wStatus) { wStatus = NFCSTATUS_FAILED; } else { PHLIBNFC_GETCONTEXT()->tNfccFeatures = tNfccFeatures; } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
static NFCSTATUS phLibNfc_IoctlSetRfCfgComplete(void* pContext,NFCSTATUS status,void* pInfo) { UNUSED(pInfo); UNUSED(pContext); PH_LOG_LIBNFC_FUNC_ENTRY(); if (NULL != gpphLibNfc_Context) { /* Invoke upper layer with proper status */ phLibNfc_Ioctl_Mgmt_CB(&gphLibNfc_IoctlCtx,NULL,status); } PH_LOG_LIBNFC_FUNC_EXIT(); return status; }
static NFCSTATUS phLibNfc_Initialize(void* pContext, NFCSTATUS status, void* pInfo) { NFCSTATUS wStatus = NFCSTATUS_SUCCESS; pphLibNfc_Context_t pCtx = (pphLibNfc_Context_t ) pContext; phNciNfc_Config_t config = {0}; PH_LOG_LIBNFC_FUNC_ENTRY(); UNUSED(status); UNUSED(pInfo); config.bConfigOpt = (uint8_t)pCtx->Config.bConfigOpt; config.bLogDataMessages = (uint8_t)pCtx->Config.bLogNciDataMessages; wStatus=phNciNfc_Initialise( pCtx->sHwReference.pDriverHandle, &config, (pphNciNfc_IfNotificationCb_t) &phLibNfc_InternalSequence,pContext, phNciNfc_ResetType_KeepConfig ); PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
static NFCSTATUS phLibNfc_IoctlSetRfConfig(uint8_t *pInBuffer, uint32_t Size) { NFCSTATUS wStatus = NFCSTATUS_INVALID_PARAMETER; PH_LOG_LIBNFC_FUNC_ENTRY(); if((NULL != pInBuffer) && (0 != Size) && (NULL != gpphLibNfc_Context)) { gpphLibNfc_Context->tRfRawConfig.length = (uint16_t) Size; gpphLibNfc_Context->tRfRawConfig.buffer = pInBuffer; /* Initialize the sequence and start */ PHLIBNFC_INIT_SEQUENCE(gpphLibNfc_Context,gphLibNfc_IoctlSetRfConfig); wStatus = phLibNfc_SeqHandler(gpphLibNfc_Context,NFCSTATUS_SUCCESS,NULL); } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
NFCSTATUS phLibNfc_IoctlSetRfCfgCmd(void* pContext, NFCSTATUS status, void* pInfo) { NFCSTATUS wStatus = NFCSTATUS_INVALID_PARAMETER; UNUSED(pInfo); UNUSED(status); UNUSED(pContext); PH_LOG_LIBNFC_FUNC_ENTRY(); if(NULL != gpphLibNfc_Context) { wStatus = phNciNfc_SetConfigRaw(gpphLibNfc_Context->sHwReference.pNciHandle, gpphLibNfc_Context->tRfRawConfig.buffer, (uint16_t) gpphLibNfc_Context->tRfRawConfig.length, (pphNciNfc_IfNotificationCb_t)&phLibNfc_InternalSequence, gpphLibNfc_Context); } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
NFCSTATUS phLibNfc_Discovered2Recv(void *pContext, void *Param1, void *Param2, void *Param3) { pphLibNfc_Context_t pLibContext = (pphLibNfc_Context_t)pContext; NFCSTATUS wStatus = NFCSTATUS_SUCCESS; UNUSED(Param2); UNUSED(Param3); PH_LOG_LIBNFC_FUNC_ENTRY(); if(NULL != pLibContext) { /* Perform P2P read */ wStatus = phNciNfc_SendData(pLibContext->sHwReference.pNciHandle, (pphNciNfc_IfNotificationCb_t)&phLibNfc_P2pRemoteDev_SendCb, (void *)pLibContext, (phNfc_sData_t *)Param1); } else { wStatus = NFCSTATUS_INVALID_PARAMETER; } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
static NFCSTATUS phLibNfc_InitializeComplete(void* pContext, NFCSTATUS status, void* pInfo) { NFCSTATUS wStatus = status; pphLibNfc_LibContext_t pLibContext = (pphLibNfc_LibContext_t)pContext; phLibNfc_Event_t TrigEvent = phLibNfc_EventReqCompleted; pphLibNfc_InitCallback_t pClientCb; void * pUpperLayerContext; UNUSED(pInfo); PH_LOG_LIBNFC_FUNC_ENTRY(); if(NFCSTATUS_SUCCESS == wStatus) { /* Initializing the Flags during init*/ gpphLibNfc_Context->HCE_FirstBuf = 0; pLibContext->bPcdConnected = FALSE; pLibContext->dev_cnt = 0; wStatus = phLibNfc_StateHandler(pContext, TrigEvent, pInfo, NULL, NULL); } if(NFCSTATUS_SUCCESS == wStatus) { pClientCb = pLibContext->CBInfo.pClientInitCb; pUpperLayerContext = pLibContext->CBInfo.pClientInitCntx; pLibContext->CBInfo.pClientInitCb = NULL; pLibContext->CBInfo.pClientInitCntx = NULL; if(NULL != pClientCb) { (*pClientCb)(pUpperLayerContext,pLibContext->eConfigStatus,wStatus); } } else { phLibNfc_ReleaseLibNfcContext(pContext,NFCSTATUS_FAILED); } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
static void phLibNfc_P2pRemoteDev_SendCb(void* pContext,NFCSTATUS status,void* pInfo) { NFCSTATUS wStatus = status; pphLibNfc_LibContext_t pLibContext = (pphLibNfc_LibContext_t)pContext; phLibNfc_Event_t TrigEvent = phLibNfc_EventReqCompleted; pphLibNfc_RspCb_t pUpperLayerCb = NULL; void *UpperLayerCtx = NULL; UNUSED(pInfo); PH_LOG_LIBNFC_FUNC_ENTRY(); if((NULL != pLibContext) && (gpphLibNfc_Context == pLibContext)) { pUpperLayerCb = pLibContext->CBInfo.pClientNfcIpTxCb; UpperLayerCtx = pLibContext->CBInfo.pClientNfcIpTxCntx; pLibContext->CBInfo.pClientNfcIpTxCb = NULL; pLibContext->CBInfo.pClientNfcIpTxCntx = NULL; (void)phLibNfc_StateHandler(pLibContext, TrigEvent, NULL, NULL, NULL); if(NULL != pUpperLayerCb) { pUpperLayerCb(UpperLayerCtx,wStatus); } } PH_LOG_LIBNFC_FUNC_EXIT(); }
static NFCSTATUS phLibNfc_DtaSetConfigCb(void* pContext, NFCSTATUS status, void* pInfo) { NFCSTATUS wStatus = NFCSTATUS_FAILED; UNUSED(pContext); UNUSED(pInfo); PH_LOG_LIBNFC_FUNC_ENTRY(); wStatus = status; if(NFCSTATUS_SUCCESS == wStatus) { PH_LOG_LIBNFC_INFO_STR("Request Successful"); } else { wStatus = NFCSTATUS_FAILED; PH_LOG_LIBNFC_CRIT_STR("Request Failed!!"); } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
NFCSTATUS phLibNfc_Mgt_IoCtl(void* pDriverHandle, uint16_t IoctlCode, phNfc_sData_t* pInParam, phNfc_sData_t* pOutParam, pphLibNfc_IoctlCallback_t pIoCtl_Rsp_cb, void* pContext ) { NFCSTATUS wStatus = NFCSTATUS_SUCCESS; PH_LOG_LIBNFC_FUNC_ENTRY(); UNUSED(pInParam); if((0 == IoctlCode) || (NULL == pIoCtl_Rsp_cb) || (NULL == pContext) || (NULL == pDriverHandle)) { wStatus = NFCSTATUS_INVALID_PARAMETER; goto Done; } gphLibNfc_IoctlCtx.CliRspCb = pIoCtl_Rsp_cb; gphLibNfc_IoctlCtx.pCliCntx = pContext; gphLibNfc_IoctlCtx.pOutParam = pOutParam; gphLibNfc_IoctlCtx.IoctlCode = IoctlCode; switch(IoctlCode) { case PHLIBNFC_ENABLE_DTA_MODE: { if(NULL != gpphLibNfc_Context) { gpphLibNfc_Context->bDtaFlag = 1; gpphLibNfc_Context->ndef_cntx.psNdefMap->bDtaFlag = 1; gpphLibNfc_Context->llcp_cntx.sLlcpContext.bDtaFlag = 1; PHLIBNFC_INIT_SEQUENCE(gpphLibNfc_Context, gphLibNfc_DtaEnableSequence); wStatus = phLibNfc_SeqHandler(gpphLibNfc_Context,NFCSTATUS_SUCCESS,NULL); } } break; case PHLIBNFC_DISABLE_DTA_MODE: { if(NULL != gpphLibNfc_Context) { gpphLibNfc_Context->bDtaFlag = 0; gpphLibNfc_Context->ndef_cntx.psNdefMap->bDtaFlag = 0; gpphLibNfc_Context->llcp_cntx.sLlcpContext.bDtaFlag = 0; PHLIBNFC_INIT_SEQUENCE(gpphLibNfc_Context, gphLibNfc_DtaDisableSequence); wStatus = phLibNfc_SeqHandler(gpphLibNfc_Context,NFCSTATUS_SUCCESS,NULL); } } break; case PHLIBNFC_SET_RAW_CONFIG: { if((NULL == pInParam) || (NULL == pInParam->buffer) || (pInParam->length < PHLIBNFC_INPUT_BUFF_MIN_LEN)) { /* Invalid input parameters, can not perform Rf configuration */ wStatus = NFCSTATUS_INVALID_PARAMETER; } else { wStatus = phLibNfc_IoctlSetRfConfig(pInParam->buffer,pInParam->length); } } break; default: { /* Do nothing */ wStatus = NFCSTATUS_INVALID_PARAMETER; } break; } Done: PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
NFCSTATUS phLibNfc_Mgt_SetP2P_ConfigParams(phLibNfc_sNfcIPCfg_t *pConfigInfo, pphLibNfc_RspCb_t pConfigRspCb, void * pContext) { NFCSTATUS wStatus = NFCSTATUS_FAILED; pphLibNfc_LibContext_t pLibContext = gpphLibNfc_Context; pphNciNfc_RfDiscConfigParams_t pRfDiscConfParam = NULL; uint8_t bGeneralBytesLength = 0; phLibNfc_DummyInfo_t Info; phLibNfc_Event_t TrigEvent = phLibNfc_EventDummy; PH_LOG_LIBNFC_FUNC_ENTRY(); Info.Evt = phLibNfc_DummyEventInvalid; if(NULL == pLibContext) { wStatus = NFCSTATUS_NOT_INITIALISED; } else if((NULL == pConfigInfo) ||(NULL == pConfigRspCb)) { wStatus = NFCSTATUS_INVALID_PARAMETER; } else { bGeneralBytesLength = pConfigInfo->generalBytesLength; if((pLibContext->bDtaFlag || (0 != bGeneralBytesLength)) && (PH_LIBNFC_INTERNAL_MAX_ATR_LENGTH >= bGeneralBytesLength)) { /* Allocate memory for the input parameter that needs to be sent to 'phNciNfc_SetConfigRfParameters' API */ pRfDiscConfParam = (pphNciNfc_RfDiscConfigParams_t)phOsalNfc_GetMemory( sizeof(phNciNfc_RfDiscConfigParams_t)); if(NULL != pRfDiscConfParam) { phOsalNfc_SetMemory(pRfDiscConfParam,0,sizeof(phNciNfc_RfDiscConfigParams_t)); pLibContext->CBInfo.pClientNfcIpCfgCb = pConfigRspCb; pLibContext->CBInfo.pClientNfcIpCfgCntx = pContext; /* Set general bytes for Poll Nfc-Dep parameters */ switch(pConfigInfo->p2pMode) { case NFC_DEP_POLL: pRfDiscConfParam->tConfigInfo.PollNfcDepConfig = 1; /* Configuring general bytes for ATR_REQ */ pRfDiscConfParam->tPollNfcDepDiscParams.PollNfcDepConfig.EnableConfig = 0; pRfDiscConfParam->tPollNfcDepDiscParams.PollNfcDepConfig.Config.bSetGenBytes = 1; pRfDiscConfParam->tPollNfcDepDiscParams.bAtrReqGeneBytesSize = bGeneralBytesLength; phOsalNfc_MemCopy(pRfDiscConfParam->tPollNfcDepDiscParams.aAtrReqGenBytes, pConfigInfo->generalBytes,bGeneralBytesLength); /*Enable General Bytes to default values*/ /*Configure to default value = 0x30*/ pRfDiscConfParam->tPollNfcDepDiscParams.PollNfcDepConfig.Config.bSetAtrConfig = 1; pRfDiscConfParam->tPollNfcDepDiscParams.AtrReqConfig.bDid = 0; /*0 For LLCP*/ pRfDiscConfParam->tPollNfcDepDiscParams.AtrReqConfig.bLr = 0x03;/*0x03 for LLCP*/ break; case NFC_DEP_LISTEN: /* Set general bytes for Listen Nfc-Dep parameters */ pRfDiscConfParam->tConfigInfo.LstnNfcDepConfig = 1; /* Configuring general bytes for ATR_RES */ pRfDiscConfParam->tLstnNfcDepDiscParams.LstnNfcDepConfig.EnableConfig = 0; pRfDiscConfParam->tLstnNfcDepDiscParams.LstnNfcDepConfig.Config.bSetGenBytes = 1; pRfDiscConfParam->tLstnNfcDepDiscParams.bAtrResGenBytesSize = bGeneralBytesLength; phOsalNfc_MemCopy(pRfDiscConfParam->tLstnNfcDepDiscParams.aAtrResGenBytes, pConfigInfo->generalBytes,bGeneralBytesLength); /*Enable General Bytes in response*/ /*Configure to defaule value*/ pRfDiscConfParam->tLstnNfcDepDiscParams.LstnNfcDepConfig.Config.bSetAtrRespConfig = 1; pRfDiscConfParam->tLstnNfcDepDiscParams.AtrRespConfig.bLengthReduction = 0x03; /*For LLCP*/ break; case NFC_DEP_DEFAULT: default: pRfDiscConfParam->tConfigInfo.PollNfcDepConfig = 1; /* Configuring general bytes for ATR_REQ */ pRfDiscConfParam->tPollNfcDepDiscParams.PollNfcDepConfig.EnableConfig = 0; pRfDiscConfParam->tPollNfcDepDiscParams.PollNfcDepConfig.Config.bSetGenBytes = 1; pRfDiscConfParam->tPollNfcDepDiscParams.bAtrReqGeneBytesSize = bGeneralBytesLength; phOsalNfc_MemCopy(pRfDiscConfParam->tPollNfcDepDiscParams.aAtrReqGenBytes, pConfigInfo->generalBytes,bGeneralBytesLength); /*Enable General Bytes to default values*/ /*Configure to default value = 0x30*/ pRfDiscConfParam->tPollNfcDepDiscParams.PollNfcDepConfig.Config.bSetAtrConfig = 1; pRfDiscConfParam->tPollNfcDepDiscParams.AtrReqConfig.bDid = 0; /*0 For LLCP*/ pRfDiscConfParam->tPollNfcDepDiscParams.AtrReqConfig.bLr = 0x03;/*0x03 for LLCP*/ pRfDiscConfParam->tConfigInfo.LstnNfcDepConfig = 1; /* Configuring general bytes for ATR_RES */ pRfDiscConfParam->tLstnNfcDepDiscParams.LstnNfcDepConfig.EnableConfig = 0; pRfDiscConfParam->tLstnNfcDepDiscParams.LstnNfcDepConfig.Config.bSetGenBytes = 1; pRfDiscConfParam->tLstnNfcDepDiscParams.bAtrResGenBytesSize = bGeneralBytesLength; phOsalNfc_MemCopy(pRfDiscConfParam->tLstnNfcDepDiscParams.aAtrResGenBytes, pConfigInfo->generalBytes,bGeneralBytesLength); /*Enable General Bytes in response*/ /*Configure to defaule value*/ pRfDiscConfParam->tLstnNfcDepDiscParams.LstnNfcDepConfig.Config.bSetAtrRespConfig = 1; pRfDiscConfParam->tLstnNfcDepDiscParams.AtrRespConfig.bLengthReduction = 0x03; /*For LLCP*/ break; } Info.Evt = phLibNfc_DummyEventSetP2PConfigs; Info.Params = (void *)pRfDiscConfParam; wStatus = phLibNfc_StateHandler(pLibContext, TrigEvent, NULL, &Info, NULL); if(NFCSTATUS_PENDING != wStatus) { phOsalNfc_FreeMemory(pRfDiscConfParam); pLibContext->CBInfo.pClientNfcIpCfgCb = NULL; pLibContext->CBInfo.pClientNfcIpCfgCntx = NULL; } } else { wStatus = NFCSTATUS_INSUFFICIENT_RESOURCES; } } else { wStatus = NFCSTATUS_INVALID_PARAMETER; } } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
NFCSTATUS phLibNfc_RemoteDev_Send(phLibNfc_Handle hRemoteDevice, phNfc_sData_t* pTransferData, pphLibNfc_RspCb_t pSendRspCb, void* pContext) { NFCSTATUS wStatus = NFCSTATUS_FAILED; pphLibNfc_LibContext_t pLibContext = gpphLibNfc_Context; phLibNfc_Event_t TrigEvent = phLibNfc_EventSend; pphNciNfc_RemoteDevInformation_t pNciRemDevHandle = NULL; phLibNfc_sRemoteDevInformation_t *pLibRemDevHandle = (phLibNfc_sRemoteDevInformation_t *)hRemoteDevice; PH_LOG_LIBNFC_FUNC_ENTRY(); wStatus = phLibNfc_IsInitialised(pLibContext); if(NFCSTATUS_SUCCESS != wStatus) { wStatus=NFCSTATUS_NOT_INITIALISED; } /* Check for valid state,If De initialize is called then return NFCSTATUS_SHUTDOWN */ else if(gpphLibNfc_Context->StateContext.TrgtState == phLibNfc_StateReset) { wStatus = NFCSTATUS_SHUTDOWN; } else if((NULL == pSendRspCb) || (NULL == pTransferData) || (NULL == pLibRemDevHandle)) { wStatus = NFCSTATUS_INVALID_PARAMETER; } else { if((NULL != pTransferData->buffer) || (0 == pTransferData->length)) { wStatus = phLibNfc_MapRemoteDevHandle(&pLibRemDevHandle,&pNciRemDevHandle,PH_LIBNFC_INTERNAL_LIBTONCI_MAP); if((NFCSTATUS_SUCCESS == wStatus) && (NULL != pNciRemDevHandle)) { pLibContext->CBInfo.pClientNfcIpTxCb = pSendRspCb; pLibContext->CBInfo.pClientNfcIpTxCntx = pContext; wStatus = phLibNfc_StateHandler(pLibContext,TrigEvent, (void *)pTransferData,NULL,NULL); if(NFCSTATUS_PENDING == wStatus) { /* Do nothing */ } else if(NFCSTATUS_INVALID_STATE == wStatus) { wStatus = NFCSTATUS_DESELECTED; pLibContext->CBInfo.pClientNfcIpTxCb = NULL; pLibContext->CBInfo.pClientNfcIpTxCntx = NULL; } else { wStatus = NFCSTATUS_FAILED; pLibContext->CBInfo.pClientNfcIpTxCb = NULL; pLibContext->CBInfo.pClientNfcIpTxCntx = NULL; } } else { wStatus = NFCSTATUS_INVALID_HANDLE; } } else { wStatus = NFCSTATUS_INVALID_PARAMETER; } } PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }
static NFCSTATUS phLibNfc_InitCb(void* pContext,NFCSTATUS wStatus,void* pInfo) { pphLibNfc_LibContext_t pLibContext=NULL; pphNciNfc_TransactInfo_t pTransactInfo=(pphNciNfc_TransactInfo_t)pInfo; NFCSTATUS tempStatus = wStatus; PH_LOG_LIBNFC_FUNC_ENTRY(); /* Initialize the local variable */ pLibContext = (pphLibNfc_LibContext_t)pContext; if((NULL != pLibContext) && (PHLIBNFC_GETCONTEXT() == pLibContext)) { if(NFCSTATUS_SUCCESS == tempStatus) { if(NULL != pInfo) { (PHLIBNFC_GETCONTEXT())->sHwReference.pNciHandle=pTransactInfo->pContext; wStatus = phLibNfc_GetNfccFeatures((PHLIBNFC_GETCONTEXT())->sHwReference.pNciHandle); if(NFCSTATUS_SUCCESS == wStatus) { /*Register for Tag discovery*/ wStatus = phNciNfc_RegisterNotification( gpphLibNfc_Context->sHwReference.pNciHandle, phNciNfc_e_RegisterTagDiscovery, &phLibNfc_NotificationRegister_Resp_Cb, (void *)gpphLibNfc_Context); if(NFCSTATUS_SUCCESS == wStatus) { /*Register for Rf Deactivate notification*/ wStatus = phNciNfc_RegisterNotification( gpphLibNfc_Context->sHwReference.pNciHandle, phNciNfc_e_RegisterRfDeActivate, &phLibNfc_DeActvNtfRegister_Resp_Cb, (void *)gpphLibNfc_Context); } /* Register for SE notification */ if(NFCSTATUS_SUCCESS == wStatus) { wStatus = phNciNfc_RegisterNotification( (void *)gpphLibNfc_Context->sHwReference.pNciHandle,\ phNciNfc_e_RegisterSecureElement,\ &phLibNfc_SENtfHandler,\ (void *)gpphLibNfc_Context); } /* Register for Generic error notification */ if(NFCSTATUS_SUCCESS == wStatus) { wStatus = phNciNfc_RegisterNotification( (void *)gpphLibNfc_Context->sHwReference.pNciHandle,\ phNciNfc_e_RegisterGenericError,\ &phLibNfc_GenericErrorHandler,\ (void *)gpphLibNfc_Context); } /* Register for Reset notification */ if(NFCSTATUS_SUCCESS == wStatus) { wStatus = phNciNfc_RegisterNotification( (void *)gpphLibNfc_Context->sHwReference.pNciHandle,\ phNciNfc_e_RegisterReset,\ &phLibNfc_ResetNtfHandler,\ (void *)gpphLibNfc_Context); } }else { wStatus = NFCSTATUS_FAILED; } }else { PH_LOG_LIBNFC_CRIT_STR("Buffer passed by lower layer is NULL"); tempStatus = NFCSTATUS_FAILED; } }else { PH_LOG_LIBNFC_CRIT_STR("NFCSTATUS_FAILED passed by lower layer"); tempStatus = NFCSTATUS_FAILED; } } else { PH_LOG_LIBNFC_CRIT_STR("Invalid Libnfc context passed by lower layer"); tempStatus = NFCSTATUS_INVALID_PARAMETER; } PH_LOG_LIBNFC_FUNC_EXIT(); return tempStatus; }
static NFCSTATUS phLibNfc_InitSetConfig(void* pContext, NFCSTATUS status, void* pInfo) { NFCSTATUS wStatus = NFCSTATUS_SUCCESS; pphLibNfc_Context_t pCtx = (pphLibNfc_Context_t) pContext; #ifdef NFC_LA_NFCID1 uint8_t aNfcId1[NFC_LA_NFCID1_LEN] = NFC_LA_NFCID1_VALUE; #endif #ifdef NFC_PB_H_INFO uint8_t aInfo[NFC_PB_H_INFO_LEN] = NFC_PB_H_INFO_VALUE; #endif #ifdef NFC_PN_ATR_REQ_GEN_BYTES uint8_t aGenBytes[NFC_NFC_PN_ATR_REQ_GEN_BYTES_LEN] = NFC_NFC_PN_ATR_REQ_GEN_BYTES_VALUE; #endif #ifdef NFC_LB_NFCID0 uint8_t aNfcId0[NFC_LB_NFCID0_LEN] = NFC_LB_NFCID0_VALUE; #endif #ifdef NFC_LB_APPLICATION_DATA uint8_t aAppData[NFC_LB_APPLICATION_DATA_LEN] = NFC_LB_APPLICATION_DATA_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_1 uint8_t aT3TId1[NFC_LF_T3T_IDENTIFIERS_1_LEN] = NFC_LF_T3T_IDENTIFIERS_1_VALUE; uint8_t bT3tId1Len = (uint8_t) NFC_LF_T3T_IDENTIFIERS_1_LEN; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_2 uint8_t aT3TId2[NFC_LF_T3T_IDENTIFIERS_2_LEN] = NFC_LF_T3T_IDENTIFIERS_2_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_3 uint8_t aT3TId3[NFC_LF_T3T_IDENTIFIERS_3_LEN] = NFC_LF_T3T_IDENTIFIERS_3_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_4 uint8_t aT3TId4[NFC_LF_T3T_IDENTIFIERS_4_LEN] = NFC_LF_T3T_IDENTIFIERS_4_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_5 uint8_t aT3TId5[NFC_LF_T3T_IDENTIFIERS_15_LEN] = NFC_LF_T3T_IDENTIFIERS_5_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_6 uint8_t aT3TId6[NFC_LF_T3T_IDENTIFIERS_6_LEN] = NFC_LF_T3T_IDENTIFIERS_6_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_7 uint8_t aT3TId7[NFC_LF_T3T_IDENTIFIERS_7_LEN] = NFC_LF_T3T_IDENTIFIERS_7_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_8 uint8_t aT3TId8[NFC_LF_T3T_IDENTIFIERS_8_LEN] = NFC_LF_T3T_IDENTIFIERS_8_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_9 uint8_t aT3TId9[NFC_LF_T3T_IDENTIFIERS_9_LEN] = NFC_LF_T3T_IDENTIFIERS_9_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_10 uint8_t aT3TId10[NFC_LF_T3T_IDENTIFIERS_10_LEN] = NFC_LF_T3T_IDENTIFIERS_10_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_11 uint8_t aT3TId11[NFC_LF_T3T_IDENTIFIERS_11_LEN] = NFC_LF_T3T_IDENTIFIERS_11_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_12 uint8_t aT3TId12[NFC_LF_T3T_IDENTIFIERS_12_LEN] = NFC_LF_T3T_IDENTIFIERS_12_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_13 uint8_t aT3TId13[NFC_LF_T3T_IDENTIFIERS_13_LEN] = NFC_LF_T3T_IDENTIFIERS_13_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_14 uint8_t aT3TId14[NFC_LF_T3T_IDENTIFIERS_14_LEN] = NFC_LF_T3T_IDENTIFIERS_14_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_15 uint8_t aT3TId15[NFC_LF_T3T_IDENTIFIERS_15_LEN] = NFC_LF_T3T_IDENTIFIERS_15_VALUE; #endif #ifdef NFC_LF_T3T_IDENTIFIERS_16 uint8_t aT3TId16[NFC_LF_T3T_IDENTIFIERS_16_LEN] = NFC_LF_T3T_IDENTIFIERS_16_VALUE; #endif #ifdef NFC_LF_T3T_PMM uint8_t aT3TPmm[NFC_LF_T3T_PMM_LEN] = NFC_LF_T3T_PMM_VALUE; #endif phNciNfc_RfDiscConfigParams_t ConfigParams = {0}; UNUSED(pContext); UNUSED(status); UNUSED(pInfo); PH_LOG_LIBNFC_FUNC_ENTRY(); ConfigParams.tConfigInfo.CommonConfig = 1; ConfigParams.tCommonDiscParams.ComnParamsConfig.Config.SetRfFieldInfo = 1; #if PH_LIBNFC_ENABLE_RFFIELD_INFO_NTF ConfigParams.tCommonDiscParams.bRfFieldInfo = 1; #else ConfigParams.tCommonDiscParams.bRfFieldInfo = 0; #endif #if PH_LIBNFC_ENABLE_RF_NFCEE_ACTION_NTF ConfigParams.tConfigInfo.CommonConfig = 1; ConfigParams.tCommonDiscParams.ComnParamsConfig.Config.SetRfNfceeAction = 1; ConfigParams.tCommonDiscParams.bRfNfceeAction = (uint8_t)pCtx->Config.bNfceeActionNtf; #endif #if PH_LIBNFC_ENABLE_NFCDEP_RTOX ConfigParams.tConfigInfo.CommonConfig = 1; ConfigParams.tCommonDiscParams.ComnParamsConfig.Config.SetNfcDepOperationParam = 1; ConfigParams.tCommonDiscParams.NfcDepOperationParam.bRtoxReq = 0; ConfigParams.tCommonDiscParams.NfcDepOperationParam.bAttentionCommand = 1; ConfigParams.tCommonDiscParams.NfcDepOperationParam.bInformationPdu = 1; ConfigParams.tCommonDiscParams.NfcDepOperationParam.bUseMaxTxLen = 1; #endif #ifdef NFC_LA_NFCID1 ConfigParams.tConfigInfo.LstnNfcAConfig = 1; ConfigParams.tLstnNfcADiscParams.LstnNfcAConfig.Config.SetNfcID1 = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcADiscParams.aNfcID1,\ aNfcId1,(uint32_t)NFC_LA_NFCID1_LEN); ConfigParams.tLstnNfcADiscParams.bNfcID1Size = (uint8_t)NFC_LA_NFCID1_LEN; #endif #ifdef NFC_PB_H_INFO if(NFC_PB_H_INFO_LEN <= PH_NCINFC_MAX_HIGHER_LAYER_INF_LEN) { ConfigParams.tConfigInfo.PollIsoDepConfig = 1; ConfigParams.tPollIsoDepDiscParams.PollIsoDepConfig.Config.SetHigherLayerInfo = 1; phOsalNfc_MemCopy(ConfigParams.tPollIsoDepDiscParams.aHigherLayerInfo,\ aInfo,(uint32_t)NFC_PB_H_INFO_LEN); ConfigParams.tPollIsoDepDiscParams.bHigherLayerInfoSize = (uint8_t)NFC_PB_H_INFO_LEN; } #endif #ifdef NFC_PN_ATR_REQ_GEN_BYTES if(NFC_NFC_PN_ATR_REQ_GEN_BYTES_LEN <= PH_NCINFC_MAX_ATR_REQ_GEN_BYTES_LEN) { ConfigParams.tConfigInfo.PollNfcDepConfig = 1; ConfigParams.tPollNfcDepDiscParams.PollNfcDepConfig.Config.bSetGenBytes = 1; phOsalNfc_MemCopy(ConfigParams.tPollNfcDepDiscParams.aAtrReqGenBytes,\ aGenBytes,(uint32_t)NFC_NFC_PN_ATR_REQ_GEN_BYTES_LEN); ConfigParams.tPollNfcDepDiscParams.bAtrReqGeneBytesSize = (uint8_t)NFC_NFC_PN_ATR_REQ_GEN_BYTES_LEN; } #endif #ifdef NFC_LB_NFCID0 if(NFC_LB_NFCID0_LEN <= PH_NCINFC_MAX_NFCID0_LEN) { ConfigParams.tConfigInfo.LstnNfcBConfig = 1; ConfigParams.tLstnNfcBDiscParams.LstnNfcBConfig.Config.SetNfcID0 = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcBDiscParams.aNfcID0,\ aNfcId0,(uint32_t)NFC_LB_NFCID0_LEN); ConfigParams.tLstnNfcBDiscParams.bNfcID0Size = (uint8_t)NFC_LB_NFCID0_LEN; } #endif #ifdef NFC_LB_APPLICATION_DATA if(NFC_LB_APPLICATION_DATA_LEN <= PH_NCINFC_APP_DATA_LEN) { ConfigParams.tConfigInfo.LstnNfcBConfig = 1; ConfigParams.tLstnNfcBDiscParams.LstnNfcBConfig.Config.SetAppData = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcBDiscParams.aAppData,\ aAppData,(uint32_t)NFC_LB_APPLICATION_DATA_LEN); } #endif #ifdef NFC_LF_T3T_IDENTIFIERS_1 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 1) { if(bT3tId1Len == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[0],\ aT3TId1,(uint32_t)NFC_LF_T3T_IDENTIFIERS_1_LEN); ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tFlags = 1; ConfigParams.tLstnNfcFDiscParams.wT3tFlags |= 1; } } } #endif /* NFC_LF_T3T_IDENTIFIERS_1 */ #ifdef NFC_LF_T3T_IDENTIFIERS_2 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 2) { if(NFC_LF_T3T_IDENTIFIERS_2_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[1],\ aT3TId2,(uint32_t)NFC_LF_T3T_IDENTIFIERS_2_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_2 */ #ifdef NFC_LF_T3T_IDENTIFIERS_3 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 3) { if(NFC_LF_T3T_IDENTIFIERS_3_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[2],\ aT3TId3,(uint32_t)NFC_LF_T3T_IDENTIFIERS_3_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_3 */ #ifdef NFC_LF_T3T_IDENTIFIERS_4 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 4) { if(NFC_LF_T3T_IDENTIFIERS_4_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[3],\ aT3TId4,(uint32_t)NFC_LF_T3T_IDENTIFIERS_4_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_4 */ #ifdef NFC_LF_T3T_IDENTIFIERS_5 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 5) { if(NFC_LF_T3T_IDENTIFIERS_5_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[4],\ aT3TId5,(uint32_t)NFC_LF_T3T_IDENTIFIERS_5_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_5 */ #ifdef NFC_LF_T3T_IDENTIFIERS_6 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 6) { if(NFC_LF_T3T_IDENTIFIERS_6_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[5],\ aT3TId6,(uint32_t)NFC_LF_T3T_IDENTIFIERS_6_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_6 */ #ifdef NFC_LF_T3T_IDENTIFIERS_7 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 7) { if(NFC_LF_T3T_IDENTIFIERS_7_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[6],\ aT3TId7,(uint32_t)NFC_LF_T3T_IDENTIFIERS_7_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_7 */ #ifdef NFC_LF_T3T_IDENTIFIERS_8 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 8) { if(NFC_LF_T3T_IDENTIFIERS_8_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[7],\ aT3TId8,(uint32_t)NFC_LF_T3T_IDENTIFIERS_8_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_8 */ #ifdef NFC_LF_T3T_IDENTIFIERS_9 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 9) { if(NFC_LF_T3T_IDENTIFIERS_9_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[8],\ aT3TId9,(uint32_t)NFC_LF_T3T_IDENTIFIERS_9_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_9 */ #ifdef NFC_LF_T3T_IDENTIFIERS_10 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 10) { if(NFC_LF_T3T_IDENTIFIERS_10_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[9],\ aT3TId10,(uint32_t)NFC_LF_T3T_IDENTIFIERS_10_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_10 */ #ifdef NFC_LF_T3T_IDENTIFIERS_11 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 11) { if(NFC_LF_T3T_IDENTIFIERS_11_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[10],\ aT3TId11,(uint32_t)NFC_LF_T3T_IDENTIFIERS_11_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_11 */ #ifdef NFC_LF_T3T_IDENTIFIERS_12 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 12) { if(NFC_LF_T3T_IDENTIFIERS_12_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[11],\ aT3TId12,(uint32_t)NFC_LF_T3T_IDENTIFIERS_12_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_12 */ #ifdef NFC_LF_T3T_IDENTIFIERS_13 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 13) { if(NFC_LF_T3T_IDENTIFIERS_13_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[12],\ aT3TId13,(uint32_t)NFC_LF_T3T_IDENTIFIERS_13_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_13 */ #ifdef NFC_LF_T3T_IDENTIFIERS_14 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 14) { if(NFC_LF_T3T_IDENTIFIERS_14_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[13],\ aT3TId14,(uint32_t)NFC_LF_T3T_IDENTIFIERS_14_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_14 */ #ifdef NFC_LF_T3T_IDENTIFIERS_15 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 15) { if(NFC_LF_T3T_IDENTIFIERS_15_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[14],\ aT3TId15,(uint32_t)NFC_LF_T3T_IDENTIFIERS_15_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_15 */ #ifdef NFC_LF_T3T_IDENTIFIERS_16 if(pCtx->bT3tMax <= PH_NCINFC_MAX_NUM_T3T_IDS) { if(pCtx->bT3tMax >= 16) { if(NFC_LF_T3T_IDENTIFIERS_16_LEN == PH_NCINFC_T3TID_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tId = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tId[15],\ aT3TId16,(uint32_t)NFC_LF_T3T_IDENTIFIERS_16_LEN); } } } #endif /* NFC_LF_T3T_IDENTIFIERS_16 */ #ifdef NFC_LF_T3T_PMM if(NFC_LF_T3T_PMM_LEN == PH_NCINFC_T3TPMM_LEN) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tPmm = 1; phOsalNfc_MemCopy(ConfigParams.tLstnNfcFDiscParams.aT3tPmm,\ aT3TPmm,(uint32_t)NFC_LF_T3T_PMM_LEN); } #endif #ifdef NFC_LF_T3T_FLAGS if(NFC_LF_T3T_FLAGS_LEN == 0x02) { ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetT3tFlags = 1; ConfigParams.tLstnNfcFDiscParams.wT3tFlags = NFC_LF_T3T_FLAGS_VALUE; } #endif #ifdef NFC_PB_AFI ConfigParams.tConfigInfo.PollNfcBConfig = 1; ConfigParams.tPollNfcBDiscParams.PollNfcBConfig.Config.SetAfi = 1; ConfigParams.tPollNfcBDiscParams.bAfi = (uint8_t)NFC_PB_AFI; #endif /* Poll Iso-Dep bit rate configuration */ #ifdef NFC_PI_BIT_RATE ConfigParams.tConfigInfo.PollIsoDepConfig = 1; ConfigParams.tPollIsoDepDiscParams.PollIsoDepConfig.Config.SetBitRate = 1; ConfigParams.tPollIsoDepDiscParams.bBitRate = (uint8_t)NFC_PI_BIT_RATE_SPEED; #endif /* Poll Nfc-Dep Data exchange bit rate configuration (0-Use max bit rate supported during data exchange 1-use the same bit rate used during activation) */ #ifdef NFC_PN_NFC_DEP_SPEED ConfigParams.tConfigInfo.PollNfcDepConfig = 1; ConfigParams.tPollNfcDepDiscParams.PollNfcDepConfig.Config.bSetSpeed = 1; ConfigParams.tPollNfcDepDiscParams.bNfcDepSpeed = (uint8_t)NFC_PN_NFC_DEP_SPEED_VALUE; #endif #ifdef NFC_PN_ATR_REQ_CONFIG ConfigParams.tConfigInfo.PollNfcDepConfig = 1; ConfigParams.tPollNfcDepDiscParams.PollNfcDepConfig.Config.bSetAtrConfig = 1; ConfigParams.tPollNfcDepDiscParams.AtrReqConfig.bDid = NFC_PN_ATR_REQ_DID; ConfigParams.tPollNfcDepDiscParams.AtrReqConfig.bLr = NFC_PN_ATR_REQ_LR; #endif #ifdef NFC_LA_BIT_FRAME_SDD ConfigParams.tConfigInfo.LstnNfcAConfig = 1; ConfigParams.tLstnNfcADiscParams.LstnNfcAConfig.Config.SetBitFrameSdd = 1; ConfigParams.tLstnNfcADiscParams.bBitFrameSDD = (uint8_t)NFC_LA_BIT_FRAME_SDD; #endif #ifdef NFC_LA_PLATFORM_CONFIG ConfigParams.tConfigInfo.LstnNfcAConfig = 1; ConfigParams.tLstnNfcADiscParams.LstnNfcAConfig.Config.SetPlatformConfig = 1; ConfigParams.tLstnNfcADiscParams.bPlatformConfig = (uint8_t)NFC_LA_PLATFORM_CONFIG; #endif #ifdef NFC_LB_SENSB_INFO ConfigParams.tConfigInfo.LstnNfcBConfig = 1; ConfigParams.tLstnNfcBDiscParams.LstnNfcBConfig.Config.SetSensBInfo = 1; ConfigParams.tLstnNfcBDiscParams.SensBInfo = (uint8_t)NFC_LB_SENSB_INFO; #endif #ifdef NFC_LB_SFGI ConfigParams.tConfigInfo.LstnNfcBConfig = 1; ConfigParams.tLstnNfcBDiscParams.LstnNfcBConfig.Config.SetSfgi = 1; ConfigParams.tLstnNfcBDiscParams.bSfgi = (uint8_t)NFC_LB_SFGI; #endif #ifdef NFC_LB_ADC_FO ConfigParams.tConfigInfo.LstnNfcBConfig = 1; ConfigParams.tLstnNfcBDiscParams.LstnNfcBConfig.Config.SetAdcFo = 1; ConfigParams.tLstnNfcBDiscParams.AdcFo.bDid = 1; ConfigParams.tLstnNfcBDiscParams.AdcFo.bAdcCodingField = 0x01; #endif #ifdef NFC_LF_CON_BITR_F ConfigParams.tConfigInfo.LstnNfcFConfig = 1; ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetConfigBitRate = 1; switch(NFC_LISTEN_F_BITRATE_SEL) { case BITRATE_LISTEN_F_212: ConfigParams.tLstnNfcFDiscParams.ConfigBitRate.bLstn212kbps = 1; ConfigParams.tLstnNfcFDiscParams.ConfigBitRate.bLstn424kbps = 0; break; case BITRATE_LISTEN_F_424: ConfigParams.tLstnNfcFDiscParams.ConfigBitRate.bLstn212kbps = 0; ConfigParams.tLstnNfcFDiscParams.ConfigBitRate.bLstn424kbps = 1; break; case BITRATE_LISTEN_F_212_424: ConfigParams.tLstnNfcFDiscParams.ConfigBitRate.bLstn212kbps = 1; ConfigParams.tLstnNfcFDiscParams.ConfigBitRate.bLstn424kbps = 1; break; default: /* Invalid bitrate selected */ ConfigParams.tLstnNfcFDiscParams.LstnNfcFConfig.Config.SetConfigBitRate = 0; break; } #endif #ifdef NFC_LI_FWI ConfigParams.tConfigInfo.LstnIsoDepConfig = 1; ConfigParams.tLstnIsoDepDiscParams.LstnIsoDepConfig.Config.SetFwt = 1; ConfigParams.tLstnIsoDepDiscParams.bFrameWaitingTime = (uint8_t)NFC_LI_FWI; #endif #ifdef NFC_LI_BIT_RATE ConfigParams.tConfigInfo.LstnIsoDepConfig = 1; ConfigParams.tLstnIsoDepDiscParams.LstnIsoDepConfig.Config.SetbBitRate = 1; ConfigParams.tLstnIsoDepDiscParams.bBitRate = (uint8_t)NFC_LI_BIT_RATE_SPEED; #endif #ifdef NFC_LN_WT ConfigParams.tConfigInfo.LstnNfcDepConfig = 1; ConfigParams.tLstnNfcDepDiscParams.LstnNfcDepConfig.Config.bSetWT = 1; ConfigParams.tLstnNfcDepDiscParams.bWaitingTime = (uint8_t)NFC_LN_WT; #endif wStatus = phNciNfc_SetConfigRfParameters(pCtx->sHwReference.pNciHandle, &ConfigParams, (pphNciNfc_IfNotificationCb_t)&phLibNfc_InternalSequence, pContext); PH_LOG_LIBNFC_FUNC_EXIT(); return wStatus; }