From d6e5058816b55955e8f09bbf28c1e4d8e817bf7c Mon Sep 17 00:00:00 2001 From: j30052480 Date: Fri, 31 May 2024 18:58:12 +0800 Subject: [PATCH 1/5] feat: hdf_core independent compile Signed-off-by: j30052480 --- adapter/BUILD.gn | 4 +- adapter/uhdf2/hdi.gni | 25 ++++--- adapter/uhdf2/host/peripheral/BUILD.gn | 22 ++++++ .../uhdf2/host/peripheral/hdf_peripheral.cfg | 74 +++++++++++++++++++ 4 files changed, 112 insertions(+), 13 deletions(-) create mode 100644 adapter/uhdf2/host/peripheral/BUILD.gn create mode 100644 adapter/uhdf2/host/peripheral/hdf_peripheral.cfg diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn index 47922a7c0..dfaa78d04 100644 --- a/adapter/BUILD.gn +++ b/adapter/BUILD.gn @@ -32,7 +32,7 @@ if (defined(ohos_lite)) { } else { group("uhdf_entry") { hdf_framework_path = "./../framework" - hdf_peripheral_path = "./../../peripheral" + hdf_peripheral_path = "./uhdf2/host/peripheral" deps = [ "$hdf_adapter_path/uhdf2/hdi:libhdi", "$hdf_adapter_path/uhdf2/host:hdf_devhost", @@ -47,7 +47,7 @@ if (defined(ohos_lite)) { "$hdf_adapter_path/uhdf2/pub_utils:libpub_utils", "$hdf_adapter_path/uhdf2/utils:libhdf_utils", "$hdf_framework_path/tools/hdf_dbg:hdf_dbg", - "$hdf_peripheral_path/base:hdf_peripheral.cfg", + "$hdf_peripheral_path:hdf_peripheral.cfg", ] } group("uhdf_test_entry") { diff --git a/adapter/uhdf2/hdi.gni b/adapter/uhdf2/hdi.gni index 597715837..67ca08ae1 100644 --- a/adapter/uhdf2/hdi.gni +++ b/adapter/uhdf2/hdi.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 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 @@ -102,16 +102,7 @@ template("hdi") { idl_headers_config = "$target_name" + "_idl_headers_config" config("$idl_headers_config") { - include_dirs = [ - "$hdf_uhdf_path/include/hdi", - "$hdf_uhdf_path/osal/include", - "$hdf_uhdf_path/ipc/include", - "$hdf_framework_path/include/utils", - "//drivers/hdf_core/interfaces/inner_api/utils", - "//drivers/hdf_core/interfaces/inner_api/osal/uhdf", - "//drivers/hdf_core/interfaces/inner_api/hdi", - ] - include_dirs += hdi_build_info.include_dirs + include_dirs = hdi_build_info.include_dirs } action("hdi_gen") { @@ -180,6 +171,11 @@ template("hdi") { external_deps = [ "hilog:libhilog" ] } + public_external_deps = [ + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + ] + if (defined(invoker.innerapi_tags)) { innerapi_tags = invoker.innerapi_tags } @@ -252,6 +248,11 @@ template("hdi") { external_deps = [ "hilog:libhilog" ] } + public_external_deps = [ + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + ] + shlib_type = "hdi_stub" install_images = [ chipset_base_dir ] subsystem_name = invoker.subsystem_name @@ -290,6 +291,7 @@ template("hdi") { group("$target_name" + "_idl_headers") { public_configs = [ ":$idl_headers_config" ] deps = [ ":hdi_gen" ] + public_external_deps = [ "hdf_core:libhdf_utils" ] } # only generate code and provide header file path @@ -299,5 +301,6 @@ template("hdi") { public_configs = [ ":$idl_headers_config" ] deps = [ ":hdi_gen" ] public_deps = hdi_build_info.header_deps + public_external_deps = [ "hdf_core:libhdf_utils" ] } } diff --git a/adapter/uhdf2/host/peripheral/BUILD.gn b/adapter/uhdf2/host/peripheral/BUILD.gn new file mode 100644 index 000000000..70e61c104 --- /dev/null +++ b/adapter/uhdf2/host/peripheral/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2021-2023 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. + +import("//build/ohos.gni") + +ohos_prebuilt_etc("hdf_peripheral.cfg") { + source = "hdf_peripheral.cfg" + relative_install_dir = "init" + install_images = [ chipset_base_dir ] + subsystem_name = "hdf" + part_name = "hdf_core" +} diff --git a/adapter/uhdf2/host/peripheral/hdf_peripheral.cfg b/adapter/uhdf2/host/peripheral/hdf_peripheral.cfg new file mode 100644 index 000000000..a49c066d2 --- /dev/null +++ b/adapter/uhdf2/host/peripheral/hdf_peripheral.cfg @@ -0,0 +1,74 @@ +{ + "jobs" : [{ + "name" : "pre-init", + "cmds" : [ + "chown input_user_host input_user_host /dev/hdf_input_host", + "chown input_user_host input_user_host /dev/hdf_input_event1", + "chown input_user_host input_user_host /dev/hdf_input_event2", + "chown input_user_host input_user_host /dev/hdf_input_event3", + "chown input_user_host input_user_host /dev/hdf_input_event4", + "chown input_user_host input_user_host /dev/hdf_input_event5", + "chown input_user_host input_user_host /dev/hdf_input_event6", + "chown hdf_devmgr uhdf_driver /dev/dev_mgr", + "chown hdf_devmgr uhdf_driver /dev/hdf_kevent", + "chown audio_host audio_host /dev/hdf_audio_render", + "chown audio_host audio_host /dev/hdf_audio_capture", + "chown audio_host audio_host /dev/hdf_audio_control", + "chown sensor_host sensor_host /dev/hdf_sensor_manager_ap", + "chown sensor_host sensor_host /dev/sensorhub", + "chown sensor_host sensor_host /sys/class/sensors/libsensor_ver", + "chown sensor_host sensor_host /dev/ar", + "chown sensor_host sensor_host /dev/motionhub", + "chown vibrator_host vibrator_host /dev/hdf_misc_vibrator", + "chown vibrator_host vibrator_host /dev/haptics", + "chown light_host light_host /dev/hdf_light", + "chown light_host light_host /sys/class/leds/blue/brightness", + "chown light_host light_host /sys/class/leds/blue/delay_on", + "chown light_host light_host /sys/class/leds/blue/delay_off", + "chown light_host light_host /sys/class/leds/red/brightness", + "chown light_host light_host /sys/class/leds/red/delay_on", + "chown light_host light_host /sys/class/leds/red/delay_off", + "chown light_host light_host /sys/class/leds/green/brightness", + "chown light_host light_host /sys/class/leds/green/delay_on", + "chown light_host light_host /sys/class/leds/green/delay_off", + "chown vendor_mpp_driver vendor_mpp_driver /dev/mpp_service", + "chown system vendor_mpp_driver /dev/rga", + "chown camera_host camera_host /dev/video0", + "chown camera_host camera_host /dev/video1", + "chown camera_host camera_host /dev/video2", + "chown camera_host camera_host /dev/video3", + "chown camera_host camera_host /dev/video4", + "chown camera_host camera_host /dev/video5", + "chown camera_host camera_host /dev/video6", + "chown camera_host camera_host /dev/video7", + "chown camera_host camera_host /dev/video8", + "chown wifi wifi_group /dev/hdfwifi" + ] + }, { + "name" : "post-fs-data", + "cmds" : [ + "chown system system /dev/hdf_disp", + "chown system system /dev/hdf_dsoftbus", + "chown composer_host composer_host /sys/class/backlight/backlight/brightness", + "mkdir /data/service/el0/battery 0751 power_host power_host", + "mkdir /data/service/el0/display 0711 power_host power_host", + "mkdir /data/service/el0/thermal 0755 thermal thermal", + "mkdir /data/service/el0/thermal/sensor 0755 power_host power_host", + "mkdir /data/service/el0/thermal/cooling 0755 power_host power_host", + "mkdir /data/service/el1/public/pinauth/ 0700 pin_auth_host pin_auth_host", + "mkdir /data/service/el1/public/userauth/ 0700 user_auth_host user_auth_host", + "chown power_host system /sys/power/wake_lock", + "chown power_host system /sys/power/wake_unlock", + "mkdir /data/service/el1/public/usb 0770 usb_host usb_host", + "write /data/service/el1/public/usb/mode device" + ] + }, { + "name" : "param:vendor.hifi.watchdog.come=true", + "condition" : "vendor.hifi.watchdog.come=true", + "cmds" : [ + "reset audio_host", + "setparam vendor.hifi.watchdog.come false" + ] + } + ] +} -- Gitee From 4af783ffe73b46d67fe3fb88106013bcbfc1d834 Mon Sep 17 00:00:00 2001 From: j30052480 Date: Sat, 1 Jun 2024 10:07:26 +0800 Subject: [PATCH 2/5] feat: hdf_core independent compile Signed-off-by: j30052480 --- adapter/BUILD.gn | 2 +- adapter/uhdf2/host/peripheral/BUILD.gn | 2 +- bundle.json | 3 ++- .../ipc/include => interfaces/inner_api/ipc}/iproxy_broker.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) rename {adapter/uhdf2/ipc/include => interfaces/inner_api/ipc}/iproxy_broker.h (97%) diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn index dfaa78d04..56677c9dc 100644 --- a/adapter/BUILD.gn +++ b/adapter/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 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 diff --git a/adapter/uhdf2/host/peripheral/BUILD.gn b/adapter/uhdf2/host/peripheral/BUILD.gn index 70e61c104..69cdd389b 100644 --- a/adapter/uhdf2/host/peripheral/BUILD.gn +++ b/adapter/uhdf2/host/peripheral/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 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 diff --git a/bundle.json b/bundle.json index 8c9c7494f..23e5c54e3 100644 --- a/bundle.json +++ b/bundle.json @@ -58,6 +58,7 @@ "ipc/hdf_dump_reg.h", "ipc/hdf_remote_service.h", "ipc/hdf_sbuf_ipc.h", + "ipc/iproxy_broker.h", "core/hdf_object.h" ], "header_base": "//drivers/hdf_core/interfaces/inner_api" @@ -156,4 +157,4 @@ ] } } -} \ No newline at end of file +} diff --git a/adapter/uhdf2/ipc/include/iproxy_broker.h b/interfaces/inner_api/ipc/iproxy_broker.h similarity index 97% rename from adapter/uhdf2/ipc/include/iproxy_broker.h rename to interfaces/inner_api/ipc/iproxy_broker.h index 182d32dc7..70d755276 100644 --- a/adapter/uhdf2/ipc/include/iproxy_broker.h +++ b/interfaces/inner_api/ipc/iproxy_broker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From e3f2af9e1f59adc773eb85eea7ddbd9b5a307b5a Mon Sep 17 00:00:00 2001 From: j30052480 Date: Sat, 1 Jun 2024 11:42:57 +0800 Subject: [PATCH 3/5] feat: hdf_core independent compile Signed-off-by: j30052480 --- adapter/uhdf2/hdi.gni | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/adapter/uhdf2/hdi.gni b/adapter/uhdf2/hdi.gni index 67ca08ae1..ab1906ce3 100644 --- a/adapter/uhdf2/hdi.gni +++ b/adapter/uhdf2/hdi.gni @@ -155,6 +155,7 @@ template("hdi") { external_deps = [ "c_utils:utils", + "hdf_core:libhdf_ipc_adapter", "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", @@ -230,6 +231,7 @@ template("hdi") { external_deps = [ "c_utils:utils", + "hdf_core:libhdf_ipc_adapter", "hdf_core:libhdi", "hilog:libhilog", ] @@ -291,7 +293,10 @@ template("hdi") { group("$target_name" + "_idl_headers") { public_configs = [ ":$idl_headers_config" ] deps = [ ":hdi_gen" ] - public_external_deps = [ "hdf_core:libhdf_utils" ] + public_external_deps = [ + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + ] } # only generate code and provide header file path @@ -301,6 +306,9 @@ template("hdi") { public_configs = [ ":$idl_headers_config" ] deps = [ ":hdi_gen" ] public_deps = hdi_build_info.header_deps - public_external_deps = [ "hdf_core:libhdf_utils" ] + public_external_deps = [ + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + ] } } -- Gitee From 6e824e5043ad4053f2aa813ddbb94d0c660c65d6 Mon Sep 17 00:00:00 2001 From: j30052480 Date: Sat, 1 Jun 2024 15:23:35 +0800 Subject: [PATCH 4/5] feat: hdf_core independent compile Signed-off-by: j30052480 --- adapter/uhdf2/ipc/include/iproxy_broker.h | 70 +++++++++++++++++++++++ interfaces/inner_api/ipc/iproxy_broker.h | 2 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 adapter/uhdf2/ipc/include/iproxy_broker.h diff --git a/adapter/uhdf2/ipc/include/iproxy_broker.h b/adapter/uhdf2/ipc/include/iproxy_broker.h new file mode 100644 index 000000000..501a6c73c --- /dev/null +++ b/adapter/uhdf2/ipc/include/iproxy_broker.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 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. + */ + +#ifndef HDI_PROXY_BROKER_H +#define HDI_PROXY_BROKER_H + +#include +#include +#include + +namespace OHOS { +namespace HDI { +template +class IProxyBroker : public OHOS::PeerHolder, public OHOS::IRemoteBroker, public INTERFACE { +public: + explicit IProxyBroker(const sptr &object); + virtual ~IProxyBroker() = default; + virtual sptr AsInterface(); + sptr AsObject() override; +}; + +template +IProxyBroker::IProxyBroker(const sptr &object) : PeerHolder(object) +{ +} + +template +sptr IProxyBroker::AsInterface() +{ + return this; +} + +template +sptr IProxyBroker::AsObject() +{ + return Remote(); +} + +template +inline sptr hdi_facecast(const sptr &object) +{ + const std::u16string descriptor = INTERFACE::GetDescriptor(); + BrokerRegistration ®istration = BrokerRegistration::Get(); + sptr broker = registration.NewInstance(descriptor, object); + INTERFACE *proxyBroker = static_cast *>(broker.GetRefPtr()); + return static_cast(proxyBroker); +} + +template +inline sptr hdi_objcast(const sptr &iface) +{ + IProxyBroker *brokerObject = static_cast *>(iface.GetRefPtr()); + return brokerObject->AsObject(); +} +} // namespace HDI +} // namespace OHOS + +#endif // HDI_PROXY_BROKER_H diff --git a/interfaces/inner_api/ipc/iproxy_broker.h b/interfaces/inner_api/ipc/iproxy_broker.h index 70d755276..29dfa45d0 100644 --- a/interfaces/inner_api/ipc/iproxy_broker.h +++ b/interfaces/inner_api/ipc/iproxy_broker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 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 -- Gitee From 2e1941bbb08af1963c15827ea0f2451c2726cd76 Mon Sep 17 00:00:00 2001 From: j30052480 Date: Sat, 1 Jun 2024 15:24:59 +0800 Subject: [PATCH 5/5] feat: hdf_core independent compile Signed-off-by: j30052480 --- adapter/uhdf2/ipc/include/iproxy_broker.h | 2 +- interfaces/inner_api/ipc/iproxy_broker.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adapter/uhdf2/ipc/include/iproxy_broker.h b/adapter/uhdf2/ipc/include/iproxy_broker.h index 501a6c73c..182d32dc7 100644 --- a/adapter/uhdf2/ipc/include/iproxy_broker.h +++ b/adapter/uhdf2/ipc/include/iproxy_broker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2022 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 diff --git a/interfaces/inner_api/ipc/iproxy_broker.h b/interfaces/inner_api/ipc/iproxy_broker.h index 29dfa45d0..d723669a6 100644 --- a/interfaces/inner_api/ipc/iproxy_broker.h +++ b/interfaces/inner_api/ipc/iproxy_broker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 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 -- Gitee