forked from xuos/xiuos
add lcd driver for xidatong-arm
It is OK
This commit is contained in:
@@ -55,17 +55,19 @@ int PrivSemaphoreDelete(sem_t *sem)
|
||||
|
||||
int PrivSemaphoreObtainWait(sem_t *sem, const struct timespec *abstime)
|
||||
{
|
||||
/* if the timeout is not set, it will be blocked all the time. */
|
||||
if(!abstime)
|
||||
{
|
||||
return sem_wait(sem);
|
||||
}
|
||||
|
||||
/* if the timeout time is set, it will be executed downward after the timeout, and will not be blocked. */
|
||||
struct timespec timeout;
|
||||
clock_gettime(CLOCK_REALTIME, &timeout);
|
||||
timeout.tv_sec += abstime->tv_sec;
|
||||
return sem_timedwait(sem, &timeout);
|
||||
}
|
||||
|
||||
int PrivSemaphoreObtainWaitForever(sem_t *sem)
|
||||
{
|
||||
return sem_wait(sem);
|
||||
}
|
||||
|
||||
int PrivSemaphoreObtainNoWait(sem_t *sem)
|
||||
{
|
||||
return sem_trywait(sem);
|
||||
@@ -133,40 +135,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************/
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/wireless/lpwan/sx127x.h>
|
||||
#include <nuttx/ioexpander/gpio.h>
|
||||
#include <termios.h>
|
||||
|
||||
typedef uint8_t uint8;
|
||||
typedef uint16_t uint16;
|
||||
@@ -43,22 +45,23 @@ 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
|
||||
#define GPIO_HIGH 0x01
|
||||
|
||||
#define GPIO_CFG_OUTPUT 0x00
|
||||
#define GPIO_CFG_INPUT 0x01
|
||||
#define GPIO_CFG_INPUT_PULLUP 0x02
|
||||
#define GPIO_CFG_OUTPUT 0x00
|
||||
#define GPIO_CFG_INPUT 0x01
|
||||
#define GPIO_CFG_INPUT_PULLUP 0x02
|
||||
#define GPIO_CFG_INPUT_PULLDOWN 0x03
|
||||
#define GPIO_CFG_OUTPUT_OD 0x04
|
||||
#define GPIO_CFG_OUTPUT_OD 0x04
|
||||
|
||||
#define GPIO_CONFIG_MODE 0xffffffff
|
||||
#define GPIO_CONFIG_MODE 0xffffffff
|
||||
|
||||
/********************SERIAL define*******************/
|
||||
#define BAUD_RATE_2400 2400
|
||||
@@ -172,15 +175,11 @@ int PrivMutexDelete(pthread_mutex_t *p_mutex);
|
||||
int PrivMutexObtain(pthread_mutex_t *p_mutex);
|
||||
int PrivMutexAbandon(pthread_mutex_t *p_mutex);
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************semaphore**********************/
|
||||
|
||||
int PrivSemaphoreCreate(sem_t *sem, int pshared, unsigned int value);
|
||||
int PrivSemaphoreDelete(sem_t *sem);
|
||||
int PrivSemaphoreObtainWait(sem_t *sem, const struct timespec *abstime);
|
||||
int PrivSemaphoreObtainWaitForever(sem_t *sem);
|
||||
int PrivSemaphoreObtainNoWait(sem_t *sem);
|
||||
int PrivSemaphoreAbandon(sem_t *sem);
|
||||
int32_t PrivSemaphoreSetValue(int32_t sem, uint16_t val);
|
||||
@@ -201,7 +200,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***********************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user