diff --git a/APP_Framework/Applications/framework_init.c b/APP_Framework/Applications/framework_init.c index 8291a118..7ac11837 100644 --- a/APP_Framework/Applications/framework_init.c +++ b/APP_Framework/Applications/framework_init.c @@ -49,7 +49,7 @@ static int AppInitDesc(struct InitDesc sub_desc[]) static struct InitDesc framework[] = { #ifdef SUPPORT_SENSOR_FRAMEWORK - { "perception_framework", SensorFrameworkInit }, + { "sensor_framework", SensorFrameworkInit }, #endif #ifdef SUPPORT_CONNECTION_FRAMEWORK @@ -59,13 +59,13 @@ static struct InitDesc framework[] = { "NULL", NULL }, }; -static struct InitDesc perception_desc[] = +static struct InitDesc sensor_desc[] = { -#ifdef PERCEPTION_D124 +#ifdef SENSOR_DEVICE_ZG09 { "d124_voice", D124VoiceInit }, #endif -#ifdef PERCEPTION_HS300X +#ifdef SENSOR_DEVICE_HS300X #ifdef SENSOR_QUANTITY_HS300X_TEMPERATURE { "hs300x_temperature", Hs300xTemperatureInit }, #endif @@ -74,13 +74,13 @@ static struct InitDesc perception_desc[] = #endif #endif -#ifdef PERCEPTION_PS5308 +#ifdef SENSOR_PS5308 #ifdef SENSOR_QUANTITY_PS5308_PM1_0 { "ps5308_pm1_0", Ps5308Pm1_0Init }, #endif #endif -#ifdef PERCEPTION_ZG09 +#ifdef SENSOR_ZG09 { "zg09_co2", Zg09Co2Init }, #endif @@ -99,24 +99,24 @@ static struct InitDesc connection_desc[] = }; /** - * This function will init perception framework and all sub perception sensors + * This function will init sensor framework and all sub sensors * @param sub_desc framework * */ -static int PerceptionFrameworkInit(struct InitDesc sub_desc[]) +static int SensorDeviceFrameworkInit(struct InitDesc sub_desc[]) { int i = 0; int ret = 0; for ( i = 0; sub_desc[i].fn != NULL; i++ ) { - if (0 == strncmp(sub_desc[i].fn_name, "perception_framework", strlen("perception_framework"))) { + if (0 == strncmp(sub_desc[i].fn_name, "sensor_framework", strlen("sensor_framework"))) { ret = sub_desc[i].fn(); break; } } if (0 == ret) { - printf("initialize perception_framework success.\n"); - AppInitDesc(perception_desc); + printf("initialize sensor_framework success.\n"); + AppInitDesc(sensor_desc); } return ret; @@ -127,7 +127,7 @@ static int PerceptionFrameworkInit(struct InitDesc sub_desc[]) * @param sub_desc framework * */ -static int ConnectionFrameworkInit(struct InitDesc sub_desc[]) +static int ConnectionDeviceFrameworkInit(struct InitDesc sub_desc[]) { int i = 0; int ret = 0; @@ -153,11 +153,11 @@ static int ConnectionFrameworkInit(struct InitDesc sub_desc[]) int FrameworkInit() { #ifdef SUPPORT_SENSOR_FRAMEWORK - PerceptionFrameworkInit(framework); + SensorDeviceFrameworkInit(framework); #endif #ifdef SUPPORT_CONNECTION_FRAMEWORK - ConnectionFrameworkInit(framework); + ConnectionDeviceFrameworkInit(framework); #endif return 0; diff --git a/APP_Framework/Applications/sensor_app/Kconfig b/APP_Framework/Applications/sensor_app/Kconfig index e413885e..86eaeb7c 100755 --- a/APP_Framework/Applications/sensor_app/Kconfig +++ b/APP_Framework/Applications/sensor_app/Kconfig @@ -3,67 +3,56 @@ menu "sensor app" menuconfig APPLICATION_SENSOR bool "Using sensor apps" default n - select PERCEPTION_SENSORDEVICE if APPLICATION_SENSOR menuconfig APPLICATION_SENSOR_CO2 bool "Using sensor CO2 apps" default n - select PERCEPTION_CO2 if APPLICATION_SENSOR_CO2 config APPLICATION_SENSOR_CO2_ZG09 bool "Using sensor ZG09 apps" default n - select PERCEPTION_ZG09 endif menuconfig APPLICATION_SENSOR_PM1_0 bool "Using sensor PM1.0 apps" default n - select PERCEPTION_PM if APPLICATION_SENSOR_PM1_0 config APPLICATION_SENSOR_PM1_0_PS5308 bool "Using sensor PS5308 apps" default n - select PERCEPTION_PS5308 endif menuconfig APPLICATION_SENSOR_VOICE bool "Using sensor voice apps" default n - select PERCEPTION_VOICE if APPLICATION_SENSOR_VOICE config APPLICATION_SENSOR_VOICE_D124 bool "Using sensor D124 apps" default n - select PERCEPTION_D124 endif menuconfig APPLICATION_SENSOR_HUMIDITY bool "Using sensor humidity apps" default n - select PERCEPTION_HUMIDITY if APPLICATION_SENSOR_HUMIDITY config APPLICATION_SENSOR_HUMIDITY_HS300X bool "Using sensor HS300x apps" default n - select PERCEPTION_HS300X endif menuconfig APPLICATION_SENSOR_TEMPERATURE bool "Using sensor temperature apps" default n - select PERCEPTION_TEMPERATURE if APPLICATION_SENSOR_TEMPERATURE config APPLICATION_SENSOR_TEMPERATURE_HS300X bool "Using sensor HS300x apps" default n - select PERCEPTION_HS300X endif endif diff --git a/APP_Framework/Framework/sensor/co2/Kconfig b/APP_Framework/Framework/sensor/co2/Kconfig index bd5d7aaa..5038baf1 100644 --- a/APP_Framework/Framework/sensor/co2/Kconfig +++ b/APP_Framework/Framework/sensor/co2/Kconfig @@ -13,13 +13,24 @@ config SENSOR_ZG09 default "co2_1" if ADD_XIUOS_FETURES - config SENSOR_DEVICE_ZG09_DEV - string "zg09 device name" - default "/dev/uart2_dev2" + config SENSOR_ZG09_DRIVER_EXTUART + bool "Using extra uart to support zg09" + default y - config SENSOR_DEVICE_ZG09_DEV_EXT_PORT - int "if ZG09 device using extuart, choose port" - default "4" + config SENSOR_DEVICE_ZG09_DEV + string "zg09 device uart path" + default "/dev/uart2_dev2" + depends on !SENSOR_ZG09_DRIVER_EXTUART + + if SENSOR_ZG09_DRIVER_EXTUART + config SENSOR_DEVICE_ZG09_DEV + string "zg09 device extra uart path" + default "/dev/extuart_dev4" + + config SENSOR_DEVICE_ZG09_DEV_EXT_PORT + int "if ZG09 device using extuart, choose port" + default "4" + endif endif if ADD_NUTTX_FETURES diff --git a/APP_Framework/Framework/sensor/co2/zg09/zg09.c b/APP_Framework/Framework/sensor/co2/zg09/zg09.c index 887670c6..e9d5fd0e 100644 --- a/APP_Framework/Framework/sensor/co2/zg09/zg09.c +++ b/APP_Framework/Framework/sensor/co2/zg09/zg09.c @@ -12,7 +12,7 @@ /** * @file zg09.c - * @brief ZG09 CO2 driver base perception + * @brief ZG09 CO2 driver base sensor * @version 1.0 * @author AIIT XUOS Lab * @date 2021.04.22 @@ -40,7 +40,7 @@ static struct SensorProductInfo info = */ static int SensorDeviceOpen(struct SensorDevice *sdev) { - int result = 1; + int result = 0; sdev->fd = PrivOpen(SENSOR_DEVICE_ZG09_DEV, O_RDWR); @@ -52,8 +52,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev) cfg.serial_parity_mode = PARITY_NONE; cfg.serial_bit_order = 0; cfg.serial_invert_mode = 0; +#ifdef SENSOR_ZG09_DRIVER_EXTUART cfg.ext_uart_no = SENSOR_DEVICE_ZG09_DEV_EXT_PORT; cfg.port_configure = PORT_CFG_INIT; +#endif struct PrivIoctlCfg ioctl_cfg; ioctl_cfg.ioctl_driver_type = SERIAL_TYPE; @@ -115,7 +117,7 @@ static int SensorDeviceIoctl(struct SensorDevice *sdev, int cmd) sdev->done->read(sdev, 8); if (memcmp(sdev->buffer, zg09_set_passive, 8) == 0) { sdev->status = SENSOR_DEVICE_PASSIVE; - return 1; + return 0; } break; @@ -124,7 +126,7 @@ static int SensorDeviceIoctl(struct SensorDevice *sdev, int cmd) sdev->done->read(sdev, 8); if (memcmp(sdev->buffer, zg09_set_active, 8) == 0) { sdev->status = SENSOR_DEVICE_ACTIVE; - return 1; + return 0; } break; diff --git a/APP_Framework/Framework/sensor/humidity/Kconfig b/APP_Framework/Framework/sensor/humidity/Kconfig index 03fd3623..91011a9c 100644 --- a/APP_Framework/Framework/sensor/humidity/Kconfig +++ b/APP_Framework/Framework/sensor/humidity/Kconfig @@ -1,9 +1,9 @@ -config PERCEPTION_HS300X +config SENSOR_HS300X bool "Using HS300x" default n - if PERCEPTION_HS300X + if SENSOR_HS300X config SENSOR_DEVICE_HS300X string "HS300x sensor name" default "hs300x_1" diff --git a/APP_Framework/Framework/sensor/humidity/hs300x_humi/hs300x_humi.c b/APP_Framework/Framework/sensor/humidity/hs300x_humi/hs300x_humi.c index e9eea71a..a91d0748 100644 --- a/APP_Framework/Framework/sensor/humidity/hs300x_humi/hs300x_humi.c +++ b/APP_Framework/Framework/sensor/humidity/hs300x_humi/hs300x_humi.c @@ -12,7 +12,7 @@ /** * @file hs300x_humi.c - * @brief HS300x humidity driver base perception + * @brief HS300x humidity driver base sensor * @version 1.0 * @author AIIT XUOS Lab * @date 2021.04.22 @@ -38,7 +38,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev) { sdev->fd = PrivOpen(SENSOR_DEVICE_HS300X_DEV, O_RDWR); - return 1; + return 0; } /** @@ -57,7 +57,7 @@ static int SensorDeviceRead(struct SensorDevice *sdev, size_t len) if (PrivRead(sdev->fd, sdev->buffer, len) != 1) return -1; - return 1; + return 0; } static struct SensorDone done = diff --git a/APP_Framework/Framework/sensor/pm/Kconfig b/APP_Framework/Framework/sensor/pm/Kconfig index e1590a03..bfda3639 100644 --- a/APP_Framework/Framework/sensor/pm/Kconfig +++ b/APP_Framework/Framework/sensor/pm/Kconfig @@ -21,13 +21,24 @@ config SENSOR_PS5308 default "pm10_1" if ADD_XIUOS_FETURES + config SENSOR_PS5308_DRIVER_EXTUART + bool "Using extra uart to support PS5308" + default y + config SENSOR_DEVICE_PS5308_DEV string "PS5308 device name" default "/dev/uart2_dev2" + depends on !SENSOR_PS5308_DRIVER_EXTUART - config SENSOR_DEVICE_PS5308_DEV_EXT_PORT - int "if PS5308 device using extuart, choose port" - default "4" + if SENSOR_PS5308_DRIVER_EXTUART + config SENSOR_DEVICE_PS5308_DEV + string "PS5308 device extra uart path" + default "/dev/extuart_dev4" + + config SENSOR_DEVICE_PS5308_DEV_EXT_PORT + int "if PS5308 device using extuart, choose port" + default "4" + endif endif if ADD_NUTTX_FETURES diff --git a/APP_Framework/Framework/sensor/pm/ps5308/ps5308.c b/APP_Framework/Framework/sensor/pm/ps5308/ps5308.c index 8b1e790d..34fa3fd8 100644 --- a/APP_Framework/Framework/sensor/pm/ps5308/ps5308.c +++ b/APP_Framework/Framework/sensor/pm/ps5308/ps5308.c @@ -12,7 +12,7 @@ /** * @file ps5308.c - * @brief PS5308 PM1.0, PM2.5, PM10, driver base perception + * @brief PS5308 PM1.0, PM2.5, PM10, driver base sensor * @version 1.0 * @author AIIT XUOS Lab * @date 2021.04.22 @@ -52,7 +52,7 @@ static void ReadTask(struct SensorDevice *sdev) */ static int SensorDeviceOpen(struct SensorDevice *sdev) { - int result = 1; + int result = 0; buff_lock = UserMutexCreate(); @@ -66,8 +66,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev) cfg.serial_parity_mode = PARITY_NONE; cfg.serial_bit_order = 0; cfg.serial_invert_mode = 0; +#ifdef SENSOR_PS5308_DRIVER_EXTUART cfg.ext_uart_no = SENSOR_DEVICE_PS5308_DEV_EXT_PORT; cfg.port_configure = PORT_CFG_INIT; +#endif result = ioctl(sdev->fd, OPE_INT, &cfg); @@ -95,7 +97,7 @@ static int SensorDeviceClose(struct SensorDevice *sdev) { UserTaskDelete(active_task_id); UserMutexDelete(buff_lock); - return 1; + return 0; } /** diff --git a/APP_Framework/Framework/sensor/sensor.c b/APP_Framework/Framework/sensor/sensor.c index cd207531..f3bd3a2c 100644 --- a/APP_Framework/Framework/sensor/sensor.c +++ b/APP_Framework/Framework/sensor/sensor.c @@ -33,7 +33,7 @@ static pthread_mutex_t quant_table_lock; static pthread_mutex_t sensor_device_list_lock; /** - * @description: Init perception framework + * @description: Init sensor framework * @return 0 */ int SensorFrameworkInit(void) diff --git a/APP_Framework/Framework/sensor/temperature/hs300x_temp/hs300x_temp.c b/APP_Framework/Framework/sensor/temperature/hs300x_temp/hs300x_temp.c index dcb2fa25..0ac49e19 100644 --- a/APP_Framework/Framework/sensor/temperature/hs300x_temp/hs300x_temp.c +++ b/APP_Framework/Framework/sensor/temperature/hs300x_temp/hs300x_temp.c @@ -12,7 +12,7 @@ /** * @file hs300x_temp.c - * @brief HS300x temperature driver base perception + * @brief HS300x temperature driver base sensor * @version 1.0 * @author AIIT XUOS Lab * @date 2021.04.22 @@ -38,7 +38,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev) { sdev->fd = PrivOpen(SENSOR_DEVICE_HS300X_DEV, O_RDWR); - return 1; + return 0; } /** @@ -57,7 +57,7 @@ static int SensorDeviceRead(struct SensorDevice *sdev, size_t len) if (PrivRead(sdev->fd, sdev->buffer, len) != 1) return -1; - return 1; + return 0; } static struct SensorDone done = diff --git a/APP_Framework/Framework/sensor/voice/Kconfig b/APP_Framework/Framework/sensor/voice/Kconfig index 4d62fe50..17576e32 100644 --- a/APP_Framework/Framework/sensor/voice/Kconfig +++ b/APP_Framework/Framework/sensor/voice/Kconfig @@ -13,13 +13,24 @@ config SENSOR_D124 default "voice_1" if ADD_XIUOS_FETURES + config SENSOR_D124_DRIVER_EXTUART + bool "Using extra uart to support D124" + default y + config SENSOR_DEVICE_D124_DEV string "D124 device name" - default "/dev/extuart_dev4" + default "/dev/uart2_dev2" + depends on !SENSOR_D124_DRIVER_EXTUART - config SENSOR_DEVICE_D124_DEV_EXT_PORT - int "if D124 device using extuart, choose port" - default "4" + if SENSOR_D124_DRIVER_EXTUART + config SENSOR_DEVICE_D124_DEV + string "D124 device extra uart path" + default "/dev/extuart_dev4" + + config SENSOR_DEVICE_D124_DEV_EXT_PORT + int "if D124 device using extuart, choose port" + default "4" + endif endif if ADD_NUTTX_FETURES diff --git a/APP_Framework/Framework/sensor/voice/d124/d124.c b/APP_Framework/Framework/sensor/voice/d124/d124.c index a5f56a51..031c1a3d 100644 --- a/APP_Framework/Framework/sensor/voice/d124/d124.c +++ b/APP_Framework/Framework/sensor/voice/d124/d124.c @@ -12,7 +12,7 @@ /** * @file d124.c - * @brief D124 voice driver base perception + * @brief D124 voice driver base sensor * @version 1.0 * @author AIIT XUOS Lab * @date 2021.04.22 @@ -52,7 +52,7 @@ static void ReadTask(struct SensorDevice *sdev) */ static int SensorDeviceOpen(struct SensorDevice *sdev) { - int result = 1; + int result = 0; buff_lock = UserMutexCreate(); @@ -66,8 +66,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev) cfg.serial_parity_mode = PARITY_NONE; cfg.serial_bit_order = 0; cfg.serial_invert_mode = 0; +#ifdef SENSOR_D124_DRIVER_EXTUART cfg.ext_uart_no = SENSOR_DEVICE_D124_DEV_EXT_PORT; cfg.port_configure = PORT_CFG_INIT; +#endif struct PrivIoctlCfg ioctl_cfg; ioctl_cfg.ioctl_driver_type = SERIAL_TYPE; @@ -98,7 +100,7 @@ static int SensorDeviceClose(struct SensorDevice *sdev) { UserTaskDelete(active_task_id); UserMutexDelete(buff_lock); - return 1; + return 0; } /** diff --git a/Ubiquitous/XiUOS/board/aiit-arm32-board/.defconfig b/Ubiquitous/XiUOS/board/aiit-arm32-board/.defconfig index dfc50882..028b6dba 100644 --- a/Ubiquitous/XiUOS/board/aiit-arm32-board/.defconfig +++ b/Ubiquitous/XiUOS/board/aiit-arm32-board/.defconfig @@ -187,11 +187,6 @@ CONFIG_FS_VFS_DEVFS=y # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/aiit-riscv64-board/.defconfig b/Ubiquitous/XiUOS/board/aiit-riscv64-board/.defconfig index 4ec1cb53..cc28e215 100644 --- a/Ubiquitous/XiUOS/board/aiit-riscv64-board/.defconfig +++ b/Ubiquitous/XiUOS/board/aiit-riscv64-board/.defconfig @@ -235,11 +235,6 @@ CONFIG_FS_VFS_DEVFS=y # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/cortex-m3-emulator/.defconfig b/Ubiquitous/XiUOS/board/cortex-m3-emulator/.defconfig index edf43735..bff68ddf 100644 --- a/Ubiquitous/XiUOS/board/cortex-m3-emulator/.defconfig +++ b/Ubiquitous/XiUOS/board/cortex-m3-emulator/.defconfig @@ -210,11 +210,6 @@ CONFIG_FS_DFS=n # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/hifive1-emulator/.defconfig b/Ubiquitous/XiUOS/board/hifive1-emulator/.defconfig index 7cf3b63d..c6451fff 100644 --- a/Ubiquitous/XiUOS/board/hifive1-emulator/.defconfig +++ b/Ubiquitous/XiUOS/board/hifive1-emulator/.defconfig @@ -208,11 +208,6 @@ CONFIG_FS_DFS=n # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/hifive1-rev-B/.defconfig b/Ubiquitous/XiUOS/board/hifive1-rev-B/.defconfig index 4e99bbd4..26e9621e 100644 --- a/Ubiquitous/XiUOS/board/hifive1-rev-B/.defconfig +++ b/Ubiquitous/XiUOS/board/hifive1-rev-B/.defconfig @@ -208,11 +208,6 @@ CONFIG_FS_DFS=n # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/k210-emulator/.defconfig b/Ubiquitous/XiUOS/board/k210-emulator/.defconfig index 6e5ef10b..418734cc 100644 --- a/Ubiquitous/XiUOS/board/k210-emulator/.defconfig +++ b/Ubiquitous/XiUOS/board/k210-emulator/.defconfig @@ -200,11 +200,6 @@ CONFIG_FS_VFS_DEVFS=y # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/kd233/.defconfig b/Ubiquitous/XiUOS/board/kd233/.defconfig index 6e5ef10b..418734cc 100644 --- a/Ubiquitous/XiUOS/board/kd233/.defconfig +++ b/Ubiquitous/XiUOS/board/kd233/.defconfig @@ -200,11 +200,6 @@ CONFIG_FS_VFS_DEVFS=y # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/maix-go/.defconfig b/Ubiquitous/XiUOS/board/maix-go/.defconfig index 4dbade85..5dfe49e2 100644 --- a/Ubiquitous/XiUOS/board/maix-go/.defconfig +++ b/Ubiquitous/XiUOS/board/maix-go/.defconfig @@ -201,11 +201,6 @@ CONFIG_FS_VFS_DEVFS=y # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/stm32f407-st-discovery/.defconfig b/Ubiquitous/XiUOS/board/stm32f407-st-discovery/.defconfig index 7c821a6c..d5f67327 100644 --- a/Ubiquitous/XiUOS/board/stm32f407-st-discovery/.defconfig +++ b/Ubiquitous/XiUOS/board/stm32f407-st-discovery/.defconfig @@ -185,11 +185,6 @@ CONFIG_FS_VFS_DEVFS=y # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/board/stm32f407zgt6/.defconfig b/Ubiquitous/XiUOS/board/stm32f407zgt6/.defconfig index 6ba9d3aa..c9163eae 100644 --- a/Ubiquitous/XiUOS/board/stm32f407zgt6/.defconfig +++ b/Ubiquitous/XiUOS/board/stm32f407zgt6/.defconfig @@ -186,11 +186,6 @@ CONFIG_FS_VFS_DEVFS=y # APP Framework # -# -# Perception -# -# CONFIG_PERCEPTION_SENSORDEVICE is not set - # # connection # diff --git a/Ubiquitous/XiUOS/path_kernel.mk b/Ubiquitous/XiUOS/path_kernel.mk index 9ca5c106..31a0fec0 100755 --- a/Ubiquitous/XiUOS/path_kernel.mk +++ b/Ubiquitous/XiUOS/path_kernel.mk @@ -164,10 +164,6 @@ ifeq ($(CONFIG_FS_CH376), y) KERNELPATHS +=-I$(KERNEL_ROOT)/fs/compatibility_ch376 # endif -# ifeq ($(CONFIG_PERCEPTION_SENSORDEVICE), y) -# KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor # -# endif - KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xiuos/user_api/posix_support/include # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xiuos #