change and delete some niobe407 hdf_config hcs to suit macro style and fix shell read bug

Signed-off-by: long_xingkai <longxingkai@talkweb.com.cn>
Change-Id: Id24df3b5c18800317bf25e55a7eb498e0f3ae3ff
This commit is contained in:
long_xingkai
2022-04-07 11:44:34 +08:00
parent d85a890422
commit f2f045ad86
20 changed files with 464 additions and 527 deletions
+1
View File
@@ -15,4 +15,5 @@ menuconfig BOARD_NIOBE407
bool "select board niobe407"
depends on SOC_STM32F407
orsource "liteos_m/hdf_config/Kconfig.liteos_m.board"
orsource "applications/Kconfig.board.applications"
+6 -6
View File
@@ -154,15 +154,15 @@ static INT32 InitDebugShellUart(uint32_t port)
static void HdfShellTaskEntry(void)
{
while(1) {
int ret = 0;
memset_s(rbuf, MAX_BUF_SIZE, 0, MAX_BUF_SIZE);
int32_t ret = UartRead(handle, rbuf, MAX_BUF_SIZE);
if (ret < 0) {
int32_t readLen = UartRead(handle, rbuf, MAX_BUF_SIZE);
if (readLen < 0) {
return;
} else {
RingBufWriteMore(g_debugRingBuf, rbuf, ret);
ret = LOS_EventWrite(&g_shellInputEvent, 0x1);
if (ret != 0) {
return;
for (int i = 0; i < readLen; i++) {
(void)RingBufWrite(g_debugRingBuf, rbuf[i]);
(void)LOS_EventWrite(&g_shellInputEvent, 0x1);
}
}
}
+21 -17
View File
@@ -15,24 +15,28 @@ import("//kernel/liteos_m/liteos.gni")
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
if (defined(LOSCFG_FS_LITTLEFS) && defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) {
sources = [
"src/fs_init.c",
"src/littlefs.c",
]
if (defined(LOSCFG_FS_LITTLEFS) && defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) {
sources = [
"src/fs_init.c",
"src/littlefs.c",
]
if (defined(LOSCFG_NIOBE407_USE_HDF) &&
defined(LOSCFG_DRIVERS_HDF_CONFIG_MACRO)) {
deps = [ "//device/board/talkweb/niobe407/liteos_m/hdf_config" ]
}
}
}
config("public") {
if (defined(LOSCFG_FS_LITTLEFS) && defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) {
include_dirs = [
"include",
"//drivers/framework/include/platform",
"//drivers/framework/include/utils",
"//drivers/adapter/khdf/liteos_m/osal/include",
"//drivers/framework/include/osal",
"//drivers/framework/include/core",
"//drivers/framework/core/common/include/host"
]
}
}
if (defined(LOSCFG_FS_LITTLEFS) && defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) {
include_dirs = [
"include",
"//drivers/framework/include/platform",
"//drivers/framework/include/utils",
"//drivers/adapter/khdf/liteos_m/osal/include",
"//drivers/framework/include/osal",
"//drivers/framework/include/core",
"//drivers/framework/core/common/include/host",
]
}
}
+11 -12
View File
@@ -11,16 +11,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//drivers/adapter/khdf/liteos_m/hdf.gni")
module_name = "hdf_hcs"
hdf_driver(module_name) {
if (defined(LOSCFG_DRIVERS_HDF_PLATFORM)) {
hcs_sources = [ "hdf.hcs" ]
}
visibility += [
"$device_path",
".",
]
if (ohos_kernel_type == "liteos_m") {
import("//drivers/adapter/khdf/liteos_m/hdf_hcs.gni")
module_switch = defined(LOSCFG_NIOBE407_USE_HDF)
macro_switch = defined(LOSCFG_DRIVERS_HDF_CONFIG_MACRO)
module_name = get_path_info(rebase_path("."), "name")
config("public") {
include_dirs = [ "$target_gen_dir" ]
}
hdf_driver(module_name) {
hcs_sources = [ "default.hcs" ]
}
}
@@ -0,0 +1,19 @@
# Copyright (c) 2022 Talkweb 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.
config NIOBE407_USE_HDF
bool "niobe407_hdf"
depends on BOARD_NIOBE407
select DRIVERS_HDF_PLATFORM_GPIO
select DRIVERS_HDF_PLATFORM_SPI
select DRIVERS_HDF_PLATFORM_UART
+68
View File
@@ -0,0 +1,68 @@
#include "default_device_info.hcs"
root {
platform {
gpio_config {
match_attr = "gpio_config";
pin = [0, 1, 2, 3, 4, 5]; // pin index when register to hdf framework 0-3 spi flash gpio 4-5 uart1
realPin = [ 5, 5, 4, 15, 6, 7]; // pin number in stm32 led2 pe5, led3 pe6,
group = [ 0, 1, 1, 0, 1, 1]; // group of gpio 0:GPIOA 1:GPIOB 2:GPIOC 3:GPIOD 4:GPIOE 5: GPIOF 6:GPIOG 7:GPIOH 8:GPIOI
mode = [ 2, 2, 2 ,1, 2, 2]; // 0: input 1: output 2:alternate 3:analog
speed = [ 3, 3, 3, 3, 3, 3]; // 0: low 1: middle 2:high 3:very_high
pull = [ 0, 0, 0, 0, 1, 1]; // 0: nopull 1:up 2:down
pinNum = 6;
output = [ 0, 0, 0, 0, 0, 0]; // 0:pushpull 1:opendrain
alternate = [ 5, 5, 5, 0, 7, 7];
}
spi_config {
spi_config1 {
match_attr = "spi_w25q_config";
busNum = 0;
csNum = 0;
transDir = 0; // 0: TW_HAL_SPI_FULL_DUPLEX 1: TW_HAL_SPI_SIMPLEX_RX 2: TW_HAL_SPI_HALF_DUPLEX_RX 3: TW_HAL_SPI_HALF_DUPLEX_TX
transMode = 1; // 1: normal 0:dma
smMode = 1; // 0: slave 1: master
dataWidth = 0; // 0:8bit 1:16bit
clkMode = 0; // 0: cpol 0 cpha 0 1:CPOL = 1; CPHA = 0 2:CPOL = 0; CPHA = 1 3:CPOL = 1; CPHA = 1
nss = 0; // 0:NSS SOFT 1: NSS HARDWARE INPUT 2: NSS HARDWARE OUTPUT
baudRate = 1; // 0:div2 1:div4 2:div8 3:div16 4:div32 5:div64 6:div128 6:div256
bitOrder = 0; // 0: MSB first 1: LSB first
crcEnable = 0; // 0: crc disable 1: crc enable
crcPoly = 10; // Min_Data = 0x00 and Max_Data = 0xFFFF
spix = 0; // 0: spi1 1: spi2 2:spi3
csPin = 15;
csGpiox = 0;
standard = 0; // 0:motorola 1: ti
dummyByte = 255;
}
}
uart_config {
uart1_config {
match_attr = "uart_config1";
num = 1; // 1 :usart1 2: USART2 3:USART3 4:UART4 5:UART5 6:USART6
baudRate = 115200; // baudrate
dataWidth = 0; // 0:8bit 1:9bit
stopBit = 1; // 0:0.5stop bits 1:1 stop bit 2:1.5 stop bits 2:2 stop bits
parity = 0; // 0: none 1: event 2:odd
transDir = 3; // 0: dir none 1: rx 2: tx 3:tx and rx
flowCtrl = 0; // 0: no flowcontrl 1: flowContorl RTS 2: flowControl CTS 3: flowControl RTS AND CTS
overSimpling = 0; // 0: overSimpling 16bits 1: overSimpling 8bits
transMode = 0; // 0:block 1:noblock 2:TX DMA RX NORMAL 3:TX NORMAL RX DMA 4: USART_TRANS_TX_RX_DMA
uartType = 0; // 0 : 232 1: 485
uartDePin = 0; // usart 485 pin
uartDeGroup = 0; // usart 485 control line
}
}
}
misc {
fs_config {
littlefs_config {
match_attr = "littlefs_config";
mount_points = ["/talkweb"];
partitions = [0x800000];
block_size = [4096];
block_count = [256];
}
}
}
}
@@ -1,55 +1,65 @@
root {
module = "talkweb,stm32f407";
device_info {
match_attr = "hdf_manager";
template host {
hostName = "";
priority = 100;
template device {
template deviceNode {
policy = 0;
priority = 80;
preload = 0;
permission = 0664;
moduleName = "";
serviceName = "";
deviceMatchAttr = "";
}
}
}
platform :: host {
priority = 50;
hostName = "platform_host";
device_spi :: device {
spi0 :: deviceNode {
policy = 2;
priority = 80;
moduleName = "ST_SPI_MODULE_HDF";
serviceName = "HDF_PLATFORM_SPI_0";
deviceMatchAttr = "spi_w25q_config";
}
}
device_uart2 :: device {
uart1 :: deviceNode {
root {
module = "talkweb,stm32f407";
device_info {
match_attr = "hdf_manager";
template host {
hostName = "";
priority = 100;
template device {
template deviceNode {
policy = 0;
priority = 100;
preload = 0;
permission = 0664;
moduleName = "";
serviceName = "";
deviceMatchAttr = "";
}
}
}
platform :: host {
hostName = "platform_host";
priority = 50;
device_gpio :: device {
gpio0 :: deviceNode {
policy = 0;
priority = 60;
moduleName = "ST_GPIO_MODULE_HDF";
serviceName = "HDF_PLATFORM_GPIO";
deviceMatchAttr = "gpio_config";
}
}
device_spi :: device {
spi0 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_SPI_MODULE_HDF";
serviceName = "HDF_PLATFORM_SPI_0";
deviceMatchAttr = "spi_w25q_config";
}
}
device_uart1 :: device {
uart1 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_UART_MODULE_HDF";
serviceName = "HDF_PLATFORM_UART_1";
deviceMatchAttr = "uart_config1";
}
}
}
misc :: host {
hostName = "misc_host";
priority = 100;
fs :: device {
littlefs :: deviceNode {
policy = 0;
priority = 100;
moduleName = "HDF_FS_LITTLEFS";
deviceMatchAttr = "littlefs_config";
}
}
}
}
}
}
}
misc :: host {
hostName = "misc_host";
priority = 100;
fs :: device {
littlefs :: deviceNode {
policy = 0;
priority = 100;
moduleName = "HDF_FS_LITTLEFS";
deviceMatchAttr = "littlefs_config";
}
}
}
}
}
@@ -1,34 +0,0 @@
root {
module = "talkweb,stm32f407";
device_info {
match_attr = "hdf_manager";
template host {
hostName = "";
priority = 100;
template device {
template deviceNode {
policy = 0;
priority = 100;
preload = 0;
permission = 0664;
moduleName = "";
serviceName = "";
deviceMatchAttr = "";
}
}
}
platform :: host {
hostName = "platform_host";
priority = 50;
device_gpio :: device {
gpio0 :: deviceNode {
policy = 0;
priority = 60;
moduleName = "ST_GPIO_MODULE_HDF";
serviceName = "HDF_PLATFORM_GPIO";
deviceMatchAttr = "gpio_config";
}
}
}
}
}
@@ -0,0 +1,137 @@
root {
module = "talkweb,stm32f407";
device_info {
match_attr = "hdf_manager";
template host {
hostName = "";
priority = 100;
template device {
template deviceNode {
policy = 0;
priority = 100;
preload = 0;
permission = 0664;
moduleName = "";
serviceName = "";
deviceMatchAttr = "";
}
}
}
platform :: host {
hostName = "platform_host";
priority = 50;
device_gpio :: device {
gpio0 :: deviceNode {
policy = 0;
priority = 60;
moduleName = "ST_GPIO_MODULE_HDF";
serviceName = "HDF_PLATFORM_GPIO";
deviceMatchAttr = "gpio_config";
}
}
device_pwm1 :: device {
pwm1 :: deviceNode { // pwm config
policy = 2;
priority = 100;
moduleName = "ST_HDF_PLATFORM_PWM";
serviceName = "HDF_PLATFORM_PWM_1";
deviceMatchAttr = "config_pwm1";
}
}
device_pwm2 :: device {
pwm2 :: deviceNode { // pwm config
policy = 2;
priority = 100;
moduleName = "ST_HDF_PLATFORM_PWM";
serviceName = "HDF_PLATFORM_PWM_2";
deviceMatchAttr = "config_pwm2";
}
}
device_pwm7 :: device {
pwm7 :: deviceNode { // pwm config
policy = 2;
priority = 100;
moduleName = "ST_HDF_PLATFORM_PWM";
serviceName = "HDF_PLATFORM_PWM_7";
deviceMatchAttr = "config_pwm7";
}
}
device_spi :: device {
spi0 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_SPI_MODULE_HDF";
serviceName = "HDF_PLATFORM_SPI_0";
deviceMatchAttr = "spi_w25q_config";
}
}
device_uart1 :: device {
uart1 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_UART_MODULE_HDF";
serviceName = "HDF_PLATFORM_UART_1";
deviceMatchAttr = "uart_config1";
}
}
device_uart4 :: device {
uart4 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_UART_MODULE_HDF";
serviceName = "HDF_PLATFORM_UART_4";
deviceMatchAttr = "uart_config4";
}
}
device_uart5 :: device {
uart5 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_UART_MODULE_HDF";
serviceName = "HDF_PLATFORM_UART_5";
deviceMatchAttr = "uart_config5";
}
}
device_i2c :: device {
i2c_manager :: deviceNode {
policy = 2;
priority = 50;
moduleName = "HDF_PLATFORM_I2C_MANAGER";
serviceName = "HDF_PLATFORM_I2C_MANAGER";
}
i2c3 :: deviceNode {
policy = 0;
priority = 100;
preload = 0;
permission = 0664;
moduleName = "HDF_I2C";
serviceName = "HDF_PLATFORM_I2C_3";
deviceMatchAttr = "i2c3_config";
}
}
device_watchdog :: device {
watchdog0 :: deviceNode {
policy = 1;
priority = 20;
permission = 0644;
moduleName = "ST_WATCHDOG_MODULE_HDF";
serviceName = "HDF_PLATFORM_WATCHDOG_0";
deviceMatchAttr = "st_watchdog";
}
}
}
misc :: host {
hostName = "misc_host";
priority = 100;
fs :: device {
littlefs :: deviceNode {
policy = 0;
priority = 100;
moduleName = "HDF_FS_LITTLEFS";
deviceMatchAttr = "littlefs_config";
}
}
}
}
}
@@ -1,49 +0,0 @@
root {
module = "talkweb,stm32f407";
device_info {
match_attr = "hdf_manager";
template host {
hostName = "";
priority = 100;
template device {
template deviceNode {
policy = 0;
priority = 100;
preload = 0;
permission = 0664;
moduleName = "ST_HDF_PLATFORM_PWM";
serviceName = "";
deviceMatchAttr = "";
}
}
}
platform :: host {
hostName = "platform_host";
priority = 50;
device_pwm1 :: device {
pwm1 :: deviceNode { // pwm config
policy = 2;
priority = 100;
serviceName = "HDF_PLATFORM_PWM_1";
deviceMatchAttr = "config_pwm1";
}
}
device_pwm2 :: device {
pwm2 :: deviceNode { // pwm config
policy = 2;
priority = 100;
serviceName = "HDF_PLATFORM_PWM_2";
deviceMatchAttr = "config_pwm2";
}
}
device_pwm7 :: device {
pwm7 :: deviceNode { // pwm config
policy = 2;
priority = 100;
serviceName = "HDF_PLATFORM_PWM_7";
deviceMatchAttr = "config_pwm7";
}
}
}
}
}
@@ -1,33 +0,0 @@
root {
module = "talkweb,stm32f407";
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";
device_spi :: device {
spi0 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_SPI_MODULE_HDF";
serviceName = "HDF_PLATFORM_SPI_0";
deviceMatchAttr = "spi_w25q_config";
}
}
}
}
}
@@ -1,42 +0,0 @@
root {
module = "talkweb,stm32f407";
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";
device_uart :: device {
uart4 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_UART_MODULE_HDF";
serviceName = "HDF_PLATFORM_UART_4";
deviceMatchAttr = "uart_config4";
}
}
device_uart1 :: device {
uart5 :: deviceNode {
policy = 2;
priority = 100;
moduleName = "ST_UART_MODULE_HDF";
serviceName = "HDF_PLATFORM_UART_5";
deviceMatchAttr = "uart_config5";
}
}
}
}
}
@@ -1,35 +0,0 @@
root {
module = "talkweb,stm32f407";
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_watchdog :: device {
watchdog0 :: deviceNode {
policy = 1;
priority = 20;
permission = 0644;
moduleName = "ST_WATCHDOG_MODULE_HDF";
serviceName = "HDF_PLATFORM_WATCHDOG_0";
deviceMatchAttr = "st_watchdog";
}
}
}
}
}
+142 -1
View File
@@ -1 +1,142 @@
#include "hdf_littlefs.hcs"
#include "device_info.hcs"
root {
platform {
gpio_config {
match_attr = "gpio_config"; // 0-3 gpio test, 4-6 pwm test , 7-10 spi flash 11-12 uart4 13-15 uart5 16-17 uart1 debug com 18-19 i2c test
pin = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]; // pin index when register to hdf framework
realPin = [5, 6, 0, 1, 3, 6, 5, 5, 5, 4, 15, 10, 11, 12, 2, 12, 6, 7, 7, 8]; // pin number in stm32 led2 pe5, led3 pe6,
group = [4, 4, 4, 4, 0, 0, 8, 0, 1, 1, 0, 2, 2, 2, 3, 6, 1, 1, 7, 7]; // group of gpio 0:GPIOA 1:GPIOB 2:GPIOC 3:GPIOD 4:GPIOE 5: GPIOF 6:GPIOG 7:GPIOH 8:GPIOI
mode = [1, 1, 0, 0, 2, 2, 2, 2, 2, 2 ,1, 2, 2, 2, 2, 1, 2, 2, 2, 2]; // 0: input 1: output 2:alternate 3:analog
speed = [0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]; // 0: low 1: middle 2:high 3:very_high
pull = [0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2, 1, 1, 0, 0]; // 0: nopull 1:up 2:down
pinNum = 20;
output = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]; // 0:pushpull 1:opendrain
alternate = [0, 0, 0, 0, 1, 2, 3, 5, 5, 5, 0, 8, 8, 8, 8, 0, 7, 7, 4, 4];
}
pwm_config {
pwm1_config {
match_attr = "config_pwm1"; // default use pwm1
pwmTim = 1; // timID tim2 0 :tim1, 1:tim2 ..... tim6 and tim7can't not use for pwm
pwmCh = 3; // tim chanel 4 0:ch1 1:ch2 2:ch3 3:ch4
prescaler = 4199; // prescaler for example tim2 clock is 84M, (84M/(4199+1)) = 20khz,
// set 20khz to caculate stanard ,tim2-tim7, tim12-tim14is 84M TIM8~TIM11 is 168M
// tim1~tim5 tim8 have 4 channel tim9,tim12 only have ch1, ch2, tim10, tim11,tim13,tim14 only ch1
}
pwm2_config {
match_attr = "config_pwm2";
pwmTim = 2;
pwmCh = 0;
prescaler = 8399;
}
pwm3_config {
match_attr = "config_pwm7";
pwmTim = 7;
pwmCh = 0;
prescaler = 8399;
}
}
spi_config {
spi_config1 {
match_attr = "spi_w25q_config";
busNum = 0;
csNum = 0;
transDir = 0; // 0: TW_HAL_SPI_FULL_DUPLEX 1: TW_HAL_SPI_SIMPLEX_RX 2: TW_HAL_SPI_HALF_DUPLEX_RX 3: TW_HAL_SPI_HALF_DUPLEX_TX
transMode = 1; // 1: normal 0:dma
smMode = 1; // 0: slave 1: master
dataWidth = 0; // 0:8bit 1:16bit
clkMode = 0; // 0: cpol 0 cpha 0 1:CPOL = 1; CPHA = 0 2:CPOL = 0; CPHA = 1 3:CPOL = 1; CPHA = 1
nss = 0; // 0:NSS SOFT 1: NSS HARDWARE INPUT 2: NSS HARDWARE OUTPUT
baudRate = 1; // 0:div2 1:div4 2:div8 3:div16 4:div32 5:div64 6:div128 6:div256
bitOrder = 0; // 0: MSB first 1: LSB first
crcEnable = 0; // 0: crc disable 1: crc enable
crcPoly = 10; // Min_Data = 0x00 and Max_Data = 0xFFFF
spix = 0; // 0: spi1 1: spi2 2:spi3
csPin = 15;
csGpiox = 0;
standard = 0; // 0:motorola 1: ti
dummyByte = 255;
}
}
uart_config {
uart1_config {
match_attr = "uart_config1";
num = 1; // 1 :usart1 2: USART2 3:USART3 4:UART4 5:UART5 6:USART6
baudRate = 115200; // baudrate
dataWidth = 0; // 0:8bit 1:9bit
stopBit = 1; // 0:0.5stop bits 1:1 stop bit 2:1.5 stop bits 2:2 stop bits
parity = 0; // 0: none 1: event 2:odd
transDir = 3; // 0: dir none 1: rx 2: tx 3:tx and rx
flowCtrl = 0; // 0: no flowcontrl 1: flowContorl RTS 2: flowControl CTS 3: flowControl RTS AND CTS
overSimpling = 0; // 0: overSimpling 16bits 1: overSimpling 8bits
transMode = 0; // 0:block 1:noblock 2:TX DMA RX NORMAL 3:TX NORMAL RX DMA 4: USART_TRANS_TX_RX_DMA
uartType = 0; // 0 : 232 1: 485
uartDePin = 0; // usart 485 pin
uartDeGroup = 0; // usart 485 control line
}
uart4_config {
match_attr = "uart_config4";
num = 4; // 1 :uart1 2: USART2 3:USART3 4:UART4 5:UART5 6:USART6
baudRate = 115200; // baudrate
dataWidth = 0; // 0:8bit 1:9bit
stopBit = 1; // 0:0.5stop bits 1:1 stop bit 2:1.5 stop bits 2:2 stop bits
parity = 0; // 0: none 1: event 2:odd
transDir = 3; // 0: dir none 1: rx 2: tx 3:tx and rx
flowCtrl = 0; // 0: no flowcontrl 1: flowContorl RTS 2: flowControl CTS 3: flowControl RTS AND CTS
overSimpling = 0; // 0: overSimpling 16bits 1: overSimpling 8bits
transMode = 0; // 0:block 1:noblock 2:TX DMA RX NORMAL 3:TX NORMAL RX DMA 4: USART_TRANS_TX_RX_DMA
uartType = 0; // 0 : 232 1: 485
uartDePin = 0; // usart 485 pin
uartDeGroup = 0; // usart 485 control line
}
uart5_config {
match_attr = "uart_config5";
num = 5; // 1 :uart1 2: USART2 3:USART3 4:UART4 5:UART5 6:USART6
baudRate = 115200; // baudrate
dataWidth = 0; // 0:8bit 1:9bit
stopBit = 1; // 0:0.5stop bits 1:1 stop bit 2:1.5 stop bits 2:2 stop bits
parity = 0; // 0: none 1: event 2:odd
transDir = 3; // 0: dir none 1: rx 2: tx 3:tx and rx
flowCtrl = 0; // 0: no flowcontrl 1: flowContorl RTS 2: flowControl CTS 3: flowControl RTS AND CTS
overSimpling = 0; // 0: overSimpling 16bits 1: overSimpling 8bits
transMode = 0; // 0:block 1:noblock 2:TX DMA RX NORMAL 3:TX NORMAL RX DMA 4: USART_TRANS_TX_RX_DMA
uartType = 1; // 0 : 232 1: 485
uartDePin = 12; // usart 485 pin
uartDeGroup = 6; // usart 485 control line
}
}
i2c_config {
i2c3_config {
match_attr = "i2c3_config";
port = 3;
devMode = 0; //0 = master, 1= slave
devAddr = 0;
speed = 100000;
}
}
watchdog_config {
template watchdog_controller {
id = 0;
regBase = 0x12050000;
regStep = 0x1000;
timeout = 1000; // watchdog interval(ms)
match_attr = "";
}
st_watchdog :: watchdog_controller {
match_attr = "st_watchdog";
timeout = 500;
}
}
}
misc {
fs_config {
littlefs_config {
match_attr = "littlefs_config";
mount_points = ["/talkweb"];
partitions = [0x800000];
block_size = [4096];
block_count = [256];
}
}
}
}
-18
View File
@@ -1,18 +0,0 @@
#include "device_gpio_info.hcs"
root {
platform {
gpio_config {
match_attr = "gpio_config";
pin = [0, 1, 2, 3]; // pin index when register to hdf framework
realPin = [5, 6, 0, 1]; // pin number in stm32 led2 pe5, led3 pe6,
group = [4, 4, 4, 4]; // group of gpio 0:GPIOA 1:GPIOB 2:GPIOC 3:GPIOD 4:GPIOE 5: GPIOF 6:GPIOG 7:GPIOH 8:GPIOI
mode = [1, 1, 0, 0]; // 0: input 1: output 2:alternate 3:analog
speed = [0, 0, 0, 0]; // 0: low 1: middle 2:high 3:very_high
pull = [0, 0, 0, 0]; // 0: nopull 1:up 2:down
pinNum = 4;
output = [0, 0, 0, 0]; // 0:pushpull 1:opendrain
alternate = [0, 0, 0, 0];
}
}
}
@@ -1,74 +0,0 @@
#include "device_littlefs_info.hcs"
root {
platform {
spi1 {
spi_gpio {
gpio_num_max = 4;
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [0, 5, 2, 3, 0, 0, 5]; // clk pa5
gpio_num_2 = [1, 5, 2, 3, 0, 0, 5]; // mosi pb5
gpio_num_3 = [1, 4, 2, 3, 0, 0, 5]; // miso pb4
gpio_num_4 = [0, 15, 1, 3, 0, 0 ,0]; // cs pa15
}
spi_config : spi_gpio{
match_attr = "spi_w25q_config";
busNum = 0;
csNum = 0;
transDir = 0; // 0: HAL_SPI_FULL_DUPLEX 1: HAL_SPI_SIMPLEX_RX 2: HAL_SPI_HALF_DUPLEX_RX 3: HAL_SPI_HALF_DUPLEX_TX
transMode = 1; // 1: normal 0:dma
smMode = 1; // 0: slave 1: master
dataWidth = 0; // 0:8bit 1:16bit
clkMode = 0; // 0: cpol 0 cpha 0 1:CPOL = 1; CPHA = 0 2:CPOL = 0; CPHA = 1 3:CPOL = 1; CPHA = 1
nss = 0; // 0:NSS SOFT 1: NSS HARDWARE INPUT 2: NSS HARDWARE OUTPUT
baudRate = 1; // 0:div2 1:div4 2:div8 3:div16 4:div32 5:div64 6:div128 6:div256
bitOrder = 0; // 0: MSB first 1: LSB first
crcEnable = 0; // 0: crc disable 1: crc enable
crcPoly = 10; // Min_Data = 0x00 and Max_Data = 0xFFFF
spix = 0; // 0: spi1 1: spi2 2:spi3
csPin = 15;
csGpiox = 0;
standard = 0; // 0:motorola 1: ti
dummyByte = 255;
}
}
uart1 {
uart_gpio {
gpio_num_max = 2;
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [1, 6, 2, 3, 0, 1, 7]; // tx pb6
gpio_num_2 = [1, 7, 2, 3, 0, 1, 7]; // rx pb7
}
uart_config1 : uart_gpio {
match_attr = "uart_config1";
num = 1; // 1 :usart1 2: USART2 3:USART3 4:UART4 5:UART5 6:USART6
baudRate = 115200; // baudrate
dataWidth = 0; // 0:8bit 1:9bit
stopBit = 1; // 0:0.5stop bits 1:1 stop bit 2:1.5 stop bits 2:2 stop bits
parity = 0; // 0: none 1: event 2:odd
transDir = 3; // 0: dir none 1: rx 2: tx 3:tx and rx
flowCtrl = 0; // 0: no flowcontrl 1: flowContorl RTS 2: flowControl CTS 3: flowControl RTS AND CTS
overSimpling = 0; // 0: overSimpling 16bits 1: overSimpling 8bits
idleIrq = 1; // 0: disable idle irq 1: enable idle irq
transMode = 0; // 0:block 1:noblock 2:TX DMA RX NORMAL 3:TX NORMAL RX DMA 4: USART_TRANS_TX_RX_DMA
maxBufSize = 1024;
uartType = 0; // 0 : 232 1: 485
uartDePin = 0; // usart 485 pin
uartDeGroup = 0; // usart 485 control line
}
}
}
misc {
littlefs_config {
match_attr = "littlefs_config";
mount_points = ["/talkweb"];
partitions = [0x800000];
block_size = [4096];
block_count = [256];
}
}
}
-46
View File
@@ -1,46 +0,0 @@
#include "device_pwm_info.hcs"
root {
platform {
pwm1_config {
gpio_pwm1 {
gpio_num_max = 1;
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [0, 3, 2, 3, 0, 2, 1]; // tim2 ch4 pa3
}
pwmconfig : gpio_pwm1 {
match_attr = "config_pwm1"; // default use pwm1
pwmTim = 1; // timID tim2 0 :tim1, 1:tim2 ..... tim6 and tim7can't not use for pwm
pwmCh = 3; // tim chanel 4 0:ch1 1:ch2 2:ch3 3:ch4
prescaler = 4199; // prescaler for example tim2 clock is 84M, (84M/(4199+1)) = 20khz,
// set 20khz to caculate stanard ,tim2-tim7, tim12-tim14is 84M TIM8~TIM11 is 168M
// tim1~tim5 tim8 have 4 channel tim9,tim12 only have ch1, ch2, tim10, tim11,tim13,tim14 only ch1
}
}
pwm2_config {
gpio_pwm2 {
gpio_num_max = 1;
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [0, 6, 2, 3, 0, 2, 2]; // tim3 ch1 pa6
}
pwmconfig2 : gpio_pwm2 {
match_attr = "config_pwm2";
pwmTim = 2;
pwmCh = 0;
prescaler = 8399;
}
}
pwm3_config {
gpio_pwm3 {
gpio_num_max = 1;
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [8, 5, 2, 3, 0, 2, 3]; // tim8 ch1 pi5
}
pwmconfig3 : gpio_pwm3 {
match_attr = "config_pwm7";
pwmTim = 7;
pwmCh = 0;
prescaler = 8399;
}
}
}
}
-36
View File
@@ -1,36 +0,0 @@
#include "device_spi_info.hcs"
root {
platform {
spi1_config {
spi1_gpio {
gpio_num_max = 4;
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [0, 5, 2, 3, 0, 0, 5]; // clk pa5
gpio_num_2 = [1, 5, 2, 3, 0, 0, 5]; // mosi pb5
gpio_num_3 = [1, 4, 2, 3, 0, 0, 5]; // miso pb4
gpio_num_4 = [0, 15, 1, 3, 0, 0 ,0]; // cs pa15
}
spi_config : spi1_gpio {
match_attr = "spi_w25q_config";
busNum = 0;
csNum = 0;
transDir = 0; // 0: TW_HAL_SPI_FULL_DUPLEX 1: TW_HAL_SPI_SIMPLEX_RX 2: TW_HAL_SPI_HALF_DUPLEX_RX 3: TW_HAL_SPI_HALF_DUPLEX_TX
transMode = 1; // 1: normal 0:dma
smMode = 1; // 0: slave 1: master
dataWidth = 0; // 0:8bit 1:16bit
clkMode = 0; // 0: cpol 0 cpha 0 1:CPOL = 1; CPHA = 0 2:CPOL = 0; CPHA = 1 3:CPOL = 1; CPHA = 1
nss = 0; // 0:NSS SOFT 1: NSS HARDWARE INPUT 2: NSS HARDWARE OUTPUT
baudRate = 1; // 0:div2 1:div4 2:div8 3:div16 4:div32 5:div64 6:div128 6:div256
bitOrder = 0; // 0: MSB first 1: LSB first
crcEnable = 0; // 0: crc disable 1: crc enable
crcPoly = 10; // Min_Data = 0x00 and Max_Data = 0xFFFF
spix = 0; // 0: spi1 1: spi2 2:spi3
csPin = 15;
csGpiox = 0;
standard = 0; // 0:motorola 1: ti
dummyByte = 255;
}
}
}
}
-58
View File
@@ -1,58 +0,0 @@
#include "device_uart_info.hcs"
root {
platform {
uart_config4 {
uart4_gpio {
gpio_num_max = 2; // uart4 rs232
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [2, 10, 2, 3, 0, 1, 8]; // tx pc10
gpio_num_2 = [2, 11, 2, 3, 0, 1, 8]; // rx pc11
}
uart4 : uart4_gpio {
match_attr = "uart_config4";
num = 4; // 1 :uart1 2: USART2 3:USART3 4:UART4 5:UART5 6:USART6
baudRate = 115200; // baudrate
dataWidth = 0; // 0:8bit 1:9bit
stopBit = 1; // 0:0.5stop bits 1:1 stop bit 2:1.5 stop bits 2:2 stop bits
parity = 0; // 0: none 1: event 2:odd
transDir = 3; // 0: dir none 1: rx 2: tx 3:tx and rx
flowCtrl = 0; // 0: no flowcontrl 1: flowContorl RTS 2: flowControl CTS 3: flowControl RTS AND CTS
overSimpling = 0; // 0: overSimpling 16bits 1: overSimpling 8bits
idleIrq = 1; // 0: disable idle irq 1: enable idle irq
transMode = 0; // 0:block 1:noblock 2:TX DMA RX NORMAL 3:TX NORMAL RX DMA 4: USART_TRANS_TX_RX_DMA
maxBufSize = 1024;
uartType = 0; // 0 : 232 1: 485
uartDePin = 0; // usart 485 pin
uartDeGroup = 0; // usart 485 control line
}
}
uart_config5 {
uart5_gpio {
gpio_num_max = 3; // uart5 as rs485
// port, pin, mode, speed, outputType, pull, alternate
gpio_num_1 = [2, 12, 2, 3, 0, 1, 8]; // tx pc12
gpio_num_2 = [3, 2, 2, 3, 0, 1, 8]; // rx pd2
gpio_num_3 = [6, 12, 1, 3, 0, 2, 0]; // de pg12
}
uart5 : uart5_gpio {
match_attr = "uart_config5";
num = 5; // 1 :uart1 2: USART2 3:USART3 4:UART4 5:UART5 6:USART6
baudRate = 115200; // baudrate
dataWidth = 0; // 0:8bit 1:9bit
stopBit = 1; // 0:0.5stop bits 1:1 stop bit 2:1.5 stop bits 2:2 stop bits
parity = 0; // 0: none 1: event 2:odd
transDir = 3; // 0: dir none 1: rx 2: tx 3:tx and rx
flowCtrl = 0; // 0: no flowcontrl 1: flowContorl RTS 2: flowControl CTS 3: flowControl RTS AND CTS
overSimpling = 0; // 0: overSimpling 16bits 1: overSimpling 8bits
idleIrq = 1; // 0: disable idle irq 1: enable idle irq
transMode = 0; // 0:block 1:noblock 2:TX DMA RX NORMAL 3:TX NORMAL RX DMA 4: USART_TRANS_TX_RX_DMA
maxBufSize = 1024;
uartType = 1; // 0 : 232 1: 485
uartDePin = 12; // usart 485 pin
uartDeGroup = 6; // usart 485 control line
}
}
}
}
@@ -1,17 +0,0 @@
#include "device_watchdog_info.hcs"
root {
platform {
template watchdog_controller {
id = 0;
regBase = 0x12050000;
regStep = 0x1000;
timeout = 1000; //看门狗喂狗最大间隔时间,单位ms
match_attr = "";
}
st_watchdog :: watchdog_controller {
match_attr = "st_watchdog";
timeout = 500;
}
}
}