Lines Matching refs:nxpncihal_ctrl

56 phNxpNciHal_Control_t nxpncihal_ctrl;  variable
191 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
193 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_OPEN_CPLT_EVT, in phNxpNciHal_client_thread()
202 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
204 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_CLOSE_CPLT_EVT, in phNxpNciHal_client_thread()
206 phNxpNciHal_kill_client_thread(&nxpncihal_ctrl); in phNxpNciHal_client_thread()
214 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
216 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_POST_INIT_CPLT_EVT, in phNxpNciHal_client_thread()
225 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
227 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_PRE_DISCOVER_CPLT_EVT, in phNxpNciHal_client_thread()
236 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
238 (*nxpncihal_ctrl.p_nfc_stack_cback)((uint32_t)NfcEvent::HCI_NETWORK_RESET, in phNxpNciHal_client_thread()
247 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
249 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_ERROR_EVT, in phNxpNciHal_client_thread()
258 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { in phNxpNciHal_client_thread()
259 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rsp_len, in phNxpNciHal_client_thread()
260 nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_client_thread()
321 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_UNKNOWN; in phNxpNciHal_fw_download()
337 if (nxpncihal_ctrl.bIsForceFwDwnld) { in phNxpNciHal_fw_download()
343 nxpncihal_ctrl.bIsForceFwDwnld = false; in phNxpNciHal_fw_download()
374 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHal_fw_download()
421 (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0))) in phNxpNciHal_CheckValidFwVersion()
426 nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_CheckValidFwVersion()
545 nxpncihal_ctrl.bIsForceFwDwnld = false; in phNxpNciHal_MinOpen()
553 if (nxpncihal_ctrl.halStatus == HAL_STATUS_MIN_OPEN) { in phNxpNciHal_MinOpen()
576 memset(&nxpncihal_ctrl, 0x00, sizeof(nxpncihal_ctrl)); in phNxpNciHal_MinOpen()
582 if (0 != sem_init(&nxpncihal_ctrl.syncSpiNfc, 0, 1)) { in phNxpNciHal_MinOpen()
587 nxpncihal_ctrl.halStatus = HAL_STATUS_OPEN; in phNxpNciHal_MinOpen()
592 nxpncihal_ctrl.nci_info.nci_version = NCI_VERSION_UNKNOWN; in phNxpNciHal_MinOpen()
607 nxpncihal_ctrl.gDrvCfg.nClientId = phDal4Nfc_msgget(0, 0600); in phNxpNciHal_MinOpen()
608 nxpncihal_ctrl.gDrvCfg.nLinkType = ENUM_LINK_TYPE_I2C; /* For PN54X */ in phNxpNciHal_MinOpen()
610 tOsalConfig.dwCallbackThreadId = (uintptr_t)nxpncihal_ctrl.gDrvCfg.nClientId; in phNxpNciHal_MinOpen()
612 tTmlConfig.dwGetMsgThreadId = (uintptr_t)nxpncihal_ctrl.gDrvCfg.nClientId; in phNxpNciHal_MinOpen()
630 ret_val = pthread_create(&nxpncihal_ctrl.client_thread, &attr, in phNxpNciHal_MinOpen()
631 phNxpNciHal_client_thread, &nxpncihal_ctrl); in phNxpNciHal_MinOpen()
643 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHal_MinOpen()
657 (nxpncihal_ctrl.retry_cnt >= MAX_RETRY_COUNT)) { in phNxpNciHal_MinOpen()
659 nxpncihal_ctrl.bIsForceFwDwnld = true; in phNxpNciHal_MinOpen()
675 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_MinOpen()
739 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_MinOpen()
763 if (nxpncihal_ctrl.halStatus == HAL_STATUS_OPEN) { in phNxpNciHal_open()
766 }else if(nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE){ in phNxpNciHal_open()
773 nxpncihal_ctrl.p_nfc_stack_cback = p_cback; in phNxpNciHal_open()
774 nxpncihal_ctrl.p_nfc_stack_data_cback = p_data_cback; in phNxpNciHal_open()
789 nxpncihal_ctrl.p_nfc_stack_cback = NULL; in phNxpNciHal_open()
790 nxpncihal_ctrl.p_nfc_stack_data_cback = NULL; in phNxpNciHal_open()
792 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_open()
834 nxpncihal_ctrl.halStatus = HAL_STATUS_MIN_OPEN; in phNxpNciHal_MinOpen_complete()
854 nxpncihal_ctrl.hal_open_status = true; in phNxpNciHal_open_complete()
855 nxpncihal_ctrl.halStatus = HAL_STATUS_OPEN; in phNxpNciHal_open_complete()
884 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_write()
888 memcpy(nxpncihal_ctrl.p_cmd_data, p_data, data_len); in phNxpNciHal_write()
889 nxpncihal_ctrl.cmd_len = data_len; in phNxpNciHal_write()
890 if (nxpncihal_ctrl.cmd_len > NCI_MAX_DATA_LEN) { in phNxpNciHal_write()
905 phNxpNciHal_write_ext(&nxpncihal_ctrl.cmd_len, nxpncihal_ctrl.p_cmd_data, in phNxpNciHal_write()
906 &nxpncihal_ctrl.rsp_len, nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_write()
919 data_len = phNxpNciHal_write_unlocked(nxpncihal_ctrl.cmd_len, in phNxpNciHal_write()
920 nxpncihal_ctrl.p_cmd_data); in phNxpNciHal_write()
948 nxpncihal_ctrl.retry_cnt = 0; in phNxpNciHal_write_unlocked()
959 memcpy(nxpncihal_ctrl.p_cmd_data, p_data, data_len); in phNxpNciHal_write_unlocked()
960 nxpncihal_ctrl.cmd_len = data_len; in phNxpNciHal_write_unlocked()
963 if(phNxpNciHal_check_ncicmd_write_window(nxpncihal_ctrl.cmd_len, in phNxpNciHal_write_unlocked()
964 nxpncihal_ctrl.p_cmd_data) != NFCSTATUS_SUCCESS) { in phNxpNciHal_write_unlocked()
972 data_len = nxpncihal_ctrl.cmd_len; in phNxpNciHal_write_unlocked()
975 (uint8_t*)nxpncihal_ctrl.p_cmd_data, (uint16_t)nxpncihal_ctrl.cmd_len, in phNxpNciHal_write_unlocked()
993 if (nxpncihal_ctrl.retry_cnt++ < MAX_RETRY_COUNT) { in phNxpNciHal_write_unlocked()
1003 nxpncihal_ctrl.retry_cnt); in phNxpNciHal_write_unlocked()
1005 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_write_unlocked()
1014 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL && in phNxpNciHal_write_unlocked()
1015 nxpncihal_ctrl.p_rx_data != NULL && in phNxpNciHal_write_unlocked()
1016 nxpncihal_ctrl.hal_open_status == true) { in phNxpNciHal_write_unlocked()
1022 nxpncihal_ctrl.rx_data_len = sizeof(reset_ntf); in phNxpNciHal_write_unlocked()
1023 memcpy(nxpncihal_ctrl.p_rx_data, reset_ntf, sizeof(reset_ntf)); in phNxpNciHal_write_unlocked()
1024 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_write_unlocked()
1025 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_write_unlocked()
1078 if (nxpncihal_ctrl.read_retry_cnt == 1) { in phNxpNciHal_read_complete()
1079 nxpncihal_ctrl.read_retry_cnt = 0; in phNxpNciHal_read_complete()
1084 sem_getvalue(&(nxpncihal_ctrl.syncSpiNfc), &sem_val); in phNxpNciHal_read_complete()
1086 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_read_complete()
1090 nxpncihal_ctrl.p_rx_ese_data = pInfo->pBuff; in phNxpNciHal_read_complete()
1091 nxpncihal_ctrl.rx_ese_data_len = pInfo->wLength; in phNxpNciHal_read_complete()
1092 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1095 nxpncihal_ctrl.p_rx_data = pInfo->pBuff; in phNxpNciHal_read_complete()
1096 nxpncihal_ctrl.rx_data_len = pInfo->wLength; in phNxpNciHal_read_complete()
1097 status = phNxpNciHal_process_ext_rsp(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_read_complete()
1098 &nxpncihal_ctrl.rx_data_len); in phNxpNciHal_read_complete()
1104 if (nxpncihal_ctrl.hal_ext_enabled == TRUE && in phNxpNciHal_read_complete()
1105 (nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_RSP) { in phNxpNciHal_read_complete()
1108 nxpncihal_ctrl.ext_cb_data.status = status; in phNxpNciHal_read_complete()
1111 if ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_RSP || in phNxpNciHal_read_complete()
1114 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1117 else if ((nxpncihal_ctrl.hal_ext_enabled == TRUE) && in phNxpNciHal_read_complete()
1118 ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_NTF) && in phNxpNciHal_read_complete()
1119 (nxpncihal_ctrl.nci_info.wait_for_ntf == TRUE)) { in phNxpNciHal_read_complete()
1121 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1122 nxpncihal_ctrl.nci_info.wait_for_ntf = FALSE; in phNxpNciHal_read_complete()
1125 else if ((nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) && in phNxpNciHal_read_complete()
1127 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_read_complete()
1128 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_read_complete()
1134 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE && in phNxpNciHal_read_complete()
1135 nxpncihal_ctrl.nci_info.wait_for_ntf == FALSE) { in phNxpNciHal_read_complete()
1209 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_core_initialized()
1234 (nxpncihal_ctrl.retry_cnt >= MAX_RETRY_COUNT)) { in phNxpNciHal_core_initialized()
1248 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_core_initialized()
1814 &nxpncihal_ctrl.rsp_len, nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_core_initialized()
1857 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { in phNxpNciHal_core_initialized()
1860 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_core_initialized()
1861 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_core_initialized()
1887 if ((nxpncihal_ctrl.rx_data_len > 0) && (nxpncihal_ctrl.p_rx_data[2] > 0)) { in phNxpNciHal_CheckRFCmdRespStatus()
1888 if (nxpncihal_ctrl.p_rx_data[3] == 0x09) { in phNxpNciHal_CheckRFCmdRespStatus()
1890 } else if (nxpncihal_ctrl.p_rx_data[3] != NFCSTATUS_SUCCESS) { in phNxpNciHal_CheckRFCmdRespStatus()
1934 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHalRFConfigCmdRecSequence()
2008 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_close()
2023 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_close()
2030 sem_destroy(&nxpncihal_ctrl.syncSpiNfc); in phNxpNciHal_close()
2042 phDal4Nfc_msgrelease(nxpncihal_ctrl.gDrvCfg.nClientId); in phNxpNciHal_close()
2044 memset(&nxpncihal_ctrl, 0x00, sizeof(nxpncihal_ctrl)); in phNxpNciHal_close()
2184 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_notify_i2c_fragmentation()
2186 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_ENABLE_I2C_FRAGMENTATION_EVT, in phNxpNciHal_notify_i2c_fragmentation()
2204 if (NULL != nxpncihal_ctrl.p_control_granted_cback) { in phNxpNciHal_control_granted()
2205 (*nxpncihal_ctrl.p_control_granted_cback)(); in phNxpNciHal_control_granted()
2225 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_request_control()
2227 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_REQUEST_CONTROL_EVT, in phNxpNciHal_request_control()
2244 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_release_control()
2246 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_RELEASE_CONTROL_EVT, in phNxpNciHal_release_control()
2266 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_power_cycle()
2325 while ((s = sem_timedwait(&nxpncihal_ctrl.syncSpiNfc, &ts)) == -1 && in phNxpNciHal_check_ncicmd_write_window()
2356 if(nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) in phNxpNciHal_ioctl()
2371 pInpOutData->out.data.nciRsp.rsp_len = nxpncihal_ctrl.rx_ese_data_len; in phNxpNciHal_ioctl()
2372 if ((nxpncihal_ctrl.rx_ese_data_len > 0) && in phNxpNciHal_ioctl()
2373 (nxpncihal_ctrl.rx_ese_data_len <= MAX_IOCTL_TRANSCEIVE_RESP_LEN) && in phNxpNciHal_ioctl()
2374 (nxpncihal_ctrl.p_rx_ese_data != NULL)) { in phNxpNciHal_ioctl()
2375 memcpy(pInpOutData->out.data.nciRsp.p_rsp, nxpncihal_ctrl.p_rx_ese_data, in phNxpNciHal_ioctl()
2376 nxpncihal_ctrl.rx_ese_data_len); in phNxpNciHal_ioctl()
2697 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_STORE; in phNxpNciHal_gpio_restore()
2705 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_STORE_DONE; in phNxpNciHal_gpio_restore()
2708 set_gpio_values_cmd[7] = nxpncihal_ctrl.phNxpNciGpioInfo.values[0]; in phNxpNciHal_gpio_restore()
2709 set_gpio_values_cmd[8] = nxpncihal_ctrl.phNxpNciGpioInfo.values[1]; in phNxpNciHal_gpio_restore()
2716 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_RESTORE; in phNxpNciHal_gpio_restore()
2724 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_RESTORE_DONE; in phNxpNciHal_gpio_restore()
2728 set_gpio_values_cmd[7] = nxpncihal_ctrl.phNxpNciGpioInfo.values[0]; in phNxpNciHal_gpio_restore()
2729 set_gpio_values_cmd[8] = nxpncihal_ctrl.phNxpNciGpioInfo.values[1]; in phNxpNciHal_gpio_restore()
2768 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_nfcc_core_reset_init()
2812 phNxpNciHal_configFeatureList(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_getChipInfoInFwDnldMode()
2813 nxpncihal_ctrl.rx_data_len); in phNxpNciHal_getChipInfoInFwDnldMode()
2878 if (nxpncihal_ctrl.p_rx_data[8] == 0x10) { in phNxpNciHal_enable_i2c_fragmentation()
2882 } else if (nxpncihal_ctrl.p_rx_data[8] == 0x00) { in phNxpNciHal_enable_i2c_fragmentation()
2909 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_enable_i2c_fragmentation()
2954 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_do_factory_reset()
3077 } else if (nxpncihal_ctrl.phNxpNciGpioInfo.state == GPIO_STORE) { in phNxpNciHal_print_res_status()
3079 nxpncihal_ctrl.phNxpNciGpioInfo.values[0] = p_rx_data[9]; in phNxpNciHal_print_res_status()
3080 nxpncihal_ctrl.phNxpNciGpioInfo.values[1] = p_rx_data[8]; in phNxpNciHal_print_res_status()
3081 } else if (nxpncihal_ctrl.phNxpNciGpioInfo.state == GPIO_RESTORE) { in phNxpNciHal_print_res_status()
3083 nxpncihal_ctrl.phNxpNciGpioInfo.values[0] = p_rx_data[9]; in phNxpNciHal_print_res_status()
3084 nxpncihal_ctrl.phNxpNciGpioInfo.values[1] = p_rx_data[8]; in phNxpNciHal_print_res_status()