From e8c5844cd3315f3598d0b83cd93443b50eaf709b Mon Sep 17 00:00:00 2001 From: zhangjiufeng Date: Tue, 20 Sep 2022 16:42:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=9C=AC=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=AD=E5=AF=B9=E7=B3=BB=E7=BB=9F=E6=BA=90=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjiufeng --- dev/team_x/GreyWolf_Latch/device_info.hcs | 135 +++++++++++++++++ .../door_access/fs/data/data/test.txt | 1 + docs/GreyWolf_Latch/README.md | 138 +++++++++++++++++- 3 files changed, 266 insertions(+), 8 deletions(-) create mode 100755 dev/team_x/GreyWolf_Latch/device_info.hcs create mode 100755 dev/team_x/GreyWolf_Latch/door_access/fs/data/data/test.txt diff --git a/dev/team_x/GreyWolf_Latch/device_info.hcs b/dev/team_x/GreyWolf_Latch/device_info.hcs new file mode 100755 index 0000000..390e46f --- /dev/null +++ b/dev/team_x/GreyWolf_Latch/device_info.hcs @@ -0,0 +1,135 @@ +root { + module = "bestechnic,bes2600w"; + device_info { + match_attr = "hdf_manager"; + template host { + hostName = ""; + priority = 100; + template device { + template deviceNode { + policy = 0; + priority = 100; + preload = 0; + permission = 0664; + moduleName = ""; + serviceName = ""; + deviceMatchAttr = ""; + } + } + } + platform :: host { + hostName = "platform_host"; + priority = 50; + device_gpio :: device { + gpio0 :: deviceNode { + policy = 0; + priority = 100; + moduleName = "BES_GPIO_MODULE_HDF"; + serviceName = "HDF_PLATFORM_GPIO"; + deviceMatchAttr = "gpio_config"; + } + } + device_pwm :: device { + pwm0 :: deviceNode { + policy = 2; + priority = 100; + moduleName = "BES_PWM_MODULE_HDF"; + serviceName = "HDF_PLATFORM_PWM_0"; + deviceMatchAttr = "pwm0_config"; + } + } + device_i2c :: device { + i2c_manager :: deviceNode { + policy = 2; + priority = 50; + moduleName = "HDF_PLATFORM_I2C_MANAGER"; + serviceName = "HDF_PLATFORM_I2C_MANAGER"; + } + i2c0 :: deviceNode { + policy = 0; + priority = 100; + moduleName = "BES_I2C_MODULE_HDF"; + serviceName = ""; + deviceMatchAttr = "i2c0_config"; + } + i2c1 :: deviceNode { + policy = 0; + priority = 100; + moduleName = "BES_I2C_MODULE_HDF"; + serviceName = ""; + deviceMatchAttr = "i2c1_config"; + } + } + device_mipi_dsi :: device { + mipi_dsi0 :: deviceNode { + policy = 2; + priority = 100; + moduleName = "HDF_PLATFORM_MIPI_DSI"; + serviceName = "HDF_PLATFORM_MIPI_DSI"; + } + } + } + display :: host { + hostName = "display_host"; + priority = 100; + device_panel :: device { + /*panel_rm69330 :: deviceNode { + policy = 0; + priority = 100; + moduleName = "HDF_PANEL_RM69330"; + deviceMatchAttr = "rm69330_config"; + } + panel_icna3311 :: deviceNode { + policy = 0; + priority = 100; + moduleName = "HDF_PANEL_ICNA3311"; + deviceMatchAttr = "icna3311_config"; + }*/ + panel_a064 :: deviceNode { + policy = 0; + priority = 100; + moduleName = "HDF_PANEL_A064"; + deviceMatchAttr = "a064_config"; + } + } + } + input :: host { + hostName = "input_host"; + priority = 100; + device_touch :: device { + /*touch_ztw523 :: deviceNode { + policy = 0; + priority = 100; + moduleName = "HDF_TOUCH_ZTW523"; + deviceMatchAttr = "touch_ztw523_config"; + }*/ + touch_fts :: deviceNode { + policy = 0; + priority = 100; + moduleName = "HDF_TOUCH_FTS"; + deviceMatchAttr = "touch_fts_config"; + } + } + } + misc :: host { + hostName = "misc_host"; + priority = 50; + fs :: device { + littlefs :: deviceNode { + policy = 0; + priority = 100; + moduleName = "HDF_FS_LITTLEFS"; + deviceMatchAttr = "littlefs_config"; + } + } + storage :: device { + flash :: deviceNode { + policy = 0; + priority = 50; // load before fs + moduleName = "HDF_STORAGE_FLASH"; + deviceMatchAttr = "flash_config"; + } + } + } + } +} diff --git a/dev/team_x/GreyWolf_Latch/door_access/fs/data/data/test.txt b/dev/team_x/GreyWolf_Latch/door_access/fs/data/data/test.txt new file mode 100755 index 0000000..244f012 --- /dev/null +++ b/dev/team_x/GreyWolf_Latch/door_access/fs/data/data/test.txt @@ -0,0 +1 @@ +/data/test.txt \ No newline at end of file diff --git a/docs/GreyWolf_Latch/README.md b/docs/GreyWolf_Latch/README.md index fde040c..b0e235f 100644 --- a/docs/GreyWolf_Latch/README.md +++ b/docs/GreyWolf_Latch/README.md @@ -32,7 +32,7 @@ 欧智通BES2600开发板: -- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/docs/bes2600_quick_start#bes2600%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3); +- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world); #### 2.项目下载和导入 @@ -47,15 +47,137 @@ git clone https://gitee.com/openharmony-sig/knowledge_demo_smart_home.git 2)项目导入 -``` -sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/door_access ~/OpenHarmony_3.1_Beta/vendor/team_x -sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/common ~/OpenHarmony_3.1_Release/vendor/team_x -sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/v200zr-evb-t1.hcs ~/OpenHarmony_3.1_Release/device/board/fnlink/shields/v200zr-evb-t1/v200zr-evb-t1.hcs -``` +- 产品代码导入 + + ``` + sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/door_access ~/OpenHarmony_3.1_Beta/vendor/team_x + sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/common ~/OpenHarmony_3.1_Release/vendor/team_x + sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/v200zr-evb-t1.hcs ~/OpenHarmony_3.1_Release/device/board/fnlink/shields/v200zr-evb-t1/ + sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/device_info.hcs ~/OpenHarmony_3.1_Release/device/soc/bestechnic/bes2600/liteos_m/components/hdf_config/ + ``` + +- 系统源码补充和修改 + + - kernel/liteos_m 修改 + + - 下载patch文件 [bes_kernle.patch](https://gitee.com/kenio_zhang/kernel_liteos_m/commit/d6e85103f49a12f13463dfd5b2bfd8274728d90a.diff) + + 1.点击上述链接进入浏览器,将该网页中内容全部复制。 + + 2.本地创建一个名为bes_kernle.patch文件,并将已经复制的内容粘贴到该文件中。 + + - 将patch文件打入源码 + + 1.将bes_kernle.patch文件复制到~/OpenHarmony_3.1_Beta/kernel/liteos_m目录下。 + + 2.执行如下命令将patch文件打入系统源码。 + + ``` + cd ~/OpenHarmony_3.1_Beta/kernel/liteos_m + patch -p1 < bes_kernle.patch + ``` + + - device/soc/bestechnic 修改 + + - 下载patch文件 [bes_device.patch](https://gitee.com/kenio_zhang/device_soc_bestechnic/commit/55fbd420d5612773c47948d715ccddbff98379be.diff)。 + + 1.点击上述链接进入浏览器,将该网页中内容全部复制。 + + 2.本地创建一个名为bes_device.patch文件,并将已经复制的内容粘贴到该文件中。 + + - 将patch文件打入源码 + + 1.将bes_kernle.patch文件复制到~/OpenHarmony_3.1_Beta/device/soc/bestechnic目录下。 + + 2.执行如下命令将patch文件打入系统源码。 + + ``` + cd ~/OpenHarmony_3.1_Beta/device/soc/bestechnic + patch -p1 < bes_device.patch + ``` + + - pwm_bes.c 修改 + + - 参考如下diff文件修改drivers/adapter/platform/pwm/pwm_bes.c文件 + + ``` + diff --git a/platform/pwm/pwm_bes.c b/platform/pwm/pwm_bes.c + index 31348f8..3656373 100644 + --- a/platform/pwm/pwm_bes.c + +++ b/platform/pwm/pwm_bes.c + @@ -82,8 +82,29 @@ static int InitPwmDevice(struct PwmDev *host) + } + + #ifdef LOSCFG_DRIVERS_HDF_CONFIG_MACRO + +#define PLATFORM_PWM_CONFIG HCS_NODE(HCS_NODE(HCS_ROOT, platform), pwm0_config) + static uint32_t GetPwmDeviceResource(struct PwmDevice *device) + { + + uint32_t tempPin = 0; + + struct DeviceResourceIface *dri = NULL; + + struct PwmResource *resource = NULL; + + if (device == NULL) { + + HDF_LOGE("device is NULL\r\n"); + + return HDF_ERR_INVALID_PARAM; + + } + + + + resource = &device->resource; + + if (resource == NULL) { + + HDF_LOGE("resource is NULL\r\n"); + + return HDF_ERR_INVALID_OBJECT; + + } + + tempPin = HCS_PROP(PLATFORM_PWM_CONFIG, pwmPin); + + resource->pwmPin = ((tempPin / DEC_TEN) * PIN_GROUP_NUM) + (tempPin % DEC_TEN); + + HDF_LOGI("pwmPin %d.\r\n", resource->pwmPin); + + resource->pwmId = HCS_PROP(PLATFORM_PWM_CONFIG, pwmId); + + HDF_LOGI("pwmId %d.\r\n", resource->pwmId); + + + + return HDF_SUCCESS; + } + #else + static uint32_t GetPwmDeviceResource( + ``` + + - 参考下方代码修改drivers\adapter\khdf\liteos_m\platform\BUILD.gn文件,将pwm_if.c纳入编译。 + + ``` + diff --git a/khdf/liteos_m/platform/BUILD.gn b/khdf/liteos_m/platform/BUILD.gn + index 84c9152..8a4016a 100755 + --- a/khdf/liteos_m/platform/BUILD.gn + +++ b/khdf/liteos_m/platform/BUILD.gn + @@ -63,7 +63,10 @@ hdf_driver("hdf_platform_lite") { + } + + if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PWM)) { + - sources += [ "$HDF_FRAMEWORKS_PATH/support/platform/src/pwm/pwm_core.c" ] + + sources += [ + + "$HDF_FRAMEWORKS_PATH/support/platform/src/pwm/pwm_core.c", + + "$HDF_FRAMEWORKS_PATH/support/platform/src/pwm/pwm_if.c", + + ] + } + + if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_RTC)) { + ``` + + - flash_size配置修改 + + 根据开发板的硬件版本不同,还需更改配置文件中flash_size的值。具体路径为/device/board/fnlink/v200zr/liteos_m/config.gni。其中v1.0版本对应16,2.0版本对应32。硬件版本打印在了开发板正面。 + + ``` + diff --git a/v200zr/liteos_m/config.gni b/v200zr/liteos_m/config.gni + index b288101..6489dd2 100644 + --- a/v200zr/liteos_m/config.gni + +++ b/v200zr/liteos_m/config.gni + @@ -47,7 +47,7 @@ if (product_path != "") { + bsp_bin_list = product_conf.bsp_bin_list + pack_burn = product_conf.pack_burn + } + -flash_size = 16 + +flash_size = 32 + ``` #### 3.编译和烧录 -参考[BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/docs/bes2600_quick_start#bes2600%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3)完成项目的编译和烧录。 +参考[BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world)完成项目的编译和烧录。 ## 三、关键代码解读 @@ -112,4 +234,4 @@ sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_Latch/v200zr-evb-t1.hcs ## 五、参考链接 -- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/docs/bes2600_quick_start#bes2600%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3) \ No newline at end of file +- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world) \ No newline at end of file -- Gitee From 71ab187e77bbd781bfc46ee69c0096a6b1d4b913 Mon Sep 17 00:00:00 2001 From: zhangjiufeng Date: Tue, 20 Sep 2022 17:05:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=9C=AC=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=AD=E5=AF=B9=E7=B3=BB=E7=BB=9F=E6=BA=90=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjiufeng --- .../car_detect/fs/data/data/test.txt | 1 + docs/GreyWolf_CarApproachDetect/README.md | 76 +++++++++++++++++-- docs/GreyWolf_Latch/README.md | 4 +- 3 files changed, 71 insertions(+), 10 deletions(-) create mode 100755 dev/team_x/GreyWolf_CarApproachDetect/car_detect/fs/data/data/test.txt diff --git a/dev/team_x/GreyWolf_CarApproachDetect/car_detect/fs/data/data/test.txt b/dev/team_x/GreyWolf_CarApproachDetect/car_detect/fs/data/data/test.txt new file mode 100755 index 0000000..244f012 --- /dev/null +++ b/dev/team_x/GreyWolf_CarApproachDetect/car_detect/fs/data/data/test.txt @@ -0,0 +1 @@ +/data/test.txt \ No newline at end of file diff --git a/docs/GreyWolf_CarApproachDetect/README.md b/docs/GreyWolf_CarApproachDetect/README.md index ef0f4ba..23f748e 100644 --- a/docs/GreyWolf_CarApproachDetect/README.md +++ b/docs/GreyWolf_CarApproachDetect/README.md @@ -32,7 +32,7 @@ 欧智通BES2600开发板: -- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/docs/bes2600_quick_start#bes2600%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3); +- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world) #### 2.项目下载和导入 @@ -47,15 +47,75 @@ git clone https://gitee.com/openharmony-sig/knowledge_demo_smart_home.git 2)项目导入 -``` -sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_CarApproachDetect/car_detect ~/OpenHarmony_3.1_Release/vendor/team_x -sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_CarApproachDetect/common ~/OpenHarmony_3.1_Release/vendor/team_x -sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_CarApproachDetect/v200zr-evb-t1.hcs ~/OpenHarmony_3.1_Release/device/board/fnlink/shields/v200zr-evb-t1/v200zr-evb-t1.hcs -``` +- 产品代码导入 + + ``` + sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_CarApproachDetect/car_detect ~/OpenHarmony_3.1_Release/vendor/team_x + sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_CarApproachDetect/common ~/OpenHarmony_3.1_Release/vendor/team_x + sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_CarApproachDetect/v200zr-evb-t1.hcs ~/OpenHarmony_3.1_Release/device/board/fnlink/shields/v200zr-evb-t1/v200zr-evb-t1.hcs + ``` + +- 系统源码补充和修改 + + - kernel/liteos_m 修改 + + - 下载patch文件 [bes_kernle.patch](https://gitee.com/kenio_zhang/kernel_liteos_m/commit/d6e85103f49a12f13463dfd5b2bfd8274728d90a.diff) + + 1.点击上述链接进入浏览器,将该网页中内容全部复制。 + + 2.本地创建一个名为bes_kernle.patch文件,并将已经复制的内容粘贴到该文件中。 + + - 将patch文件打入源码 + + 1.将bes_kernle.patch文件复制到~/OpenHarmony_3.1_Beta/kernel/liteos_m目录下。 + + 2.执行如下命令将patch文件打入系统源码。 + + ``` + cd ~/OpenHarmony_3.1_Beta/kernel/liteos_m + patch -p1 < bes_kernle.patch + ``` + + + - device/soc/bestechnic 修改 + + - 下载patch文件 [bes_device.patch](https://gitee.com/kenio_zhang/device_soc_bestechnic/commit/55fbd420d5612773c47948d715ccddbff98379be.diff)。 + + 1.点击上述链接进入浏览器,将该网页中内容全部复制。 + + 2.本地创建一个名为bes_device.patch文件,并将已经复制的内容粘贴到该文件中。 + + - 将patch文件打入源码 + + 1.将bes_kernle.patch文件复制到~/OpenHarmony_3.1_Beta/device/soc/bestechnic目录下。 + + 2.执行如下命令将patch文件打入系统源码。 + + ``` + cd ~/OpenHarmony_3.1_Beta/device/soc/bestechnic + patch -p1 < bes_device.patch + ``` + + - flash_size配置修改 + + 根据开发板的硬件版本不同,还需更改配置文件中flash_size的值。具体路径为/device/board/fnlink/v200zr/liteos_m/config.gni。其中v1.0版本对应16,2.0版本对应32。硬件版本打印在了开发板正面。 + + ``` + diff --git a/v200zr/liteos_m/config.gni b/v200zr/liteos_m/config.gni + index b288101..6489dd2 100644 + --- a/v200zr/liteos_m/config.gni + +++ b/v200zr/liteos_m/config.gni + @@ -47,7 +47,7 @@ if (product_path != "") { + bsp_bin_list = product_conf.bsp_bin_list + pack_burn = product_conf.pack_burn + } + -flash_size = 16 + +flash_size = 32 + ``` #### 3.编译和烧录 -参考[BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/docs/bes2600_quick_start#bes2600%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3)完成项目的编译和烧录。 +参考[BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world)完成项目的编译和烧录。 ## 三、关键代码解读 @@ -108,4 +168,4 @@ sudo cp -rfa ~/knowledge_demo_travel/dev/team_x/GreyWolf_CarApproachDetect/v200z ## 五、参考链接 -- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/docs/bes2600_quick_start#bes2600%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3) \ No newline at end of file +- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world) \ No newline at end of file diff --git a/docs/GreyWolf_Latch/README.md b/docs/GreyWolf_Latch/README.md index b0e235f..ea88bec 100644 --- a/docs/GreyWolf_Latch/README.md +++ b/docs/GreyWolf_Latch/README.md @@ -32,7 +32,7 @@ 欧智通BES2600开发板: -- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world); +- [BES2600快速上手指导文档](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/bes2600_hello_world) #### 2.项目下载和导入 @@ -66,7 +66,7 @@ git clone https://gitee.com/openharmony-sig/knowledge_demo_smart_home.git 2.本地创建一个名为bes_kernle.patch文件,并将已经复制的内容粘贴到该文件中。 - - 将patch文件打入源码 + - 将patch文件打入源码 1.将bes_kernle.patch文件复制到~/OpenHarmony_3.1_Beta/kernel/liteos_m目录下。 -- Gitee