support e220 for nuttx on xidatong

This commit is contained in:
wgzAIIT
2022-04-26 18:23:14 +08:00
parent 9ac84e7cb4
commit a09caa272f
8 changed files with 62 additions and 40 deletions

View File

@@ -133,40 +133,9 @@ int PrivWrite(int fd, const void *buf, size_t len)
return write(fd, buf, len);
}
static int PrivSerialIoctl(int fd, int cmd, void *args)
int PrivIoctl(int fd, int cmd, unsigned long args)
{
struct SerialDataCfg *serial_cfg = (struct SerialDataCfg *)args;
return ioctl(fd, cmd, serial_cfg);
}
static int PrivPinIoctl(int fd, int cmd, void *args)
{
struct PinParam *pin_cfg = (struct PinParam *)args;
return ioctl(fd, cmd, pin_cfg);
}
int PrivIoctl(int fd, int cmd, void *args)
{
int ret = 0;
struct PrivIoctlCfg *ioctl_cfg = (struct PrivIoctlCfg *)args;
switch (ioctl_cfg->ioctl_driver_type)
{
case SERIAL_TYPE:
ret = PrivSerialIoctl(fd, cmd, ioctl_cfg->args);
break;
case PIN_TYPE:
ret = PrivPinIoctl(fd, cmd, ioctl_cfg->args);
break;
case I2C_TYPE:
ret = ioctl(fd, cmd, ioctl_cfg->args);
break;
default:
break;
}
return ret;
return ioctl(fd, cmd, args);
}
/********************memory api************/

View File

@@ -28,6 +28,7 @@
#include <stddef.h>
#include <stdint.h>
#include <nuttx/wireless/lpwan/sx127x.h>
#include <nuttx/ioexpander/gpio.h>
typedef uint8_t uint8;
typedef uint16_t uint16;
@@ -43,10 +44,11 @@ typedef int64_t int64;
extern "C" {
#endif
#define OPE_INT 0x0000
#define OPE_CFG 0x0001
#define OPE_INT 0x0000
#define OPE_CFG 0x0001
#define NAME_NUM_MAX 32
#define NAME_NUM_MAX 32
/*********************GPIO define*********************/
#define GPIO_LOW 0x00
@@ -201,7 +203,7 @@ int PrivOpen(const char *path, int flags);
int PrivRead(int fd, void *buf, size_t len);
int PrivWrite(int fd, const void *buf, size_t len);
int PrivClose(int fd);
int PrivIoctl(int fd, int cmd, void *args);
int PrivIoctl(int fd, int cmd, unsigned long args);
/*********************memory***********************/