forked from xuos/xiuos
add sensor framework
This commit is contained in:
@@ -26,50 +26,6 @@
|
||||
#define XIUOS_OS
|
||||
|
||||
#ifdef XIUOS_OS
|
||||
/************************Kernel Posix Transform***********************/
|
||||
|
||||
|
||||
/************************Driver Posix Transform***********************/
|
||||
int PrivOpen(const char *path, int flags, ...)
|
||||
{
|
||||
return open(path, flags, ...);
|
||||
}
|
||||
|
||||
int PrivClose(int fd)
|
||||
{
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
int PrivRead(int fd, void *buf, size_t len)
|
||||
{
|
||||
return read(fd, buf, len);
|
||||
}
|
||||
|
||||
int PrivWrite(int fd, const void *buf, size_t len)
|
||||
{
|
||||
return write(fd, buf, len);
|
||||
}
|
||||
|
||||
static int PrivSerialIoctl(int fd, void *args)
|
||||
{
|
||||
struct SerialDataCfg *serial_cfg = (struct SerialDataCfg *)args;
|
||||
|
||||
return ioctl(fd, OPE_INT, &serial_cfg);
|
||||
}
|
||||
|
||||
int PrivIoctl(int fd, int cmd, void *args)
|
||||
{
|
||||
struct PrivIoctlCfg *ioctl_cfg = (struct PrivIoctlCfg *)args;
|
||||
|
||||
switch (ioctl_cfg->ioctl_driver_type)
|
||||
{
|
||||
case SERIAL_TYPE:
|
||||
PrivSerialIoctl(fd, ioctl_cfg->args);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* private mutex API */
|
||||
int PrivMutexCreate(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *attr)
|
||||
@@ -168,11 +124,11 @@ int PrivWrite(int fd, const void *buf, size_t len)
|
||||
return write(fd, buf, len);
|
||||
}
|
||||
|
||||
static int PrivSerialIoctl(int fd, void *args)
|
||||
static int PrivSerialIoctl(int fd, int cmd, void *args)
|
||||
{
|
||||
struct SerialDataCfg *serial_cfg = (struct SerialDataCfg *)args;
|
||||
|
||||
return ioctl(fd, OPE_INT, &serial_cfg);
|
||||
return ioctl(fd, cmd, &serial_cfg);
|
||||
}
|
||||
|
||||
int PrivIoctl(int fd, int cmd, void *args)
|
||||
@@ -182,7 +138,7 @@ int PrivIoctl(int fd, int cmd, void *args)
|
||||
switch (ioctl_cfg->ioctl_driver_type)
|
||||
{
|
||||
case SERIAL_TYPE:
|
||||
PrivSerialIoctl(fd, ioctl_cfg->args);
|
||||
PrivSerialIoctl(fd, cmd, ioctl_cfg->args);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -206,4 +162,6 @@ void *PrivCalloc(size_t count, size_t size)
|
||||
void PrivFree(void *pointer)
|
||||
{
|
||||
UserFree(pointer);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -75,6 +75,14 @@ extern "C" {
|
||||
#define SERIAL_RB_BUFSZ 128
|
||||
#endif
|
||||
|
||||
enum ExtSerialPortConfigure
|
||||
{
|
||||
PORT_CFG_INIT = 0,
|
||||
PORT_CFG_PARITY_CHECK,
|
||||
PORT_CFG_DISABLE,
|
||||
PORT_CFG_DIV,
|
||||
};
|
||||
|
||||
struct SerialDataCfg
|
||||
{
|
||||
uint32_t serial_baud_rate;
|
||||
@@ -84,6 +92,9 @@ struct SerialDataCfg
|
||||
uint8_t serial_bit_order;
|
||||
uint8_t serial_invert_mode;
|
||||
uint16_t serial_buffer_size;
|
||||
|
||||
uint8 ext_uart_no;
|
||||
enum ExtSerialPortConfigure port_configure;
|
||||
};
|
||||
|
||||
enum IoctlDriverType
|
||||
|
||||
Reference in New Issue
Block a user