diff options
author | Bhuvan Varshney <bvarshne@codeaurora.org> | 2020-03-06 18:33:35 +0530 |
---|---|---|
committer | Bhuvan Varshney <bvarshne@codeaurora.org> | 2020-03-27 16:33:06 +0530 |
commit | a7589d8774808a64d1d2e8de9f5416faf10eedd9 (patch) | |
tree | 113bd052c1089d5dbfd354895ffa7e3cd14415cc | |
parent | 5972a80b705558227f6c208e136073158ebb6cde (diff) |
NFC: HIDL implementation manual merge
Manual merge for HAL service implementation files
from third party release for MW upgradation to 11.01.00.
Change-Id: I24765e5c08fafc39a7c2378bb2daf1f6ffffe4f2
-rw-r--r-- | 2.0/default/NqNfc.cpp | 113 | ||||
-rw-r--r-- | 2.0/default/NqNfc.h | 38 |
2 files changed, 147 insertions, 4 deletions
diff --git a/2.0/default/NqNfc.cpp b/2.0/default/NqNfc.cpp index 2e40a20..a1e0b42 100644 --- a/2.0/default/NqNfc.cpp +++ b/2.0/default/NqNfc.cpp @@ -27,9 +27,32 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * Not a contribution. + */ + +/* + * Copyright 2018-2020 NXP + * + * 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 <hardware/hardware.h> #include <log/log.h> #include "NqNfc.h" +#include "eSEClientExtns.h" +#include "eSEClientIntf.h" +#include "phNxpNciHal.h" #include "phNxpNciHal_Adaptation.h" #include "phNxpNciHal_IoctlOperations.h" @@ -94,16 +117,98 @@ Return<void> NqNfc::getNfcFirmwareVersion(getNfcFirmwareVersion_cb _hidl_cb) { // Methods from ::vendor::nxp::hardware::nfc::V2_0::INqNfc follow. Return<void> NqNfc::getSystemProperty(const ::android::hardware::hidl_string& key, getSystemProperty_cb _hidl_cb){ - string val = phNxpNciHal_getSystemProperty(key); - _hidl_cb(val); - return Void(); + string val = phNxpNciHal_getSystemProperty(key); + _hidl_cb(val); + return Void(); } Return<bool> NqNfc::setSystemProperty(const ::android::hardware::hidl_string& key, const ::android::hardware::hidl_string& value){ - return phNxpNciHal_setSystemProperty(key, value); + return phNxpNciHal_setSystemProperty(key, value); +} + +Return<void> NxpNfc::getVendorParam(const ::android::hardware::hidl_string &key, + getVendorParam_cb _hidl_cb) { + string val = phNxpNciHal_getSystemProperty(key); + _hidl_cb(val); + return Void(); +} + +Return<bool> NxpNfc::setVendorParam(const ::android::hardware::hidl_string &key, + const ::android::hardware::hidl_string &value) { + return phNxpNciHal_setSystemProperty(key, value); +} + +Return<bool> NxpNfc::resetEse(uint64_t resetType) { + NFCSTATUS status = NFCSTATUS_FAILED; + bool ret = false; + + ALOGD("NxpNfc::resetEse Entry"); + if((uint64_t)Constants::HAL_NFC_ESE_HARD_RESET == resetType) { + status = phNxpNciHal_resetEse(); + if(NFCSTATUS_SUCCESS == status) { + ret = true; + status = NFCSTATUS_SUCCESS; + ALOGD("HAL_NFC_ESE_HARD_RESET completed"); + } else { + ALOGD("HAL_NFC_ESE_HARD_RESET failed"); + } + } else { + ALOGD("reset called with %lu type", resetType); + } + ALOGD("NxpNfc::resetEse Exit"); + return ret; +} + +Return<bool> NxpNfc::setEseUpdateState(NxpNfcHalEseState eSEState) { + int ret = -1; + bool status = false; + + ALOGD("NxpNfc::setEseUpdateState Entry"); + ret = phNxpNciHal_nfcTriggerSavedCb((uint8_t)NxpNfcEvents::HAL_NFC_HCI_RESET); + if(ret == 0) { + status = true; + } + + if(eSEState == NxpNfcHalEseState::HAL_NFC_ESE_JCOP_UPDATE_COMPLETED + || eSEState == NxpNfcHalEseState::HAL_NFC_ESE_LS_UPDATE_COMPLETED) { + ALOGD("NxpNfc::setEseUpdateState state == HAL_NFC_ESE_JCOP_UPDATE_COMPLETED"); + seteSEClientState((uint8_t)eSEState); + eSEClientUpdate_NFC_Thread(); + } + if (eSEState == NxpNfcHalEseState::HAL_NFC_ESE_UPDATE_COMPLETED) { + phNxpNciHal_nfcTriggerSavedCb((uint8_t)NxpNfcEvents::HAL_NFC_RESTART); + } + ALOGD("NxpNfc::setEseUpdateState Exit"); + return status; } +Return<bool> NxpNfc::setNxpTransitConfig(const ::android::hardware::hidl_string &strval) { + bool status = true; + + ALOGD("NxpNfc::setNxpTransitConfig Entry"); + status = phNxpNciHal_setNxpTransitConfig((char *)strval.c_str()); + ALOGD("NxpNfc::setNxpTransitConfig Exit"); + return status; +} + +Return<bool> NxpNfc::isJcopUpdateRequired() { + bool status = 0; + + ALOGD("NxpNfc::isJcopUpdateRequired Entry"); + status = getJcopUpdateRequired(); + ALOGD("NxpNfc::isJcopUpdateRequired Exit"); + return status; +} + +Return<bool> NxpNfc::isLsUpdateRequired() { + bool status = 0; + + ALOGD("NxpNfc::isLsUpdateRequired Entry"); + status = getLsUpdateRequired(); + ALOGD("NxpNfc::isLsUpdateRequired Exit"); + return status; +} } // namespace implementation } // namespace V2_0 diff --git a/2.0/default/NqNfc.h b/2.0/default/NqNfc.h index a921848..465ed33 100644 --- a/2.0/default/NqNfc.h +++ b/2.0/default/NqNfc.h @@ -27,6 +27,26 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * Not a contribution. + */ + +/* + * Copyright 2018-2020 NXP + * + * 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 VENDOR_NXP_HARDWARE_NFC_V2_0_NQNFC_H #define VENDOR_NXP_HARDWARE_NFC_V2_0_NQNFC_H @@ -35,6 +55,15 @@ #include <hidl/MQDescriptor.h> #include <hidl/Status.h> +enum Constants : uint16_t { + HAL_NFC_ESE_HARD_RESET = 5, +}; + +enum NxpNfcEvents : uint8_t { + HAL_NFC_RESTART = 0x30, + HAL_NFC_HCI_RESET = 0x40, +}; + namespace vendor { namespace nxp { namespace hardware { @@ -67,6 +96,15 @@ struct NqNfc : public INqNfc { getSystemProperty_cb _hidl_cb) override; Return<bool> setSystemProperty(const ::android::hardware::hidl_string& key, const ::android::hardware::hidl_string& value) override; + Return<void> getVendorParam(const ::android::hardware::hidl_string &key, + getVendorParam_cb _hidl_cb) override; + Return<bool> setVendorParam(const ::android::hardware::hidl_string &key, + const ::android::hardware::hidl_string &value) override; + Return<bool> resetEse(uint64_t resetType) override; + Return<bool> setEseUpdateState(NxpNfcHalEseState state) override; + Return<bool> setNxpTransitConfig(const ::android::hardware::hidl_string &strval) override; + Return<bool> isJcopUpdateRequired() override; + Return<bool> isLsUpdateRequired() override; }; } // namespace implementation |