diff --git a/hcs/Makefile b/hcs/Makefile index e750686c9fe97a708743886af689145415ae47dc..9b91ef3b5302937c31ffa1116feed18c8e044bc2 100755 --- a/hcs/Makefile +++ b/hcs/Makefile @@ -13,21 +13,24 @@ # ifneq ($(findstring $(shell uname),Linux),) -HCGEN_PATH := linux-x86/bin/hc-gen + HCGEN_PATH := linux-x86/bin/hc-gen else -HCGEN_PATH := win-x86/bin/hc-gen.exe + HCGEN_PATH := win-x86/bin/hc-gen.exe endif -SOURCE_ROOT:=$(HDF_PROJECT_ROOT) +SOURCE_ROOT:=$(PROJECT_ROOT) HC_GEN := hc-gen BUILD_IN_HC_GEN := $(SOURCE_ROOT)/prebuilts/build-tools/$(HCGEN_PATH) ifneq ($(wildcard $(BUILD_IN_HC_GEN)),) -HC_GEN := $(BUILD_IN_HC_GEN) + HC_GEN := $(BUILD_IN_HC_GEN) endif LOCAL_HCS_ROOT := $(abspath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))) HCS_DIR := $(SOURCE_ROOT)/$(product_path) +ifneq ($(wildcard $(HCS_DIR)),) + HCS_DIR := $(LOCAL_HCS_ROOT) +endif HCB_FLAGS := -b -i -a diff --git a/hcs/device_info/device_info.hcs b/hcs/device_info/device_info.hcs new file mode 100644 index 0000000000000000000000000000000000000000..be5823e89559b6281fa890a8fc7b0379358ffcb5 --- /dev/null +++ b/hcs/device_info/device_info.hcs @@ -0,0 +1,320 @@ + 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 = 0; + priority = 10; + permission = 0644; + moduleName = "linux_gpio_adapter"; + deviceMatchAttr = "linux_gpio_adapter"; + } + } + device_watchdog :: device { + device0 :: deviceNode { + policy = 1; + priority = 20; + permission = 0644; + moduleName = "HDF_PLATFORM_WATCHDOG"; + serviceName = "HDF_PLATFORM_WATCHDOG_0"; + deviceMatchAttr = "hisilicon_hi35xx_watchdog_0"; + } + } + device_rtc :: device { + device0 :: deviceNode { + policy = 1; + priority = 30; + permission = 0644; + moduleName = "HDF_PLATFORM_RTC"; + serviceName = "HDF_PLATFORM_RTC"; + deviceMatchAttr = "hisilicon_hi35xx_rtc"; + } + } + + device_uart :: device { + device0 :: deviceNode { + policy = 1; + priority = 40; + permission = 0644; + moduleName = "HDF_PLATFORM_UART"; + serviceName = "HDF_PLATFORM_UART_0"; + deviceMatchAttr = "hisilicon_hi35xx_uart_0"; + } + device1 :: deviceNode { + policy = 2; + permission = 0644; + priority = 40; + moduleName = "HDF_PLATFORM_UART"; + serviceName = "HDF_PLATFORM_UART_1"; + deviceMatchAttr = "hisilicon_hi35xx_uart_1"; + } + } + 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 = "linux_i2c_adapter"; + deviceMatchAttr = "linux_i2c_adapter"; + } + } + device_spi :: device { + device0 :: deviceNode { + policy = 1; + priority = 60; + permission = 0644; + moduleName = "HDF_PLATFORM_SPI"; + serviceName = "HDF_PLATFORM_SPI_0"; + deviceMatchAttr = "hisilicon_hi35xx_spi_0"; + } + device1 :: deviceNode { + policy = 1; + priority = 60; + permission = 0644; + moduleName = "HDF_PLATFORM_SPI"; + serviceName = "HDF_PLATFORM_SPI_1"; + deviceMatchAttr = "hisilicon_hi35xx_spi_1"; + } + device2 :: deviceNode { + policy = 1; + priority = 60; + permission = 0644; + moduleName = "HDF_PLATFORM_SPI"; + serviceName = "HDF_PLATFORM_SPI_2"; + deviceMatchAttr = "hisilicon_hi35xx_spi_2"; + } + } + device_sdio :: device { + device0 :: deviceNode { + policy = 1; + priority = 70; + permission = 0644; + moduleName = "HDF_PLATFORM_SDIO"; + serviceName = "HDF_PLATFORM_SDIO_0"; + deviceMatchAttr = "hisilicon_hi35xx_sdio_0"; + } + device1 :: deviceNode { + policy = 1; + priority = 70; + permission = 0644; + moduleName = "HDF_PLATFORM_SDIO"; + serviceName = "HDF_PLATFORM_SDIO_1"; + deviceMatchAttr = "hisilicon_hi35xx_sdio_1"; + } + } + device_emmc :: device { + device0 :: deviceNode { + policy = 2; + priority = 20; + permission = 0644; + moduleName = "HDF_PLATFORM_EMMC"; + serviceName = "HDF_PLATFORM_EMMC_0"; + deviceMatchAttr = "hisilicon_hi35xx_emmc_0"; + } + } + device_pwm :: device { + device0 :: deviceNode { + policy = 1; + priority = 80; + permission = 0644; + moduleName = "HDF_PLATFORM_PWM"; + serviceName = "HDF_PLATFORM_PWM_0"; + deviceMatchAttr = "hisilicon_hi35xx_pwm_0"; + } + device1 :: deviceNode { + policy = 1; + priority = 80; + permission = 0644; + moduleName = "HDF_PLATFORM_PWM"; + serviceName = "HDF_PLATFORM_PWM_1"; + deviceMatchAttr = "hisilicon_hi35xx_pwm_1"; + } + } + device_mipi_dsi:: device { + device0 :: deviceNode { + policy = 0; + priority = 150; + permission = 0644; + moduleName = "HDF_MIPI_TX"; + serviceName = "HDF_MIPI_TX"; + } + } + } + display :: host { + hostName = "display_host"; + device_hdf_disp :: device { + device0 :: deviceNode { + policy = 2; + priority = 200; + permission = 0660; + moduleName = "HDF_DISP"; + serviceName = "hdf_disp"; + } + } + device_hi35xx_disp :: device { + device0 :: deviceNode { + policy = 0; + priority = 199; + moduleName = "HI351XX_DISP"; + } + } + device_lcd :: device { + device0 :: deviceNode { + policy = 0; + priority = 100; + preload = 2; + moduleName = "LITE_LCDKIT"; + deviceMatchAttr = "hdf_lcdkit_driver"; + } + device1 :: deviceNode { + policy = 0; + priority = 100; + preload = 0; + moduleName = "LCD_ICN9700"; + } + device2 :: deviceNode { + policy = 0; + priority = 100; + preload = 2; + moduleName = "LCD_ST7789"; + } + } + } + + 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"; + } + } + device_hdf_hid :: device { + device0 :: deviceNode { + policy = 2; + priority = 200; + preload = 0; + permission = 0660; + moduleName = "HDF_HID"; + } + } + } + + 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"; + } + } + } + sensor :: host { + hostName = "sensor_host"; + device_sensor_manager :: device { + device0 :: deviceNode { + policy = 2; + priority = 100; + preload = 0; + permission = 0664; + moduleName = "HDF_SENSOR_MGR_AP"; + serviceName = "hdf_sensor_manager_ap"; + } + } + device_sensor_accel :: device { + device0 :: deviceNode { + policy = 1; + priority = 105; + preload = 2; + permission = 0664; + moduleName = "HDF_SENSOR_ACCEL"; + serviceName = "sensor_accel"; + deviceMatchAttr = "hdf_sensor_accel_driver"; + } + } + } + usb_pnp_linux :: host { + hostName = "usb_pnp_linux_host"; + device_usb_pnp_linux :: device { + device0 :: deviceNode { + policy = 2; + priority = 100; + preload = 0; + permission = 0664; + moduleName = "HDF_USB_PNP_NOTIFY"; + serviceName = "hdf_usb_pnp_notify_service"; + deviceMatchAttr = "hdf_usb_pnp_notify_config"; + } + } + } + } +} diff --git a/hcs/hdf.hcs b/hcs/hdf.hcs new file mode 100644 index 0000000000000000000000000000000000000000..6a5ef430f4227b46706478223679f174ddc2bffa --- /dev/null +++ b/hcs/hdf.hcs @@ -0,0 +1,16 @@ +#include "device_info/device_info.hcs" +#include "platform/i2c_config.hcs" +#include "platform/hi35xx_watchdog_config.hcs" +#include "platform/hi35xx_pwm_config.hcs" +#include "platform/hi35xx_uart_config.hcs" +#include "platform/sdio_config.hcs" +#include "platform/emmc_config.hcs" +#include "platform/hi35xx_spi_config.hcs" +#include "input/input_config.hcs" +#include "wifi/wlan_platform.hcs" +#include "wifi/wlan_chip_hi3881.hcs" +#include "sensor/sensor_config.hcs" + +root { + module = "hisilicon,hi35xx_chip"; +} diff --git a/hcs/hdf_test/Makefile b/hcs/hdf_test/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..60c59fa24b2645c688f44585be3b7f61680c0e02 --- /dev/null +++ b/hcs/hdf_test/Makefile @@ -0,0 +1,71 @@ +# +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# +# This software is licensed under the terms of the GNU General Public +# License version 2, as published by the Free Software Foundation, and +# may be copied, distributed, and modified under those terms. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# + +ifneq ($(findstring $(shell uname),Linux),) + HCGEN_PATH := linux-x86/bin/hc-gen +else + HCGEN_PATH := win-x86/bin/hc-gen.exe +endif + +ifeq ($(LOCAL_HCS_ROOT),) + LOCAL_HCS_ROOT := $(PRODUCT_PATH) +endif + +SOURCE_ROOT:=$(abspath ../../../../../) +$(info SOURCE_ROOT = $(SOURCE_ROOT)) +HC_GEN := hc-gen +BUILD_IN_HC_GEN := $(SOURCE_ROOT)/prebuilts/build-tools/$(HCGEN_PATH) +ifneq ($(wildcard $(BUILD_IN_HC_GEN)),) + HC_GEN := $(BUILD_IN_HC_GEN) +endif + +LOCAL_HCS_ROOT := $(abspath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))) + +HCS_DIR := $(LOCAL_HCS_ROOT) + +ifneq ($(TARGET_BOARD_PLATFORM),) + HCS_DIR := $(LOCAL_HCS_ROOT)/$(TARGET_BOARD_PLATFORM) +else + ifneq ($(CONFIG_ARCH_HI3516DV300),) + HCS_DIR := $(LOCAL_HCS_ROOT) + endif + ifneq ($(CONFIG_ARCH_HI3518EV300),) + HCS_DIR := $(LOCAL_HCS_ROOT) + endif +endif +$(info HCS_DIR = $(HCS_DIR)) +HCB_FLAGS := -b -i -a + +HCS_OBJ := hdf_hcs_hex.o +HCS_OBJ_SRC := $(subst .o,.c,$(notdir $(HCS_OBJ))) + +CONFIG_GEN_HEX_SRC := $(addprefix $(LOCAL_HCS_ROOT)/, $(HCS_OBJ_SRC)) +CONFIG_HCS_SRC := $(subst _hcs_hex.o,.hcs,$(addprefix $(HCS_DIR)/, $(HCS_OBJ))) + +$(obj)/$(HCS_OBJ): $(CONFIG_GEN_HEX_SRC) + $(Q)$(CC) $(c_flags) -c -o $@ $< + $(Q)rm -f $< + +$(CONFIG_GEN_HEX_SRC): $(LOCAL_HCS_ROOT)/%_hcs_hex.c: $(HCS_DIR)/%.hcs + $(Q)echo gen hdf built-in config + $(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi + $(Q)$(HC_GEN) $(HCB_FLAGS) -o $(subst _hex.c,,$(@)) $< + +$(CONFIG_GEN_SRCS): $(CONFIG_OUT_DIR)%.c: $(HCS_DIR)/%.hcs + $(Q)echo gen hdf driver config + $(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi + $(Q)$(HC_GEN) -t -o $@ $< + + +obj-$(CONFIG_DRIVERS_HDF) += $(HCS_OBJ) diff --git a/hcs/hdf_test/emmc_test_config.hcs b/hcs/hdf_test/emmc_test_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..fe1d87652ff4bd288ee52df962799aaef50f5292 --- /dev/null +++ b/hcs/hdf_test/emmc_test_config.hcs @@ -0,0 +1,10 @@ +root { + module = "emmc"; + emmc_config { + emmc_controller_tester { + match_attr = "EMMC_TEST"; + busNum = 0; + hostId = 0; + } + } +} diff --git a/hcs/hdf_test/gpio_test_config.hcs b/hcs/hdf_test/gpio_test_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..093f52a91f91a16c095d45584c88f82fbc4eb63a --- /dev/null +++ b/hcs/hdf_test/gpio_test_config.hcs @@ -0,0 +1,10 @@ +root { + module = "gpio"; + gpio_config { + gpio_controller_tester { + match_attr = "GPIO_TEST"; + gpio = 83; + gpioIrq = 83; + } + } +} diff --git a/hcs/hdf_test/hdf.hcs b/hcs/hdf_test/hdf.hcs new file mode 100644 index 0000000000000000000000000000000000000000..c253b38b7e0480649dd6e3c92caed2a313755cc7 --- /dev/null +++ b/hcs/hdf_test/hdf.hcs @@ -0,0 +1,14 @@ +#include "../hdf.hcs" +#include "hdf_config_test.hcs" +#include "hdf_test_manager/device_info.hcs" +#include "gpio_test_config.hcs" +#include "i2c_test_config.hcs" +#include "pwm_test_config.hcs" +#include "spi_test_config.hcs" +#include "sdio_test_config.hcs" +#include "emmc_test_config.hcs" +#include "uart_test_config.hcs" + +root { + module = "hisilicon,hi35xx_chip"; +} diff --git a/hcs/hdf_test/hdf_config_test.hcs b/hcs/hdf_test/hdf_config_test.hcs new file mode 100644 index 0000000000000000000000000000000000000000..ddc7b0962d429034be9df942546a952529c5905b --- /dev/null +++ b/hcs/hdf_test/hdf_config_test.hcs @@ -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; +} diff --git a/hcs/hdf_test/hdf_test_manager/device_info.hcs b/hcs/hdf_test/hdf_test_manager/device_info.hcs new file mode 100644 index 0000000000000000000000000000000000000000..7b723fb60b30b3f22c0e6b894132e02a49fa8029 --- /dev/null +++ b/hcs/hdf_test/hdf_test_manager/device_info.hcs @@ -0,0 +1,119 @@ +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 = 0; + permission = 0644; + moduleName = "sample_driver"; + serviceName = "sample_service"; + } + } + device_platform_test :: device { + gpio_tester :: deviceNode { + policy = 1; + priority = 101; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_GPIO_TEST"; + deviceMatchAttr = "GPIO_TEST"; + serviceName = "GPIO_TEST"; + } + i2c_tester :: deviceNode { + policy = 2; + priority = 101; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_I2C_TEST"; + deviceMatchAttr = "I2C_TEST"; + serviceName = "I2C_TEST"; + } + pwm_test :: deviceNode { + policy = 1; + priority = 110; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_PWM_TEST"; + serviceName = "PWM_TEST"; + deviceMatchAttr = "PWM_TEST"; + } + spi_test :: deviceNode { + policy = 1; + priority = 100; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_SPI_TEST"; + serviceName = "SPI_TEST"; + deviceMatchAttr = "SPI_TEST"; + } + emmc_tester :: deviceNode { + policy = 1; + priority = 100; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_EMMC_TEST"; + serviceName = "EMMC_TEST"; + deviceMatchAttr = "EMMC_TEST"; + } + sdio_tester :: deviceNode { + policy = 1; + priority = 100; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_SDIO_TEST"; + serviceName = "SDIO_TEST"; + deviceMatchAttr = "SDIO_TEST"; + } + watchdog_test :: deviceNode { + policy = 1; + priority = 110; + preload = 0; + permission = 0660; + moduleName = "PLATFORM_WATCHDOG_TEST"; + serviceName = "WATCHDOG_TEST"; + deviceMatchAttr = "WATCHDOG_TEST"; + } + mipi_dsi_test :: deviceNode { + policy = 1; + priority = 100; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_MIPI_DSI_TEST"; + serviceName = "PLATFORM_MIPI_DSI_TEST"; + deviceMatchAttr = "PLATFORM_MIPI_DSI_TEST"; + } + uart_tester :: deviceNode { + policy = 1; + priority = 100; + preload = 0; + permission = 0644; + moduleName = "PLATFORM_UART_TEST"; + serviceName = "UART_TEST"; + deviceMatchAttr = "UART_TEST"; + } + } + device_sensor_test :: device { + sensor_tester :: deviceNode { + policy = 0; + priority = 100; + preload = 0; + permission = 0644; + moduleName = "HDF_SENSOR_TEST_DRIVER"; + } + } + } + } +} + diff --git a/hcs/hdf_test/i2c_test_config.hcs b/hcs/hdf_test/i2c_test_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..596e23690b6243d451a8162bbd27e7208d268569 --- /dev/null +++ b/hcs/hdf_test/i2c_test_config.hcs @@ -0,0 +1,13 @@ +root { + module = "i2c"; + i2c_config { + i2c_controller_tester { + match_attr = "I2C_TEST"; + bus_num = 6; + dev_addr = 0x5d; + reg_addr = 0xd0; + reg_len = 2; + buf_size = 7; + } + } +} diff --git a/hcs/hdf_test/pwm_test_config.hcs b/hcs/hdf_test/pwm_test_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..d29d8cee0162c592f38eb8433c28b0f09a18ecc5 --- /dev/null +++ b/hcs/hdf_test/pwm_test_config.hcs @@ -0,0 +1,11 @@ +root { + pwm_test { + module = "pwm_test"; + match_attr = "PWM_TEST"; + num = 0; + period = 999; + duty = 333; + polarity = 0; + status = 1; + } +} diff --git a/hcs/hdf_test/sdio_test_config.hcs b/hcs/hdf_test/sdio_test_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..3141f078013b11da8fd44a6f61806b36125a23d6 --- /dev/null +++ b/hcs/hdf_test/sdio_test_config.hcs @@ -0,0 +1,12 @@ +root { + module = "sdio"; + sdio_config { + sdio_controller_tester { + match_attr = "SDIO_TEST"; + busNum = 1; + funcNum = 1; + vendorId = 0x296; + deviceId = 0x5347; + } + } +} diff --git a/hcs/hdf_test/spi_test_config.hcs b/hcs/hdf_test/spi_test_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..028707ed1b9f8e01e1cbb82609f9c3d48bff96d3 --- /dev/null +++ b/hcs/hdf_test/spi_test_config.hcs @@ -0,0 +1,10 @@ +root { + spi_test { + module = "spi_test"; + match_attr = "SPI_TEST"; + bus = 0; + cs = 0; + len = 8; + wbuf = [0xa1, 0xb2, 0xc3, 0xd4, 0xe5, 0xf6, 0x78, 0x90]; + } +} diff --git a/hcs/hdf_test/uart_test_config.hcs b/hcs/hdf_test/uart_test_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..54ae69c76e7005871eac9d99802e9b384214a1e6 --- /dev/null +++ b/hcs/hdf_test/uart_test_config.hcs @@ -0,0 +1,9 @@ +root { + uart_test { + module = "uart_test"; + match_attr = "UART_TEST"; + port = 1; + len = 8; + wbuf = [0xa1, 0xb2, 0xc3, 0xd4, 0xe5, 0xf6, 0x78, 0x90]; + } +} \ No newline at end of file diff --git a/hcs/input/input_config.hcs b/hcs/input/input_config.hcs new file mode 100755 index 0000000000000000000000000000000000000000..5cbcd7bbdd8b18bc9298ba23f5eabf0b53f7490c --- /dev/null +++ b/hcs/input/input_config.hcs @@ -0,0 +1,198 @@ +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"; + } + +// Hi3516DV300-Runhe gt911--5p5 & 4p0 + busConfig { + // 0:i2c 1:spi + busType = 0; + busNum = 6; + clkGpio = 86; + dataGpio = 87; + i2cClkIomux = [0x114f0048, 0x403]; + i2cDataIomux = [0x114f004c, 0x403]; + } + + pinConfig { + rstGpio = 3; + intGpio = 4; + rstRegCfg = [0x112f0094, 0x400]; + intRegCfg = [0x112f0098, 0x400]; + } + +// Hi3516DV300-Ruishi gt911--7p0 +/* + busConfig { + // 0:i2c 1:spi + busType = 0; + busNum = 6; + clkGpio = 26; + dataGpio = 27; + i2cClkIomux = [0x114f0048, 0x403]; + i2cDataIomux = [0x114f004c, 0x403]; + } + + pinConfig { + rstGpio = 13; + intGpio = 12; + rstRegCfg = [0x10ff0030, 0x400]; + intRegCfg = [0x10ff002C, 0x400]; + } +*/ +// Hi3516DV300-Demo board: ft6336--2p35 +/* + busConfig { + // 0:i2c 1:spi + busType = 0; + busNum = 3; + clkGpio = 2; + dataGpio = 1; + i2cClkIomux = [0x112f0090, 0x5f1]; + i2cDataIomux = [0x112f008c, 0x5f1]; + } + + pinConfig { + rstGpio = 3; + intGpio = 4; + rstRegCfg = [0x0, 0x0]; + intRegCfg = [0x112f0098, 0x5f0]; + } +*/ + powerConfig { + /* 0:unused 1:ldo 2:gpio 3:pmic */ + vccType = 2; + 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 = 0x5D; + /* 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] + 0:none 1:vcc-1.8v 2:vci-3.3v 3:reset 4:int + 0:off or low 1:on or high 2:no ops + 0:input 1:output 2:no ops + 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 + } + + chip1 :: touchChip { + match_attr = "zsj_gt911_4p0"; + chipInfo = "ZIDN45101"; + chipVersion = 1; //parse point by TypeB + } + + chip2 :: touchChip { + match_attr = "tg_gt911_7p0"; + vendorName = "tg"; + chipInfo = "ZIDN45102"; + chipVersion = 2; //parse point by TypeC + } + + chip3 :: touchChip { + match_attr = "st_ft6336_2p35"; + chipName = "ft6336"; + vendorName = "st"; + chipInfo = "ZIDN53200"; + deviceAddr = 0x38; + irqFlag = 1; // Rising + powerSequence { + /* [type, status, dir , delay] + 0:none 1:vcc-1.8v 2:vci-3.3v 3:reset 4:int + 0:off or low 1:on or high 2:no ops + 0:input 1:output 2:no ops + meanings delay xms, 20: delay 20ms + */ + powerOnSeq = [4, 2, 0, 0, + 3, 1, 1, 2, + 3, 0, 2, 5, + 3, 1, 2, 200]; + suspendSeq = [3, 0, 2, 10]; + resumeSeq = [3, 1, 2, 10]; + powerOffSeq = [3, 0, 2, 10, + 1, 0, 2, 20]; + } + } + } + } + } + + keyConfig { + keyList = ["power", "VolUp", "VolDown", "Up", "Down", "Left", "Right"]; + keyInfoList { + key1 { + match_attr = "key_device0"; + /* 0:touch 1:key 2:keyboard 3:mouse 4:button 5:crown 6:encoder */ + inputType = 1; + keyName = "power"; + gpioNum = 1; + irqFlag = 3; + debounceTime = 80; + } + + key2 { + keyName = "volUp"; + gpioNum = 31; + irqFlag = 1; + debounceTime = 80; + } + + key3 { + keyName = "volDown"; + gpioNum = 32; + irqFlag = 1; + debounceTime = 80; + } + } + } + } +} diff --git a/hcs/platform/emmc_config.hcs b/hcs/platform/emmc_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..0df7f43a6c20b8858bc5bb0993b505fc9724c814 --- /dev/null +++ b/hcs/platform/emmc_config.hcs @@ -0,0 +1,14 @@ +root { + platform { + emmc_config { + template emmc_controller { + match_attr = ""; + hostId = 0; + } + + controller_0x00 :: emmc_controller { + match_attr = "hisilicon_hi35xx_emmc_0"; + } + } + } +} diff --git a/hcs/platform/hi35xx_pwm_config.hcs b/hcs/platform/hi35xx_pwm_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..1dea99849fa6d3b7ab059844cbac64fbe95b5fca --- /dev/null +++ b/hcs/platform/hi35xx_pwm_config.hcs @@ -0,0 +1,24 @@ +root { + platform { + pwm_config { + template pwm_device { + serviceName = ""; + match_attr = ""; + num = 0; + base = 0x12070000; + } + + device_0x12070000 :: pwm_device { + match_attr = "hisilicon_hi35xx_pwm_0"; + } + + device_0x12070020 :: pwm_device { + match_attr = "hisilicon_hi35xx_pwm_1"; + num = 1; + base = 0x12070020; + } + } + } +} + + diff --git a/hcs/platform/hi35xx_spi_config.hcs b/hcs/platform/hi35xx_spi_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..edb459c7f1000d5a2b8e171d57df29a1bed10507 --- /dev/null +++ b/hcs/platform/hi35xx_spi_config.hcs @@ -0,0 +1,32 @@ +root { + platform { + spi_config { + template spi_controller { + serviceName = ""; + match_attr = ""; + busNum = 0; + numCs = 0; + } + + controller_0x120c0000 :: spi_controller { + busNum = 0; + numCs = 1; + match_attr = "hisilicon_hi35xx_spi_0"; + } + + controller_0x120c1000 :: spi_controller { + match_attr = "hisilicon_hi35xx_spi_1"; + busNum = 1; + numCs = 2; + } + + controller_0x120c2000 :: spi_controller { + match_attr = "hisilicon_hi35xx_spi_2"; + busNum = 2; + numCs = 1; + } + } + } +} + + diff --git a/hcs/platform/hi35xx_uart_config.hcs b/hcs/platform/hi35xx_uart_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..1a3f8e8af46820afa900e9c740a81e1cce31809a --- /dev/null +++ b/hcs/platform/hi35xx_uart_config.hcs @@ -0,0 +1,20 @@ +root { + platform { + uart_config { + template uart_device { + serviceName = ""; + match_attr = ""; + driver_name = "ttyAMA"; + num = 0; + } + + device_uart_0x0000 :: uart_device { + match_attr = "hisilicon_hi35xx_uart_0"; + } + device_uart_0x0001 :: uart_device { + num = 1; + match_attr = "hisilicon_hi35xx_uart_1"; + } + } + } +} diff --git a/hcs/platform/hi35xx_watchdog_config.hcs b/hcs/platform/hi35xx_watchdog_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..91eaf822acd4d2d8be4f3121c2df13f0e5a8dd32 --- /dev/null +++ b/hcs/platform/hi35xx_watchdog_config.hcs @@ -0,0 +1,16 @@ +root { + platform { + watchdog_config { + template watchdog_device { + serviceName = "HDF_PLATFORM_WATCHDOG_0"; + match_attr = ""; + id = 0; + } + + device_0x12050000 :: watchdog_device { + id = 0; + match_attr = "hisilicon_hi35xx_watchdog_0"; + } + } + } +} \ No newline at end of file diff --git a/hcs/platform/i2c_config.hcs b/hcs/platform/i2c_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..7bc3d003306462e3efc4e1f7522a7d3c84d12395 --- /dev/null +++ b/hcs/platform/i2c_config.hcs @@ -0,0 +1,36 @@ +root { + platform { + i2c_config { + match_attr = "linux_i2c_adapter"; + + template i2c_controller { + bus = 0; + } + + controller_0x120b0000 :: i2c_controller { + bus = 0; + } + controller_0x120b1000 :: i2c_controller { + bus = 1; + } + controller_0x120b2000 :: i2c_controller { + bus = 2; + } + controller_0x120b3000 :: i2c_controller { + bus = 3; + } + controller_0x120b4000 :: i2c_controller { + bus = 4; + } + controller_0x120b5000 :: i2c_controller { + bus = 5; + } + controller_0x120b6000 :: i2c_controller { + bus = 6; + } + controller_0x120b7000 :: i2c_controller { + bus = 7; + } + } + } +} diff --git a/hcs/platform/sdio_config.hcs b/hcs/platform/sdio_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..c4fd83d172cd3d2d6419ca3ef22a7722e1ec26ef --- /dev/null +++ b/hcs/platform/sdio_config.hcs @@ -0,0 +1,21 @@ +root { + platform { + sdio_config { + template sdio_controller { + match_attr = ""; + funcNum = 1; + vendorId = 0x296; + deviceId = 0x5347; + } + + controller_0x2dd1 :: sdio_controller { + match_attr = "hisilicon_hi35xx_sdio_0"; + deviceId = 0x2dd1; + } + + controller_0x5347 :: sdio_controller { + match_attr = "hisilicon_hi35xx_sdio_1"; + } + } + } +} diff --git a/hcs/sensor/accel/accel_config.hcs b/hcs/sensor/accel/accel_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..ceebff63f6f32a09e52e3602636c3bd6853c3c5e --- /dev/null +++ b/hcs/sensor/accel/accel_config.hcs @@ -0,0 +1,32 @@ +// accel sensor common config template +root { + sensorAccelConfig { + accelChipConfig { + template sensorInfo { + sensorName = "accelerometer"; // max string length is 16 bytes + vendorName = "borsh_bmi160"; // max string length is 16 bytes + firmwareVersion = "1.0"; + hardwareVersion = "1.0"; + sensorTypeId = 1; // enum SensorTypeTag + sensorId = 1; // user define sensor id, defaultenum SensorTypeTag + maxRange = 8; // g + accuracy = 0; + power = 230; + } + + template sensorBusConfig { + busType = 0; // 0:i2c 1:spi + busNum = 6; + busAddr = 0; + regWidth = 1; + regBigEndian = 0; + } + + template sensorAttr { + chipName = ""; + chipIdRegister = 0xf; + chipIdValue = 0xd1; + } + } + } +} diff --git a/hcs/sensor/accel/bmi160_config.hcs b/hcs/sensor/accel/bmi160_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..df6bb9d44da772981ba0026197d9af120cc2afb2 --- /dev/null +++ b/hcs/sensor/accel/bmi160_config.hcs @@ -0,0 +1,50 @@ +#include "accel_config.hcs" +root { + sensorAccelConfig { + accel_bmi160_chip_config : accelChipConfig { + match_attr = "hdf_sensor_accel_driver"; + accelInfo :: sensorInfo { + vendorName = "borsh_bmi160"; // max string length is 16 bytes + sensorTypeId = 1; // enum SensorTypeTag + sensorId = 1; // user define sensor id + } + accelBusConfig :: sensorBusConfig { + busType = 0; // 0:i2c 1:spi + busNum = 6; + busAddr = 0x68; + regWidth = 1; // 1btye + } + accelAttr :: sensorAttr { + chipName = "bmi160"; + chipIdRegister = 0x00; + chipIdValue = 0xd1; + } + accelRegConfig { + /* regAddr: register address + value: config register value + len: size of value + mask: mask of value + delay: config register delay time (ms) + opsType: enum SensorOpsType 0-none 1-read 2-write 3-read_check 4-update_bit + calType: enum SensorBitCalType 0-none 1-set 2-revert 3-xor 4-left shift 5-right shift + shiftNum: shift bits + debug: 0-no debug 1-debug + save: 0-no save 1-save + */ + /* regAddr, value, mask, len, delay, opsType, calType, shiftNum, debug, save */ + initSeqConfig = [ + 0x7e, 0xb6, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + enableSeqConfig = [ + 0x7e, 0x11, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x41, 0x03, 0xff, 1, 0, 2, 0, 0, 0, 0, + 0x40, 0x08, 0xff, 1, 0, 2, 0, 0, 0, 0 + ]; + disableSeqConfig = [ + 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + } + } + } +} \ No newline at end of file diff --git a/hcs/sensor/sensor_config.hcs b/hcs/sensor/sensor_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..fa1bbc011549f68d696848be28a2e39e98af44ef --- /dev/null +++ b/hcs/sensor/sensor_config.hcs @@ -0,0 +1 @@ +#include "accel/bmi160_config.hcs" \ No newline at end of file diff --git a/hcs/wifi/wlan_chip_hi3881.hcs b/hcs/wifi/wlan_chip_hi3881.hcs new file mode 100644 index 0000000000000000000000000000000000000000..2454e79efa11285fa188b026b38e7fb744f3dc6e --- /dev/null +++ b/hcs/wifi/wlan_chip_hi3881.hcs @@ -0,0 +1,14 @@ +root { + wlan_config { + hi3881 :& chipList { + chipHi3881 :: chipInst { + match_attr = "hdf_wlan_chips_hi3881"; + driverName = "hisi"; + sdio { + vendorId = 0x0296; + deviceId = [0x5347]; + } + } + } + } +} \ No newline at end of file diff --git a/hcs/wifi/wlan_platform.hcs b/hcs/wifi/wlan_platform.hcs new file mode 100644 index 0000000000000000000000000000000000000000..b71c14a8be507f315650e575acfa430ce033a12f --- /dev/null +++ b/hcs/wifi/wlan_platform.hcs @@ -0,0 +1,112 @@ +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 = 91; + 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 = 90; + 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]; + } + } + } + } +} \ No newline at end of file