add stm32mp157 development board

Signed-off-by: Laowang-BearPi <wangcheng@holdiot.com>
This commit is contained in:
Laowang-BearPi
2022-04-01 14:57:42 +08:00
parent fb66ded5ce
commit ecc00dcd08
43 changed files with 2910 additions and 73 deletions
-37
View File
@@ -1,37 +0,0 @@
# vendor/bearpi<a name="EN-US_TOPIC_0000001130275863"></a>
- [Introduction](#section469617221261)
- [Constraints](#section12212842173518)
- [Repositories Involved](#section641143415335)
## Introduction<a name="section469617221261"></a>
### BearPi Introduction
"BearPi" is an open source hardware platform, which is committed to the technology open source and promotion of new technology fields such as IOT, 5g, AI and OS; Its "BearPi open source community" focuses on providing free technical open source materials and tutorials for developers, serving millions of developers and hundreds of thousands of little bear fans.
### Development board overview
BearPi[BearPi-HM Nano](https://item.taobao.com/item.htm?id=633296694816)is a development board specially built by BearPi school for openharmony system. It carries a highly integrated 2.4GHz WLAN SOC chip hi3861, and carries NFC circuit and standard E53 interface. The standard E53 interface can expand cases such as intelligent humidifier, intelligent desk lamp, intelligent security, intelligent smoke detector, etc
### Development board function
BearPi-HM Nano development board, for developers, is used for openharmony development and learning. At the same time, it provides rich cases and tutorials to realize full scene application design
1. E53 interface: it is a standard interface with rich resources and easy to expand. It realizes multi application case expansion, making case development more flexible and convenient
2. NFC: the on-board NFC RF circuit, combined with the key capabilities of openharmony, can perfectly realize the "touch and touch" networking mechanism and service pull-up function of openharmony system, reduce the complexity of user operation, and improve the user experience
3. User keys: open function keys. The key functions are fully defined by the developer, which increases user operability
## Constraints<a name="section12212842173518"></a>
Currently, BearPi-HM Nano \(Hi3861 V100\) are supported.
## Repositories Involved<a name="section641143415335"></a>
device/bearpi/bearpi_hm_nano
**vendor/bearpi**
-36
View File
@@ -1,36 +0,0 @@
# vendor/bearpi 组件<a name="ZH-CN_TOPIC_0000001130275863"></a>
- [简介](#section469617221261)
- [约束](#section12212842173518)
- [对应仓库](#section641143415335)
## 简介<a name="section469617221261"></a>
### 小熊派简介
“小熊派”是一个开源硬件平台,致力于IoT、5G、AI、OS等新技术领域的技术开源及推广;旗下“小熊派开源社区”专注于为开发者免费提供技术开源资料及教程,服务数百万开发者,拥有数十万小熊派粉丝。
### 开发板概述
小熊派[BearPi-HM Nano](https://item.taobao.com/item.htm?id=633296694816)是一款由小熊派专为OpenHarmony系统打造的开发板,板载高度集成的2.4GHz WLAN SoC芯片Hi3861,并板载NFC电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例
### 开发指导
参考[开发指导](https://gitee.com/laowang-bearpi/device_bearpi_bearpi_hm_nano/tree/master/docs)
### 开发板功能
BearPi-HM Nano开发板,面向开发者,用于OpenHarmony开发学习,同时提供丰富案例和教程,实现全场景应用设计
1. E53 Interface:是一种资源丰富,易于扩展的标准接口,实现多应用案例扩展,使得案例开发变得更加灵活和方便
2. NFC:板载的NFC射频电路,配合OpenHarmony开放的关键能力,可以完美实现OpenHarmony系统的“碰一碰”联网机制和服务拉起功能,降低用户操作复杂度,从而提高用户体验
3. 用户按键:开放式功能按键,按键功能全权由开发者定义,增加了用户可操作性
## 约束<a name="section12212842173518"></a>
支持BearPi-HM Nano开发板(Hi3861V100)。
## 对应仓库<a name="section641143415335"></a>
device/bearpi/bearpi_hm_nano
**vendor/bearpi**
+38
View File
@@ -0,0 +1,38 @@
# vendor_bearpi
- [简介](#section469617221261)
- [目录](#section161941989596)
- [约束](#section12212842173518)
- [对应仓库](#section641143415335)
## 简介<a name="section469617221261"></a>
### 小熊派简介
“小熊派”是一个开源硬件平台,致力于IoT、5G、AI、OS等新技术领域的技术开源及推广;旗下“小熊派开源社区”专注于为开发者免费提供技术开源资料及教程。目前,小熊派已有两款开发板适配OpenHarmony,分别是基于海思Hi3861的轻量系统BearPi-HM Nano开发板和基于意法半导体STM32MP157的小型系统BearPi-HM Micro开发板,
### 开发板概述
小熊派[BearPi-HM Nano](https://item.taobao.com/item.htm?id=633296694816)开发板是一款由小熊派专为OpenHarmony系统打造的开发板,板载高度集成的2.4GHz WLAN SoC芯片Hi3861,并板载NFC电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。
小熊派[BearPi-HM Micro](https://item.taobao.com/item.htm?id=633296694816)开发板是一款高度集成并可运行OpenHarmony系统的开发板,板载高性能的工业级处理器STM32MP157芯片,搭配4.3寸LCD电容式触摸屏,并板载无线模块电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。可折叠式屏幕设计提高用户开发体验,便于携带和存放,更好地满足不同用户的需求,拓展无限可能。
## 目录<a name="section161941989596"></a>
```
/vendor/bearpi
├── bearpi_hm_micro # 小熊派小型系统STM32MP157开发板
├── bearpi_hm_nano # 小熊派轻量系统Hi3861开发板
```
## 约束<a name="section12212842173518"></a>
* 支持BearPi-HM Nano开发板(Hi3861V100)。
* 支持BearPi-HM Micro开发板(STM32MP157)。
## 相关仓<a name="section641143415335"></a>
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[device_soc_st](https://gitee.com/openharmony/device_soc_st)
**[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)**
+31
View File
@@ -0,0 +1,31 @@
# Copyright (c) 2021 Nanjing Xiaoxiongpai Intelligent Technology 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/lite/config/component/lite_component.gni")
group("bearpi_hm_micro") {
deps = [
":build_stm32_image",
"init_configs:init_configs",
"init_configs:init_configs_mksh",
]
}
build_ext_component("build_stm32_image") {
deps = [ "//kernel/liteos_a:copy_liteos" ]
exec_path = rebase_path(root_out_dir)
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
command = "$objcopy -O binary OHOS_Image OHOS_Image.bin"
command += " && sh -c '$objdump -t OHOS_Image | sort >OHOS_Image.sym.sorted'"
command += " && sh -c 'mkimage -A arm -T kernel -C none -a 0xC0100000 -e 0xC0100000 -n liteos-a -d OHOS_Image.bin OHOS_Image.stm32' "
}
@@ -0,0 +1,122 @@
/*
* Copyright (c) 2021 Nanjing Xiaoxiongpai Intelligent Technology 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 PRODUCT_ACELITE_CONFIG_H
#define PRODUCT_ACELITE_CONFIG_H
/**
* Compile all test entry for hmf
*/
#define FEATURE_TEST_IMPLEMENTATION 1
/**
* use hi log interface to trace out
*/
#define FEATURE_ACELITE_HI_LOG_PRINTF 1
/**
* append no blank color to rootview for easy using, delete this after the mouse showing is optimized
*/
#define FEATURE_ROOTVIEW_CUSTOM_BACKGROUND_COLOR 1
/**
* js system capabillity switch
*/
#define FEATURE_ACELITE_SYSTEM_CAPABILITY 1
/**
* js profiler switch
*/
#define FEATURE_ACELITE_JS_PROFILER 1
/**
* support audio API for JS
*/
#define FEATURE_MODULE_AUDIO 0
/**
* switch for cipher module
*/
#define ENABLE_MODULE_CIPHER 1
/**
* support storage and file API for JS
*/
#define FEATURE_MODULE_STORAGE 1
/**
* support battery API for JS
*/
#define FEATURE_MODULE_BATTERY 1
/**
* support device API for JS
*/
#define FEATURE_MODULE_DEVICE 1
/**
* timer module
*/
#define FEATURE_TIMER_MODULE 1
/**
* date time module
*/
#define FEATURE_DATE_FORMAT 1
#define FEATURE_API_VERSION 1
/**
* support lite ace dfx module
*/
#define FEATURE_ACELITE_DFX_MODULE 1
#define FEATURE_ACELITE_LITE_DFX_MODULE 1
/**
* enable Canvas component Feature API on ipcamera real devices
*/
#define FEATURE_COMPONENT_CANVAS 1
#define FEATURE_LOCALIZATION_MODULE 1
#define FEATURE_COMPONENT_CAMERA 0
#define FEATURE_COMPONENT_QRCODE 1
#define FEATURE_COMPONENT_VIDEO 0
#define FEATURE_MODULE_DIALOG 1
/**
* support intl module
*/
#define FEATURE_INTL_MODULE 1
/**
* supoort number format module
*/
#define FEATURE_NUMBER_FORMAT 1
#define FEATURE_UPDATE_VIDEO_PROGRESS_ASYNC 1
#define DEFAULT_PROFILER_MSG_PATH "/storage/user/data/"
#define PROFILER_ENABLE_FLAG_FILE "/storage/user/data/profiler_enable"
#define RUNTIME_MODE_FILE_PATH "/storage/user/data/js_snapshot_enable"
#define FEATURE_SUPPORT_HTTP 1
#endif // PRODUCT_ACELITE_CONFIG_H
+150
View File
@@ -0,0 +1,150 @@
{
"product_name": "bearpi_hm_micro",
"version": "3.0",
"type": "small",
"ohos_version": "OpenHarmony 3.0",
"device_company": "bearpi",
"board": "bearpi_hm_micro",
"kernel_type": "liteos_a",
"kernel_version": "",
"subsystems": [
{
"subsystem": "aafwk",
"components": [
{ "component": "aafwk_lite", "features":[ "enable_ohos_appexecfwk_feature_ability = true" ] }
]
},
{
"subsystem": "bearpi_hm_micro_sample",
"components": [
{ "component": "bearpi_hm_micro_sample", "features":[] }
]
},
{
"subsystem": "hiviewdfx",
"components": [
{ "component": "hilog_featured_lite", "features":[] },
{ "component": "hidumper_lite", "features":[] }
]
},
{
"subsystem": "distributed_schedule",
"components": [
{ "component": "samgr_lite", "features":[] },
{ "component": "safwk_lite", "features":[] },
{ "component": "dmsfwk_lite", "features":[] }
]
},
{
"subsystem": "security",
"components": [
{ "component": "permission_lite", "features":[] },
{ "component": "appverify", "features":[] },
{ "component": "deviceauth_standard", "features":[] },
{ "component": "huks", "features":
[
"huks_config_file = \"hks_config_small.h\""
]
}
]
},
{
"subsystem": "graphic",
"components": [
{ "component": "graphic_utils",
"features": [ "enable_ohos_graphic_utils_product_config = true"
]
},
{ "component": "graphic_hals", "features":[] },
{ "component": "ui", "features":[ "enable_graphic_font = true","enable_video_component=false"] },
{ "component": "surface", "features":[] },
{ "component": "wms", "features":[] }
]
},
{
"subsystem": "startup",
"components": [
{ "component": "syspara_lite", "features":[] },
{ "component": "bootstrap_lite", "features":[] },
{ "component": "appspawn_lite", "features":[] },
{ "component": "init_lite", "features":[] }
]
},
{
"subsystem": "kernel",
"components": [
{ "component": "liteos_a", "features":[] }
]
},
{
"subsystem": "communication",
"components": [
{ "component": "ipc_lite", "features":[] },
{ "component": "wpa_supplicant", "features":[] }
]
},
{
"subsystem": "ace",
"components": [
{ "component": "ace_engine_lite",
"features": [
"enable_ohos_ace_engine_lite_product_config = true"
]
}
]
},
{
"subsystem": "hdf",
"components": [
{ "component": "device_driver_framework", "features":[] },
{ "component": "display_device_driver", "features":[] },
{ "component": "input_device_driver", "features":[] },
{ "component": "wlan_device_driver", "features":[] }
]
},
{
"subsystem": "appexecfwk",
"components": [
{ "component": "appexecfwk_lite", "features":[] }
]
},
{
"subsystem": "global",
"components": [
{ "component": "resmgr_lite", "features":[] },
{ "component": "i18n_lite", "features":[] }
]
},
{
"subsystem": "xts",
"components": [
{ "component": "developer_test", "features":[] },
{ "component": "xts_acts", "features":[] },
{ "component": "xts_tools", "features":[] }
]
},
{
"subsystem": "utils",
"components": [
{ "component": "kv_store", "features":[] },
{ "component": "os_dump", "features":[] }
]
},
{
"subsystem": "ai",
"components": [
{ "component": "ai_engine", "features":[] }
]
},
{
"subsystem": "powermgr",
"components": [
{ "component": "powermgr_lite", "features":[ "enable_screensaver = true" ] },
{ "component": "battery_lite", "features":[ "enable_screensaver = true" ] }
]
}
],
"third_party_dir": "//third_party",
"product_adapter_dir": "//vendor/bearpi/bearpi_hm_micro/hals"
}
+208
View File
@@ -0,0 +1,208 @@
-
fs_dir_name: mksh_rootfs
fs_dirs:
-
source_dir: ${root_path}/out/preloader/${product_name}/system
target_dir: system
dir_mode: 555
file_mode: 444
-
source_dir: bin
target_dir: bin
ignore_files:
- Test.bin
- TestSuite.bin
- query.bin
- cve
- checksum
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: libs
target_dir: lib
ignore_files:
- .a
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: usr/lib
target_dir: usr/lib
ignore_files:
- .a
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: usr/bin
target_dir: usr/bin
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: vendor
target_dir: vendor
dir_mode: 555
file_mode: 444
-
source_dir: config
target_dir: etc
ignore_files:
- init.cfg
dir_mode: 555
file_mode: 444
-
source_dir: system
target_dir: system
dir_mode: 555
file_mode: 444
-
source_dir: etc
target_dir: etc
dir_mode: 555
file_mode: 444
-
source_dir: obj/foundation/distributedschedule/samgr_lite/config
target_dir: etc
dir_mode: 555
file_mode: 444
-
target_dir: system/external
-
target_dir: proc
-
target_dir: dev
-
target_dir: storage
-
target_dir: userdata
fs_filemode:
-
file_dir: "etc/init.cfg"
file_mode: 400
-
file_dir: "bin/init"
file_mode: 500
-
file_dir: "bin/mksh"
file_mode: 500
fs_make_cmd:
- chmod 777 ${fs_dir}/etc
- chmod 777 ${fs_dir}/etc/init_mksh.cfg
- mv ${fs_dir}/etc/init_mksh.cfg ${fs_dir}/etc/init.cfg
- chmod 400 ${fs_dir}/etc/init.cfg
- chmod 555 ${fs_dir}/etc
- ${root_path}/build/lite/make_rootfs/rootfsimg_liteos.sh ${fs_dir} vfat
-
fs_dir_name: rootfs
fs_dirs:
-
source_dir: ${root_path}/out/preloader/${product_name}/system
target_dir: system
dir_mode: 555
file_mode: 444
-
source_dir: bin
target_dir: bin
ignore_files:
- Test.bin
- TestSuite.bin
- query.bin
- cve
- checksum
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: libs
target_dir: lib
ignore_files:
- .a
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: usr/lib
target_dir: usr/lib
ignore_files:
- .a
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: usr/bin
target_dir: usr/bin
is_strip: TRUE
dir_mode: 555
file_mode: 555
-
source_dir: vendor
target_dir: vendor
dir_mode: 555
file_mode: 444
-
source_dir: config
target_dir: etc
ignore_files:
- init_mksh.cfg
dir_mode: 555
file_mode: 444
-
source_dir: system
target_dir: system
dir_mode: 555
file_mode: 444
-
source_dir: etc
target_dir: etc
dir_mode: 555
file_mode: 444
-
source_dir: obj/foundation/distributedschedule/samgr_lite/config
target_dir: etc
dir_mode: 555
file_mode: 444
-
target_dir: system/external
-
target_dir: proc
-
target_dir: dev
fs_filemode:
-
file_dir: "etc/init.cfg"
file_mode: 400
-
file_dir: "bin/init"
file_mode: 500
-
file_dir: "bin/shell"
file_mode: 500
fs_make_cmd:
- ${root_path}/build/lite/make_rootfs/rootfsimg_liteos.sh ${fs_dir} vfat 20971520
-
fs_dir_name: userfs
fs_dirs:
-
source_dir: obj/base/security/services/app_verify/config
target_dir: data/verify
-
source_dir: storage/etc
target_dir: etc
-
source_dir: data
target_dir: data
-
target_dir: app
-
target_dir: data/system/param
fs_make_cmd:
- ${root_path}/build/lite/make_rootfs/rootfsimg_liteos.sh ${fs_dir} vfat 104857600
fs_attr:
tee_enable:
fs_dirs:
-
target_dir: data/sec_storage_data
-
target_dir: sec_storage
@@ -0,0 +1,148 @@
/*
* Copyright (c) 2021 Nanjing Xiaoxiongpai Intelligent Technology 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 PRODUCT_GRAPHIC_LITE_CONFIG_H
#define PRODUCT_GRAPHIC_LITE_CONFIG_H
/**
* @brief Vector type font, which is enabled by default on Huawei LiteOS.
*/
#define ENABLE_VECTOR_FONT 1
/**
* @brief Bitmap type font, which is disabled by default on Huawei LiteOS.
*/
#define ENABLE_BITMAP_FONT 0
/**
* @brief Static Bitmap type font, which is disabled by default on Huawei LiteOS.
*/
#define ENABLE_STATIC_FONT 0
#define ENABLE_JPEG_AND_PNG 1
#define ENABLE_GIF 1
#define FULLY_RENDER 1
/**
* @brief Graphics rendering hardware acceleration, which is enabled by default on Huawei LiteOS.
*/
#define ENABLE_HARDWARE_ACCELERATION 0
/**
* @brief Graphics rendering hardware acceleration for text, which is disabled by default on Huawei LiteOS.
*/
#define ENABLE_HARDWARE_ACCELERATION_FOR_TEXT 0
/**
* @brief Graphics rendering accelerated by gfx_engines, which is disabled by default on Huawei LiteOS.
*/
#define ENABLE_GFX_ENGINES 0
/**
* @brief ARM NEON ability, which is disabled by default on Huawei LiteOS.
*/
#define ENABLE_ARM_NEON 0
#define ENABLE_ROTATE_INPUT 1
#define ENABLE_VIBRATOR 0
#define ENABLE_FOCUS_MANAGER 1
/**
* @brief Graphics local rendering, which is disabled by default.
*/
#define LOCAL_RENDER 0
/**
* @brief Actually use ARM NEON optimization.
* __ARM_NEON__ and __ARM_NEON are set by the compiler according to the compilation option -mfpu=neon
*/
#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && ENABLE_ARM_NEON == 1
#define ARM_NEON_OPT
#endif
/**
* @brief Graphics bottom-layer RGBA, which is enabled by default.
*/
#define ENABLE_BUFFER_RGBA 1
/**
* @brief Debug mode, which is disabled by default.
*/
#define ENABLE_DEBUG 1
/**
* @brief Memory hook, which is enabled by default. The system memory allocation is taken over after it is enabled.
*/
#define ENABLE_MEMORY_HOOKS 0
/**
* @brief Function for monitoring the image refresh frame rate, which is disabled by default.
*/
#define ENABLE_FPS_SUPPORT 1
/**
* @brief Anti-aliasing, which is enabled by default.
*/
#define ENABLE_ANTIALIAS 1
/**
* @brief Rectangle anti-aliasing, which is disabled by default.
*/
#define ENABLE_RECT_ANTIALIAS 0
/**
* @brief Font color mode, which is disabled by default.
* After it is enabled, the font color mode is set to <b>4</b> to accelerate font rendering.
*/
#define ENABLE_SPEC_FONT 0
/**
* @brief Log function of a graphics subsystem, which is disabled by default
*/
#define ENABLE_GRAPHIC_LOG 0
/**
* @brief Performance tracking for debugging, which is disabled by default.
*/
#define ENABLE_DEBUG_PERFORMANCE_TRACE 0
/**
* @brief Function for receiving input events in screen-off mode, which is disabled by default.
*/
#define ENABLE_AOD 0
/**
* @brief Defines the log level. A smaller value indicates a higher priority.
* Logs whose priorities are higher than a specified level can be recorded.
* Log levels:
* NONE: disabling logs
* FATAL: fatal level
* ERROR: error level
* WARN: warning level
* INFO: info level
* DEBUG: debugging level
*/
#define GRAPHIC_LOG_LEVEL 5
/**
* @brief Defines the color depth of graphics rendering. The default value is <b>32</b> bits.
* The value can be <b>16</b> or <b>32</b>.
*/
#define COLOR_DEPTH 32
/**
* @brief Represents the code number of the layer pixel format.
* 0: LAYER_PF_ARGB1555
* 1: LAYER_PF_ARGB8888
* Other: LAYER_PF_ARGB8888
*/
#define LAYER_PF_CODE 1
#define HORIZONTAL_RESOLUTION 800
#define VERTICAL_RESOLUTION 480
#define IMG_CACHE_SIZE 8
#endif // PRODUCT_GRAPHIC_LITE_CONFIG_H
@@ -0,0 +1,41 @@
#
# Copyright (c) 2021 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/lite/config/component/lite_component.gni")
shared_library("hal_pms") {
sources = [ "hal_pms.c" ]
cflags = [ "-Wall" ]
include_dirs = [
"//base/security/permission/services/permission_lite/pms/include/hals",
"//base/security/permission/services/permission_lite/pms/include",
"//base/security/permission/interfaces/kits/permission_lite",
"//base/hiviewdfx/interfaces/kits/hilog",
"//base/startup/syspara_lite/interfaces/kits",
"//drivers/framework/include/platform",
"//drivers/framework/include/core",
"//drivers/framework/include/osal",
"//drivers/adapter/uhdf/posix/include",
"//drivers/framework/include/utils",
"//drivers/framework/include/config",
"//drivers/framework/include",
"//third_party/bounds_checking_function/include/",
]
deps = [
"//base/startup/syspara_lite/frameworks/parameter:parameter",
"//drivers/adapter/uhdf/platform:hdf_platform",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/mbedtls:mbedtls_shared",
]
}
@@ -0,0 +1,215 @@
/*
* Copyright (c) 2021 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_pms.h"
#include <limits.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <mbedtls/md.h>
#include "emmc_if.h"
#include "parameter.h"
#include "securec.h"
#define CID_LENGTH 16
#define UDID_ORI_BYTES 32
#define HEX_LEN 2
#define P_DIR "/storage/app/etc/permissions/"
#define PERM_MAX 1024
static pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
static const PermissionDef g_permissions[] = {
// appfwk
{"ohos.permission.LISTEN_BUNDLE_CHANGE", SYSTEM_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.GET_BUNDLE_INFO", SYSTEM_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.INSTALL_BUNDLE", SYSTEM_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
// media
{"ohos.permission.CAMERA", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.MODIFY_AUDIO_SETTINGS", SYSTEM_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.READ_MEDIA", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.MICROPHONE", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.WRITE_MEDIA", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
// soft_bus
{"ohos.permission.DISTRIBUTED_DATASYNC", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
// dvkit
{"ohos.permission.DISTRIBUTED_VIRTUALDEVICE", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
// might expire in the future
{"ohos.permission.RECORD_AUDIO", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.READ_MEDIA_AUDIO", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.READ_MEDIA_IMAGES", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.READ_MEDIA_VIDEO", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.WRITE_MEDIA_AUDIO", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.WRITE_MEDIA_IMAGES", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
{"ohos.permission.WRITE_MEDIA_VIDEO", USER_GRANT, NOT_RESTRICTED, CAP_NOT_BINDED},
};
static unsigned char *GetCId(void)
{
int mallocSize = sizeof(unsigned char) * CID_LENGTH;
unsigned char *cid = (unsigned char *)malloc(mallocSize);
if (cid == NULL) {
return NULL;
}
if (memset_s(cid, mallocSize, 0x0, mallocSize) != EOK) {
free(cid);
return NULL;
}
EmmcGetHuid(cid, CID_LENGTH);
return cid;
}
static int GenerateOriginalDevUdid(unsigned char *ori, int size)
{
if (ori == NULL || size != UDID_ORI_BYTES) {
return PERM_ERRORCODE_INVALID_PARAMS;
}
int result = PERM_ERRORCODE_GENERATE_UDID_FAILED;
const mbedtls_md_info_t *mdInfo = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
if (mdInfo == NULL) {
return result;
}
mbedtls_md_context_t mdCtx;
mbedtls_md_init(&mdCtx);
if (mbedtls_md_setup(&mdCtx, mdInfo, 0) != 0) {
mbedtls_md_free(&mdCtx);
return result;
}
if (mbedtls_md_starts(&mdCtx) != 0) {
mbedtls_md_free(&mdCtx);
return result;
}
// Get sn number
const char *sn = GetSerial();
if (sn == NULL) {
mbedtls_md_free(&mdCtx);
return result;
}
// Get emmc id
unsigned char *cid = GetCId();
if (cid == NULL) {
mbedtls_md_free(&mdCtx);
return result;
}
if (mbedtls_md_update(&mdCtx, sn, strlen(sn)) != 0) {
free(cid);
mbedtls_md_free(&mdCtx);
return result;
}
if (mbedtls_md_update(&mdCtx, cid, CID_LENGTH) != 0) {
free(cid);
mbedtls_md_free(&mdCtx);
return result;
}
if (mbedtls_md_finish(&mdCtx, ori) != 0) {
free(cid);
mbedtls_md_free(&mdCtx);
return result;
}
result = PERM_ERRORCODE_SUCCESS;
free(cid);
mbedtls_md_free(&mdCtx);
return result;
}
PermissionDef* HalGetPermissionList(unsigned int *length)
{
if (length == NULL) {
return NULL;
}
*length = sizeof(g_permissions) / sizeof(PermissionDef);
return (PermissionDef*)g_permissions;
}
const char *HalGetPermissionPath(void)
{
return P_DIR;
}
int HalGetMaxPermissionSize(void)
{
return PERM_MAX;
}
void* HalMalloc(unsigned int size)
{
if (size == 0) {
return NULL;
}
return malloc(size);
}
void HalFree(void *ptr)
{
if (ptr != NULL) {
free(ptr);
}
}
int HalAccess(const char *pathname)
{
return access(pathname, F_OK);
}
void HalMutexLock(void)
{
pthread_mutex_lock(&g_mutex);
}
void HalMutexUnlock(void)
{
pthread_mutex_unlock(&g_mutex);
}
int HalGetDevUdid(unsigned char *udid, int size)
{
unsigned char tempUdid[UDID_ORI_BYTES] = {0};
int result = GenerateOriginalDevUdid(tempUdid, UDID_ORI_BYTES);
if (result != PERM_ERRORCODE_SUCCESS) {
return result;
}
for (int i = 0; i < UDID_ORI_BYTES; i++) {
if (sprintf_s(udid + HEX_LEN * i, UDID_FINAL_BYTES + 1 - HEX_LEN * i, "%02X", tempUdid[i]) < 0) {
return PERM_ERRORCODE_GENERATE_UDID_FAILED;
}
}
udid[UDID_FINAL_BYTES] = '\0';
return PERM_ERRORCODE_SUCCESS;
}
bool HalIsValidPath(const char *path)
{
if (path == NULL) {
return false;
}
char resolvedPath[PATH_MAX + 1] = {0x0};
if (strlen(path) > PATH_MAX || realpath(path, resolvedPath) == NULL) {
return false;
}
struct stat buf;
stat(path, &buf);
if (S_IFDIR & buf.st_mode) {
resolvedPath[strlen(resolvedPath)] = '/';
}
return (strncmp(resolvedPath, P_DIR, strlen(P_DIR)) == 0);
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2020~2021 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 POLICY_PERSET_PRODUCT_H
#define POLICY_PERSET_PRODUCT_H
#include "policy_define.h"
#define POLICY_PRODUCT 0 // if config g_productPolicies,modify as 1
static PolicySetting g_productPolicies[] = {
};
static int g_productPolicySize = sizeof(g_productPolicies) / sizeof(PolicySetting);
#endif // POLICY_PERSET_PRODUCT_H
@@ -0,0 +1,36 @@
# 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.
shared_library("hal_sysparam") {
sources = [ "hal_sys_param.c" ]
cflags = [ "-Wall" ]
include_dirs = [
"//base/startup/syspara_lite/hals",
"//drivers/framework/include/platform",
"//drivers/framework/include/utils",
"//drivers/adapter/uhdf/posix/include",
"//third_party/bounds_checking_function/include",
]
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}\"",
]
deps = [
"//drivers/adapter/uhdf/platform:hdf_platform",
"//third_party/bounds_checking_function:libsec_shared",
]
}
@@ -0,0 +1,199 @@
/*
* 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"
#include <emmc_if.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include "securec.h"
#define STR_MAX 65
#define CID_LENGTH 16
#define EOK 0
#define TWO_TIMES 2
#define DIGITAL_CID_LENGTH (CID_LENGTH * TWO_TIMES + 1)
#define HEX_OF_BINARY_BITS 4
#define LAST_FOUR_BINARY_DIGITS 16
#define DIVIDE_NUMBER_AND_LETTERS 10
#define CID_ERROR (-1)
#define CID_OK 1
static const char OHOS_DEVICE_TYPE[] = {"BearPi-HM Micro"};
static const char OHOS_DISPLAY_VERSION[] = {"OpenHarmony 3.0"};
static const char OHOS_MANUFACTURE[] = {"BearPi"};
static const char OHOS_BRAND[] = {"BearPi"};
static const char OHOS_MARKET_NAME[] = {"****"};
static const char OHOS_PRODUCT_SERIES[] = {"20211113"};
static const char OHOS_PRODUCT_MODEL[] = {"****"};
static const char OHOS_SOFTWARE_MODEL[] = {"****"};
static const char OHOS_HARDWARE_MODEL[] = {"A03"};
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;
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;
}
static int GetDigitalCidLocation(int i)
{
return ((i / HEX_OF_BINARY_BITS + 1) * HEX_OF_BINARY_BITS - (i % HEX_OF_BINARY_BITS) - 1) * TWO_TIMES;
}
static int32_t TranslateCid(uint8_t *cid, uint32_t cidLen, char *digitalCid, uint32_t digitalCidLen)
{
if (cid == NULL || digitalCid == NULL || cidLen * TWO_TIMES + 1 != digitalCidLen) {
return CID_ERROR;
}
uint8_t tmp;
for (int i = 0; i < cidLen; i++) {
tmp = cid[i] / LAST_FOUR_BINARY_DIGITS;
if (tmp < DIVIDE_NUMBER_AND_LETTERS) {
digitalCid[GetDigitalCidLocation(i)] = tmp + '0';
} else {
digitalCid[GetDigitalCidLocation(i)] = tmp - DIVIDE_NUMBER_AND_LETTERS + 'a';
}
tmp = cid[i] % LAST_FOUR_BINARY_DIGITS;
if (tmp < DIVIDE_NUMBER_AND_LETTERS) {
digitalCid[GetDigitalCidLocation(i) + 1] = tmp + '0';
} else {
digitalCid[GetDigitalCidLocation(i) + 1] = tmp - DIVIDE_NUMBER_AND_LETTERS + 'a';
}
}
digitalCid[digitalCidLen - 1] = '\0';
return CID_OK;
}
static int32_t Getcid(char * str, int strlength)
{
if (str == NULL) {
return CID_ERROR;
}
uint8_t cid[CID_LENGTH] = {0};
EmmcGetHuid(cid, CID_LENGTH);
char digitalCid[DIGITAL_CID_LENGTH] = {0};
if (TranslateCid(cid, CID_LENGTH, digitalCid, DIGITAL_CID_LENGTH) != CID_OK) {
return CID_ERROR;
}
if (strncpy_s(str, strlength, digitalCid, strlen(digitalCid)) != EOK) {
return CID_ERROR;
}
return CID_OK;
}
const char* HalGetSerial(void)
{
static char str[STR_MAX] = {0};
if (strlen(str) > 0) {
return str;
}
if (Getcid(str, STR_MAX) != CID_OK) {
return OHOS_SERIAL;
}
return str;
}
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;
}
+25
View File
@@ -0,0 +1,25 @@
#
# 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.
#
import("//build/lite/config/component/lite_component.gni")
shared_library("haltoken_shared") {
sources = [ "hal_token.c" ]
cflags = [ "-Wall" ]
include_dirs = [
"//base/startup/syspara_lite/hals",
"//utils/native/lite/include",
]
deps = []
}
@@ -0,0 +1,122 @@
/*
* 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 <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include "ohos_errno.h"
#include "hal_token.h"
static int OEMReadToken(char *token, unsigned int len)
{
// OEM need add here, read token from device
return EC_SUCCESS;
}
static int OEMWriteToken(const char *token, unsigned int len)
{
// OEM need add here, write token to device
return EC_SUCCESS;
}
static int OEMGetAcKey(char *acKey, unsigned int len)
{
// OEM need add here, get AcKey
return EC_SUCCESS;
}
static int OEMGetProdId(char *productId, unsigned int len)
{
// OEM need add here, get ProdId
return EC_SUCCESS;
}
static int OEMGetProdKey(char *productKey, unsigned int len)
{
// OEM need add here, get ProdKey
return EC_SUCCESS;
}
static int UidVerify(void)
{
uid_t uid;
uid = getuid();
if (uid >= KIT_FRAMEWORK_UID_MAX) {
return EC_FAILURE;
}
return EC_SUCCESS;
}
int HalReadToken(char *token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
if (UidVerify()) {
return EC_FAILURE;
}
return OEMReadToken(token, len);
}
int HalWriteToken(const char *token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
if (UidVerify()) {
return EC_FAILURE;
}
return OEMWriteToken(token, len);
}
int HalGetAcKey(char *acKey, unsigned int len)
{
if (acKey == NULL) {
return EC_FAILURE;
}
if (UidVerify()) {
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;
}
if (UidVerify()) {
return EC_FAILURE;
}
return OEMGetProdKey(productKey, len);
}
+44
View File
@@ -0,0 +1,44 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# 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.
import("//drivers/adapter/khdf/liteos/hdf.gni")
module_switch = defined(LOSCFG_DRIVERS_HDF) && !defined(LOSCFG_DRIVERS_HDF_TEST)
module_name = "libhdf_config"
hdf_driver(module_name) {
hcs_sources = [ "hdf.hcs" ]
}
group("hdf_config") {
public_deps = [ ":$module_name" ]
deps = [
"hdf_test",
"hdf_test/hcs_macro_test",
]
}
+9
View File
@@ -0,0 +1,9 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk
MODULE_NAME := hdf_config
LOCAL_PLATFORM_HCS_SRC := hdf.hcs
include $(HDF_DRIVER)
@@ -0,0 +1,241 @@
root {
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 {
device0 :: deviceNode {
policy = 2;
priority = 10;
permission = 0644;
moduleName = "HDF_PLATFORM_GPIO_MANAGER";
serviceName = "HDF_PLATFORM_GPIO_MANAGER";
}
device1 :: deviceNode {
policy = 0;
priority = 10;
permission = 0644;
moduleName = "HDF_PLATFORM_GPIO";
serviceName = "HDF_PLATFORM_GPIO";
deviceMatchAttr = "st_stm32mp1_gpio";
}
}
device_iwdg :: device {
device0 :: deviceNode {
policy = 2;
priority = 20;
permission = 0644;
moduleName = "stm32mp1_iwdg";
serviceName = "HDF_PLATFORM_WATCHDOG_0";
deviceMatchAttr = "stm32mp1_iwdg_0";
}
device1 :: deviceNode {
policy = 2;
priority = 20;
permission = 0644;
moduleName = "stm32mp1_iwdg";
serviceName = "HDF_PLATFORM_WATCHDOG_1";
deviceMatchAttr = "stm32mp1_iwdg_1";
}
}
device_uart :: device {
device0 :: deviceNode {
policy = 2;
priority = 40;
permission = 0644;
moduleName = "stm32mp1_uart";
serviceName = "HDF_PLATFORM_UART_4";
deviceMatchAttr = "stm32mp1_uart_4";
}
device2 :: deviceNode {
policy = 2;
priority = 40;
permission = 0644;
moduleName = "stm32mp1_uart";
serviceName = "HDF_PLATFORM_UART_5";
deviceMatchAttr = "stm32mp1_uart_5";
}
}
device_spi :: device {
device0 :: deviceNode {
policy = 2;
priority = 40;
permission = 0644;
moduleName = "stm32mp1_spi_driver";
serviceName = "HDF_PLATFORM_SPI_1";
deviceMatchAttr = "st_stm32mp157_spi_1";
}
}
device_mmc:: device {
device0 :: deviceNode {
policy = 2;
priority = 10;
permission = 0644;
moduleName = "HDF_PLATFORM_SDMMC";
serviceName = "HDF_PLATFORM_MMC_2";
deviceMatchAttr = "st_stm32mp1_sdmmc_emmc";
}
device1 :: deviceNode {
policy = 2;
priority = 20;
permission = 0644;
moduleName = "HDF_PLATFORM_SDMMC";
serviceName = "HDF_PLATFORM_MMC_1";
deviceMatchAttr = "st_stm32mp1_sdmmc_sd";
}
device2 :: deviceNode {
policy = 1;
priority = 30;
permission = 0644;
moduleName = "HDF_PLATFORM_SDMMC";
serviceName = "HDF_PLATFORM_MMC_3";
deviceMatchAttr = "st_stm32mp1_sdmmc_sdio";
}
}
device_ltdc:: device {
device0 :: deviceNode {
policy = 0;
priority = 170;
permission = 0644;
moduleName = "HDF_PLATFORM_LTDC";
serviceName = "HDF_PLATFORM_LTDC";
deviceMatchAttr = "st_stm32mp1_ltdc";
}
}
device_i2c :: device {
device0 :: deviceNode {
policy = 2;
priority = 50;
permission = 0644;
moduleName = "HDF_PLATFORM_I2C_MANAGER";
serviceName = "HDF_PLATFORM_I2C_MANAGER";
deviceMatchAttr = "hdf_platform_i2c_manager";
}
device1 :: deviceNode {
policy = 0;
priority = 55;
permission = 0644;
moduleName = "HDF_PLATFORM_I2C";
serviceName = "HDF_PLATFORM_I2C";
deviceMatchAttr = "st_stm32mp1_i2c";
}
}
device_adc :: device {
device0 :: deviceNode {
policy = 2;
priority = 50;
permission = 0644;
moduleName = "HDF_PLATFORM_ADC_MANAGER";
serviceName = "HDF_PLATFORM_ADC_MANAGER";
deviceMatchAttr = "hdf_platform_adc_manager";
}
device1 :: deviceNode {
policy = 0;
priority = 55;
permission = 0644;
moduleName = "stm32mp1_adc_driver";
deviceMatchAttr = "st_stm32mp1_adc";
}
}
device_pwm :: device {
device0 :: deviceNode {
policy = 2;
priority = 80;
permission = 0644;
moduleName = "HDF_PLATFORM_PWM";
serviceName = "HDF_PLATFORM_PWM_0";
deviceMatchAttr = "st_stm32mp1_pwm_0";
}
}
}
display :: host {
hostName = "display_host";
device_hdf_disp :: device {
device0 :: deviceNode {
policy = 2;
priority = 140;
permission = 0660;
moduleName = "HDF_DISP";
serviceName = "hdf_disp";
}
}
}
input :: host {
hostName = "input_host";
priority = 100;
device_input_manager :: device {
device0 :: deviceNode {
policy = 2;
priority = 100;
preload = 0;
permission = 0660;
moduleName = "HDF_INPUT_MANAGER";
serviceName = "hdf_input_host";
deviceMatchAttr = "";
}
}
device_hdf_touch :: device {
device0 :: deviceNode {
policy = 2;
priority = 120;
preload = 0;
permission = 0660;
moduleName = "HDF_TOUCH";
serviceName = "hdf_input_event1";
deviceMatchAttr = "touch_device1";
}
}
device_touch_chip :: device {
device0 :: deviceNode {
policy = 0;
priority = 130;
preload = 0;
permission = 0660;
moduleName = "HDF_TOUCH_GT911";
serviceName = "hdf_touch_gt911_service";
deviceMatchAttr = "zsj_gt911_5p5";
}
}
}
network :: host {
hostName = "network_host";
device_wifi :: device {
device0 :: deviceNode {
policy = 2;
priority = 100;
preload = 0;
permission = 0664;
moduleName = "HDF_WIFI";
deviceMatchAttr = "hdf_wlan_driver";
serviceName = "hdfwifi";
}
}
device_wlan_chips :: device {
device0 :: deviceNode {
policy = 0;
preload = 2;
moduleName = "HDF_WLAN_CHIPS";
deviceMatchAttr = "hdf_wlan_chips_hi3881";
serviceName = "hisi";
}
}
}
}
}
+19
View File
@@ -0,0 +1,19 @@
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/i2c/i2c_config.hcs"
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/adc/adc_config.hcs"
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/gpio/gpio_config.hcs"
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/uart/uart_config.hcs"
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/mmc/mmc_config.hcs"
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/pwm/pwm_config.hcs"
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/spi_i2s/spi_i2s_config.hcs"
#include "../../../../device/soc/st/stm32mp1xx/sdk_liteos/hdf_config/watchdog/watchdog_config.hcs"
#include "device_info/device_info.hcs"
#include "wifi/wlan_platform.hcs"
#include "wifi/wlan_chip_hi3881.hcs"
#include "ltdc/ltdc_config.hcs"
#include "input/input_config.hcs"
root {
module = "st,stm32mp1xx";
}
@@ -0,0 +1,36 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# 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.
import("//drivers/adapter/khdf/liteos/hdf.gni")
module_switch = defined(LOSCFG_DRIVERS_HDF_TEST)
module_name = "hdf_test_config"
hdf_driver(module_name) {
hcs_sources = [ "hdf_test.hcs" ]
}
@@ -0,0 +1,9 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk
MODULE_NAME := hdf_test_config
LOCAL_HCS_ROOT := $(shell pwd)
LOCAL_PLATFORM_HCS_SRC := hdf_test.hcs
include $(HDF_DRIVER)
@@ -0,0 +1,14 @@
root {
module = "adc";
adc_config {
adc_device_tester {
match_attr = "ADC_TEST";
devNum = 1;
channel = 1;
maxChannel = 20;
dataWidth = 8;
rate = 20000;
}
}
}
@@ -0,0 +1,10 @@
root {
module = "emmc";
emmc_config {
emmc_controller_tester {
match_attr = "EMMC_TEST";
busNum = 1;
hostId = 1;
}
}
}
@@ -0,0 +1,11 @@
root {
module = "gpio";
gpio_config {
gpio_controller_tester {
match_attr = "GPIO_TEST";
gpio = 13;
gpioIrq = 98;
testUserApi = 1;
}
}
}
@@ -0,0 +1,37 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# 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.
import("//drivers/adapter/khdf/liteos/hdf.gni")
module_switch = defined(LOSCFG_DRIVERS_HDF_TEST)
module_name = "hdf_test_macro"
hdf_driver(module_name) {
hcs_sources = [ "../hdf_test.hcs" ]
sources = [ "//drivers/framework/test/unittest/utils/hcs_parser/unittest/hcs_macro_cases.c" ]
outputs = [ "$target_gen_dir/hdf_macro_test.h" ]
}
@@ -0,0 +1,40 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
ifeq ($(filter $(LITEOSTOPDIR)/config.mk,$(MAKEFILE_LIST)),)
include $(LITEOSTOPDIR)/config.mk
endif
MODULE_NAME := hdf_test_macro
LOCAL_HCS_ROOT := $(shell pwd)
HDF_FRAMWORK_ROOT = $(abspath $(LITEOSTOPDIR)/../../drivers/framework)
HC_GEN_DIR = $(HDF_FRAMWORK_ROOT)/tools/hc-gen
HC_GEN = $(OUT)/hc_gen_build/hc-gen
HDF_FRAMWORK_TEST_ROOT = $(HDF_FRAMWORK_ROOT)/test/unittest/utils/hcs_parser/unittest
HCS_MACRO_OBJ := hcs_macro_cases.o
HCS_MACRO_SRC := $(HDF_FRAMWORK_TEST_ROOT)/hcs_macro_cases.c
HCS_DEP := $(HDF_FRAMWORK_TEST_ROOT)/hdf_macro_test.h
HCS_MACRO_GEN_FILE := $(HDF_FRAMWORK_TEST_ROOT)/hdf_macro_test
HCS_FILE := $(PRODUCT_PATH)/hdf_config/hdf_test/hdf_test.hcs
$(warning HC_GEN = $(HC_GEN))
$(warning HCS_MACRO_SRC = $(HCS_MACRO_SRC))
$(warning HCS_MACRO_GEN_FILE = $(HCS_MACRO_GEN_FILE))
$(HCS_MACRO_OBJ): $(HCS_MACRO_SRC) $(HCS_DEP)
$(Q)$(CC) $(CFLAGS) $(LOCAL_FLAGS) $(LOCAL_CFLAGS) -c -o $@ $<
$(HCS_DEP): $(HC_GEN)
$(Q)echo gen hdf built-in config macro
$(Q)$(HC_GEN) -m -o $(HCS_MACRO_GEN_FILE) $(HCS_FILE)
$(HC_GEN):
$(HIDE)make -j -C $(HC_GEN_DIR) BUILD_DIR=$(dir $@)
$(OUT)/lib/lib$(MODULE_NAME).a: $(HCS_MACRO_OBJ)
$(HIDE)$(AR) $(ARFLAGS) $@ $^
all : $(OUT)/lib/lib$(MODULE_NAME).a
.PHONY: all
@@ -0,0 +1,52 @@
root {
module = "ConfigTest";
match_attr = "test,config";
audio_info {
match_attr = "hw,hw_audio_info";
pa_identifier = "smartpakit";
smartpa_addr = 65536;
smartpa_num = 1;
builtin_primary_mic_exist = true;
builtin_second_mic_exist = true;
voice_vol_level = 256;
cust_name = "audio_custom_v2";
dual_smartpa_delay = "true";
read_u64data = 0x100000000;
status = "ok";
}
fingerprint_info {
match_attr = "hw,hw_fingerprint_info";
read_u32_index = [1, 256, 65536];
finger_info = &fingerprint_one;
audio_info = &root.audio_info;
fingerprint_one {
product = "test";
chip = "one";
one_child {
status = "ok";
}
status = "ok";
}
dual_fingerprint = "false";
fingerprint_two: fingerprint_one {
chip = "two";
status = "disable";
}
string_list_names = ["first", "second", "third"];
status = "ok";
}
data_type_test {
match_attr = "hw,data_type_test";
read_four_data_type = [0x1, 0x100, 0x10000, 0x100000000];
test_u8_elem_data = [0, 1, 2, 3, 4, 5, 6, 7];
test_u16_elem_data = [0, 1, 2, 3, 4, 5, 256, 257];
}
board_id = [65536, 256];
support_Device = "TP LCD Sensor";
fingerprint_three: root.fingerprint_info.fingerprint_one {
chip = "three";
status = "disable";
}
modem_id = [0xF6B40136, 0x0];
boardId = 8000;
}
@@ -0,0 +1,11 @@
#include "../hdf.hcs"
#include "hdf_test_manager/device_info.hcs"
#include "gpio_test_config.hcs"
#include "i2c_test_config.hcs"
#include "adc_test_config.hcs"
#include "spi_test_config.hcs"
#include "uart_test_config.hcs"
#include "hdf_config_test.hcs"
#include "sdio_test_config.hcs"
#include "emmc_test_config.hcs"
#include "pwm_test_config.hcs"
@@ -0,0 +1,123 @@
root {
device_info {
test_host :: host {
hostName = "test_host";
priority = 180;
device_hdf_test :: device {
device0 :: deviceNode {
policy = 2;
priority = 10;
preload = 0;
permission = 0644;
moduleName = "HDF_TEST";
serviceName = "HDF_TEST";
}
device1 :: deviceNode {
policy = 2;
priority = 10;
preload = 2;
permission = 0644;
moduleName = "sample_driver";
serviceName = "sample_service";
}
device2 :: deviceNode {
policy = 2;
priority = 10;
preload = 0;
permission = 0644;
moduleName = "pm_test_driver";
serviceName = "pm_test_service";
}
}
device_platform_test :: device {
platform_test:: deviceNode {
policy = 1;
priority = 150;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_TEST_DRIVER";
serviceName = "PLATFORM_TEST";
deviceMatchAttr = "platform_test";
}
}
device_platform_spi_test :: device {
spi_test :: deviceNode {
policy = 2;
priority = 100;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_SPI_TEST";
serviceName = "SPI_TEST";
deviceMatchAttr = "SPI_TEST";
}
}
device_platform_i2c_test :: device {
i2c_tester :: deviceNode {
policy = 2;
priority = 101;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_I2C_TEST";
serviceName = "I2C_TEST";
deviceMatchAttr = "I2C_TEST";
}
}
device_platform_emmc_test :: device {
emmc_tester :: deviceNode {
policy = 1;
priority = 100;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_EMMC_TEST";
serviceName = "EMMC_TEST";
deviceMatchAttr = "EMMC_TEST";
}
}
device_platform_pwm_test :: device {
pwm_test :: deviceNode {
policy = 2;
priority = 110;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_PWM_TEST";
serviceName = "PWM_TEST";
deviceMatchAttr = "PWM_TEST";
}
}
device_platform_uart_test :: device {
uart_test :: deviceNode {
policy = 2;
priority = 100;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_UART_TEST";
serviceName = "UART_TEST";
deviceMatchAttr = "UART_TEST";
}
}
device_platform_gpio_test :: device {
gpio_tester :: deviceNode {
policy = 2;
priority = 101;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_GPIO_TEST";
serviceName = "GPIO_TEST";
deviceMatchAttr = "GPIO_TEST";
}
}
device_platform_adc_test :: device {
adc_tester :: deviceNode {
policy = 2;
priority = 110;
preload = 0;
permission = 0644;
moduleName = "PLATFORM_ADC_TEST";
serviceName = "ADC_TEST";
deviceMatchAttr = "ADC_TEST";
}
}
}
}
}
@@ -0,0 +1,13 @@
root {
module = "i2c";
i2c_config {
i2c_controller_tester {
match_attr = "I2C_TEST";
bus_num = 1;
dev_addr = 0x68;
reg_addr = 0x75;
reg_len = 2;
buf_size = 7;
}
}
}
@@ -0,0 +1,11 @@
root {
pwm_test {
module = "pwm_test";
match_attr = "PWM_TEST";
num = 0;
period = 999;
duty = 333;
polarity = 0;
status = 1;
}
}
@@ -0,0 +1,12 @@
root {
module = "sdio";
sdio_config {
sdio_controller_tester {
match_attr = "SDIO_TEST";
busNum = 2;
funcNum = 1;
vendorId = 0x296;
deviceId = 0x5347;
}
}
}
@@ -0,0 +1,10 @@
root {
spi_test {
module = "spi_test";
match_attr = "SPI_TEST";
bus = 1;
cs = 0;
len = 8;
wbuf = [0xa1, 0xb2, 0xc3, 0xd4, 0xe5, 0xf6, 0x78, 0x90];
}
}
@@ -0,0 +1,9 @@
root {
uart_test {
module = "uart_test";
match_attr = "UART_TEST";
port = 5;
len = 8;
wbuf = [0xa1, 0xb2, 0xc3, 0xd4, 0xe5, 0xf6, 0x78, 0x90];
}
}
@@ -0,0 +1,91 @@
root {
input_config {
touchConfig {
touch0 {
boardConfig {
match_attr = "touch_device1";
inputAttr {
/* 0:touch 1:key 2:keyboard 3:mouse 4:button 5:crown 6:encoder */
inputType = 0;
solutionX = 480;
solutionY = 960;
devName = "main_touch";
}
busConfig {
// 0:i2c 1:spi
busType = 0;
busNum = 2;
clkGpio = 116;
dataGpio = 117;
i2cClkIomux = [0x50009020, 0x40000];
i2cDataIomux = [0x50009020, 0x400000];
}
pinConfig {
rstGpio = 71;
intGpio = 104;
rstRegCfg = [0x50008024, 0x0];
intRegCfg = [0x50007020, 0x0];
}
powerConfig {
/* 0:unused 1:ldo 2:gpio 3:pmic */
vccType = 1;
vccNum = 20; // gpio20
vccValue = 1800;
vciType = 1;
vciNum = 12; // ldo12
vciValue = 3300;
}
featureConfig {
capacitanceTest = 0;
gestureMode = 0;
gloverMOde = 0;
coverMode = 0;
chargerMode = 0;
knuckleMode = 0;
}
}
chipConfig {
template touchChip {
match_attr = "";
chipName = "gt911";
vendorName = "zsj";
chipInfo = "AAAA11222"; // 4-ProjectName, 2-TP IC, 3-TP Module
/* 0:i2c 1:spi*/
busType = 0;
deviceAddr = 0xBA;
/* 0:None 1:Rising 2:Failing 4:High-level 8:Low-level */
irqFlag = 2;
maxSpeed = 400;
chipVersion = 0; //parse Coord TypeA
powerSequence {
/* [type, status, dir , delay]
<type> 0:none 1:vcc-1.8v 2:vci-3.3v 3:reset 4:int
<status> 0:off or low 1:on or high 2:no ops
<dir> 0:input 1:output 2:no ops
<delay> meanings delay xms, 20: delay 20ms
*/
powerOnSeq = [4, 0, 1, 0,
3, 0, 1, 10,
3, 1, 2, 60,
4, 2, 0, 0];
suspendSeq = [3, 0, 2, 10];
resumeSeq = [3, 1, 2, 10];
powerOffSeq = [3, 0, 2, 10,
1, 0, 2, 20];
}
}
chip0 :: touchChip {
match_attr = "zsj_gt911_5p5";
chipInfo = "ZIDN45100"; // 4-ProjectName, 2-TP IC, 3-TP Module
chipVersion = 0; //parse point by TypeA
}
}
}
}
}
}
@@ -0,0 +1,31 @@
root {
platform {
ltdc_config {
match_attr = "st_stm32mp1_ltdc";
template ltdc_device {
vsync = 0;
vbp = 23;
vfp = 22;
vact = 480;
hsync = 1;
hbp = 46;
hfp = 210;
hact = 800;
reg_pbase = 0x5A001000;
reg_size = 0x400;
}
device_0 :: ltdc_device {
vsync = 1;
vbp = 23;
vfp = 22;
vact = 480;
hsync = 1;
hbp = 46;
hfp = 210;
hact = 800;
reg_pbase = 0x5A001000;
reg_size = 0x400;
}
}
}
}
@@ -0,0 +1,14 @@
root {
wlan_config {
hi3881 :& chipList {
chipHi3881 :: chipInst {
match_attr = "hdf_wlan_chips_hi3881";
driverName = "hisi";
sdio {
vendorId = 0x0296;
deviceId = [0x5347];
}
}
}
}
}
@@ -0,0 +1,113 @@
root {
module = "wlan";
wlan_config {
match_attr = "hdf_wlan_driver";
hostChipName = "hi3516dv300";
moduleConfig {
featureMap = 0xFFFF;
msgName = "WalService";
Station {
name = "sta";
mode = true;
}
HostAp {
name = "ap";
mode = 0; /* 0-- notsupported; 1--softap-host; 2--soft AP DMAC HOST; 3-IOT 1:DMAC OFFLOAD: IPC */
vapResNum = 1; /*virtual ap*/
userResNum = 8; /*max users support each ap*/
}
P2P {
name = "p2p";
mode = false;
}
Mac80211 {
mode = true;
}
Phy {
mode = true;
}
}
deviceList {
template deviceInst {
deviceInstId = 0;
powers {
power0 {
powerSeqDelay = 0;
powerType = 1; /* AlwaysON(0);GPIO(1) */
gpioId = 1;
activeLevel=1; /* High(1); Low(0) */
}
power1 {
/* to support two-stage power supply */
powerSeqDelay = 0;
powerType = 0;
gpioId = 1;
activeLevel=1; /* High(1); Low(0) */
}
}
reset {
resetType = 1; /* NotManaged(0);GPIO(1) */
gpioId = 2;
activeLevel = 1; /* High(1); Low(0) */
resetHoldTime = 30; /*In ms*/
}
bootUpTimeOut = 30;
bus {
busType = 0; /* 0-sdio 1-usb 2-spi etc. */
busIdx = 2;
funcNum = [1,2];
timeout = 1000;
blockSize = 512;
}
}
}
hisi :& deviceList {
device0 :: deviceInst {
deviceInstId = 0;
powers {
power0 {
powerSeqDelay = 0;
powerType = 0; /* AlwaysON(0);GPIO(1) */
gpioId = 45;
activeLevel=1; /* High(1); Low(0) */
}
power1 {
powerSeqDelay = 0;
powerType = 0;
gpioId = 1;
activeLevel = 1; /* High(1); Low(0) */
}
}
reset {
resetType = 1; /* NotManaged(0);GPIO(1) */
gpioId = 45;
activeLevel = 0; /* High(1); Low(0) */
resetHoldTime = 16; /*In ms*/
}
bootUpTimeOut = 32;
bus {
busType = 0; /* 0-sdio 1-usb 2-spi etc. */
busIdx = 2;
funcNum = [1];
timeout = 1000;
blockSize = 512;
}
}
}
chipList {
template chipInst {
match_attr = "hdf_wlan_chips_hi3881";
driverName = "hi3881";
sdio {
vendorId = 0x0296;
deviceId = [0x5347];
}
}
}
}
}
+22
View File
@@ -0,0 +1,22 @@
# Copyright (c) 2021 Nanjing Xiaoxiongpai Intelligent Technology 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.
copy("init_configs") {
sources = [ "init_bearpi_hm_micro.cfg" ]
outputs = [ "$root_out_dir/config/init.cfg" ]
}
copy("init_configs_mksh") {
sources = [ "init_bearpi_hm_micro_mksh.cfg" ]
outputs = [ "$root_out_dir/config/init_mksh.cfg" ]
}
@@ -0,0 +1,157 @@
{
"jobs" : [{
"name" : "pre-init",
"cmds" : [
"mkdir /storage/data/log",
"chmod 0755 /storage/data/log",
"chown 4 4 /storage/data/log",
"mkdir /storage/data/softbus",
"chmod 0700 /storage/data/softbus",
"chown 7 7 /storage/data/softbus",
"mkdir /sdcard",
"chmod 0777 /sdcard",
"mount vfat /dev/mmcblk0 /sdcard rw,umask=000",
"mount vfat /dev/mmcblk1 /sdcard rw,umask=000",
"start foundation",
"start bundle_daemon",
"start appspawn",
"start media_server",
"start wms_server",
"start shell"
]
}, {
"name" : "init",
"cmds" : [
"start apphilogcat",
"start hiview",
"start deviceauth_service",
"start sensor_service",
"start ai_server",
"start softbus_server"
]
}, {
"name" : "post-init",
"cmds" : [
"chown 0 99 /dev/hdf",
"chown 0 99 /dev/hdf/dev_mgr",
"chown 0 99 /dev/hdf/hdfwifi",
"chown 0 99 /dev/gpio",
"chown 0 99 /dev/i2c-0",
"chown 0 99 /dev/i2c-1",
"chown 0 99 /dev/i2c-2",
"chown 0 99 /dev/i2c-3",
"chown 0 99 /dev/i2c-4",
"chown 0 99 /dev/i2c-5",
"chown 0 99 /dev/i2c-6",
"chown 0 99 /dev/i2c-7",
"chown 0 99 /dev/uartdev-0",
"chown 0 99 /dev/uartdev-1",
"chown 0 99 /dev/uartdev-2",
"chown 0 99 /dev/uartdev-3",
"chown 0 99 /dev/spidev0.0",
"chown 0 99 /dev/spidev1.0",
"chown 0 99 /dev/spidev2.0",
"chown 0 99 /dev/spidev2.1"
]
}
],
"services" : [{
"name" : "foundation",
"path" : ["/bin/foundation"],
"uid" : 7,
"gid" : 7,
"once" : 0,
"importance" : 1,
"caps" : [10, 11, 12, 13]
}, {
"name" : "shell",
"path" : ["/bin/shell"],
"uid" : 2,
"gid" : 2,
"once" : 0,
"importance" : 0,
"caps" : [4294967295]
}, {
"name" : "appspawn",
"path" : ["/bin/appspawn"],
"uid" : 1,
"gid" : 1,
"once" : 0,
"importance" : 0,
"caps" : [2, 6, 7, 8, 11, 23]
}, {
"name" : "apphilogcat",
"path" : ["/bin/apphilogcat", "-L", "auto"],
"uid" : 4,
"gid" : 4,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "media_server",
"path" : ["/bin/media_server"],
"uid" : 0,
"gid" : 0,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "wms_server",
"path" : ["/bin/wms_server"],
"uid" : 0,
"gid" : 0,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "bundle_daemon",
"path" : ["/bin/bundle_daemon"],
"uid" : 8,
"gid" : 8,
"once" : 0,
"importance" : 0,
"caps" : [0, 1]
}, {
"name" : "hiview",
"path" : ["/bin/hiview"],
"uid" : 4,
"gid" : 4,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "sensor_service",
"path" : ["/bin/sensor_service"],
"uid" : 0,
"gid" : 0,
"once" : 0,
"importance" : 0,
"caps" : []
}, {
"name" : "ai_server",
"path" : ["/bin/ai_server"],
"uid" : 2,
"gid" : 2,
"once" : 0,
"importance" : 0,
"caps" : []
}, {
"name" : "softbus_server",
"path" : ["/bin/softbus_server"],
"uid" : 0,
"gid" : 0,
"once" : 0,
"importance" : 0,
"caps" : []
}, {
"name" : "deviceauth_service",
"path" : ["/bin/deviceauth_service"],
"uid" : 0,
"gid" : 0,
"once" : 1,
"importance" : 0,
"caps" : []
}
]
}
@@ -0,0 +1,156 @@
{
"jobs" : [{
"name" : "pre-init",
"cmds" : [
"mkdir /storage/data/log",
"chmod 0755 /storage/data/log",
"chown 4 4 /storage/data/log",
"mkdir /storage/data/softbus",
"chmod 0700 /storage/data/softbus",
"chown 7 7 /storage/data/softbus",
"mkdir /sdcard",
"chmod 0777 /sdcard",
"mount vfat /dev/mmcblk0 /sdcard rw,umask=000",
"mount vfat /dev/mmcblk1 /sdcard rw,umask=000",
"start foundation",
"start bundle_daemon",
"start appspawn",
"start media_server",
"start wms_server",
"start mksh"
]
}, {
"name" : "init",
"cmds" : [
"start apphilogcat",
"start hiview",
"start deviceauth_service",
"start sensor_service",
"start ai_server",
"start softbus_server"
]
}, {
"name" : "post-init",
"cmds" : [
"chown 0 99 /dev/hdf/dev_mgr",
"chown 0 99 /dev/hdf/hdfwifi",
"chown 0 99 /dev/gpio",
"chown 0 99 /dev/i2c-0",
"chown 0 99 /dev/i2c-1",
"chown 0 99 /dev/i2c-2",
"chown 0 99 /dev/i2c-3",
"chown 0 99 /dev/i2c-4",
"chown 0 99 /dev/i2c-5",
"chown 0 99 /dev/i2c-6",
"chown 0 99 /dev/i2c-7",
"chown 0 99 /dev/uartdev-0",
"chown 0 99 /dev/uartdev-1",
"chown 0 99 /dev/uartdev-2",
"chown 0 99 /dev/uartdev-3",
"chown 0 99 /dev/spidev0.0",
"chown 0 99 /dev/spidev1.0",
"chown 0 99 /dev/spidev2.0",
"chown 0 99 /dev/spidev2.1"
]
}
],
"services" : [{
"name" : "foundation",
"path" : ["/bin/foundation"],
"uid" : 7,
"gid" : 7,
"once" : 0,
"importance" : 1,
"caps" : [10, 11, 12, 13]
}, {
"name" : "mksh",
"path" : ["/bin/shell", "exec", "/bin/mksh"],
"uid" : 2,
"gid" : 2,
"once" : 0,
"importance" : 0,
"caps" : [4294967295]
}, {
"name" : "appspawn",
"path" : ["/bin/appspawn"],
"uid" : 1,
"gid" : 1,
"once" : 0,
"importance" : 0,
"caps" : [2, 6, 7, 8, 11, 23]
}, {
"name" : "apphilogcat",
"path" : ["/bin/apphilogcat", "-L", "auto"],
"uid" : 4,
"gid" : 4,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "media_server",
"path" : ["/bin/media_server"],
"uid" : 0,
"gid" : 0,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "wms_server",
"path" : ["/bin/wms_server"],
"uid" : 0,
"gid" : 0,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "bundle_daemon",
"path" : ["/bin/bundle_daemon"],
"uid" : 8,
"gid" : 8,
"once" : 0,
"importance" : 0,
"caps" : [0, 1]
}, {
"name" : "hiview",
"path" : ["/bin/hiview"],
"uid" : 4,
"gid" : 4,
"once" : 1,
"importance" : 0,
"caps" : []
}, {
"name" : "sensor_service",
"path" : ["/bin/sensor_service"],
"uid" : 0,
"gid" : 0,
"once" : 0,
"importance" : 0,
"caps" : []
}, {
"name" : "ai_server",
"path" : ["/bin/ai_server"],
"uid" : 2,
"gid" : 2,
"once" : 0,
"importance" : 0,
"caps" : []
}, {
"name" : "softbus_server",
"path" : ["/bin/softbus_server"],
"uid" : 0,
"gid" : 0,
"once" : 0,
"importance" : 0,
"caps" : []
}, {
"name" : "deviceauth_service",
"path" : ["/bin/deviceauth_service"],
"uid" : 0,
"gid" : 0,
"once" : 1,
"importance" : 0,
"caps" : []
}
]
}
@@ -0,0 +1,242 @@
#
# Compiler
#
# LOSCFG_COMPILER_GCC is not set
LOSCFG_COMPILER_CLANG_LLVM=y
LOSCFG_LLVM_TARGET="arm-liteos"
# LOSCFG_COMPILE_DEBUG is not set
LOSCFG_COMPILE_OPTIMIZE=y
LOSCFG_COMPILE_OPTIMIZE_SIZE=y
LOSCFG_COMPILE_LTO=y
# end of Compiler
#
# Platform
#
LOSCFG_PLATFORM="stm32mp157"
LOSCFG_PRODUCT_NAME="bearpi_hm_micro"
LOSCFG_DEVICE_COMPANY="st"
# LOSCFG_PLATFORM_HI3516DV300 is not set
# LOSCFG_PLATFORM_HI3518EV300 is not set
# LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 is not set
LOSCFG_PLATFORM_STM32MP157=y
LOSCFG_PRODUCT_BEARPI_HM_MICRO=y
LOSCFG_BOARD_CONFIG_PATH="device/board/bearpi/bearpi_hm_micro/liteos_a/board"
LOSCFG_TEE_ENABLE=y
# LOSCFG_HRTIMER_ENABLE is not set
LOSCFG_ARCH_ARM=y
LOSCFG_ARCH_ARM_AARCH32=y
LOSCFG_ARCH_ARM_V7A=y
LOSCFG_ARCH_ARM_VER="armv7-a"
LOSCFG_ARCH_FPU_VFP_V4=y
LOSCFG_ARCH_FPU_VFP_D32=y
LOSCFG_ARCH_FPU_VFP_NEON=y
LOSCFG_ARCH_FPU="neon-vfpv4"
LOSCFG_ARCH_CORTEX_A7=y
LOSCFG_ARCH_CPU="cortex-a7"
LOSCFG_ARCH_GIC_V2=y
#
# Extra Configurations
#
# LOSCFG_ARCH_FPU_DISABLE is not set
LOSCFG_IRQ_USE_STANDALONE_STACK=y
LOSCFG_PLATFORM_ROOTFS=y
# LOSCFG_STORAGE_SPINOR is not set
LOSCFG_STORAGE_EMMC=y
LOSCFG_BOOTENV_ADDR=2560
# LOSCFG_BOOTENV_RAM is not set
# LOSCFG_PLATFORM_PATCHFS is not set
# LOSCFG_BLACKBOX is not set
LOSCFG_HIDUMPER=y
# LOSCFG_QUICK_START is not set
# end of Platform
#
# Kernel
#
LOSCFG_KERNEL_SMP=y
LOSCFG_KERNEL_SMP_LOCKDEP=y
LOSCFG_KERNEL_SMP_TASK_SYNC=y
LOSCFG_KERNEL_MMU=y
LOSCFG_KERNEL_VM=y
LOSCFG_KERNEL_SYSCALL=y
LOSCFG_KERNEL_EXTKERNEL=y
LOSCFG_KERNEL_CPPSUPPORT=y
LOSCFG_KERNEL_CPUP=y
LOSCFG_CPUP_INCLUDE_IRQ=y
LOSCFG_KERNEL_DYNLOAD=y
LOSCFG_ASLR=y
LOSCFG_KERNEL_PM=y
LOSCFG_KERNEL_VDSO=y
# LOSCFG_KERNEL_HOOK is not set
LOSCFG_TRACE_BUFFER_SIZE=10000
LOSCFG_KERNEL_SHM=y
LOSCFG_KERNEL_LITEIPC=y
LOSCFG_KERNEL_PIPE=y
LOSCFG_BASE_CORE_HILOG=y
LOSCFG_HILOG=y
LOSCFG_HILOG_BUFFER_SIZE=4096
# end of Kernel
#
# Lib
#
LOSCFG_LIB_LIBC=y
LOSCFG_LIB_ZLIB=y
# end of Lib
#
# Compat
#
LOSCFG_COMPAT_POSIX=y
LOSCFG_COMPAT_BSD=y
LOSCFG_COMPAT_LINUXKPI=y
# end of Compat
#
# FileSystem
#
LOSCFG_FS_VFS=y
LOSCFG_FS_VFS_BLOCK_DEVICE=y
LOSCFG_FILE_MODE=y
LOSCFG_FS_FAT=y
LOSCFG_FS_FAT_CACHE=y
# LOSCFG_FS_FAT_CACHE_SYNC_THREAD is not set
LOSCFG_FS_FAT_CHINESE=y
LOSCFG_FS_FAT_VIRTUAL_PARTITION=y
LOSCFG_FS_FAT_VOLUMES=16
LOSCFG_FS_FAT_DISK=y
LOSCFG_FS_RAMFS=y
# LOSCFG_FS_ROMFS is not set
LOSCFG_FS_NFS=y
LOSCFG_FS_PROC=y
# LOSCFG_FS_JFFS is not set
# LOSCFG_FS_JFFS2_SUMMARY is not set
# LOSCFG_ENABLE_READ_BUFFER is not set
LOSCFG_MAX_VNODE_SIZE=512
LOSCFG_MAX_PATH_CACHE_SIZE=512
# end of FileSystem
#
# Net
#
LOSCFG_NET_LWIP_SACK=y
LOSCFG_NET_LWIP_SACK_2_1=y
# LOSCFG_NET_LWIP_SACK_2_0 is not set
# end of Net
#
# Debug
#
# LOSCFG_GDB is not set
LOSCFG_PLATFORM_ADAPT=y
LOSCFG_ENABLE_OOM_LOOP_TASK=y
LOSCFG_ENABLE_MAGICKEY=y
# LOSCFG_THUMB is not set
# LOSCFG_PLATFORM_DVFS is not set
# LOSCFG_SAVE_EXCINFO is not set
LOSCFG_DEBUG_VERSION=y
# LOSCFG_DEBUG_KERNEL is not set
LOSCFG_SHELL=y
#
# Functionality of Shell
#
LOSCFG_SHELL_LK=y
LOSCFG_SHELL_DMESG=y
# end of Functionality of Shell
LOSCFG_NET_LWIP_SACK_TFTP=y
LOSCFG_NET_TELNET=y
# LOSCFG_SCHED_DEBUG is not set
# LOSCFG_USER_INIT_DEBUG is not set
LOSCFG_SHELL_CMD_DEBUG=y
LOSCFG_MEM_DEBUG=y
# LOSCFG_MEM_LEAKCHECK is not set
# LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK is not set
# LOSCFG_MEM_WATERLINE is not set
# LOSCFG_VM_OVERLAP_CHECK is not set
# end of Debug
#
# Driver
#
LOSCFG_DRIVERS=y
# LOSCFG_DRIVERS_USB is not set
LOSCFG_DRIVERS_HDF=y
LOSCFG_DRIVERS_HDF_PLATFORM=y
LOSCFG_DRIVERS_HDF_PLATFORM_GPIO=y
LOSCFG_DRIVERS_HDF_PLATFORM_I2C=y
LOSCFG_DRIVERS_HDF_PLATFORM_ADC=y
LOSCFG_DRIVERS_HDF_PLATFORM_MMC=y
LOSCFG_DRIVERS_HDF_PLATFORM_EMMC=y
LOSCFG_DRIVERS_HDF_PLATFORM_PWM=y
# LOSCFG_DRIVERS_HDF_PLATFORM_RTC is not set
LOSCFG_DRIVERS_HDF_PLATFORM_SDIO=y
# LOSCFG_DRIVERS_HDF_PLATFORM_DMAC is not set
LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_DSI=y
LOSCFG_DRIVERS_HDF_PLATFORM_LTDC=y
# LOSCFG_DRIVERS_HDF_PLATFORM_HISI_SDK is not set
LOSCFG_DRIVERS_HDF_PLATFORM_SPI=y
# LOSCFG_DRIVERS_HDF_PLATFORM_I2S is not set
LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG=y
LOSCFG_DRIVERS_HDF_WIFI=y
# LOSCFG_DRIVERS_HDF_USB is not set
LOSCFG_DRIVERS_HDF_TEST=y
LOSCFG_DRIVERS_HDF_DISP=y
# LOSCFG_DRIVERS_HDF_LCDKIT is not set
# LOSCFG_DRIVERS_HDF_LCD_ICN9700 is not set
# LOSCFG_DRIVERS_HDF_LCD_ST7789 is not set
LOSCFG_DRIVERS_HDF_INPUT=y
LOSCFG_DRIVERS_HDF_TP_5P5_GT911=y
# LOSCFG_DRIVERS_HDF_SENSOR is not set
LOSCFG_DRIVERS_HDF_STORAGE=y
# LOSCFG_DRIVERS_HDF_STORAGE_MTD is not set
# LOSCFG_DRIVERS_HDF_VIBRATOR is not set
# LOSCFG_DRIVERS_HDF_USBFN_MASTER is not set
# LOSCFG_DRIVERS_HDF_USBFN_CDCACM is not set
# LOSCFG_DRIVERS_HDF_USBFN_CDCECM is not set
LOSCFG_DRIVERS_HDF_PLATFORM_UART=y
# LOSCFG_PLATFORM_UART_WITHOUT_VFS is not set
# LOSCFG_PLATFORM_NO_UART is not set
LOSCFG_DRIVERS_MMC=y
LOSCFG_DRIVERS_SD=y
LOSCFG_DRIVERS_EMMC=y
LOSCFG_DRIVERS_EMMC_HS200=y
#LOSCFG_DRIVERS_MTD is not set
#LOSCFG_DRIVERS_MTD_SPI_NOR is not set
LOSCFG_DRIVERS_MEM=y
LOSCFG_DRIVERS_HI3881=y
LOSCFG_DRIVERS_QUICKSTART=y
LOSCFG_DRIVERS_RANDOM=y
LOSCFG_HW_RANDOM_ENABLE=y
LOSCFG_DRIVERS_VIDEO=y
# LOSCFG_DRIVERS_TZDRIVER is not set
LOSCFG_DRIVERS_HIEVENT=y
# end of Driver
#
# Security
#
LOSCFG_SECURITY=y
LOSCFG_SECURITY_CAPABILITY=y
LOSCFG_SECURITY_VID=y
# LOSCFG_SECURITY_BOOT is not set
# end of Security
#
# Test
#
# LOSCFG_ENABLE_KERNEL_TEST is not set
# end of Test
#
# Stack Smashing Protector (SSP) Compiler Feature
#
# LOSCFG_CC_NO_STACKPROTECTOR is not set
# LOSCFG_CC_STACKPROTECTOR is not set
LOSCFG_CC_STACKPROTECTOR_STRONG=y
# LOSCFG_CC_STACKPROTECTOR_ALL is not set
# end of Stack Smashing Protector (SSP) Compiler Feature
+10
View File
@@ -0,0 +1,10 @@
{
"parts": {
"product_bearpi_hm_micro": {
"module_list": [
"//vendor/bearpi/bearpi_hm_micro:bearpi_hm_micro"
]
}
},
"subsystem": "product_bearpi_hm_micro"
}