From ca810ab03c4be3f664c786ed13c1b4c1a5b195ee Mon Sep 17 00:00:00 2001 From: zhaoxc0502 Date: Thu, 20 Jan 2022 00:07:57 +0800 Subject: [PATCH] modify for add nxp && vim3l && esp32c3 board Signed-off-by: zhaoxc0502 --- esp32/BUILD.gn | 4 + esp32/config.json | 26 +++++ esp32/hals/utils/sys_param/BUILD.gn | 27 +++++ esp32/hals/utils/sys_param/hal_sys_param.c | 128 +++++++++++++++++++++ esp32/hals/utils/token/BUILD.gn | 22 ++++ esp32/hals/utils/token/hal_token.c | 104 +++++++++++++++++ 6 files changed, 311 insertions(+) create mode 100755 esp32/BUILD.gn create mode 100755 esp32/config.json create mode 100755 esp32/hals/utils/sys_param/BUILD.gn create mode 100755 esp32/hals/utils/sys_param/hal_sys_param.c create mode 100755 esp32/hals/utils/token/BUILD.gn create mode 100755 esp32/hals/utils/token/hal_token.c diff --git a/esp32/BUILD.gn b/esp32/BUILD.gn new file mode 100755 index 0000000..26b5b33 --- /dev/null +++ b/esp32/BUILD.gn @@ -0,0 +1,4 @@ +# Copyright (C) 2020 Hisilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + +group("esp32") { +} diff --git a/esp32/config.json b/esp32/config.json new file mode 100755 index 0000000..cdd0009 --- /dev/null +++ b/esp32/config.json @@ -0,0 +1,26 @@ +{ + "product_name": "esp32", + "ohos_version": "OpenHarmony 1.0", + "device_company": "espressif", + "board": "esp32", + "kernel_type": "liteos_m", + "kernel_version": "3.0.0", + "subsystems": [ + { + "subsystem": "kernel", + "components": [ + { "component": "liteos_m", + "features":[ + "enable_ohos_kernel_liteos_m_test = false", + "enable_ohos_kernel_liteos_m_fs = true", + "enable_ohos_kernel_liteos_m_kal = true" + ] + } + ] + } + ], + "vendor_adapter_dir": "//device/espressif/esp32", + "third_party_dir": "", + "product_adapter_dir": "//vendor/espressif/esp32" +} + diff --git a/esp32/hals/utils/sys_param/BUILD.gn b/esp32/hals/utils/sys_param/BUILD.gn new file mode 100755 index 0000000..da7e635 --- /dev/null +++ b/esp32/hals/utils/sys_param/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# 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. + +static_library("hal_sysparam") { + sources = [ "hal_sys_param.c" ] + include_dirs = [ + "//base/startup/syspara_lite/hals", + ] + defines = [ + "INCREMENTAL_VERSION=\"${ohos_version}\"", + "BUILD_TYPE=\"${ohos_build_type}\"", + "BUILD_USER=\"${ohos_build_user}\"", + "BUILD_TIME=\"${ohos_build_time}\"", + "BUILD_HOST=\"${ohos_build_host}\"", + "BUILD_ROOTHASH=\"${ohos_build_roothash}\"", + ] +} diff --git a/esp32/hals/utils/sys_param/hal_sys_param.c b/esp32/hals/utils/sys_param/hal_sys_param.c new file mode 100755 index 0000000..11b5c4d --- /dev/null +++ b/esp32/hals/utils/sys_param/hal_sys_param.c @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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 "hal_sys_param.h" + +static const char OHOS_DEVICE_TYPE[] = {"****"}; +static const char OHOS_DISPLAY_VERSION[] = {"OpenHarmony 1.0.1"}; +static const char OHOS_MANUFACTURE[] = {"****"}; +static const char OHOS_BRAND[] = {"****"}; +static const char OHOS_MARKET_NAME[] = {"****"}; +static const char OHOS_PRODUCT_SERIES[] = {"****"}; +static const char OHOS_PRODUCT_MODEL[] = {"****"}; +static const char OHOS_SOFTWARE_MODEL[] = {"****"}; +static const char OHOS_HARDWARE_MODEL[] = {"****"}; +static const char OHOS_HARDWARE_PROFILE[] = {"aout:true,display:true"}; +static const char OHOS_BOOTLOADER_VERSION[] = {"bootloader"}; +static const char OHOS_ABI_LIST[] = {"****"}; +static const char OHOS_SERIAL[] = {"1234567890"}; // provided by OEM. +static const int OHOS_FIRST_API_VERSION = 1; + +static const char EMPTY_STR[] = {""}; + +const char* HalGetDeviceType(void) +{ + return OHOS_DEVICE_TYPE; +} + +const char* HalGetManufacture(void) +{ + return OHOS_MANUFACTURE; +} + +const char* HalGetBrand(void) +{ + return OHOS_BRAND; +} + +const char* HalGetMarketName(void) +{ + return OHOS_MARKET_NAME; +} + +const char* HalGetProductSeries(void) +{ + return OHOS_PRODUCT_SERIES; +} + +const char* HalGetProductModel(void) +{ + return OHOS_PRODUCT_MODEL; +} + +const char* HalGetSoftwareModel(void) +{ + return OHOS_SOFTWARE_MODEL; +} + +const char* HalGetHardwareModel(void) +{ + return OHOS_HARDWARE_MODEL; +} + +const char* HalGetHardwareProfile(void) +{ + return OHOS_HARDWARE_PROFILE; +} + +const char* HalGetSerial(void) +{ + return OHOS_SERIAL; +} + +const char* HalGetBootloaderVersion(void) +{ + return OHOS_BOOTLOADER_VERSION; +} + +const char* HalGetAbiList(void) +{ + return OHOS_ABI_LIST; +} + +const char* HalGetDisplayVersion(void) +{ + return OHOS_DISPLAY_VERSION; +} + +const char* HalGetIncrementalVersion(void) +{ + return INCREMENTAL_VERSION; +} + +const char* HalGetBuildType(void) +{ + return BUILD_TYPE; +} + +const char* HalGetBuildUser(void) +{ + return BUILD_USER; +} + +const char* HalGetBuildHost(void) +{ + return BUILD_HOST; +} + +const char* HalGetBuildTime(void) +{ + return BUILD_TIME; +} + +int HalGetFirstApiVersion(void) +{ + return OHOS_FIRST_API_VERSION; +} diff --git a/esp32/hals/utils/token/BUILD.gn b/esp32/hals/utils/token/BUILD.gn new file mode 100755 index 0000000..0fde10c --- /dev/null +++ b/esp32/hals/utils/token/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# 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. + +static_library("hal_token_static") { + sources = [ "hal_token.c" ] + + include_dirs = [ + "//base/startup/syspara_lite/hals", + "//utils/native/lite/include", + ] + deps = [] +} diff --git a/esp32/hals/utils/token/hal_token.c b/esp32/hals/utils/token/hal_token.c new file mode 100755 index 0000000..08c9c3f --- /dev/null +++ b/esp32/hals/utils/token/hal_token.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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 "hal_token.h" +#include "ohos_errno.h" +#include "ohos_types.h" + +static int OEMReadToken(char *token, unsigned int len) +{ + // OEM need add here, read token from device + (void)(token); + (void)(len); + return EC_SUCCESS; +} + +static int OEMWriteToken(const char *token, unsigned int len) +{ + // OEM need add here, write token to device + (void)(token); + (void)(len); + return EC_SUCCESS; +} + +static int OEMGetAcKey(char *acKey, unsigned int len) +{ + // OEM need add here, get AcKey + (void)(acKey); + (void)(len); + return EC_SUCCESS; +} + +static int OEMGetProdId(char *productId, unsigned int len) +{ + // OEM need add here, get ProdId + (void)(productId); + (void)(len); + return EC_SUCCESS; +} + +static int OEMGetProdKey(char *productKey, unsigned int len) +{ + // OEM need add here, get ProdKey + (void)(productKey); + (void)(len); + return EC_SUCCESS; +} + + +int HalReadToken(char *token, unsigned int len) +{ + if (token == NULL) { + return EC_FAILURE; + } + + return OEMReadToken(token, len); +} + +int HalWriteToken(const char *token, unsigned int len) +{ + if (token == NULL) { + return EC_FAILURE; + } + + return OEMWriteToken(token, len); +} + +int HalGetAcKey(char *acKey, unsigned int len) +{ + if (acKey == NULL) { + return EC_FAILURE; + } + + return OEMGetAcKey(acKey, len); +} + +int HalGetProdId(char *productId, unsigned int len) +{ + if (productId == NULL) { + return EC_FAILURE; + } + + return OEMGetProdId(productId, len); +} + +int HalGetProdKey(char *productKey, unsigned int len) +{ + if (productKey == NULL) { + return EC_FAILURE; + } + + return OEMGetProdKey(productKey, len); +} \ No newline at end of file -- Gitee