Lines Matching refs:nxpncihal_ctrl
58 phNxpNciHal_Control_t nxpncihal_ctrl; variable
196 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
198 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_OPEN_CPLT_EVT, in phNxpNciHal_client_thread()
207 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
209 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_CLOSE_CPLT_EVT, in phNxpNciHal_client_thread()
212 phNxpNciHal_kill_client_thread(&nxpncihal_ctrl); in phNxpNciHal_client_thread()
219 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
221 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_POST_INIT_CPLT_EVT, in phNxpNciHal_client_thread()
230 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
232 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_PRE_DISCOVER_CPLT_EVT, in phNxpNciHal_client_thread()
241 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
243 (*nxpncihal_ctrl.p_nfc_stack_cback)((uint32_t)NfcEvent::HCI_NETWORK_RESET, in phNxpNciHal_client_thread()
252 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
254 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_ERROR_EVT, in phNxpNciHal_client_thread()
263 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { in phNxpNciHal_client_thread()
264 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rsp_len, in phNxpNciHal_client_thread()
265 nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_client_thread()
326 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_UNKNOWN; in phNxpNciHal_fw_download()
342 if (nxpncihal_ctrl.bIsForceFwDwnld) { in phNxpNciHal_fw_download()
348 nxpncihal_ctrl.bIsForceFwDwnld = false; in phNxpNciHal_fw_download()
379 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHal_fw_download()
426 (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0))) in phNxpNciHal_CheckValidFwVersion()
431 nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_CheckValidFwVersion()
550 nxpncihal_ctrl.bIsForceFwDwnld = false; in phNxpNciHal_MinOpen()
560 if (nxpncihal_ctrl.halStatus == HAL_STATUS_MIN_OPEN) { in phNxpNciHal_MinOpen()
583 memset(&nxpncihal_ctrl, 0x00, sizeof(nxpncihal_ctrl)); in phNxpNciHal_MinOpen()
589 if (0 != sem_init(&nxpncihal_ctrl.syncSpiNfc, 0, 1)) { in phNxpNciHal_MinOpen()
594 nxpncihal_ctrl.halStatus = HAL_STATUS_OPEN; in phNxpNciHal_MinOpen()
599 nxpncihal_ctrl.nci_info.nci_version = NCI_VERSION_UNKNOWN; in phNxpNciHal_MinOpen()
614 nxpncihal_ctrl.gDrvCfg.nClientId = phDal4Nfc_msgget(0, 0600); in phNxpNciHal_MinOpen()
615 nxpncihal_ctrl.gDrvCfg.nLinkType = ENUM_LINK_TYPE_I2C; /* For PN54X */ in phNxpNciHal_MinOpen()
617 tOsalConfig.dwCallbackThreadId = (uintptr_t)nxpncihal_ctrl.gDrvCfg.nClientId; in phNxpNciHal_MinOpen()
619 tTmlConfig.dwGetMsgThreadId = (uintptr_t)nxpncihal_ctrl.gDrvCfg.nClientId; in phNxpNciHal_MinOpen()
634 ret_val = pthread_create(&nxpncihal_ctrl.client_thread, NULL, in phNxpNciHal_MinOpen()
635 phNxpNciHal_client_thread, &nxpncihal_ctrl); in phNxpNciHal_MinOpen()
646 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHal_MinOpen()
660 (nxpncihal_ctrl.retry_cnt >= MAX_RETRY_COUNT)) { in phNxpNciHal_MinOpen()
662 nxpncihal_ctrl.bIsForceFwDwnld = true; in phNxpNciHal_MinOpen()
678 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_MinOpen()
746 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_MinOpen()
770 if (nxpncihal_ctrl.halStatus == HAL_STATUS_OPEN) { in phNxpNciHal_open()
773 }else if(nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE){ in phNxpNciHal_open()
780 nxpncihal_ctrl.p_nfc_stack_cback = p_cback; in phNxpNciHal_open()
781 nxpncihal_ctrl.p_nfc_stack_data_cback = p_data_cback; in phNxpNciHal_open()
796 nxpncihal_ctrl.p_nfc_stack_cback = NULL; in phNxpNciHal_open()
797 nxpncihal_ctrl.p_nfc_stack_data_cback = NULL; in phNxpNciHal_open()
799 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_open()
841 nxpncihal_ctrl.halStatus = HAL_STATUS_MIN_OPEN; in phNxpNciHal_MinOpen_complete()
861 nxpncihal_ctrl.hal_open_status = true; in phNxpNciHal_open_complete()
862 nxpncihal_ctrl.halStatus = HAL_STATUS_OPEN; in phNxpNciHal_open_complete()
891 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_write()
900 memcpy(nxpncihal_ctrl.p_cmd_data, p_data, data_len); in phNxpNciHal_write()
901 nxpncihal_ctrl.cmd_len = data_len; in phNxpNciHal_write()
913 phNxpNciHal_write_ext(&nxpncihal_ctrl.cmd_len, nxpncihal_ctrl.p_cmd_data, in phNxpNciHal_write()
914 &nxpncihal_ctrl.rsp_len, nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_write()
927 data_len = phNxpNciHal_write_unlocked(nxpncihal_ctrl.cmd_len, in phNxpNciHal_write()
928 nxpncihal_ctrl.p_cmd_data); in phNxpNciHal_write()
956 nxpncihal_ctrl.retry_cnt = 0; in phNxpNciHal_write_unlocked()
967 memcpy(nxpncihal_ctrl.p_cmd_data, p_data, data_len); in phNxpNciHal_write_unlocked()
968 nxpncihal_ctrl.cmd_len = data_len; in phNxpNciHal_write_unlocked()
971 if(phNxpNciHal_check_ncicmd_write_window(nxpncihal_ctrl.cmd_len, in phNxpNciHal_write_unlocked()
972 nxpncihal_ctrl.p_cmd_data) != NFCSTATUS_SUCCESS) { in phNxpNciHal_write_unlocked()
979 (uint8_t *)nxpncihal_ctrl.p_cmd_data, (uint16_t)nxpncihal_ctrl.cmd_len); in phNxpNciHal_write_unlocked()
983 data_len = nxpncihal_ctrl.cmd_len; in phNxpNciHal_write_unlocked()
986 (uint8_t*)nxpncihal_ctrl.p_cmd_data, (uint16_t)nxpncihal_ctrl.cmd_len, in phNxpNciHal_write_unlocked()
1004 if (nxpncihal_ctrl.retry_cnt++ < MAX_RETRY_COUNT) { in phNxpNciHal_write_unlocked()
1014 nxpncihal_ctrl.retry_cnt); in phNxpNciHal_write_unlocked()
1016 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_write_unlocked()
1025 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL && in phNxpNciHal_write_unlocked()
1026 nxpncihal_ctrl.p_rx_data != NULL && in phNxpNciHal_write_unlocked()
1027 nxpncihal_ctrl.hal_open_status == true) { in phNxpNciHal_write_unlocked()
1033 nxpncihal_ctrl.rx_data_len = sizeof(reset_ntf); in phNxpNciHal_write_unlocked()
1034 memcpy(nxpncihal_ctrl.p_rx_data, reset_ntf, sizeof(reset_ntf)); in phNxpNciHal_write_unlocked()
1035 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_write_unlocked()
1036 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_write_unlocked()
1089 if (nxpncihal_ctrl.read_retry_cnt == 1) { in phNxpNciHal_read_complete()
1090 nxpncihal_ctrl.read_retry_cnt = 0; in phNxpNciHal_read_complete()
1095 sem_getvalue(&(nxpncihal_ctrl.syncSpiNfc), &sem_val); in phNxpNciHal_read_complete()
1097 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_read_complete()
1101 nxpncihal_ctrl.p_rx_ese_data = pInfo->pBuff; in phNxpNciHal_read_complete()
1102 nxpncihal_ctrl.rx_ese_data_len = pInfo->wLength; in phNxpNciHal_read_complete()
1103 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1106 nxpncihal_ctrl.p_rx_data = pInfo->pBuff; in phNxpNciHal_read_complete()
1107 nxpncihal_ctrl.rx_data_len = pInfo->wLength; in phNxpNciHal_read_complete()
1108 status = phNxpNciHal_process_ext_rsp(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_read_complete()
1109 &nxpncihal_ctrl.rx_data_len); in phNxpNciHal_read_complete()
1114 if ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_NTF) { in phNxpNciHal_read_complete()
1115 NfccPowerTracker::getInstance().ProcessNtf(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_read_complete()
1116 nxpncihal_ctrl.rx_data_len); in phNxpNciHal_read_complete()
1119 if (nxpncihal_ctrl.hal_ext_enabled == TRUE && in phNxpNciHal_read_complete()
1120 (nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_RSP) { in phNxpNciHal_read_complete()
1123 nxpncihal_ctrl.ext_cb_data.status = status; in phNxpNciHal_read_complete()
1126 if ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_RSP || in phNxpNciHal_read_complete()
1129 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1132 else if ((nxpncihal_ctrl.hal_ext_enabled == TRUE) && in phNxpNciHal_read_complete()
1133 ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_NTF) && in phNxpNciHal_read_complete()
1134 (nxpncihal_ctrl.nci_info.wait_for_ntf == TRUE)) { in phNxpNciHal_read_complete()
1136 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1137 nxpncihal_ctrl.nci_info.wait_for_ntf = FALSE; in phNxpNciHal_read_complete()
1140 else if ((nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) && in phNxpNciHal_read_complete()
1142 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_read_complete()
1143 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_read_complete()
1145 if ((nfcFL.chipType == pn557) && nxpncihal_ctrl.p_rx_data[0] == 0x62 && in phNxpNciHal_read_complete()
1146 nxpncihal_ctrl.p_rx_data[1] == 0x00 && in phNxpNciHal_read_complete()
1147 nxpncihal_ctrl.p_rx_data[3] == 0xC0 && in phNxpNciHal_read_complete()
1148 nxpncihal_ctrl.p_rx_data[4] == 0x00) { in phNxpNciHal_read_complete()
1156 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(sizeof(nfcee_notifiations[i]), in phNxpNciHal_read_complete()
1165 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE && in phNxpNciHal_read_complete()
1166 nxpncihal_ctrl.nci_info.wait_for_ntf == FALSE) { in phNxpNciHal_read_complete()
1230 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_core_initialized()
1255 (nxpncihal_ctrl.retry_cnt >= MAX_RETRY_COUNT)) { in phNxpNciHal_core_initialized()
1269 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_core_initialized()
1839 &nxpncihal_ctrl.rsp_len, nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_core_initialized()
1882 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { in phNxpNciHal_core_initialized()
1885 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_core_initialized()
1886 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_core_initialized()
1909 if((nxpncihal_ctrl.p_rx_data[8] & 0x40) == 0x40) { in phNxpNciHal_phase_tirm_offset_sign_update()
1911 phase_tirm_offset_write[7] |= nxpncihal_ctrl.p_rx_data[8] & 0x3F; in phNxpNciHal_phase_tirm_offset_sign_update()
1936 if(nxpncihal_ctrl.p_rx_data[9] == 0x1 && nxpncihal_ctrl.p_rx_data[13] == 0x1) { in phNxpNciHal_isFactoryOTAModeActive()
1980 if ((nxpncihal_ctrl.rx_data_len > 0) && (nxpncihal_ctrl.p_rx_data[2] > 0)) { in phNxpNciHal_CheckRFCmdRespStatus()
1981 if (nxpncihal_ctrl.p_rx_data[3] == 0x09) { in phNxpNciHal_CheckRFCmdRespStatus()
1983 } else if (nxpncihal_ctrl.p_rx_data[3] != NFCSTATUS_SUCCESS) { in phNxpNciHal_CheckRFCmdRespStatus()
2027 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHalRFConfigCmdRecSequence()
2102 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_close()
2110 sem_getvalue(&(nxpncihal_ctrl.syncSpiNfc), &sem_val); in phNxpNciHal_close()
2112 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_close()
2133 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_close()
2140 sem_destroy(&nxpncihal_ctrl.syncSpiNfc); in phNxpNciHal_close()
2152 if (0 != pthread_join(nxpncihal_ctrl.client_thread, (void **)NULL)) { in phNxpNciHal_close()
2158 phDal4Nfc_msgrelease(nxpncihal_ctrl.gDrvCfg.nClientId); in phNxpNciHal_close()
2160 memset(&nxpncihal_ctrl, 0x00, sizeof(nxpncihal_ctrl)); in phNxpNciHal_close()
2337 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_notify_i2c_fragmentation()
2339 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_ENABLE_I2C_FRAGMENTATION_EVT, in phNxpNciHal_notify_i2c_fragmentation()
2357 if (NULL != nxpncihal_ctrl.p_control_granted_cback) { in phNxpNciHal_control_granted()
2358 (*nxpncihal_ctrl.p_control_granted_cback)(); in phNxpNciHal_control_granted()
2378 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_request_control()
2380 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_REQUEST_CONTROL_EVT, in phNxpNciHal_request_control()
2397 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_release_control()
2399 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_RELEASE_CONTROL_EVT, in phNxpNciHal_release_control()
2419 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_power_cycle()
2478 while ((s = sem_timedwait(&nxpncihal_ctrl.syncSpiNfc, &ts)) == -1 && in phNxpNciHal_check_ncicmd_write_window()
2509 if(nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) in phNxpNciHal_ioctl()
2524 pInpOutData->out.data.nciRsp.rsp_len = nxpncihal_ctrl.rx_ese_data_len; in phNxpNciHal_ioctl()
2525 if ((nxpncihal_ctrl.rx_ese_data_len > 0) && in phNxpNciHal_ioctl()
2526 (nxpncihal_ctrl.rx_ese_data_len <= MAX_IOCTL_TRANSCEIVE_RESP_LEN) && in phNxpNciHal_ioctl()
2527 (nxpncihal_ctrl.p_rx_ese_data != NULL)) { in phNxpNciHal_ioctl()
2528 memcpy(pInpOutData->out.data.nciRsp.p_rsp, nxpncihal_ctrl.p_rx_ese_data, in phNxpNciHal_ioctl()
2529 nxpncihal_ctrl.rx_ese_data_len); in phNxpNciHal_ioctl()
2555 if ((nxpncihal_ctrl.halStatus == HAL_STATUS_MIN_OPEN) && (level == 0x01)) { in phNxpNciHal_ioctl()
2854 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_STORE; in phNxpNciHal_gpio_restore()
2862 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_STORE_DONE; in phNxpNciHal_gpio_restore()
2865 set_gpio_values_cmd[7] = nxpncihal_ctrl.phNxpNciGpioInfo.values[0]; in phNxpNciHal_gpio_restore()
2866 set_gpio_values_cmd[8] = nxpncihal_ctrl.phNxpNciGpioInfo.values[1]; in phNxpNciHal_gpio_restore()
2873 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_RESTORE; in phNxpNciHal_gpio_restore()
2881 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_RESTORE_DONE; in phNxpNciHal_gpio_restore()
2885 set_gpio_values_cmd[7] = nxpncihal_ctrl.phNxpNciGpioInfo.values[0]; in phNxpNciHal_gpio_restore()
2886 set_gpio_values_cmd[8] = nxpncihal_ctrl.phNxpNciGpioInfo.values[1]; in phNxpNciHal_gpio_restore()
2925 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_nfcc_core_reset_init()
2969 phNxpNciHal_configFeatureList(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_getChipInfoInFwDnldMode()
2970 nxpncihal_ctrl.rx_data_len); in phNxpNciHal_getChipInfoInFwDnldMode()
3035 if (nxpncihal_ctrl.p_rx_data[8] == 0x10) { in phNxpNciHal_enable_i2c_fragmentation()
3039 } else if (nxpncihal_ctrl.p_rx_data[8] == 0x00) { in phNxpNciHal_enable_i2c_fragmentation()
3066 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_enable_i2c_fragmentation()
3111 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_do_factory_reset()
3234 } else if (nxpncihal_ctrl.phNxpNciGpioInfo.state == GPIO_STORE) { in phNxpNciHal_print_res_status()
3236 nxpncihal_ctrl.phNxpNciGpioInfo.values[0] = p_rx_data[9]; in phNxpNciHal_print_res_status()
3237 nxpncihal_ctrl.phNxpNciGpioInfo.values[1] = p_rx_data[8]; in phNxpNciHal_print_res_status()
3238 } else if (nxpncihal_ctrl.phNxpNciGpioInfo.state == GPIO_RESTORE) { in phNxpNciHal_print_res_status()
3240 nxpncihal_ctrl.phNxpNciGpioInfo.values[0] = p_rx_data[9]; in phNxpNciHal_print_res_status()
3241 nxpncihal_ctrl.phNxpNciGpioInfo.values[1] = p_rx_data[8]; in phNxpNciHal_print_res_status()