Merge branch 'master' of https://github.com/rt-thread/rt-thread into rtt_issues

This commit is contained in:
Wayne Lin
2020-05-15 09:41:27 +08:00
404 changed files with 91675 additions and 4505 deletions
Executable → Regular
View File
@@ -22,6 +22,8 @@ struct rt_data_item;
/* data queue implementation */
struct rt_data_queue
{
rt_uint32_t magic;
rt_uint16_t size;
rt_uint16_t lwm;
rt_bool_t waiting_lwm;
@@ -57,5 +59,6 @@ rt_err_t rt_data_queue_peak(struct rt_data_queue *queue,
const void **data_ptr,
rt_size_t *size);
void rt_data_queue_reset(struct rt_data_queue *queue);
rt_err_t rt_data_queue_deinit(struct rt_data_queue *queue);
#endif
+2
View File
@@ -61,6 +61,8 @@ extern "C" {
#define RT_SENSOR_VENDOR_ASAIR (8) /* Aosong */
#define RT_SENSOR_VENDOR_SHARP (9) /* Sharp */
#define RT_SENSOR_VENDOR_SENSIRION (10) /* Sensirion */
#define RT_SENSOR_VENDOR_TI (11) /* Texas Instruments*/
/* Sensor unit types */
+2
View File
@@ -785,6 +785,8 @@ static rt_err_t rt_serial_close(struct rt_device *dev)
tx_dma = (struct rt_serial_tx_dma*)serial->serial_tx;
RT_ASSERT(tx_dma != RT_NULL);
rt_data_queue_deinit(&(tx_dma->data_queue));
rt_free(tx_dma);
serial->serial_tx = RT_NULL;
dev->open_flag &= ~RT_DEVICE_FLAG_DMA_TX;
+32 -3
View File
@@ -13,6 +13,8 @@
#include <rtdevice.h>
#include <rthw.h>
#define DATAQUEUE_MAGIC 0xbead0e0e
struct rt_data_item
{
const void *data_ptr;
@@ -29,6 +31,7 @@ rt_data_queue_init(struct rt_data_queue *queue,
queue->evt_notify = evt_notify;
queue->magic = DATAQUEUE_MAGIC;
queue->size = size;
queue->lwm = lwm;
@@ -57,6 +60,7 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
rt_thread_t thread;
rt_err_t result;
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
RT_ASSERT(queue != RT_NULL);
result = RT_EOK;
@@ -145,7 +149,8 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
rt_ubase_t level;
rt_thread_t thread;
rt_err_t result;
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
RT_ASSERT(queue != RT_NULL);
RT_ASSERT(data_ptr != RT_NULL);
RT_ASSERT(size != RT_NULL);
@@ -244,7 +249,8 @@ rt_err_t rt_data_queue_peak(struct rt_data_queue *queue,
rt_size_t *size)
{
rt_ubase_t level;
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
RT_ASSERT(queue != RT_NULL);
level = rt_hw_interrupt_disable();
@@ -269,7 +275,9 @@ void rt_data_queue_reset(struct rt_data_queue *queue)
{
struct rt_thread *thread;
register rt_ubase_t temp;
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
rt_enter_critical();
/* wakeup all suspend threads */
@@ -325,3 +333,24 @@ void rt_data_queue_reset(struct rt_data_queue *queue)
rt_schedule();
}
RTM_EXPORT(rt_data_queue_reset);
rt_err_t rt_data_queue_deinit(struct rt_data_queue *queue)
{
rt_ubase_t level;
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
RT_ASSERT(queue != RT_NULL);
level = rt_hw_interrupt_disable();
/* wakeup all suspend threads */
rt_data_queue_reset(queue);
queue->magic = 0;
rt_free(queue->queue);
rt_hw_interrupt_enable(level);
return RT_EOK;
}
RTM_EXPORT(rt_data_queue_deinit);
+13 -2
View File
@@ -323,18 +323,29 @@ static const struct dfs_file_ops pipe_fops =
rt_err_t rt_pipe_open (rt_device_t device, rt_uint16_t oflag)
{
rt_pipe_t *pipe = (rt_pipe_t *)device;
rt_err_t ret = RT_EOK;
if (device == RT_NULL) return -RT_EINVAL;
if (device == RT_NULL)
{
ret = -RT_EINVAL;
goto __exit;
}
rt_mutex_take(&(pipe->lock), RT_WAITING_FOREVER);
if (pipe->fifo == RT_NULL)
{
pipe->fifo = rt_ringbuffer_create(pipe->bufsz);
if (pipe->fifo == RT_NULL)
{
ret = -RT_ENOMEM;
}
}
rt_mutex_release(&(pipe->lock));
return RT_EOK;
__exit:
return ret;
}
rt_err_t rt_pipe_close (rt_device_t device)
@@ -426,7 +426,7 @@ static rt_size_t _read_capacity(ufunction_t func, ustorage_cbw_t cbw)
data = (struct mstorage*)func->user_data;
buf = data->ep_in->buffer;
sector_count = data->geometry.sector_count;
sector_count = data->geometry.sector_count - 1; /* Last Logical Block Address */
sector_size = data->geometry.bytes_per_sector;
buf[0] = sector_count >> 24;
+2 -2
View File
@@ -8,8 +8,8 @@
* 2011-12-12 Yi Qiu first version
*/
#ifndef __HID_H__
#define __HID_H__
#ifndef __ADK_H__
#define __ADK_H__
#include <rtthread.h>
+3 -3
View File
@@ -102,7 +102,7 @@ rt_err_t rt_wlan_dev_connect(struct rt_wlan_device *device, struct rt_wlan_info
if ((password_len > RT_WLAN_PASSWORD_MAX_LENGTH) ||
(info->ssid.len > RT_WLAN_SSID_MAX_LENGTH))
{
LOG_E("L:%d password or ssid is to long", __LINE__);
LOG_E("L:%d password or ssid is too long", __LINE__);
return -RT_ERROR;
}
rt_memset(&sta_info, 0, sizeof(struct rt_sta_info));
@@ -150,7 +150,7 @@ rt_err_t rt_wlan_dev_ap_start(struct rt_wlan_device *device, struct rt_wlan_info
if ((password_len > RT_WLAN_PASSWORD_MAX_LENGTH) ||
(info->ssid.len > RT_WLAN_SSID_MAX_LENGTH))
{
LOG_E("L:%d password or ssid is to long", __LINE__);
LOG_E("L:%d password or ssid is too long", __LINE__);
return -RT_ERROR;
}
@@ -530,7 +530,7 @@ rt_err_t rt_wlan_dev_scan(struct rt_wlan_device *device, struct rt_wlan_info *in
{
if (info->ssid.len > RT_WLAN_SSID_MAX_LENGTH)
{
LOG_E("L:%d ssid is to long", __LINE__);
LOG_E("L:%d ssid is too long", __LINE__);
return -RT_EINVAL;
}
rt_memcpy(&scan_info.ssid, &info->ssid, sizeof(rt_wlan_ssid_t));
+10
View File
@@ -29,6 +29,7 @@
* 2018-11-22 Jesven list_thread add smp support
* 2018-12-27 Jesven Fix the problem that disable interrupt too long in list_thread
* Provide protection for the "first layer of objects" when list_*
* 2020-04-07 chenhui add clear
*/
#include <rthw.h>
@@ -48,6 +49,15 @@ long hello(void)
}
FINSH_FUNCTION_EXPORT(hello, say hello world);
long clear(void)
{
rt_kprintf("\x1b[2J\x1b[H");
return 0;
}
FINSH_FUNCTION_EXPORT(clear,clear the terminal screen);
MSH_CMD_EXPORT(clear,clear the terminal screen);
extern void rt_show_version(void);
long version(void)
{
+2 -2
View File
@@ -27,8 +27,8 @@
#define HEAP_ALIGNMENT 4 /* heap alignment */
#define FINSH_GET16(x) (*(x)) | (*((x)+1) << 8)
#define FINSH_GET32(x) (rt_uint32_t)(*(x)) | ((rt_uint32_t)*((x)+1) << 8) | \
((rt_uint32_t)*((x)+2) << 16) | ((rt_uint32_t)*((x)+3) << 24)
#define FINSH_GET32(x) (rt_ubase_t)(*(x)) | ((rt_ubase_t)*((x)+1) << 8) | \
((rt_ubase_t)*((x)+2) << 16) | ((rt_ubase_t)*((x)+3) << 24)
#define FINSH_SET16(x, v) \
do \
+1 -1
View File
@@ -191,7 +191,7 @@ static int finsh_compile(struct finsh_node* node)
case FINSH_NODE_VALUE_NULL:
case FINSH_NODE_VALUE_STRING:
finsh_code_byte(FINSH_OP_LD_DWORD);
finsh_code_dword((uint32_t)node->value.ptr);
finsh_code_dword((rt_ubase_t)node->value.ptr);
break;
/* arithmetic operation */
@@ -25,8 +25,6 @@ typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef int mode_t;
typedef unsigned long clockid_t;
typedef int pid_t;
+1 -1
View File
@@ -744,7 +744,7 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f
goto __exit;
}
/* if the socket type is UDP, nead to connect socket first */
/* if the socket type is UDP, need to connect socket first */
if (from && sock->type == AT_SOCKET_UDP && sock->state == AT_SOCKET_OPEN)
{
ip_addr_t remote_addr;
+1 -1
View File
@@ -1087,7 +1087,7 @@ int netdev_cmd_ping(char* target_name, rt_uint32_t times, rt_size_t size)
}
}
/* if the response time is more than NETDEV_PING_DELAY, no nead to delay */
/* if the response time is more than NETDEV_PING_DELAY, no need to delay */
delay_tick = ((rt_tick_get() - start_tick) > NETDEV_PING_DELAY) || (index == times) ? 0 : NETDEV_PING_DELAY;
rt_thread_delay(delay_tick);
}
+4 -3
View File
@@ -679,7 +679,7 @@ int sal_shutdown(int socket, int how)
/* get the socket object by socket descriptor */
SAL_SOCKET_OBJ_GET(sock, socket);
/* shutdown operation not nead to check network interface status */
/* shutdown operation not need to check network interface status */
/* check the network interface socket opreation */
SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, shutdown);
@@ -924,6 +924,7 @@ int sal_socket(int domain, int type, int protocol)
sock = sal_get_socket(socket);
if (sock == RT_NULL)
{
socket_delete(socket);
return -1;
}
@@ -956,7 +957,7 @@ int sal_socket(int domain, int type, int protocol)
sock->user_data = (void *) proto_socket;
return sock->socket;
}
socket_delete(socket);
return -1;
}
@@ -969,7 +970,7 @@ int sal_closesocket(int socket)
/* get the socket object by socket descriptor */
SAL_SOCKET_OBJ_GET(sock, socket);
/* clsoesocket operation not nead to vaild network interface status */
/* clsoesocket operation not need to vaild network interface status */
/* valid the network interface socket opreation */
SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, socket);