diff options
author | Gaurav Singhal <gsinghal@codeaurora.org> | 2020-04-23 16:49:53 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-05-18 05:41:55 -0700 |
commit | bdd6847f89e15a51d2ab676a4f3cb1e9ebc80baa (patch) | |
tree | 4736892c869e42ac33594bd6bedfec7a2c8fc087 | |
parent | 8855fe4de50416b870e117341c9fd3a63d335bd1 (diff) |
NFC: HIDL service manual merge for legacy HAL
HIDL service manual merge for legacy HAL from third party release.
Change-Id: Ic046140fe1bdbc5a4101bdf1c78afe633918ab32
-rw-r--r-- | 2.0/default/NxpNfcLegacy.cpp | 195 | ||||
-rw-r--r-- | 2.0/default/NxpNfcLegacy.h | 61 |
2 files changed, 256 insertions, 0 deletions
diff --git a/2.0/default/NxpNfcLegacy.cpp b/2.0/default/NxpNfcLegacy.cpp new file mode 100644 index 0000000..1ac5da4 --- /dev/null +++ b/2.0/default/NxpNfcLegacy.cpp @@ -0,0 +1,195 @@ +/****************************************************************************** + * + * Copyright 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 <log/log.h> + +#include "NxpNfcLegacy.h" +#include "phNxpNciHal.h" +#include <phTmlNfc.h> + +extern bool nfc_debug_enabled; + +namespace vendor { +namespace nxp { +namespace nxpnfclegacy { +namespace V1_0 { +namespace implementation { + + +Return<uint8_t> +NxpNfcLegacy::setEseState(NxpNfcHalEseState EseState) { + NFCSTATUS status = NFCSTATUS_FAILED; + ALOGD("NxpNfcLegacy::setEseState Entry"); + + if(EseState == NxpNfcHalEseState::HAL_NFC_ESE_IDLE_MODE) + { + ALOGD("NxpNfcLegacy::setEseState state == HAL_NFC_ESE_IDLE_MODE"); + status = phNxpNciHal_setEseState(phNxpNciHalNfc_e_SetIdleMode); + } + if (EseState == NxpNfcHalEseState::HAL_NFC_ESE_WIRED_MODE) { + ALOGD("NxpNfcLegacy::setEseState state == HAL_NFC_ESE_WIRED_MODE"); + status = phNxpNciHal_setEseState(phNxpNciHalNfc_e_SetWiredMode); + } + + ALOGD("NxpNfcLegacy::setEseState Exit"); + return status; +} + +Return<uint8_t> +NxpNfcLegacy::getchipType() { + uint8_t chiptype; + ALOGD("NxpNfcLegacy::getchipType Entry"); + chiptype = phNxpHal_getchipType(); + ALOGD("NxpNfcLegacy::getchipType Exit"); + return chiptype; +} + +Return<uint16_t> +NxpNfcLegacy::setNfcServicePid(uint64_t pid) { + NFCSTATUS status = NFCSTATUS_FAILED; + ALOGD("NxpNfcLegacy::setNfcServicePid Entry"); + status = phNxpNciHal_setNfcServicePid(pid); + ALOGD("NxpNfcLegacy::setNfcServicePid Exit"); + return status; +} + +Return<uint16_t> +NxpNfcLegacy::getEseState() { + NFCSTATUS status = NFCSTATUS_FAILED; + ALOGD("NxpNfcLegacy::getEseState Entry"); + status = phNxpNciHal_getEseState(); + ALOGD("NxpNfcLegacy::getEseState Exit"); + return status; +} + +Return<uint16_t> +NxpNfcLegacy::spiDwpSync(uint32_t level) { + uint16_t status = 0; + + ALOGD("NxpNfcLegacy::spiDwpSync Entry"); + status = phNxpNciHal_ReleaseSVDDWait(level); + + ALOGD("NxpNfcLegacy::spiDwpSync Exit"); + return status; +} + +Return<uint16_t> +NxpNfcLegacy::RelForceDwpOnOffWait(uint32_t level) { + uint16_t status = 0; + + ALOGD("NxpNfcLegacy::RelForceDwpOnOffWait Entry"); + status = phNxpNciHal_ReleaseDWPOnOffWait(level); + + ALOGD("NxpNfcLegacy::RelForceDwpOnOffWait Exit"); + return status; +} + +Return<int8_t> +NxpNfcLegacy::getSPMStatus(uint32_t level) { + int8_t status = -1; + + ALOGD("NxpNfcLegacy::getSPMStatus Entry"); + status = phNxpNciHal_getSPMStatus(level); + + ALOGD("NxpNfcLegacy::getSPMStatus Exit"); + return status; +} + +Return<int32_t> +NxpNfcLegacy::hciInitUpdateState(NfcHciInitStatus HciStatus) { + int32_t status = 0; + + ALOGD("NxpNfcLegacy::hciInitUpdateState Entry"); + if (HciStatus == NfcHciInitStatus::NFC_HCI_INIT_START) + { + ALOGD("NxpNfcLegacy::hciInitUpdateState state == NFC_HCI_INIT_START"); + phNxpNciHal_hciInitUpdateState(phNxpNfcHciInitStatus_e_Start); + } + else if (HciStatus == NfcHciInitStatus::NFC_HCI_INIT_COMPLETE) + { + ALOGD("NxpNfcLegacy::hciInitUpdateState state == NFC_HCI_INIT_COMPLETE"); + phNxpNciHal_hciInitUpdateState(phNxpNfcHciInitStatus_e_Complete); + } + ALOGD("NxpNfcLegacy::hciInitUpdateState Exit"); + return status; +} + +Return<int32_t> +NxpNfcLegacy::hciInitUpdateStateComplete() { + int32_t status = 0; + + ALOGD("NxpNfcLegacy::hciInitUpdateStateComplete Entry"); + + status = phNxpNciHal_hciInitUpdateStateComplete(); + + ALOGD("NxpNfcLegacy::hciInitUpdateStateComplete Exit"); + + return status; +} + +Return<void> NxpNfcLegacy::getCachedNfccConfig(getCachedNfccConfig_cb _hidl_cb){ + phNxpNci_getCfg_info_t GetCfg_info; + NxpNciCfgInfo ConfigData; + + ALOGD("NxpNfcLegacy::GetCachedNfccConfig Entry" ); + + phNxpNciHal_GetCachedNfccConfig(&GetCfg_info); + memcpy(&ConfigData,&GetCfg_info,sizeof(NxpNciCfgInfo)); + _hidl_cb(ConfigData); + + ALOGD("NxpNfcLegacy::GetCachedNfccConfig Exit"); + return Void(); +} + +Return<void> NxpNfcLegacy::getNxpConfig(getNxpConfig_cb _hidl_cb) +{ + phNxpNfcHalConfig localConfigData; + NxpNfcHalConfig config; + ALOGD("NxpNfcLegacy::getNxpConfig Entry" ); + phNxpNciHal_getNxpConfig(&localConfigData); + memcpy(&config, &localConfigData, sizeof(NxpNfcHalConfig)); + _hidl_cb(config); + ALOGD("NxpNfcLegacy::getNxpConfig Exit"); + return Void(); +} + +Return<void> NxpNfcLegacy::nciTransceive( const NxpNciExtnCmd &NciCmd,nciTransceive_cb _hidl_cb){ + phNxpNci_Extn_Cmd_t in; + phNxpNci_Extn_Resp_t out; + + NxpNciExtnResp nciResp; + + ALOGD("NxpNfcLegacy::NciTransceive Entry" ); + + memcpy(&in,&NciCmd,sizeof(NxpNciExtnCmd)); + + phNxpNciHal_nciTransceive(&in,&out); + + memcpy(&nciResp,&out,sizeof(NxpNciExtnResp)); + + _hidl_cb(nciResp); + + ALOGD("NxpNfcLegacy::NciTransceive Exit"); + return Void(); +} + + +} // namespace implementation +} // namespace V1_0 +} // namespace nxpnfclegacy +} // namespace nxp +} // namespace vendor diff --git a/2.0/default/NxpNfcLegacy.h b/2.0/default/NxpNfcLegacy.h new file mode 100644 index 0000000..5978bd2 --- /dev/null +++ b/2.0/default/NxpNfcLegacy.h @@ -0,0 +1,61 @@ +/****************************************************************************** + * + * Copyright 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_NXPNFCLEGACY_V1_0_NXPNFCLEGACY_H +#define VENDOR_NXP_NXPNFCLEGACY_V1_0_NXPNFCLEGACY_H + +#include <vendor/nxp/nxpnfclegacy/1.0/INxpNfcLegacy.h> +#include <hidl/MQDescriptor.h> +#include <hidl/Status.h> + + + +namespace vendor { +namespace nxp { +namespace nxpnfclegacy { +namespace V1_0 { +namespace implementation { + +using ::android::hidl::base::V1_0::IBase; +using ::vendor::nxp::nxpnfclegacy::V1_0::INxpNfcLegacy; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +struct NxpNfcLegacy : public INxpNfcLegacy{ + Return<uint8_t> setEseState(NxpNfcHalEseState EseState) override; + Return<uint8_t> getchipType() override; + Return<uint16_t> setNfcServicePid(uint64_t pid) override; + Return<uint16_t> getEseState() override; + Return<uint16_t> spiDwpSync(uint32_t level) override; + Return<uint16_t> RelForceDwpOnOffWait(uint32_t level) override; + Return<int8_t> getSPMStatus(uint32_t level) override; + Return<int32_t> hciInitUpdateState(NfcHciInitStatus HciStatus) override; + Return<int32_t> hciInitUpdateStateComplete() override; + Return<void> getCachedNfccConfig(getCachedNfccConfig_cb _hidl_cb) override; + Return<void> getNxpConfig(getNxpConfig_cb _hidl_cb) override; + Return<void> nciTransceive(const NxpNciExtnCmd &in,nciTransceive_cb _hidl_cb); +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace nxpnfclegacy +} // namespace nxp +} // namespace vendor + +#endif // VENDOR_NXP_NXPNFCLEGACY_V1_0_NXPNFCLEGACY_H |