diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-09-10 07:24:43 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-09-10 07:24:43 +0000 |
commit | 779c9014e29bc43912c88c5f8fea1ea66b23c787 (patch) | |
tree | f24951e9e7f078837eebb03fe26c2fd04d1cee09 | |
parent | 1c99ae19da5afe5b3b3e45c70cca20ced54f9de5 (diff) | |
parent | 09d6deca3da3faf4fd07d62a0e9a6f15525f08ac (diff) | |
download | android_hardware_broadcom_nfc-779c9014e29bc43912c88c5f8fea1ea66b23c787.tar.gz android_hardware_broadcom_nfc-779c9014e29bc43912c88c5f8fea1ea66b23c787.tar.bz2 android_hardware_broadcom_nfc-779c9014e29bc43912c88c5f8fea1ea66b23c787.zip |
release-request-946c768b-83eb-4b7b-83e7-5737856fa8ec-for-git_oc-mr1-release-4326576 snap-temp-L80300000101054689
Change-Id: Ie4350b2987b7f9d18f57f2bea8066b805d88dcfd
-rw-r--r-- | halimpl/pn54x/hal/phNxpNciHal.c | 16 | ||||
-rw-r--r-- | halimpl/pn54x/hal/phNxpNciHal_Kovio.c | 242 | ||||
-rw-r--r-- | halimpl/pn54x/hal/phNxpNciHal_Kovio.h | 26 | ||||
-rw-r--r-- | halimpl/pn54x/hal/phNxpNciHal_ext.c | 11 | ||||
-rw-r--r-- | src/nfc/nfc/nfc_ncif.cc | 2 |
5 files changed, 3 insertions, 294 deletions
diff --git a/halimpl/pn54x/hal/phNxpNciHal.c b/halimpl/pn54x/hal/phNxpNciHal.c index 0a4c372..f3ba207 100644 --- a/halimpl/pn54x/hal/phNxpNciHal.c +++ b/halimpl/pn54x/hal/phNxpNciHal.c @@ -21,7 +21,6 @@ #include <phNxpNciHal.h> #include <phNxpNciHal_Adaptation.h> #include <phNxpNciHal_Dnld.h> -#include <phNxpNciHal_Kovio.h> #include <phNxpNciHal_NfcDepSWPrio.h> #include <phNxpNciHal_ext.h> #include <phTmlNfc.h> @@ -70,9 +69,6 @@ extern uint16_t wFwVer; extern uint16_t fw_maj_ver; extern uint16_t rom_version; -extern int send_to_upper_kovio; -extern int kovio_detected; -extern int disable_kovio; #if (NFC_NXP_CHIP_TYPE != PN547C2) extern uint8_t gRecFWDwnld; static uint8_t gRecFwRetryCount; // variable to hold dummy FW recovery count @@ -83,7 +79,6 @@ static uint8_t Rx_data[NCI_MAX_DATA_LEN]; uint8_t discovery_cmd[50] = {0}; uint8_t discovery_cmd_len = 0; #endif -extern bool_t rf_deactive_cmd; uint32_t timeoutTimerId = 0; phNxpNciHal_Sem_t config_data; @@ -768,15 +763,6 @@ int phNxpNciHal_write(uint16_t data_len, const uint8_t* p_data) { phNxpNciHal_clean_P2P_Prio(); } #endif - /* Specific logic to block RF disable when Kovio detection logic is active */ - if (p_data[0] == 0x21 && p_data[1] == 0x06 && p_data[2] == 0x01) { - rf_deactive_cmd = true; - if (kovio_detected == true) { - NXPLOG_NCIHAL_D( - "Kovio detection logic is active: Set Flag to disable it."); - disable_kovio = 0x01; - } - } /* Check for NXP ext before sending write */ status = @@ -982,7 +968,7 @@ static void phNxpNciHal_read_complete(void* pContext, } /* Read successful send the event to higher layer */ else if ((nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) && - (status == NFCSTATUS_SUCCESS) && (send_to_upper_kovio == 1)) { + (status == NFCSTATUS_SUCCESS)) { (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, nxpncihal_ctrl.p_rx_data); } diff --git a/halimpl/pn54x/hal/phNxpNciHal_Kovio.c b/halimpl/pn54x/hal/phNxpNciHal_Kovio.c deleted file mode 100644 index f239fcc..0000000 --- a/halimpl/pn54x/hal/phNxpNciHal_Kovio.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (C) 2012-2014 NXP Semiconductors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <phNxpLog.h> -#include <phNxpNciHal_Kovio.h> - -/* Timeout value to wait for RF INTF Activated NTF.*/ -#define KOVIO_TIMEOUT 1000 -#define KOVIO_ACT_NTF_TEMP_BUFF_LEN \ - 64 /* length of temp buffer to manipulate \ -the activated notification to match BCM format*/ -#define MAX_WRITE_RETRY 5 - -/******************* Global variables *****************************************/ -extern phNxpNciHal_Control_t nxpncihal_ctrl; -extern NFCSTATUS phNxpNciHal_send_ext_cmd(uint16_t cmd_len, uint8_t* p_cmd); - -int kovio_detected = 0x00; -int send_to_upper_kovio = 0x01; -int disable_kovio = 0x00; -bool_t rf_deactive_cmd = false; -static uint8_t rf_deactivate_cmd[] = {0x21, 0x06, 0x01, 0x03}; /* discovery */ -static uint8_t rf_deactivated_ntf[] = {0x61, 0x06, 0x02, 0x03, 0x01}; -static uint8_t reset_ntf[] = {0x60, 0x00, 0x06, 0xA0, 0x00, - 0xC7, 0xD4, 0x00, 0x00}; - -static uint32_t kovio_timer; - -/************** Kovio functions ***************************************/ - -static NFCSTATUS phNxpNciHal_rf_deactivate(void); - -/******************************************************************************* -** -** Function hal_write_cb -** -** Description Callback function for hal write. -** -** Returns None -** -*******************************************************************************/ -static void hal_write_cb(void* pContext, phTmlNfc_TransactInfo_t* pInfo) { - UNUSED(pContext); - UNUSED(pInfo); - return; -} - -/******************************************************************************* -** -** Function kovio_timer_handler -** -** Description Callback function for kovio timer. -** -** Returns None -** -*******************************************************************************/ -static void kovio_timer_handler(uint32_t timerId, void* pContext) { - UNUSED(timerId); - UNUSED(pContext); - NXPLOG_NCIHAL_D( - ">> kovio_timer_handler. Did not receive RF_INTF_ACTIVATED_NTF, Kovio " - "TAG must be removed."); - - phOsalNfc_Timer_Delete(kovio_timer); - - kovio_detected = 0x00; - send_to_upper_kovio = 0x01; - disable_kovio = 0x00; - /* - * send kovio deactivated ntf to upper layer. - */ - NXPLOG_NCIHAL_D(">> send kovio deactivated ntf to upper layer."); - if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { - (*nxpncihal_ctrl.p_nfc_stack_data_cback)(sizeof(rf_deactivated_ntf), - rf_deactivated_ntf); - } - return; -} - -/******************************************************************************* -** -** Function phNxpNciHal_rf_deactivate -** -** Description Sends rf deactivate cmd to NFCC -** -** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED -** -*******************************************************************************/ -static NFCSTATUS phNxpNciHal_rf_deactivate() { - NFCSTATUS status = NFCSTATUS_SUCCESS; - int cb_data; - int retryCnt = 0; - - do { - retryCnt++; - status = phTmlNfc_Write(rf_deactivate_cmd, sizeof(rf_deactivate_cmd), - (pphTmlNfc_TransactCompletionCb_t)&hal_write_cb, - &cb_data); - } while (status != NFCSTATUS_PENDING && retryCnt <= MAX_WRITE_RETRY); - - if (status != NFCSTATUS_PENDING) { - // phNxpNciHal_emergency_recovery(); - if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL && - nxpncihal_ctrl.hal_open_status == true) { - NXPLOG_NCIHAL_D( - "Send the Core Reset NTF to upper layer, which will trigger the " - "recovery\n"); - // Send the Core Reset NTF to upper layer, which will trigger the - // recovery. - send_to_upper_kovio = 0; - nxpncihal_ctrl.rx_data_len = sizeof(reset_ntf); - memcpy(nxpncihal_ctrl.p_rx_data, reset_ntf, sizeof(reset_ntf)); - (*nxpncihal_ctrl.p_nfc_stack_data_cback)(nxpncihal_ctrl.rx_data_len, - nxpncihal_ctrl.p_rx_data); - } - } - - return status; -} - -/******************************************************************************* -** -** Function phNxpNciHal_kovio_rsp_ext -** -** Description Implements kovio presence check. In BCM controller this is -** managed by NFCC. But since PN54X does not handle this, the -** presence check is mimiced here. -** For the very first time Kovio is detected, NTF has to be -** passed on to upper layer. for every NTF, DH send a -** deactivated command to NFCC and NFCC follows this up with -** another activated notification. When the tag is removed, -** activated notification stops coming and this is indicated to -** upper layer with a HAL generated deactivated notification. -** -** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED -** -*******************************************************************************/ -NFCSTATUS phNxpNciHal_kovio_rsp_ext(uint8_t* p_ntf, uint16_t* p_len) { - NFCSTATUS status = NFCSTATUS_SUCCESS; - uint8_t tBuff[KOVIO_ACT_NTF_TEMP_BUFF_LEN]; - - send_to_upper_kovio = 1; - if ((p_ntf[0] == 0x61) && (p_ntf[1] == 0x05)) { -#if (NFC_NXP_CHIP_TYPE != PN547C2) - if ((p_ntf[5] == 0x81) && (p_ntf[6] == 0x70)) -#else - if ((p_ntf[5] == 0x8A) && (p_ntf[6] == 0x77)) -#endif - { - if (kovio_detected == 0) { - if ((*p_len - 9) < KOVIO_ACT_NTF_TEMP_BUFF_LEN) { - p_ntf[2] += 1; - memcpy(tBuff, &p_ntf[9], *p_len - 9); - p_ntf[9] = p_ntf[9] + 1; - memcpy(&p_ntf[10], tBuff, *p_len - 9); - *p_len += 1; - } else { - NXPLOG_NCIHAL_D("Kovio Act ntf payload exceeded temp buffer size"); - } - kovio_detected = 1; - kovio_timer = phOsalNfc_Timer_Create(); - NXPLOG_NCIHAL_D("custom kovio timer Created - %d", kovio_timer); - } else { - send_to_upper_kovio = 0; - } - - if (!rf_deactive_cmd) { - NXPLOG_NCIHAL_D("Send RF deactivate command to NFCC"); - status = phNxpNciHal_rf_deactivate(); - } else { - NXPLOG_NCIHAL_D("RF deactivate command is already sent to NFCC"); - disable_kovio = true; - send_to_upper_kovio = 0; - } - status = phOsalNfc_Timer_Start(kovio_timer, KOVIO_TIMEOUT, - &kovio_timer_handler, NULL); - if (NFCSTATUS_SUCCESS == status) { - NXPLOG_NCIHAL_D("kovio timer started"); - } else { - NXPLOG_NCIHAL_E("kovio timer not started!!!"); - status = NFCSTATUS_FAILED; - } - } else { - if (kovio_detected == 1) { - phNxpNciHal_clean_Kovio_Ext(); - NXPLOG_NCIHAL_D( - "Disabling Kovio detection logic as another tag type detected"); - } - } - } else if ((p_ntf[0] == 0x41) && (p_ntf[1] == 0x06) && (p_ntf[2] == 0x01)) { - rf_deactive_cmd = false; - if (kovio_detected == 1) send_to_upper_kovio = 0; - if ((kovio_detected == 1) && (disable_kovio == 0x01)) { - NXPLOG_NCIHAL_D("Disabling Kovio detection logic"); - phNxpNciHal_clean_Kovio_Ext(); - disable_kovio = 0x00; - } - } else if ((p_ntf[0] == 0x61) && (p_ntf[1] == 0x06) && (p_ntf[2] == 0x02) && - (p_ntf[3] == 0x03) && (p_ntf[4] == 0x00)) { - if (kovio_detected == 1) send_to_upper_kovio = 0; - } else if ((p_ntf[0] == 0x61) && (p_ntf[1] == 0x03)) { - if (kovio_detected == 1) send_to_upper_kovio = 0; - } - return status; -} -/******************************************************************************* -** -** Function phNxpNciHal_clean_Kovio_Ext -** -** Description Clean up Kovio extension state machine. -** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED -** -*******************************************************************************/ -void phNxpNciHal_clean_Kovio_Ext() { - NXPLOG_NCIHAL_D(">> Cleaning up Kovio State machine and timer."); - phOsalNfc_Timer_Delete(kovio_timer); - kovio_detected = 0x00; - send_to_upper_kovio = 0x01; - disable_kovio = 0x00; - /* - * send kovio deactivated ntf to upper layer. - */ - NXPLOG_NCIHAL_D(">> send kovio deactivated ntf to upper layer."); - if (nxpncihal_ctrl.p_nfc_stack_data_cback != NULL) { - (*nxpncihal_ctrl.p_nfc_stack_data_cback)(sizeof(rf_deactivated_ntf), - rf_deactivated_ntf); - } - return; -} diff --git a/halimpl/pn54x/hal/phNxpNciHal_Kovio.h b/halimpl/pn54x/hal/phNxpNciHal_Kovio.h deleted file mode 100644 index dbb0ce7..0000000 --- a/halimpl/pn54x/hal/phNxpNciHal_Kovio.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2012-2014 NXP Semiconductors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef _PHNXPNCIHAL_KOVIO_H_ -#define _PHNXPNCIHAL_KOVIO_H_ - -#include <phNxpNciHal.h> -#include <phTmlNfc.h> -#include <string.h> - -extern NFCSTATUS phNxpNciHal_kovio_rsp_ext(uint8_t* p_ntf, uint16_t* p_len); -extern void phNxpNciHal_clean_Kovio_Ext(); - -#endif /* _PHNXPNCIHAL_KOVIO_H_ */ diff --git a/halimpl/pn54x/hal/phNxpNciHal_ext.c b/halimpl/pn54x/hal/phNxpNciHal_ext.c index cbfa296..5cca590 100644 --- a/halimpl/pn54x/hal/phNxpNciHal_ext.c +++ b/halimpl/pn54x/hal/phNxpNciHal_ext.c @@ -17,7 +17,6 @@ #include <phNxpConfig.h> #include <phNxpLog.h> #include <phNxpNciHal.h> -#include <phNxpNciHal_Kovio.h> #include <phNxpNciHal_NfcDepSWPrio.h> #include <phNxpNciHal_ext.h> #include <phTmlNfc.h> @@ -31,9 +30,6 @@ extern phNxpNciHal_Control_t nxpncihal_ctrl; extern phNxpNciProfile_Control_t nxpprofile_ctrl; -extern int kovio_detected; -extern int disable_kovio; -extern int send_to_upper_kovio; extern uint32_t cleanup_timer; uint8_t icode_detected = 0x00; uint8_t icode_send_eof = 0x00; @@ -89,9 +85,6 @@ void phNxpNciHal_ext_init(void) { icode_detected = 0x00; icode_send_eof = 0x00; setEEModeDone = 0x00; - kovio_detected = 0x00; - disable_kovio = 0x00; - send_to_upper_kovio = 0x01; EnableP2P_PrioLogic = false; } @@ -132,8 +125,7 @@ NFCSTATUS phNxpNciHal_process_ext_rsp(uint8_t* p_ntf, uint16_t* p_len) { NXPLOG_NCIHAL_D("Is EnableP2P_PrioLogic: 0x0%X", EnableP2P_PrioLogic); if (phNxpDta_IsEnable() == false) { - if ((icode_detected != 1) && (kovio_detected != 1) && - (EnableP2P_PrioLogic == true)) { + if ((icode_detected != 1) && (EnableP2P_PrioLogic == true)) { if (phNxpNciHal_NfcDep_comapre_ntf(p_ntf, *p_len) == NFCSTATUS_FAILED) { status = phNxpNciHal_NfcDep_rsp_ext(p_ntf, p_len); if (status != NFCSTATUS_INVALID_PARAMETER) { @@ -145,7 +137,6 @@ NFCSTATUS phNxpNciHal_process_ext_rsp(uint8_t* p_ntf, uint16_t* p_len) { #endif status = NFCSTATUS_SUCCESS; - status = phNxpNciHal_kovio_rsp_ext(p_ntf, p_len); if (p_ntf[0] == 0x61 && p_ntf[1] == 0x05) { #if (NFC_NXP_CHIP_TYPE == PN548C2) diff --git a/src/nfc/nfc/nfc_ncif.cc b/src/nfc/nfc/nfc_ncif.cc index 47f49e2..da691a4 100644 --- a/src/nfc/nfc/nfc_ncif.cc +++ b/src/nfc/nfc/nfc_ncif.cc @@ -700,7 +700,7 @@ Available after Technology Detection p_i93->dsfid = *p++; STREAM_TO_ARRAY(p_i93->uid, p, NFC_ISO15693_UID_LEN); } else if (NCI_DISCOVERY_TYPE_POLL_KOVIO == p_param->mode) { - p_param->param.pk.uid_len = *p++; + p_param->param.pk.uid_len = len; if (p_param->param.pk.uid_len > NFC_KOVIO_MAX_LEN) { NFC_TRACE_ERROR2("Kovio UID len:0x%x exceeds max(0x%x)", p_param->param.pk.uid_len, NFC_KOVIO_MAX_LEN); |