modify sensor framework extuart path configure
This commit is contained in:
parent
281482855d
commit
7f5192351a
|
@ -13,14 +13,25 @@ config SENSOR_ZG09
|
||||||
default "co2_1"
|
default "co2_1"
|
||||||
|
|
||||||
if ADD_XIUOS_FETURES
|
if ADD_XIUOS_FETURES
|
||||||
|
config SENSOR_ZG09_DRIVER_EXTUART
|
||||||
|
bool "Using extra uart to support zg09"
|
||||||
|
default y
|
||||||
|
|
||||||
config SENSOR_DEVICE_ZG09_DEV
|
config SENSOR_DEVICE_ZG09_DEV
|
||||||
string "zg09 device name"
|
string "zg09 device uart path"
|
||||||
default "/dev/uart2_dev2"
|
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
|
config SENSOR_DEVICE_ZG09_DEV_EXT_PORT
|
||||||
int "if ZG09 device using extuart, choose port"
|
int "if ZG09 device using extuart, choose port"
|
||||||
default "4"
|
default "4"
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if ADD_NUTTX_FETURES
|
if ADD_NUTTX_FETURES
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ static struct SensorProductInfo info =
|
||||||
*/
|
*/
|
||||||
static int SensorDeviceOpen(struct SensorDevice *sdev)
|
static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
{
|
{
|
||||||
int result = 1;
|
int result = 0;
|
||||||
|
|
||||||
sdev->fd = PrivOpen(SENSOR_DEVICE_ZG09_DEV, O_RDWR);
|
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_parity_mode = PARITY_NONE;
|
||||||
cfg.serial_bit_order = 0;
|
cfg.serial_bit_order = 0;
|
||||||
cfg.serial_invert_mode = 0;
|
cfg.serial_invert_mode = 0;
|
||||||
|
#ifdef SENSOR_ZG09_DRIVER_EXTUART
|
||||||
cfg.ext_uart_no = SENSOR_DEVICE_ZG09_DEV_EXT_PORT;
|
cfg.ext_uart_no = SENSOR_DEVICE_ZG09_DEV_EXT_PORT;
|
||||||
cfg.port_configure = PORT_CFG_INIT;
|
cfg.port_configure = PORT_CFG_INIT;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct PrivIoctlCfg ioctl_cfg;
|
struct PrivIoctlCfg ioctl_cfg;
|
||||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||||
|
@ -115,7 +117,7 @@ static int SensorDeviceIoctl(struct SensorDevice *sdev, int cmd)
|
||||||
sdev->done->read(sdev, 8);
|
sdev->done->read(sdev, 8);
|
||||||
if (memcmp(sdev->buffer, zg09_set_passive, 8) == 0) {
|
if (memcmp(sdev->buffer, zg09_set_passive, 8) == 0) {
|
||||||
sdev->status = SENSOR_DEVICE_PASSIVE;
|
sdev->status = SENSOR_DEVICE_PASSIVE;
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -124,7 +126,7 @@ static int SensorDeviceIoctl(struct SensorDevice *sdev, int cmd)
|
||||||
sdev->done->read(sdev, 8);
|
sdev->done->read(sdev, 8);
|
||||||
if (memcmp(sdev->buffer, zg09_set_active, 8) == 0) {
|
if (memcmp(sdev->buffer, zg09_set_active, 8) == 0) {
|
||||||
sdev->status = SENSOR_DEVICE_ACTIVE;
|
sdev->status = SENSOR_DEVICE_ACTIVE;
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
{
|
{
|
||||||
sdev->fd = PrivOpen(SENSOR_DEVICE_HS300X_DEV, O_RDWR);
|
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)
|
if (PrivRead(sdev->fd, sdev->buffer, len) != 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct SensorDone done =
|
static struct SensorDone done =
|
||||||
|
|
|
@ -21,14 +21,25 @@ config SENSOR_PS5308
|
||||||
default "pm10_1"
|
default "pm10_1"
|
||||||
|
|
||||||
if ADD_XIUOS_FETURES
|
if ADD_XIUOS_FETURES
|
||||||
|
config SENSOR_PS5308_DRIVER_EXTUART
|
||||||
|
bool "Using extra uart to support PS5308"
|
||||||
|
default y
|
||||||
|
|
||||||
config SENSOR_DEVICE_PS5308_DEV
|
config SENSOR_DEVICE_PS5308_DEV
|
||||||
string "PS5308 device name"
|
string "PS5308 device name"
|
||||||
default "/dev/uart2_dev2"
|
default "/dev/uart2_dev2"
|
||||||
|
depends on !SENSOR_PS5308_DRIVER_EXTUART
|
||||||
|
|
||||||
|
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
|
config SENSOR_DEVICE_PS5308_DEV_EXT_PORT
|
||||||
int "if PS5308 device using extuart, choose port"
|
int "if PS5308 device using extuart, choose port"
|
||||||
default "4"
|
default "4"
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if ADD_NUTTX_FETURES
|
if ADD_NUTTX_FETURES
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void ReadTask(struct SensorDevice *sdev)
|
||||||
*/
|
*/
|
||||||
static int SensorDeviceOpen(struct SensorDevice *sdev)
|
static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
{
|
{
|
||||||
int result = 1;
|
int result = 0;
|
||||||
|
|
||||||
buff_lock = UserMutexCreate();
|
buff_lock = UserMutexCreate();
|
||||||
|
|
||||||
|
@ -66,8 +66,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
cfg.serial_parity_mode = PARITY_NONE;
|
cfg.serial_parity_mode = PARITY_NONE;
|
||||||
cfg.serial_bit_order = 0;
|
cfg.serial_bit_order = 0;
|
||||||
cfg.serial_invert_mode = 0;
|
cfg.serial_invert_mode = 0;
|
||||||
|
#ifdef SENSOR_PS5308_DRIVER_EXTUART
|
||||||
cfg.ext_uart_no = SENSOR_DEVICE_PS5308_DEV_EXT_PORT;
|
cfg.ext_uart_no = SENSOR_DEVICE_PS5308_DEV_EXT_PORT;
|
||||||
cfg.port_configure = PORT_CFG_INIT;
|
cfg.port_configure = PORT_CFG_INIT;
|
||||||
|
#endif
|
||||||
|
|
||||||
result = ioctl(sdev->fd, OPE_INT, &cfg);
|
result = ioctl(sdev->fd, OPE_INT, &cfg);
|
||||||
|
|
||||||
|
@ -95,7 +97,7 @@ static int SensorDeviceClose(struct SensorDevice *sdev)
|
||||||
{
|
{
|
||||||
UserTaskDelete(active_task_id);
|
UserTaskDelete(active_task_id);
|
||||||
UserMutexDelete(buff_lock);
|
UserMutexDelete(buff_lock);
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,7 +38,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
{
|
{
|
||||||
sdev->fd = PrivOpen(SENSOR_DEVICE_HS300X_DEV, O_RDWR);
|
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)
|
if (PrivRead(sdev->fd, sdev->buffer, len) != 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct SensorDone done =
|
static struct SensorDone done =
|
||||||
|
|
|
@ -13,14 +13,25 @@ config SENSOR_D124
|
||||||
default "voice_1"
|
default "voice_1"
|
||||||
|
|
||||||
if ADD_XIUOS_FETURES
|
if ADD_XIUOS_FETURES
|
||||||
|
config SENSOR_D124_DRIVER_EXTUART
|
||||||
|
bool "Using extra uart to support D124"
|
||||||
|
default y
|
||||||
|
|
||||||
config SENSOR_DEVICE_D124_DEV
|
config SENSOR_DEVICE_D124_DEV
|
||||||
string "D124 device name"
|
string "D124 device name"
|
||||||
|
default "/dev/uart2_dev2"
|
||||||
|
depends on !SENSOR_D124_DRIVER_EXTUART
|
||||||
|
|
||||||
|
if SENSOR_D124_DRIVER_EXTUART
|
||||||
|
config SENSOR_DEVICE_D124_DEV
|
||||||
|
string "D124 device extra uart path"
|
||||||
default "/dev/extuart_dev4"
|
default "/dev/extuart_dev4"
|
||||||
|
|
||||||
config SENSOR_DEVICE_D124_DEV_EXT_PORT
|
config SENSOR_DEVICE_D124_DEV_EXT_PORT
|
||||||
int "if D124 device using extuart, choose port"
|
int "if D124 device using extuart, choose port"
|
||||||
default "4"
|
default "4"
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if ADD_NUTTX_FETURES
|
if ADD_NUTTX_FETURES
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void ReadTask(struct SensorDevice *sdev)
|
||||||
*/
|
*/
|
||||||
static int SensorDeviceOpen(struct SensorDevice *sdev)
|
static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
{
|
{
|
||||||
int result = 1;
|
int result = 0;
|
||||||
|
|
||||||
buff_lock = UserMutexCreate();
|
buff_lock = UserMutexCreate();
|
||||||
|
|
||||||
|
@ -66,8 +66,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
cfg.serial_parity_mode = PARITY_NONE;
|
cfg.serial_parity_mode = PARITY_NONE;
|
||||||
cfg.serial_bit_order = 0;
|
cfg.serial_bit_order = 0;
|
||||||
cfg.serial_invert_mode = 0;
|
cfg.serial_invert_mode = 0;
|
||||||
|
#ifdef SENSOR_D124_DRIVER_EXTUART
|
||||||
cfg.ext_uart_no = SENSOR_DEVICE_D124_DEV_EXT_PORT;
|
cfg.ext_uart_no = SENSOR_DEVICE_D124_DEV_EXT_PORT;
|
||||||
cfg.port_configure = PORT_CFG_INIT;
|
cfg.port_configure = PORT_CFG_INIT;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct PrivIoctlCfg ioctl_cfg;
|
struct PrivIoctlCfg ioctl_cfg;
|
||||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||||
|
@ -98,7 +100,7 @@ static int SensorDeviceClose(struct SensorDevice *sdev)
|
||||||
{
|
{
|
||||||
UserTaskDelete(active_task_id);
|
UserTaskDelete(active_task_id);
|
||||||
UserMutexDelete(buff_lock);
|
UserMutexDelete(buff_lock);
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue