From 594d3bdd8ca3352924bfd721ef7065f1d9cbbd1b Mon Sep 17 00:00:00 2001 From: haizhouyang Date: Wed, 21 Apr 2021 15:42:19 +0800 Subject: [PATCH 1/4] Revert "add testcase door" This reverts commit 8fe5492738e3edfe1b1d16ea29db823ad22aa02f. --- uhdf/test/unittest/manager/BUILD.gn | 44 ----------------------------- 1 file changed, 44 deletions(-) diff --git a/uhdf/test/unittest/manager/BUILD.gn b/uhdf/test/unittest/manager/BUILD.gn index af06e5a..e89ef69 100644 --- a/uhdf/test/unittest/manager/BUILD.gn +++ b/uhdf/test/unittest/manager/BUILD.gn @@ -129,47 +129,3 @@ unittest("hdf_adapter_uhdf_test_sbuf") { "-fno-strict-aliasing", ] } - -unittest("hdf_adapter_uhdf_test_door") { - output_extension = "bin" - output_dir = "$root_out_dir/test/unittest/hdf" - include_dirs = [ - "//third_party/googletest/googletest/include", - "//third_party/bounds_checking_function/include", - "//drivers/framework/ability/sbuf/include", - "//drivers/framework/include/platform", - "//drivers/framework/include/core", - "//drivers/framework/core/common/include/host", - "//drivers/framework/core/shared/include", - "//drivers/framework/include/osal", - "//drivers/adapter/uhdf/posix/include", - "//drivers/framework/include/utils", - "//drivers/framework/include/config", - "//drivers/framework/include", - "//drivers/framework/test/unittest/include", - "//drivers/framework/test/unittest/manager", - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", - ] - - defines = [ "__USER__" ] - sources = [ - "//drivers/framework/core/manager/test/unittest/common/hdf_ioservice_test.cpp", - "//drivers/framework/core/manager/test/unittest/common/hdf_lite_manager_test.cpp", - "//drivers/framework/core/manager/test/unittest/common/hdf_sbuf_test.cpp", - ] - deps = [ - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", - "//drivers/adapter/uhdf/manager:hdf_core", - "//drivers/adapter/uhdf/posix:hdf_posix_osal", - "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", - ] - public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - cflags = [ - "-Wall", - "-Wextra", - "-Werror", - "-fsigned-char", - "-fno-common", - "-fno-strict-aliasing", - ] -} -- Gitee From e8dd1cd065a5efd096bebabf4a2542b012e2f291 Mon Sep 17 00:00:00 2001 From: haizhouyang Date: Wed, 21 Apr 2021 17:06:35 +0800 Subject: [PATCH 2/4] add adaptation for platform core(i2c/gpio/uart) --- khdf/liteos_m/BUILD.gn | 1 + khdf/liteos_m/platform/BUILD.gn | 60 ++++++++++++++++++++++++++++ khdf/liteos_m/platform/plat_common.c | 37 +++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 khdf/liteos_m/platform/BUILD.gn create mode 100644 khdf/liteos_m/platform/plat_common.c diff --git a/khdf/liteos_m/BUILD.gn b/khdf/liteos_m/BUILD.gn index 241db0f..b2ce310 100644 --- a/khdf/liteos_m/BUILD.gn +++ b/khdf/liteos_m/BUILD.gn @@ -32,6 +32,7 @@ group("hdf_lite") { "osal:hdf_osal_lite", "core:hdf_core", "hcs:hdf_hcs", + "platform:hdf_platform_lite", "test\sample_driver:sample_driver" ] } diff --git a/khdf/liteos_m/platform/BUILD.gn b/khdf/liteos_m/platform/BUILD.gn new file mode 100644 index 0000000..020a52c --- /dev/null +++ b/khdf/liteos_m/platform/BUILD.gn @@ -0,0 +1,60 @@ +# +# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +config("libhdf_platform_pub_config") { + visibility = [ ":*" ] + include_dirs = [ + "$hdf_fwk_path/include/platform", + "$hdf_fwk_path/support/platform/include", + ] +} + +static_library("hdf_platform_lite") { + sources = [ + "plat_common.c", + "$hdf_fwk_path/support/platform/src/i2c_if.c", + "$hdf_fwk_path/support/platform/src/i2c_core.c", + "$hdf_fwk_path/support/platform/src/gpio_if.c", + "$hdf_fwk_path/support/platform/src/gpio_core.c", + "$hdf_fwk_path/support/platform/src/uart_if.c", + "$hdf_fwk_path/support/platform/src/uart_core.c", + ] + include_dirs = [ + "kernel/liteos_m/kernel/arch/include", + ] + public_configs = [ + ":libhdf_platform_pub_config", + ] + deps = [ + "$khdf_path/osal:hdf_osal_lite", + "$khdf_path/core:hdf_core", + ] +} diff --git a/khdf/liteos_m/platform/plat_common.c b/khdf/liteos_m/platform/plat_common.c new file mode 100644 index 0000000..d053fae --- /dev/null +++ b/khdf/liteos_m/platform/plat_common.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "plat_common.h" +#include "los_interrupt.h" + +bool PlatInIrqContext(void) +{ + return (OS_INT_ACTIVE > 0); +} -- Gitee From a96a0351e941a36ed96411afb996c771e7dadd24 Mon Sep 17 00:00:00 2001 From: haizhouyang Date: Wed, 21 Apr 2021 17:07:37 +0800 Subject: [PATCH 3/4] Revert "Revert "add testcase door"" This reverts commit 594d3bdd8ca3352924bfd721ef7065f1d9cbbd1b. --- uhdf/test/unittest/manager/BUILD.gn | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/uhdf/test/unittest/manager/BUILD.gn b/uhdf/test/unittest/manager/BUILD.gn index e89ef69..af06e5a 100644 --- a/uhdf/test/unittest/manager/BUILD.gn +++ b/uhdf/test/unittest/manager/BUILD.gn @@ -129,3 +129,47 @@ unittest("hdf_adapter_uhdf_test_sbuf") { "-fno-strict-aliasing", ] } + +unittest("hdf_adapter_uhdf_test_door") { + output_extension = "bin" + output_dir = "$root_out_dir/test/unittest/hdf" + include_dirs = [ + "//third_party/googletest/googletest/include", + "//third_party/bounds_checking_function/include", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/platform", + "//drivers/framework/include/core", + "//drivers/framework/core/common/include/host", + "//drivers/framework/core/shared/include", + "//drivers/framework/include/osal", + "//drivers/adapter/uhdf/posix/include", + "//drivers/framework/include/utils", + "//drivers/framework/include/config", + "//drivers/framework/include", + "//drivers/framework/test/unittest/include", + "//drivers/framework/test/unittest/manager", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + ] + + defines = [ "__USER__" ] + sources = [ + "//drivers/framework/core/manager/test/unittest/common/hdf_ioservice_test.cpp", + "//drivers/framework/core/manager/test/unittest/common/hdf_lite_manager_test.cpp", + "//drivers/framework/core/manager/test/unittest/common/hdf_sbuf_test.cpp", + ] + deps = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//drivers/adapter/uhdf/manager:hdf_core", + "//drivers/adapter/uhdf/posix:hdf_posix_osal", + "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", + ] + public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + cflags = [ + "-Wall", + "-Wextra", + "-Werror", + "-fsigned-char", + "-fno-common", + "-fno-strict-aliasing", + ] +} -- Gitee From cbe97e4fd9eadc49fa691dd4d66e28c76da48f6f Mon Sep 17 00:00:00 2001 From: haizhouyang Date: Wed, 21 Apr 2021 17:12:15 +0800 Subject: [PATCH 4/4] gn format for BUILD.gn --- khdf/liteos_m/BUILD.gn | 14 +- khdf/liteos_m/core/BUILD.gn | 208 +++++++++++----------- khdf/liteos_m/hcs/BUILD.gn | 29 ++- khdf/liteos_m/osal/BUILD.gn | 118 ++++++------ khdf/liteos_m/platform/BUILD.gn | 114 ++++++------ khdf/liteos_m/test/sample_driver/BUILD.gn | 88 +++++---- 6 files changed, 276 insertions(+), 295 deletions(-) diff --git a/khdf/liteos_m/BUILD.gn b/khdf/liteos_m/BUILD.gn index b2ce310..3f09f50 100644 --- a/khdf/liteos_m/BUILD.gn +++ b/khdf/liteos_m/BUILD.gn @@ -28,11 +28,11 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. group("hdf_lite") { - deps = [ - "osal:hdf_osal_lite", - "core:hdf_core", - "hcs:hdf_hcs", - "platform:hdf_platform_lite", - "test\sample_driver:sample_driver" - ] + deps = [ + "core:hdf_core", + "hcs:hdf_hcs", + "osal:hdf_osal_lite", + "platform:hdf_platform_lite", + "test\sample_driver:sample_driver", + ] } diff --git a/khdf/liteos_m/core/BUILD.gn b/khdf/liteos_m/core/BUILD.gn index 9be8f0e..8ecc0da 100644 --- a/khdf/liteos_m/core/BUILD.gn +++ b/khdf/liteos_m/core/BUILD.gn @@ -1,107 +1,103 @@ -# -# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# +# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import("//drivers/adapter/khdf/liteos_m/hdf.gni") - -config("libhdf_core_pub_config") { - visibility = [ ":*" ] - -include_dirs = [ - "$hdf_fwk_path/include", - "$hdf_fwk_path/include/osal", - "$hdf_fwk_path/include/utils", - "$hdf_fwk_path/utils/include", - "$hdf_fwk_path/include/platform", - "$hdf_fwk_path/include/core", - "$hdf_fwk_path/include/net", - "$hdf_fwk_path/include/wifi", - "$hdf_fwk_path/model/network/common/netdevice", - "$hdf_fwk_path/ability/sbuf/include", - "$hdf_fwk_path/support/platform/include", - "$hdf_fwk_path/core/host/include", - "$hdf_fwk_path/core/manager/include", - "$hdf_fwk_path/core/shared/include", - "$hdf_fwk_path/core/common/include/manager", - "$hdf_fwk_path/core/common/include/host", - "$hdf_fwk_path/core/adapter/vnode/include", - "$hdf_fwk_path/core/adapter/syscall/include", - "$hdf_fwk_path/include/config", - "$hdf_fwk_path/ability/config/hcs_parser/include", - ] -} - -static_library("hdf_core") { - sources = [ - "common/src/hdf_device_node_ext.c", - "common/src/devmgr_service_start.c", - "$hdf_fwk_path/utils/src/hdf_cstring.c", - "$hdf_fwk_path/utils/src/hdf_slist.c", - "$hdf_fwk_path/utils/src/hdf_sref.c", - "$hdf_fwk_path/ability/sbuf/src/hdf_sbuf.c", - "$hdf_fwk_path/core/host/src/devhost_service.c", - "$hdf_fwk_path/core/host/src/devmgr_service_clnt.c", - "$hdf_fwk_path/core/host/src/devsvc_manager_clnt.c", - "$hdf_fwk_path/core/host/src/hdf_device.c", - "$hdf_fwk_path/core/host/src/hdf_device_node.c", - "$hdf_fwk_path/core/host/src/hdf_device_token.c", - "$hdf_fwk_path/core/host/src/hdf_driver_loader.c", - "$hdf_fwk_path/core/host/src/hdf_observer_record.c", - "$hdf_fwk_path/core/host/src/hdf_service_subscriber.c", - "$hdf_fwk_path/core/host/src/hdf_device_object.c", - "$hdf_fwk_path/core/host/src/hdf_service_observer.c", - "$hdf_fwk_path/core/host/src/power_state_token.c", - "$hdf_fwk_path/core/manager/src/devhost_service_clnt.c", - "$hdf_fwk_path/core/manager/src/device_token_clnt.c", - "$hdf_fwk_path/core/manager/src/devmgr_service.c", - "$hdf_fwk_path/core/manager/src/devsvc_manager.c", - "$hdf_fwk_path/core/manager/src/hdf_driver_installer.c", - "$hdf_fwk_path/core/manager/src/hdf_host_info.c", - "$hdf_fwk_path/core/manager/src/power_state_manager.c", - "$hdf_fwk_path/core/manager/src/power_state_token_clnt.c", - "$hdf_fwk_path/core/shared/src/hdf_service_record.c", - "$hdf_fwk_path/core/shared/src/hdf_device_info.c", - "$hdf_fwk_path/core/shared/src/hdf_object_manager.c", - "$hdf_fwk_path/core/common/src/devlite_object_config.c", - "$hdf_fwk_path/core/common/src/hdf_attribute.c", - "$hdf_fwk_path/core/common/src/load_driver_entry.c", - "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_blob_if.c", - "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_parser.c", - "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_generate_tree.c", - "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_tree_if.c", - "$hdf_fwk_path/ability/config/device_resource_if.c", - ] - - include_dirs = [] - public_configs = [ - ":libhdf_core_pub_config" - ] - deps = [ - "$khdf_path/osal:hdf_osal_lite" - ] -} \ No newline at end of file + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +config("libhdf_core_pub_config") { + visibility = [ ":*" ] + + include_dirs = [ + "$hdf_fwk_path/include", + "$hdf_fwk_path/include/osal", + "$hdf_fwk_path/include/utils", + "$hdf_fwk_path/utils/include", + "$hdf_fwk_path/include/platform", + "$hdf_fwk_path/include/core", + "$hdf_fwk_path/include/net", + "$hdf_fwk_path/include/wifi", + "$hdf_fwk_path/model/network/common/netdevice", + "$hdf_fwk_path/ability/sbuf/include", + "$hdf_fwk_path/support/platform/include", + "$hdf_fwk_path/core/host/include", + "$hdf_fwk_path/core/manager/include", + "$hdf_fwk_path/core/shared/include", + "$hdf_fwk_path/core/common/include/manager", + "$hdf_fwk_path/core/common/include/host", + "$hdf_fwk_path/core/adapter/vnode/include", + "$hdf_fwk_path/core/adapter/syscall/include", + "$hdf_fwk_path/include/config", + "$hdf_fwk_path/ability/config/hcs_parser/include", + ] +} + +static_library("hdf_core") { + sources = [ + "$hdf_fwk_path/ability/config/device_resource_if.c", + "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_blob_if.c", + "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_generate_tree.c", + "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_parser.c", + "$hdf_fwk_path/ability/config/hcs_parser/src/hcs_tree_if.c", + "$hdf_fwk_path/ability/sbuf/src/hdf_sbuf.c", + "$hdf_fwk_path/core/common/src/devlite_object_config.c", + "$hdf_fwk_path/core/common/src/hdf_attribute.c", + "$hdf_fwk_path/core/common/src/load_driver_entry.c", + "$hdf_fwk_path/core/host/src/devhost_service.c", + "$hdf_fwk_path/core/host/src/devmgr_service_clnt.c", + "$hdf_fwk_path/core/host/src/devsvc_manager_clnt.c", + "$hdf_fwk_path/core/host/src/hdf_device.c", + "$hdf_fwk_path/core/host/src/hdf_device_node.c", + "$hdf_fwk_path/core/host/src/hdf_device_object.c", + "$hdf_fwk_path/core/host/src/hdf_device_token.c", + "$hdf_fwk_path/core/host/src/hdf_driver_loader.c", + "$hdf_fwk_path/core/host/src/hdf_observer_record.c", + "$hdf_fwk_path/core/host/src/hdf_service_observer.c", + "$hdf_fwk_path/core/host/src/hdf_service_subscriber.c", + "$hdf_fwk_path/core/host/src/power_state_token.c", + "$hdf_fwk_path/core/manager/src/devhost_service_clnt.c", + "$hdf_fwk_path/core/manager/src/device_token_clnt.c", + "$hdf_fwk_path/core/manager/src/devmgr_service.c", + "$hdf_fwk_path/core/manager/src/devsvc_manager.c", + "$hdf_fwk_path/core/manager/src/hdf_driver_installer.c", + "$hdf_fwk_path/core/manager/src/hdf_host_info.c", + "$hdf_fwk_path/core/manager/src/power_state_manager.c", + "$hdf_fwk_path/core/manager/src/power_state_token_clnt.c", + "$hdf_fwk_path/core/shared/src/hdf_device_info.c", + "$hdf_fwk_path/core/shared/src/hdf_object_manager.c", + "$hdf_fwk_path/core/shared/src/hdf_service_record.c", + "$hdf_fwk_path/utils/src/hdf_cstring.c", + "$hdf_fwk_path/utils/src/hdf_slist.c", + "$hdf_fwk_path/utils/src/hdf_sref.c", + "common/src/devmgr_service_start.c", + "common/src/hdf_device_node_ext.c", + ] + + include_dirs = [] + public_configs = [ ":libhdf_core_pub_config" ] + deps = [ "$khdf_path/osal:hdf_osal_lite" ] +} diff --git a/khdf/liteos_m/hcs/BUILD.gn b/khdf/liteos_m/hcs/BUILD.gn index 20462f7..e221e03 100644 --- a/khdf/liteos_m/hcs/BUILD.gn +++ b/khdf/liteos_m/hcs/BUILD.gn @@ -30,19 +30,16 @@ import("//drivers/adapter/khdf/liteos_m/hdf.gni") static_library("hdf_hcs") { - sources = [ - "hdf_config_gen_hex.c" - ] - config_path = product_path + "/config/hdf.hcs" - print("aaa " + ohos_root_path) - exec_script( - "hcs_build.py", - [ - ohos_root_path+"$hdf_fwk_path/tools/hc-gen/bin/hc-gen", - "-i", - "-o", - rebase_path("hdf_config_gen.c"), - config_path - ], - "") -} \ No newline at end of file + sources = [ "hdf_config_gen_hex.c" ] + config_path = product_path + "/config/hdf.hcs" + print("aaa " + ohos_root_path) + exec_script("hcs_build.py", + [ + ohos_root_path + "$hdf_fwk_path/tools/hc-gen/bin/hc-gen", + "-i", + "-o", + rebase_path("hdf_config_gen.c"), + config_path, + ], + "") +} diff --git a/khdf/liteos_m/osal/BUILD.gn b/khdf/liteos_m/osal/BUILD.gn index a4e8d26..ed47960 100644 --- a/khdf/liteos_m/osal/BUILD.gn +++ b/khdf/liteos_m/osal/BUILD.gn @@ -1,61 +1,59 @@ -# -# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# +# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import("//drivers/adapter/khdf/liteos_m/hdf.gni") - -config("libhdf_osal_pub_config") { - visibility = [ ":*" ] - include_dirs = [ - "include", - "//utils/native/lite/include", - "//drivers/framework/include/osal", - "//drivers/framework/include/utils", - "//kernel/liteos_m/kernel/arch/include", - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", - "//kernel/liteos_m/components/bounds_checking_function/include", - "//kernel/liteos_m/kernel/include", - "//kernel/liteos_m/utils/", - ] -} - -static_library("hdf_osal_lite") { - sources = [ - "src/osal_mutex.c", - "src/osal_mem.c", - "src/osal_sem.c", - "src/osal_thread.c", - "src/osal_time.c", - "src/osal_timer.c", - "src/osal_spinlock.c", - ] - include_dirs = [] - public_configs = [ - ":libhdf_osal_pub_config", - ] -} + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +config("libhdf_osal_pub_config") { + visibility = [ ":*" ] + include_dirs = [ + "include", + "//utils/native/lite/include", + "//drivers/framework/include/osal", + "//drivers/framework/include/utils", + "//kernel/liteos_m/kernel/arch/include", + "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + "//kernel/liteos_m/components/bounds_checking_function/include", + "//kernel/liteos_m/kernel/include", + "//kernel/liteos_m/utils/", + ] +} + +static_library("hdf_osal_lite") { + sources = [ + "src/osal_mem.c", + "src/osal_mutex.c", + "src/osal_sem.c", + "src/osal_spinlock.c", + "src/osal_thread.c", + "src/osal_time.c", + "src/osal_timer.c", + ] + include_dirs = [] + public_configs = [ ":libhdf_osal_pub_config" ] +} diff --git a/khdf/liteos_m/platform/BUILD.gn b/khdf/liteos_m/platform/BUILD.gn index 020a52c..5315cec 100644 --- a/khdf/liteos_m/platform/BUILD.gn +++ b/khdf/liteos_m/platform/BUILD.gn @@ -1,60 +1,56 @@ -# -# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# +# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import("//drivers/adapter/khdf/liteos_m/hdf.gni") - -config("libhdf_platform_pub_config") { - visibility = [ ":*" ] - include_dirs = [ - "$hdf_fwk_path/include/platform", - "$hdf_fwk_path/support/platform/include", - ] -} - -static_library("hdf_platform_lite") { - sources = [ - "plat_common.c", - "$hdf_fwk_path/support/platform/src/i2c_if.c", - "$hdf_fwk_path/support/platform/src/i2c_core.c", - "$hdf_fwk_path/support/platform/src/gpio_if.c", - "$hdf_fwk_path/support/platform/src/gpio_core.c", - "$hdf_fwk_path/support/platform/src/uart_if.c", - "$hdf_fwk_path/support/platform/src/uart_core.c", - ] - include_dirs = [ - "kernel/liteos_m/kernel/arch/include", - ] - public_configs = [ - ":libhdf_platform_pub_config", - ] - deps = [ - "$khdf_path/osal:hdf_osal_lite", - "$khdf_path/core:hdf_core", - ] -} + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +config("libhdf_platform_pub_config") { + visibility = [ ":*" ] + include_dirs = [ + "$hdf_fwk_path/include/platform", + "$hdf_fwk_path/support/platform/include", + ] +} + +static_library("hdf_platform_lite") { + sources = [ + "$hdf_fwk_path/support/platform/src/gpio_core.c", + "$hdf_fwk_path/support/platform/src/gpio_if.c", + "$hdf_fwk_path/support/platform/src/i2c_core.c", + "$hdf_fwk_path/support/platform/src/i2c_if.c", + "$hdf_fwk_path/support/platform/src/uart_core.c", + "$hdf_fwk_path/support/platform/src/uart_if.c", + "plat_common.c", + ] + include_dirs = [ "kernel/liteos_m/kernel/arch/include" ] + public_configs = [ ":libhdf_platform_pub_config" ] + deps = [ + "$khdf_path/core:hdf_core", + "$khdf_path/osal:hdf_osal_lite", + ] +} diff --git a/khdf/liteos_m/test/sample_driver/BUILD.gn b/khdf/liteos_m/test/sample_driver/BUILD.gn index a88e5ef..4481444 100644 --- a/khdf/liteos_m/test/sample_driver/BUILD.gn +++ b/khdf/liteos_m/test/sample_driver/BUILD.gn @@ -1,48 +1,42 @@ -# -# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# +# Copyright (c) 2021, Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import("//drivers/adapter/khdf/liteos_m/hdf.gni") - -static_library("sample_driver") { - sources = [ - "src/sample_driver.c" - ] - include_dirs = [ - "include" - ] - - deps = [ - "$khdf_path/osal:hdf_osal_lite", - "$khdf_path/core:hdf_core", - ] - - ldflags = [ - "-Wl,--whole-archive" - ] -} + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +static_library("sample_driver") { + sources = [ "src/sample_driver.c" ] + include_dirs = [ "include" ] + + deps = [ + "$khdf_path/core:hdf_core", + "$khdf_path/osal:hdf_osal_lite", + ] + + ldflags = [ "-Wl,--whole-archive" ] +} -- Gitee