Lines Matching refs:nxpncihal_ctrl

61 phNxpNciHal_Control_t nxpncihal_ctrl;  variable
204 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
206 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_OPEN_CPLT_EVT, in phNxpNciHal_client_thread()
215 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
217 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_CLOSE_CPLT_EVT, in phNxpNciHal_client_thread()
220 phNxpNciHal_kill_client_thread(&nxpncihal_ctrl); in phNxpNciHal_client_thread()
227 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
229 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_POST_INIT_CPLT_EVT, in phNxpNciHal_client_thread()
238 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
240 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_PRE_DISCOVER_CPLT_EVT, in phNxpNciHal_client_thread()
249 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
251 (*nxpncihal_ctrl.p_nfc_stack_cback)( in phNxpNciHal_client_thread()
260 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_client_thread()
262 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_ERROR_EVT, in phNxpNciHal_client_thread()
271 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { in phNxpNciHal_client_thread()
272 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rsp_len, in phNxpNciHal_client_thread()
273 nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_client_thread()
335 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_UNKNOWN; in phNxpNciHal_fw_download()
390 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHal_fw_download()
440 nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_CheckValidFwVersion()
566 if (nxpncihal_ctrl.halStatus == HAL_STATUS_MIN_OPEN) { in phNxpNciHal_MinOpen()
592 memset(&nxpncihal_ctrl, 0x00, sizeof(nxpncihal_ctrl)); in phNxpNciHal_MinOpen()
598 if (0 != sem_init(&nxpncihal_ctrl.syncSpiNfc, 0, 1)) { in phNxpNciHal_MinOpen()
604 nxpncihal_ctrl.halStatus = HAL_STATUS_OPEN; in phNxpNciHal_MinOpen()
609 nxpncihal_ctrl.nci_info.nci_version = NCI_VERSION_UNKNOWN; in phNxpNciHal_MinOpen()
623 nxpncihal_ctrl.gDrvCfg.nClientId = phDal4Nfc_msgget(0, 0600); in phNxpNciHal_MinOpen()
624 nxpncihal_ctrl.gDrvCfg.nLinkType = ENUM_LINK_TYPE_I2C; /* For PN54X */ in phNxpNciHal_MinOpen()
626 tOsalConfig.dwCallbackThreadId = (uintptr_t)nxpncihal_ctrl.gDrvCfg.nClientId; in phNxpNciHal_MinOpen()
628 tTmlConfig.dwGetMsgThreadId = (uintptr_t)nxpncihal_ctrl.gDrvCfg.nClientId; in phNxpNciHal_MinOpen()
643 ret_val = pthread_create(&nxpncihal_ctrl.client_thread, NULL, in phNxpNciHal_MinOpen()
644 phNxpNciHal_client_thread, &nxpncihal_ctrl); in phNxpNciHal_MinOpen()
655 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHal_MinOpen()
679 (nxpncihal_ctrl.retry_cnt >= MAX_RETRY_COUNT); in phNxpNciHal_MinOpen()
697 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_MinOpen()
771 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_MinOpen()
794 if (nxpncihal_ctrl.halStatus == HAL_STATUS_OPEN) { in phNxpNciHal_open()
797 } else if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_open()
804 nxpncihal_ctrl.p_nfc_stack_cback = p_cback; in phNxpNciHal_open()
805 nxpncihal_ctrl.p_nfc_stack_data_cback = p_data_cback; in phNxpNciHal_open()
819 nxpncihal_ctrl.p_nfc_stack_cback = NULL; in phNxpNciHal_open()
820 nxpncihal_ctrl.p_nfc_stack_data_cback = NULL; in phNxpNciHal_open()
822 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_open()
862 nxpncihal_ctrl.halStatus = HAL_STATUS_MIN_OPEN; in phNxpNciHal_MinOpen_complete()
882 nxpncihal_ctrl.hal_open_status = true; in phNxpNciHal_open_complete()
883 nxpncihal_ctrl.halStatus = HAL_STATUS_OPEN; in phNxpNciHal_open_complete()
931 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_write_internal()
940 memcpy(nxpncihal_ctrl.p_cmd_data, p_data, data_len); in phNxpNciHal_write_internal()
941 nxpncihal_ctrl.cmd_len = data_len; in phNxpNciHal_write_internal()
956 phNxpNciHal_write_ext(&nxpncihal_ctrl.cmd_len, nxpncihal_ctrl.p_cmd_data, in phNxpNciHal_write_internal()
957 &nxpncihal_ctrl.rsp_len, nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_write_internal()
970 data_len = phNxpNciHal_write_unlocked(nxpncihal_ctrl.cmd_len, in phNxpNciHal_write_internal()
971 nxpncihal_ctrl.p_cmd_data); in phNxpNciHal_write_internal()
1002 nxpncihal_ctrl.retry_cnt = 0; in phNxpNciHal_write_unlocked()
1013 memcpy(nxpncihal_ctrl.p_cmd_data, p_data, data_len); in phNxpNciHal_write_unlocked()
1014 nxpncihal_ctrl.cmd_len = data_len; in phNxpNciHal_write_unlocked()
1017 if (phNxpNciHal_check_ncicmd_write_window(nxpncihal_ctrl.cmd_len, in phNxpNciHal_write_unlocked()
1018 nxpncihal_ctrl.p_cmd_data) != in phNxpNciHal_write_unlocked()
1026 (uint8_t*)nxpncihal_ctrl.p_cmd_data, (uint16_t)nxpncihal_ctrl.cmd_len); in phNxpNciHal_write_unlocked()
1030 data_len = nxpncihal_ctrl.cmd_len; in phNxpNciHal_write_unlocked()
1033 (uint8_t*)nxpncihal_ctrl.p_cmd_data, (uint16_t)nxpncihal_ctrl.cmd_len, in phNxpNciHal_write_unlocked()
1051 if (nxpncihal_ctrl.retry_cnt++ < MAX_RETRY_COUNT) { in phNxpNciHal_write_unlocked()
1061 nxpncihal_ctrl.retry_cnt); in phNxpNciHal_write_unlocked()
1063 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_write_unlocked()
1072 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL && in phNxpNciHal_write_unlocked()
1073 nxpncihal_ctrl.p_rx_data != NULL && in phNxpNciHal_write_unlocked()
1074 nxpncihal_ctrl.hal_open_status == true) { in phNxpNciHal_write_unlocked()
1080 nxpncihal_ctrl.rx_data_len = sizeof(reset_ntf); in phNxpNciHal_write_unlocked()
1081 memcpy(nxpncihal_ctrl.p_rx_data, reset_ntf, sizeof(reset_ntf)); in phNxpNciHal_write_unlocked()
1082 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_write_unlocked()
1083 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_write_unlocked()
1136 if (nxpncihal_ctrl.read_retry_cnt == 1) { in phNxpNciHal_read_complete()
1137 nxpncihal_ctrl.read_retry_cnt = 0; in phNxpNciHal_read_complete()
1142 sem_getvalue(&(nxpncihal_ctrl.syncSpiNfc), &sem_val); in phNxpNciHal_read_complete()
1144 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_read_complete()
1150 nxpncihal_ctrl.p_rx_ese_data = pInfo->pBuff; in phNxpNciHal_read_complete()
1151 nxpncihal_ctrl.rx_ese_data_len = pInfo->wLength; in phNxpNciHal_read_complete()
1152 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1154 nxpncihal_ctrl.p_rx_data = pInfo->pBuff; in phNxpNciHal_read_complete()
1155 nxpncihal_ctrl.rx_data_len = pInfo->wLength; in phNxpNciHal_read_complete()
1156 status = phNxpNciHal_process_ext_rsp(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_read_complete()
1157 &nxpncihal_ctrl.rx_data_len); in phNxpNciHal_read_complete()
1162 if ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_NTF) { in phNxpNciHal_read_complete()
1163 NfccPowerTracker::getInstance().ProcessNtf(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_read_complete()
1164 nxpncihal_ctrl.rx_data_len); in phNxpNciHal_read_complete()
1167 if (nxpncihal_ctrl.hal_ext_enabled == TRUE && in phNxpNciHal_read_complete()
1168 (nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_RSP) { in phNxpNciHal_read_complete()
1171 nxpncihal_ctrl.ext_cb_data.status = status; in phNxpNciHal_read_complete()
1174 if ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_RSP || in phNxpNciHal_read_complete()
1177 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1180 else if ((nxpncihal_ctrl.hal_ext_enabled == TRUE) && in phNxpNciHal_read_complete()
1181 ((nxpncihal_ctrl.p_rx_data[0x00] & NCI_MT_MASK) == NCI_MT_NTF) && in phNxpNciHal_read_complete()
1182 (nxpncihal_ctrl.nci_info.wait_for_ntf == TRUE)) { in phNxpNciHal_read_complete()
1184 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1185 nxpncihal_ctrl.nci_info.wait_for_ntf = FALSE; in phNxpNciHal_read_complete()
1187 (nxpncihal_ctrl.p_rx_data[0x00] == 0x00)) { in phNxpNciHal_read_complete()
1190 nxpncihal_ctrl.p_rx_data, nxpncihal_ctrl.rx_data_len); in phNxpNciHal_read_complete()
1192 SEM_POST(&(nxpncihal_ctrl.ext_cb_data)); in phNxpNciHal_read_complete()
1195 else if ((nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) && in phNxpNciHal_read_complete()
1197 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_read_complete()
1198 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_read_complete()
1200 if ((nfcFL.chipType == pn557) && nxpncihal_ctrl.p_rx_data[0] == 0x62 && in phNxpNciHal_read_complete()
1201 nxpncihal_ctrl.p_rx_data[1] == 0x00 && in phNxpNciHal_read_complete()
1202 nxpncihal_ctrl.p_rx_data[3] == 0xC0 && in phNxpNciHal_read_complete()
1203 nxpncihal_ctrl.p_rx_data[4] == 0x00) { in phNxpNciHal_read_complete()
1211 (*nxpncihal_ctrl.p_nfc_stack_data_cback)( in phNxpNciHal_read_complete()
1220 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE && in phNxpNciHal_read_complete()
1221 nxpncihal_ctrl.nci_info.wait_for_ntf == FALSE) { in phNxpNciHal_read_complete()
1286 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_core_initialized()
1311 (nxpncihal_ctrl.retry_cnt >= MAX_RETRY_COUNT)) { in phNxpNciHal_core_initialized()
1325 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_core_initialized()
1879 &nxpncihal_ctrl.rsp_len, nxpncihal_ctrl.p_rsp_data); in phNxpNciHal_core_initialized()
1925 if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { in phNxpNciHal_core_initialized()
1928 (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, in phNxpNciHal_core_initialized()
1929 nxpncihal_ctrl.p_rx_data); in phNxpNciHal_core_initialized()
1951 if (nxpncihal_ctrl.p_rx_data[9] == 0x1 && in phNxpNciHal_isFactoryOTAModeActive()
1952 nxpncihal_ctrl.p_rx_data[13] == 0x1) { in phNxpNciHal_isFactoryOTAModeActive()
2000 if ((nxpncihal_ctrl.rx_data_len > 0) && (nxpncihal_ctrl.p_rx_data[2] > 0)) { in phNxpNciHal_CheckRFCmdRespStatus()
2001 if (nxpncihal_ctrl.p_rx_data[3] == 0x09) { in phNxpNciHal_CheckRFCmdRespStatus()
2003 } else if (nxpncihal_ctrl.p_rx_data[3] != NFCSTATUS_SUCCESS) { in phNxpNciHal_CheckRFCmdRespStatus()
2047 nxpncihal_ctrl.p_cmd_data, NCI_MAX_DATA_LEN, in phNxpNciHalRFConfigCmdRecSequence()
2122 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_close()
2130 sem_getvalue(&(nxpncihal_ctrl.syncSpiNfc), &sem_val); in phNxpNciHal_close()
2132 sem_post(&(nxpncihal_ctrl.syncSpiNfc)); in phNxpNciHal_close()
2155 nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; in phNxpNciHal_close()
2162 sem_destroy(&nxpncihal_ctrl.syncSpiNfc); in phNxpNciHal_close()
2174 if (0 != pthread_join(nxpncihal_ctrl.client_thread, (void**)NULL)) { in phNxpNciHal_close()
2180 phDal4Nfc_msgrelease(nxpncihal_ctrl.gDrvCfg.nClientId); in phNxpNciHal_close()
2182 memset(&nxpncihal_ctrl, 0x00, sizeof(nxpncihal_ctrl)); in phNxpNciHal_close()
2356 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_notify_i2c_fragmentation()
2358 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_ENABLE_I2C_FRAGMENTATION_EVT, in phNxpNciHal_notify_i2c_fragmentation()
2376 if (NULL != nxpncihal_ctrl.p_control_granted_cback) { in phNxpNciHal_control_granted()
2377 (*nxpncihal_ctrl.p_control_granted_cback)(); in phNxpNciHal_control_granted()
2397 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_request_control()
2399 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_REQUEST_CONTROL_EVT, in phNxpNciHal_request_control()
2416 if (nxpncihal_ctrl.p_nfc_stack_cback != NULL) { in phNxpNciHal_release_control()
2418 (*nxpncihal_ctrl.p_nfc_stack_cback)(HAL_NFC_RELEASE_CONTROL_EVT, in phNxpNciHal_release_control()
2438 if (nxpncihal_ctrl.halStatus != HAL_STATUS_OPEN) { in phNxpNciHal_power_cycle()
2502 while ((s = sem_timedwait(&nxpncihal_ctrl.syncSpiNfc, &ts)) == -1 && in phNxpNciHal_check_ncicmd_write_window()
2533 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_ioctl()
2545 pInpOutData->out.data.nciRsp.rsp_len = nxpncihal_ctrl.rx_ese_data_len; in phNxpNciHal_ioctl()
2546 if ((nxpncihal_ctrl.rx_ese_data_len > 0) && in phNxpNciHal_ioctl()
2547 (nxpncihal_ctrl.rx_ese_data_len <= MAX_IOCTL_TRANSCEIVE_RESP_LEN) && in phNxpNciHal_ioctl()
2548 (nxpncihal_ctrl.p_rx_ese_data != NULL)) { in phNxpNciHal_ioctl()
2549 memcpy(pInpOutData->out.data.nciRsp.p_rsp, nxpncihal_ctrl.p_rx_ese_data, in phNxpNciHal_ioctl()
2550 nxpncihal_ctrl.rx_ese_data_len); in phNxpNciHal_ioctl()
2581 if ((nxpncihal_ctrl.halStatus == HAL_STATUS_MIN_OPEN) && in phNxpNciHal_ioctl()
2886 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_STORE; in phNxpNciHal_gpio_restore()
2895 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_STORE_DONE; in phNxpNciHal_gpio_restore()
2898 set_gpio_values_cmd[7] = nxpncihal_ctrl.phNxpNciGpioInfo.values[0]; in phNxpNciHal_gpio_restore()
2899 set_gpio_values_cmd[8] = nxpncihal_ctrl.phNxpNciGpioInfo.values[1]; in phNxpNciHal_gpio_restore()
2907 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_RESTORE; in phNxpNciHal_gpio_restore()
2916 nxpncihal_ctrl.phNxpNciGpioInfo.state = GPIO_RESTORE_DONE; in phNxpNciHal_gpio_restore()
2920 set_gpio_values_cmd[7] = nxpncihal_ctrl.phNxpNciGpioInfo.values[0]; in phNxpNciHal_gpio_restore()
2921 set_gpio_values_cmd[8] = nxpncihal_ctrl.phNxpNciGpioInfo.values[1]; in phNxpNciHal_gpio_restore()
2960 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_nfcc_core_reset_init()
3004 phNxpNciHal_configFeatureList(nxpncihal_ctrl.p_rx_data, in phNxpNciHal_getChipInfoInFwDnldMode()
3005 nxpncihal_ctrl.rx_data_len); in phNxpNciHal_getChipInfoInFwDnldMode()
3075 if (nxpncihal_ctrl.p_rx_data[8] == 0x10) { in phNxpNciHal_enable_i2c_fragmentation()
3079 } else if (nxpncihal_ctrl.p_rx_data[8] == 0x00) { in phNxpNciHal_enable_i2c_fragmentation()
3106 if (nxpncihal_ctrl.nci_info.nci_version == NCI_VERSION_2_0) { in phNxpNciHal_enable_i2c_fragmentation()
3151 if (nxpncihal_ctrl.halStatus == HAL_STATUS_CLOSE) { in phNxpNciHal_do_factory_reset()
3272 } else if (nxpncihal_ctrl.phNxpNciGpioInfo.state == GPIO_STORE) { in phNxpNciHal_print_res_status()
3274 nxpncihal_ctrl.phNxpNciGpioInfo.values[0] = p_rx_data[9]; in phNxpNciHal_print_res_status()
3275 nxpncihal_ctrl.phNxpNciGpioInfo.values[1] = p_rx_data[8]; in phNxpNciHal_print_res_status()
3276 } else if (nxpncihal_ctrl.phNxpNciGpioInfo.state == GPIO_RESTORE) { in phNxpNciHal_print_res_status()
3278 nxpncihal_ctrl.phNxpNciGpioInfo.values[0] = p_rx_data[9]; in phNxpNciHal_print_res_status()
3279 nxpncihal_ctrl.phNxpNciGpioInfo.values[1] = p_rx_data[8]; in phNxpNciHal_print_res_status()