mirror of
https://gitee.com/Vancouver2017/luban-lite.git
synced 2025-12-17 09:38:55 +00:00
v1.2.2
This commit is contained in:
@@ -551,6 +551,10 @@ menuconfig RT_USING_WIFI
|
||||
default y
|
||||
|
||||
if RT_WLAN_MANAGE_ENABLE
|
||||
config RT_WLAN_JOIN_SCAN_BY_MGNT
|
||||
bool "Scan the ap before connecting"
|
||||
default n
|
||||
|
||||
config RT_WLAN_SCAN_WAIT_MS
|
||||
int "Set scan timeout time(ms)"
|
||||
default 10000
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#define CAN_LOCK(can) rt_mutex_take(&(can->lock), RT_WAITING_FOREVER)
|
||||
#define CAN_UNLOCK(can) rt_mutex_release(&(can->lock))
|
||||
#define CAN_LOCK(can) rt_mutex_take(&(can->lock), RT_WAITING_FOREVER)
|
||||
#define CAN_UNLOCK(can) rt_mutex_release(&(can->lock))
|
||||
#define RT_COMPLETED_CAN 1
|
||||
|
||||
static rt_err_t rt_can_init(struct rt_device *dev)
|
||||
{
|
||||
@@ -165,7 +166,10 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da
|
||||
}
|
||||
|
||||
can->status.sndchange = 1;
|
||||
rt_completion_wait(&(tx_tosnd->completion), RT_WAITING_FOREVER);
|
||||
|
||||
if ((tx_tosnd->result == RT_CAN_SND_RESULT_WAIT) && (tx_tosnd->completion.flag == RT_COMPLETED_CAN))
|
||||
rt_completion_init(&(tx_tosnd->completion));
|
||||
rt_completion_wait(&(tx_tosnd->completion), RT_WAITING_TIMEOUT);
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
result = tx_tosnd->result;
|
||||
@@ -692,7 +696,7 @@ static void cantimeout(void *arg)
|
||||
}
|
||||
|
||||
#ifdef RT_USING_DEVICE_OPS
|
||||
const static struct rt_device_ops can_device_ops =
|
||||
static const struct rt_device_ops can_device_ops =
|
||||
{
|
||||
rt_can_init,
|
||||
rt_can_open,
|
||||
|
||||
@@ -185,6 +185,8 @@ struct rt_can_ops;
|
||||
#define RT_CAN_STOP_DMA 0x1E
|
||||
#define RT_CAN_CONFIG_DMA_TX 0x20
|
||||
#define RT_CAN_CONFIG_DMA_RX 0x21
|
||||
#define RT_CAN_CMD_DISABLE_RETRANS 0x22
|
||||
#define RT_CAN_CMD_SET_AUTOBUSOFF 0x23
|
||||
|
||||
#define RT_DEVICE_CAN_INT_ERR 0x1000
|
||||
|
||||
|
||||
@@ -109,7 +109,6 @@ struct rt_mmcsd_host {
|
||||
rt_uint32_t sdio_irq_num;
|
||||
|
||||
struct rt_event *sdio_irq_event;
|
||||
struct rt_semaphore *sdio_irq_delete_sem;
|
||||
|
||||
struct rt_thread *sdio_irq_thread;
|
||||
#ifdef AIC_SDMC_DRV
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#define PWM_CMD_SET_PUL (RT_DEVICE_CTRL_BASE(PWM) + 11)
|
||||
#define PWM_CMD_SET_OUTPUT (RT_DEVICE_CTRL_BASE(PWM) + 12)
|
||||
#define PWM_CMD_DMA_SET_FIFO (RT_DEVICE_CTRL_BASE(PWM) + 13)
|
||||
#define PWM_CMD_VDD_REGU (RT_DEVICE_CTRL_BASE(PWM) + 14)
|
||||
|
||||
struct rt_pwm_configuration
|
||||
{
|
||||
@@ -46,16 +47,6 @@ struct rt_pwm_configuration
|
||||
rt_uint32_t irq_mode;
|
||||
rt_uint32_t pul_cnt;
|
||||
#endif
|
||||
#ifdef AIC_XPWM_DRV
|
||||
rt_uint32_t pulse_cnt; /* 0:PWM mode, 1-n:XPWM pulse cnt */
|
||||
rt_uint32_t fifo_num;
|
||||
rt_uint32_t fifo_index;
|
||||
rt_uint32_t pul_num;
|
||||
rt_uint32_t pul_prd;
|
||||
rt_uint32_t pul_cmp;
|
||||
rt_uint32_t *buf;
|
||||
rt_uint32_t buf_len;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct rt_device_pwm;
|
||||
@@ -77,11 +68,7 @@ rt_err_t rt_pwm_disable(struct rt_device_pwm *device, int channel);
|
||||
#if defined(AIC_PWM_DRV) || defined(AIC_EPWM_DRV)
|
||||
rt_err_t rt_pwm_set_pul(struct rt_device_pwm *device, int channel, rt_uint32_t irq_mode, rt_uint32_t period, rt_uint32_t pulse, rt_uint32_t pul_cnt);
|
||||
#endif
|
||||
#ifdef AIC_XPWM_DRV
|
||||
rt_err_t rt_pwm_set(struct rt_device_pwm *device, int channel, rt_uint32_t period, rt_uint32_t pulse, rt_uint32_t pulse_cnt);
|
||||
#else
|
||||
rt_err_t rt_pwm_set(struct rt_device_pwm *device, int channel, rt_uint32_t period, rt_uint32_t pulse);
|
||||
#endif
|
||||
rt_err_t rt_pwm_set_output(struct rt_device_pwm *device, int channel, rt_uint32_t period, rt_uint32_t pulse, rt_uint32_t output);
|
||||
rt_err_t rt_pwm_set_period(struct rt_device_pwm *device, int channel, rt_uint32_t period);
|
||||
rt_err_t rt_pwm_set_pulse(struct rt_device_pwm *device, int channel, rt_uint32_t pulse);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define BAUD_RATE_230400 230400
|
||||
#define BAUD_RATE_460800 460800
|
||||
#define BAUD_RATE_921600 921600
|
||||
#define BAUD_RATE_1500000 1500000
|
||||
#define BAUD_RATE_2000000 2000000
|
||||
#define BAUD_RATE_2500000 2500000
|
||||
#define BAUD_RATE_3000000 3000000
|
||||
@@ -96,6 +97,7 @@
|
||||
#define RT_SERIAL_SW_FLOW_CTRL 0x85
|
||||
#define RT_SERIAL_SW_RECEIVE_ON_OFF 0x86
|
||||
#define RT_SERIAL_SET_BAUDRATE 0x87
|
||||
#define RT_SERIAL_GET_CONFIG 0x88
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -147,7 +149,7 @@ struct serial_configure
|
||||
rt_uint32_t flow_ctrl_suspend :1;
|
||||
rt_uint32_t flowctrl_cts_enable :1;
|
||||
rt_uint32_t flowctrl_rts_enable :1;
|
||||
rt_uint32_t uart_index :4;
|
||||
rt_uint32_t uart_index;
|
||||
rt_uint32_t uart_freq;
|
||||
};
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ extern "C" {
|
||||
#define RT_TOUCH_CTRL_GET_DYNAMIC_FLAG (RT_DEVICE_CTRL_BASE(Touch) + 15) /* Get Touch Dynamic Rotation Enable Flag */
|
||||
#define RT_TOUCH_CTRL_SET_OSD_FLAG (RT_DEVICE_CTRL_BASE(Touch) + 16) /* Set Touch OSD Flag */
|
||||
#define RT_TOUCH_CTRL_GET_OSD_FLAG (RT_DEVICE_CTRL_BASE(Touch) + 17) /* Get Touch OSD Flag */
|
||||
#define RT_TOUCH_CTRL_SET_DYNAMIC_CROP (RT_DEVICE_CTRL_BASE(Touch) + 18) /* Set Touch Dynamic Crop */
|
||||
#define RT_TOUCH_CTRL_GET_DYNAMIC_CROP (RT_DEVICE_CTRL_BASE(Touch) + 19) /* Get Touch Dynamic Crop */
|
||||
|
||||
/* Touch event */
|
||||
#define RT_TOUCH_EVENT_NONE (0) /* Touch none */
|
||||
@@ -76,6 +78,13 @@ struct rt_touch_info
|
||||
rt_int32_t range_y; /* Y coordinate range */
|
||||
};
|
||||
|
||||
struct rt_touch_crop_info
|
||||
{
|
||||
rt_int32_t width;
|
||||
rt_int32_t height;
|
||||
rt_uint8_t enable;
|
||||
};
|
||||
|
||||
struct rt_touch_config
|
||||
{
|
||||
rt_uint8_t rst_pin;
|
||||
|
||||
@@ -161,11 +161,7 @@ rt_err_t rt_pwm_disable(struct rt_device_pwm *device, int channel)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef AIC_XPWM_DRV
|
||||
rt_err_t rt_pwm_set(struct rt_device_pwm *device, int channel, rt_uint32_t period, rt_uint32_t pulse, rt_uint32_t pulse_cnt)
|
||||
#else
|
||||
rt_err_t rt_pwm_set(struct rt_device_pwm *device, int channel, rt_uint32_t period, rt_uint32_t pulse)
|
||||
#endif
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
struct rt_pwm_configuration configuration = {0};
|
||||
@@ -178,9 +174,6 @@ rt_err_t rt_pwm_set(struct rt_device_pwm *device, int channel, rt_uint32_t perio
|
||||
configuration.channel = (channel > 0) ? (channel) : (-channel);
|
||||
configuration.period = period;
|
||||
configuration.pulse = pulse;
|
||||
#ifdef AIC_XPWM_DRV
|
||||
configuration.pulse_cnt = pulse_cnt;
|
||||
#endif
|
||||
result = rt_device_control(&device->parent, PWM_CMD_SET, &configuration);
|
||||
|
||||
return result;
|
||||
@@ -205,78 +198,6 @@ rt_err_t rt_pwm_set_output(struct rt_device_pwm *device, int channel, rt_uint32_
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef AIC_XPWM_DRV
|
||||
rt_err_t rt_pwm_set_fifo_num(struct rt_device_pwm *device, int channel, rt_uint32_t fifo_num)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
struct rt_pwm_configuration configuration = {0};
|
||||
|
||||
if (!device)
|
||||
{
|
||||
return -RT_EIO;
|
||||
}
|
||||
|
||||
configuration.channel = (channel > 0) ? (channel) : (-channel);
|
||||
configuration.fifo_num = fifo_num;
|
||||
result = rt_device_control(&device->parent, PWM_CMD_SET_FIFO_NUM, &configuration);
|
||||
|
||||
return result;
|
||||
}
|
||||
#ifdef AIC_USING_DMA
|
||||
rt_err_t rt_pwm_dma_set_fifo(struct rt_device_pwm *device, int channel, rt_uint32_t *buf, rt_uint32_t buf_len)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
struct rt_pwm_configuration configuration = {0};
|
||||
|
||||
if (!device)
|
||||
{
|
||||
return -RT_EIO;
|
||||
}
|
||||
|
||||
configuration.channel = (channel > 0) ? (channel) : (-channel);
|
||||
configuration.buf = buf;
|
||||
configuration.buf_len = buf_len;
|
||||
result = rt_device_control(&device->parent, PWM_CMD_DMA_SET_FIFO, &configuration);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
rt_err_t rt_pwm_set_fifo(struct rt_device_pwm *device, int channel, rt_uint32_t fifo_index, rt_uint32_t period, rt_uint32_t pulse, rt_uint32_t pulse_cnt)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
struct rt_pwm_configuration configuration = {0};
|
||||
|
||||
if (!device)
|
||||
{
|
||||
return -RT_EIO;
|
||||
}
|
||||
|
||||
configuration.channel = (channel > 0) ? (channel) : (-channel);
|
||||
configuration.fifo_index = fifo_index;
|
||||
configuration.pul_prd = period;
|
||||
configuration.pul_cmp = pulse;
|
||||
configuration.pul_num = pulse_cnt;
|
||||
result = rt_device_control(&device->parent, PWM_CMD_SET_FIFO, &configuration);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
rt_err_t rt_pwm_get_fifo(struct rt_device_pwm *device, int channel)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
struct rt_pwm_configuration configuration = {0};
|
||||
|
||||
if (!device)
|
||||
{
|
||||
return -RT_EIO;
|
||||
}
|
||||
|
||||
configuration.channel = (channel > 0) ? (channel) : (-channel);
|
||||
result = rt_device_control(&device->parent, PWM_CMD_GET_FIFO, &configuration);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
rt_err_t rt_pwm_set_period(struct rt_device_pwm *device, int channel, rt_uint32_t period)
|
||||
{
|
||||
@@ -354,36 +275,6 @@ rt_err_t rt_pwm_set_pul(struct rt_device_pwm *device, int channel, rt_uint32_t i
|
||||
#include <string.h>
|
||||
#include <finsh.h>
|
||||
|
||||
#if defined(AIC_XPWM_DRV) && defined(AIC_USING_DMA)
|
||||
rt_uint32_t buf[8][30] __attribute__((aligned(CACHE_LINE_SIZE))) = {0};
|
||||
rt_uint32_t pul_num[10] = {2, 5, 2, 1, 2, 1, 2, 1, 2, 2};
|
||||
rt_uint32_t pul_prd[10] = {1000000, 500000, 800000, 1000000, 300000,
|
||||
500000, 800000, 200000, 900000, 600000};
|
||||
rt_uint32_t pul_cmp[10] = {200000, 400000, 100000, 500000, 100000,
|
||||
400000, 600000, 100000, 450000, 300000};
|
||||
rt_uint32_t loop_times = 0;
|
||||
/* callback function */
|
||||
static rt_err_t xpwm_cb(rt_device_t dev, void *buff)
|
||||
{
|
||||
int i, j;
|
||||
rt_uint8_t *p = (rt_uint8_t *)buff;
|
||||
|
||||
static int loop = 1;
|
||||
|
||||
if (loop < loop_times) {
|
||||
for (j = 0, i = 0; j < 10; j++, i+=3) {
|
||||
buf[p[0]][i] = pul_prd[j];
|
||||
buf[p[0]][i + 1] = pul_cmp[j];
|
||||
buf[p[0]][i + 2] = pul_num[j];
|
||||
}
|
||||
rt_pwm_dma_set_fifo((struct rt_device_pwm *)dev, p[0], buf[p[0]], sizeof(buf[p[0]]));
|
||||
loop++;
|
||||
} else {
|
||||
loop = 1;
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int pwm(int argc, char **argv)
|
||||
{
|
||||
@@ -473,120 +364,17 @@ static int pwm(int argc, char **argv)
|
||||
#endif
|
||||
else if (!strcmp(argv[1], "set"))
|
||||
{
|
||||
#ifdef AIC_XPWM_DRV
|
||||
if(argc == 6)
|
||||
{
|
||||
result = rt_pwm_set(pwm_device, atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), atoi(argv[5]));
|
||||
rt_kprintf("pwm info set on %s at channel %d\n",pwm_device,atoi(argv[2]));
|
||||
}
|
||||
#else
|
||||
if(argc == 5)
|
||||
{
|
||||
result = rt_pwm_set(pwm_device, atoi(argv[2]), atoi(argv[3]), atoi(argv[4]));
|
||||
rt_kprintf("pwm info set on %s at channel %d\n",pwm_device,atoi(argv[2]));
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
rt_kprintf("Set info of device: [%s] error\n", pwm_device);
|
||||
#ifdef AIC_XPWM_DRV
|
||||
rt_kprintf("Usage: pwm set <channel> <period> <pulse> <pulse cnt>\n");
|
||||
#else
|
||||
rt_kprintf("Usage: pwm set <channel> <period> <pulse>\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef AIC_XPWM_DRV
|
||||
else if (!strcmp(argv[1], "set_fifo_num"))
|
||||
{
|
||||
if (argc == 4)
|
||||
{
|
||||
result = rt_pwm_set_fifo_num(pwm_device, atoi(argv[2]), atoi(argv[3]));
|
||||
rt_kprintf("pwm set fifo num on %s at channel %d\n",pwm_device,atoi(argv[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("Set fifo num of device: [%s] error\n", pwm_device);
|
||||
rt_kprintf("Usage: pwm set_fifo_num <channel> <fifo_num>\n");
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[1], "set_fifo"))
|
||||
{
|
||||
if (argc == 7)
|
||||
{
|
||||
result = rt_pwm_set_fifo(pwm_device, atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), atoi(argv[5]), atoi(argv[6]));
|
||||
rt_kprintf("pwm set fifo on %s at channel %d\n",pwm_device,atoi(argv[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("Set fifo of device: [%s] error\n", pwm_device);
|
||||
rt_kprintf("Usage: pwm set_fifo <channel> <fifo_index> <period> <pulse> <pulse cnt>\n");
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[1], "get_fifo"))
|
||||
{
|
||||
if (argc == 3)
|
||||
{
|
||||
result = rt_pwm_get_fifo(pwm_device, atoi(argv[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("get fifo info of device: [%s] error\n", pwm_device);
|
||||
rt_kprintf("Usage: pwm get_fifo <channel>\n");
|
||||
}
|
||||
}
|
||||
#ifdef AIC_USING_DMA
|
||||
else if (!strcmp(argv[1], "dma_set_fifo"))
|
||||
{
|
||||
if (argc == 6)
|
||||
{
|
||||
rt_uint32_t buf[3] __attribute__((aligned(CACHE_LINE_SIZE))) = {0};
|
||||
|
||||
loop_times = 0;
|
||||
buf[0] = atoi(argv[3]);
|
||||
buf[1] = atoi(argv[4]);
|
||||
buf[2] = atoi(argv[5]);
|
||||
|
||||
result = rt_pwm_dma_set_fifo(pwm_device, atoi(argv[2]), buf, sizeof(buf));
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("DMA set fifo of device: [%s] error\n", pwm_device);
|
||||
rt_kprintf("Usage: pwm dma_set_fifo <channel> <period> <pulse> <pulse cnt>\n");
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[1], "dma_test"))
|
||||
{
|
||||
if (argc == 4)
|
||||
{
|
||||
int i, j;
|
||||
int ch = atoi(argv[2]);
|
||||
|
||||
/* set callback function */
|
||||
rt_device_set_tx_complete(&pwm_device->parent, xpwm_cb);
|
||||
|
||||
/* loop triggering will be reflected in the callback */
|
||||
loop_times = atoi(argv[3]);
|
||||
|
||||
rt_kprintf("xpwm ch%d will loop %d times\n", ch, loop_times);
|
||||
|
||||
for (j = 0, i = 0; j < 10; j++, i+=3)
|
||||
{
|
||||
buf[ch][i] = pul_prd[j];
|
||||
buf[ch][i + 1] = pul_cmp[j];
|
||||
buf[ch][i + 2] = pul_num[j];
|
||||
}
|
||||
/* trigger the first DMA transport */
|
||||
result = rt_pwm_dma_set_fifo(pwm_device, ch, buf[ch], sizeof(buf[ch]));
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("xpwm dma test: [%s] error\n", pwm_device);
|
||||
rt_kprintf("Usage: pwm dma_test <channel> <loop_times>\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else
|
||||
{
|
||||
rt_kprintf("pwm get <channel> - get pwm channel info\n");
|
||||
@@ -603,16 +391,7 @@ static int pwm(int argc, char **argv)
|
||||
#if defined(AIC_PWM_DRV) || defined(AIC_EPWM_DRV)
|
||||
rt_kprintf("pwm set_pul <channel> <irq_mode> <period> <pulse> <pulse cnt> - set pwm pulse\n");
|
||||
#endif
|
||||
#ifdef AIC_XPWM_DRV
|
||||
rt_kprintf("pwm set <channel> <period> <pulse> <pulse cnt> - set pwm channel info\n");
|
||||
rt_kprintf("pwm set_fifo_num <channel> <fifo_num> - set xpwm fifo count\n");
|
||||
rt_kprintf("pwm set_fifo <channel> <fifo_index> <period> <pulse> <pulse cnt> - set xpwm fifo info\n");
|
||||
rt_kprintf("pwm get_fifo <channel> - get xpwm fifo info\n");
|
||||
rt_kprintf("pwm dma_set_fifo <channel> <period> <pulse> <pulse cnt> - set xpwm dma fifo info\n");
|
||||
rt_kprintf("pwm dma_test <channel> <loop_times> - xpwm dma test\n");
|
||||
#else
|
||||
rt_kprintf("pwm set <channel> <period> <pulse> - set pwm channel info\n");
|
||||
#endif
|
||||
result = - RT_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -1079,8 +1079,8 @@ static void sdio_irq_thread(void *param)
|
||||
break;
|
||||
}
|
||||
|
||||
if (host->sdio_irq_delete_sem)
|
||||
rt_sem_release(host->sdio_irq_delete_sem);
|
||||
rt_event_delete(host->sdio_irq_event);
|
||||
host->sdio_irq_event = NULL;
|
||||
}
|
||||
|
||||
static rt_int32_t sdio_irq_thread_create(struct rt_mmcsd_card *card)
|
||||
@@ -1093,8 +1093,6 @@ static rt_int32_t sdio_irq_thread_create(struct rt_mmcsd_card *card)
|
||||
host->sdio_irq_num++;
|
||||
host->sdio_irq_event = rt_event_create("sdio_irq", 0);
|
||||
RT_ASSERT(host->sdio_irq_event != RT_NULL);
|
||||
host->sdio_irq_delete_sem = rt_sem_create("sdio_irq_delete", 0, RT_IPC_FLAG_FIFO);
|
||||
RT_ASSERT(host->sdio_irq_delete_sem != RT_NULL);
|
||||
|
||||
host->sdio_irq_thread = rt_thread_create("sdio_irq", sdio_irq_thread, host,
|
||||
RT_SDIO_STACK_SIZE, RT_SDIO_THREAD_PRIORITY, 20);
|
||||
@@ -1119,10 +1117,6 @@ static rt_int32_t sdio_irq_thread_delete(struct rt_mmcsd_card *card)
|
||||
if (host->flags & MMCSD_SUP_SDIO_IRQ)
|
||||
host->ops->enable_sdio_irq(host, 0);
|
||||
rt_event_send(host->sdio_irq_event, RT_SDIO_IRQ_THREAD_EXIT);
|
||||
rt_sem_take(host->sdio_irq_delete_sem, RT_WAITING_FOREVER);
|
||||
|
||||
rt_sem_delete(host->sdio_irq_delete_sem);
|
||||
rt_event_delete(host->sdio_irq_event);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -305,7 +305,6 @@ rt_inline int _serial_int_rx(struct rt_serial_device *serial, rt_uint8_t *data,
|
||||
ch = rx_fifo->buffer[rx_fifo->get_index];
|
||||
rx_fifo->get_index += 1;
|
||||
|
||||
#ifdef RT_SERIAL_USING_FLOWCTRL
|
||||
if (serial->config.function == RT_SERIAL_RS232_UNAUTO_FLOW_CTRL ||
|
||||
serial->config.function == RT_SERIAL_RS232_SW_FLOW_CTRL ||
|
||||
serial->config.function == RT_SERIAL_RS232_SW_HW_FLOW_CTRL )
|
||||
@@ -315,7 +314,7 @@ rt_inline int _serial_int_rx(struct rt_serial_device *serial, rt_uint8_t *data,
|
||||
rt_flowctrl_low_detect(serial, 1, RT_SERIAL_INT_FCL_BUFFER);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rx_fifo->get_index >= serial->config.bufsz) rx_fifo->get_index = 0;
|
||||
|
||||
if (rx_fifo->is_full == RT_TRUE)
|
||||
@@ -410,7 +409,6 @@ static rt_size_t _serial_fifo_calc_recved_len(struct rt_serial_device *serial)
|
||||
}
|
||||
#endif /* RT_USING_POSIX_STDIO || RT_SERIAL_USING_DMA */
|
||||
|
||||
#ifdef RT_SERIAL_USING_FLOWCTRL
|
||||
/**
|
||||
* Flow control high level detect.
|
||||
*
|
||||
@@ -486,7 +484,7 @@ void rt_flowctrl_low_detect(struct rt_serial_device *serial, rt_size_t len, rt_s
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_SERIAL_USING_DMA
|
||||
/**
|
||||
@@ -625,7 +623,7 @@ rt_inline int _serial_dma_rx(struct rt_serial_device *serial, rt_uint8_t *data,
|
||||
rt_memcpy(data + serial->config.bufsz - rx_fifo->get_index, rx_fifo->buffer,
|
||||
recv_len + rx_fifo->get_index - serial->config.bufsz);
|
||||
}
|
||||
#ifdef RT_SERIAL_USING_FLOWCTRL
|
||||
|
||||
if (serial->config.function == RT_SERIAL_RS232_UNAUTO_FLOW_CTRL ||
|
||||
serial->config.function == RT_SERIAL_RS232_SW_FLOW_CTRL ||
|
||||
serial->config.function == RT_SERIAL_RS232_SW_HW_FLOW_CTRL)
|
||||
@@ -635,7 +633,7 @@ rt_inline int _serial_dma_rx(struct rt_serial_device *serial, rt_uint8_t *data,
|
||||
rt_flowctrl_low_detect(serial, recv_len, RT_SERIAL_DMA_FCL_BUFFER);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rt_dma_recv_update_get_index(serial, recv_len);
|
||||
rt_hw_interrupt_enable(level);
|
||||
return recv_len;
|
||||
@@ -1146,6 +1144,15 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
|
||||
|
||||
break;
|
||||
|
||||
case RT_SERIAL_GET_CONFIG:
|
||||
if (args)
|
||||
{
|
||||
struct serial_configure *pconfig = (struct serial_configure *) args;
|
||||
*pconfig = serial->config;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RT_SERIAL_RS485_RTS_LOW:
|
||||
serial->ops->control(serial, cmd, args);
|
||||
break;
|
||||
@@ -1445,7 +1452,6 @@ void rt_serial_rx_ind(struct rt_serial_device *serial)
|
||||
rx_fifo->put_index += 1;
|
||||
if (rx_fifo->put_index >= serial->config.bufsz) rx_fifo->put_index = 0;
|
||||
|
||||
#ifdef RT_SERIAL_USING_FLOWCTRL
|
||||
if ((serial->config.function == RT_SERIAL_RS232_UNAUTO_FLOW_CTRL ||
|
||||
serial->config.function == RT_SERIAL_RS232_SW_FLOW_CTRL ||
|
||||
serial->config.function == RT_SERIAL_RS232_SW_HW_FLOW_CTRL) &&
|
||||
@@ -1460,7 +1466,7 @@ void rt_serial_rx_ind(struct rt_serial_device *serial)
|
||||
{
|
||||
serial->ops->control(serial, RT_SERIAL_SW_RECEIVE_ON_OFF, &ch);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* if the next position is read index, discard this 'read char' */
|
||||
if (rx_fifo->put_index == rx_fifo->get_index)
|
||||
{
|
||||
@@ -1564,7 +1570,6 @@ void rt_hw_serial_isr(struct rt_serial_device *serial, int event)
|
||||
{
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
#ifdef RT_SERIAL_USING_FLOWCTRL
|
||||
/* flow control high level detect */
|
||||
if ((serial->config.function == RT_SERIAL_RS232_UNAUTO_FLOW_CTRL ||
|
||||
serial->config.function == RT_SERIAL_RS232_SW_FLOW_CTRL ||
|
||||
@@ -1573,7 +1578,6 @@ void rt_hw_serial_isr(struct rt_serial_device *serial, int event)
|
||||
{
|
||||
rt_flowctrl_high_detect(serial, length, RT_SERIAL_DMA_FCH_BUFFER);
|
||||
}
|
||||
#endif
|
||||
/* update fifo put index */
|
||||
rt_dma_recv_update_put_index(serial, length);
|
||||
/* calculate received total length */
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
static uint16_t g_touch_angle = 0;
|
||||
static uint8_t g_touch_dynamic_enable = 0;
|
||||
static uint8_t g_osd_enable = 0;
|
||||
/* Dynamic Crop Width */
|
||||
static rt_int32_t g_width = 0;
|
||||
/* Dynamic Crop Height */
|
||||
static rt_int32_t g_height = 0;
|
||||
/* Dynamic Crop Switch */
|
||||
static rt_uint8_t g_crop_enable = 0;
|
||||
|
||||
static void aic_set_dynamic_touch_rotation(uint16_t angle)
|
||||
{
|
||||
@@ -45,6 +51,20 @@ static uint8_t aic_get_osd_rotation_flag(uint8_t flag)
|
||||
return g_osd_enable;
|
||||
}
|
||||
|
||||
static void aic_touch_set_dynamic_crop(rt_int32_t width, rt_int32_t height, rt_uint8_t enable)
|
||||
{
|
||||
g_width = width;
|
||||
g_height = height;
|
||||
g_crop_enable = enable;
|
||||
}
|
||||
|
||||
static void aic_touch_get_dynamic_crop(rt_int32_t *width, rt_int32_t *height, rt_uint8_t *enable)
|
||||
{
|
||||
*width = g_width;
|
||||
*height = g_height;
|
||||
*enable = g_crop_enable;
|
||||
}
|
||||
|
||||
/* ISR for touch interrupt */
|
||||
void rt_hw_touch_isr(rt_touch_t touch)
|
||||
{
|
||||
@@ -249,6 +269,24 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args)
|
||||
else
|
||||
result = -RT_EINVAL;
|
||||
|
||||
break;
|
||||
case RT_TOUCH_CTRL_SET_DYNAMIC_CROP:
|
||||
if (args) {
|
||||
struct rt_touch_crop_info *crop_info = (struct rt_touch_crop_info *)args;
|
||||
aic_touch_set_dynamic_crop(crop_info->width, crop_info->height, crop_info->enable);
|
||||
} else {
|
||||
result = -RT_EINVAL;
|
||||
}
|
||||
|
||||
break;
|
||||
case RT_TOUCH_CTRL_GET_DYNAMIC_CROP:
|
||||
if (args) {
|
||||
struct rt_touch_crop_info *crop_info = (struct rt_touch_crop_info *)args;
|
||||
aic_touch_get_dynamic_crop(&crop_info->width, &crop_info->height, &crop_info->enable);
|
||||
} else {
|
||||
result = -RT_EINVAL;
|
||||
}
|
||||
|
||||
break;
|
||||
case RT_TOUCH_CTRL_DISABLE_INT:
|
||||
rt_touch_irq_disable(touch);
|
||||
|
||||
@@ -656,6 +656,9 @@ static void rt_wlan_complete_delete(struct rt_wlan_complete_des *complete)
|
||||
rt_free(complete);
|
||||
}
|
||||
|
||||
#if defined(RT_WLAN_PROT_ENABLE) && defined(RT_WLAN_DEFAULT_PROT)
|
||||
static struct rt_wlan_device *g_wlan_device = NULL;
|
||||
#endif
|
||||
rt_err_t rt_wlan_set_mode(const char *dev_name, rt_wlan_mode_t mode)
|
||||
{
|
||||
rt_device_t device = RT_NULL;
|
||||
@@ -686,11 +689,31 @@ rt_err_t rt_wlan_set_mode(const char *dev_name, rt_wlan_mode_t mode)
|
||||
MGNT_LOCK();
|
||||
if (RT_WLAN_DEVICE(device)->mode == mode)
|
||||
{
|
||||
RT_WLAN_LOG_D("L:%d this device mode is set");
|
||||
err = rt_device_control(device, RT_WLAN_CMD_MODE, (void *)&mode);
|
||||
if (err != RT_EOK)
|
||||
{
|
||||
LOG_E("L:%d wlan config mode failed", __LINE__);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
#if defined(RT_WLAN_PROT_ENABLE) && defined(RT_WLAN_DEFAULT_PROT)
|
||||
if ((g_wlan_device != NULL) && (g_wlan_device != device)) {
|
||||
rt_wlan_prot_detach_dev(g_wlan_device);
|
||||
g_wlan_device = device;
|
||||
rt_wlan_prot_attach_dev(device, RT_WLAN_DEFAULT_PROT);
|
||||
}
|
||||
#endif
|
||||
RT_WLAN_LOG_D("L:%d this device mode is set", mode);
|
||||
MGNT_UNLOCK();
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
#if defined(RT_WLAN_PROT_ENABLE) && defined(RT_WLAN_DEFAULT_PROT)
|
||||
if (g_wlan_device != NULL)
|
||||
rt_wlan_prot_detach_dev(g_wlan_device);
|
||||
|
||||
g_wlan_device = device;
|
||||
#endif
|
||||
|
||||
if ((mode == RT_WLAN_STATION) &&
|
||||
(RT_WLAN_DEVICE(device)->flags & RT_WLAN_FLAG_AP_ONLY))
|
||||
{
|
||||
@@ -913,7 +936,7 @@ rt_err_t rt_wlan_connect(const char *ssid, const char *password)
|
||||
rt_memcpy(&info.ssid.val[0],ssid,rt_strlen(ssid));
|
||||
info.ssid.len = rt_strlen(ssid);
|
||||
|
||||
#if 1 //def RT_WLAN_JOIN_SCAN_BY_MGNT
|
||||
#ifdef RT_WLAN_JOIN_SCAN_BY_MGNT
|
||||
info.rssi = -100;
|
||||
err = rt_wlan_register_event_handler(RT_WLAN_EVT_SCAN_REPORT,rt_wlan_join_scan_callback,&info);
|
||||
if(err != RT_EOK)
|
||||
|
||||
Reference in New Issue
Block a user