Merge branch 'master' of https://github.com/RT-Thread/rt-thread into develop_one

This commit is contained in:
liuxianliang
2021-04-06 10:42:58 +08:00
472 changed files with 17540 additions and 15072 deletions
@@ -49,6 +49,7 @@ extern "C" {
#define RT_SENSOR_CLASS_ECO2 (15) /* eCO2 sensor */
#define RT_SENSOR_CLASS_GNSS (16) /* GPS/GNSS sensor */
#define RT_SENSOR_CLASS_TOF (17) /* TOF sensor */
#define RT_SENSOR_CLASS_SPO2 (18) /* SpO2 sensor */
/* Sensor vendor types */
@@ -89,6 +90,7 @@ extern "C" {
#define RT_SENSOR_UNIT_PPB (15) /* Concentration unit: ppb */
#define RT_SENSOR_UNIT_DMS (16) /* Coordinates unit: DMS */
#define RT_SENSOR_UNIT_DD (17) /* Coordinates unit: DD */
#define RT_SENSOR_UNIT_PERCENT (18) /* Percentage unit: % */
/* Sensor communication interface types */
@@ -217,6 +219,7 @@ struct rt_sensor_data
rt_int32_t force; /* Force sensor. unit: mN */
rt_uint32_t dust; /* Dust sensor. unit: ug/m3 */
rt_uint32_t eco2; /* eCO2 sensor. unit: ppm */
rt_uint32_t spo2; /* SpO2 sensor. unit: % */
} data;
};
+2 -1
View File
@@ -36,7 +36,8 @@ static char *const sensor_name_str[] =
"dust_", /* Dust sensor */
"eco2_", /* eCO2 sensor */
"gnss_", /* GPS/GNSS sensor */
"tof_" /* TOF sensor */
"tof_", /* TOF sensor */
"spo2_" /* SpO2 sensor */
};
/* Sensor interrupt correlation function */
+1 -1
View File
@@ -816,11 +816,11 @@ static rt_err_t rt_serial_close(struct rt_device *dev)
/* configure low level device */
serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *) RT_DEVICE_FLAG_DMA_TX);
}
#endif /* RT_SERIAL_USING_DMA */
serial->ops->control(serial, RT_DEVICE_CTRL_CLOSE, RT_NULL);
dev->flag &= ~RT_DEVICE_FLAG_ACTIVATED;
#endif /* RT_SERIAL_USING_DMA */
return RT_EOK;
}
+4 -1
View File
@@ -28,7 +28,10 @@ if GetDepend('RT_USING_SFUD'):
if rtconfig.CROSS_TOOL == 'gcc':
LOCAL_CCFLAGS += ' -std=c99'
elif rtconfig.CROSS_TOOL == 'keil':
LOCAL_CCFLAGS += ' --c99'
if rtconfig.PLATFORM == 'armcc':
LOCAL_CCFLAGS += ' --c99'
elif rtconfig.PLATFORM == 'armclang':
LOCAL_CCFLAGS += ' -std=c99'
src += src_device
+1 -1
View File
@@ -218,7 +218,7 @@ sfud_err sfud_qspi_fast_read_enable(sfud_flash *flash, uint8_t data_line_width)
break;
case 2:
if (read_mode & DUAL_IO) {
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_IO_READ_DATA, 1, 2, 8, 2);
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_IO_READ_DATA, 1, 2, 4, 2);
} else if (read_mode & DUAL_OUTPUT) {
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_OUTPUT_READ_DATA, 1, 1, 8, 2);
} else {
+21 -21
View File
@@ -50,26 +50,26 @@ RTM_EXPORT(rt_rbb_init);
* @param buf_size buffer size
* @param blk_max_num max block number
*
* @return != NULL: ring block buffer object
* NULL: create failed
* @return != RT_NULL: ring block buffer object
* RT_NULL: create failed
*/
rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num)
{
rt_rbb_t rbb = NULL;
rt_rbb_t rbb = RT_NULL;
rt_uint8_t *buf;
rt_rbb_blk_t blk_set;
rbb = (rt_rbb_t)rt_malloc(sizeof(struct rt_rbb));
if (!rbb)
{
return NULL;
return RT_NULL;
}
buf = (rt_uint8_t *)rt_malloc(buf_size);
if (!buf)
{
rt_free(rbb);
return NULL;
return RT_NULL;
}
blk_set = (rt_rbb_blk_t)rt_malloc(sizeof(struct rt_rbb_blk) * blk_max_num);
@@ -77,7 +77,7 @@ rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num)
{
rt_free(buf);
rt_free(rbb);
return NULL;
return RT_NULL;
}
rt_rbb_init(rbb, buf, buf_size, blk_set, blk_max_num);
@@ -116,7 +116,7 @@ static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb)
}
}
return NULL;
return RT_NULL;
}
/**
@@ -127,14 +127,14 @@ static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb)
*
* @note When your application need align access, please make the blk_szie is aligned.
*
* @return != NULL: allocated block
* NULL: allocate failed
* @return != RT_NULL: allocated block
* RT_NULL: allocate failed
*/
rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
{
rt_base_t level;
rt_size_t empty1 = 0, empty2 = 0;
rt_rbb_blk_t head, tail, new_rbb = NULL;
rt_rbb_blk_t head, tail, new_rbb = RT_NULL;
RT_ASSERT(rbb);
RT_ASSERT(blk_size < (1L << 24));
@@ -178,7 +178,7 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
else
{
/* no space */
new_rbb = NULL;
new_rbb = RT_NULL;
}
}
else
@@ -202,7 +202,7 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
else
{
/* no space */
new_rbb = NULL;
new_rbb = RT_NULL;
}
}
}
@@ -217,7 +217,7 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
}
else
{
new_rbb = NULL;
new_rbb = RT_NULL;
}
rt_hw_interrupt_enable(level);
@@ -245,13 +245,13 @@ RTM_EXPORT(rt_rbb_blk_put);
*
* @param rbb ring block buffer object
*
* @return != NULL: block
* NULL: get failed
* @return != RT_NULL: block
* RT_NULL: get failed
*/
rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
{
rt_base_t level;
rt_rbb_blk_t block = NULL;
rt_rbb_blk_t block = RT_NULL;
rt_slist_t *node;
RT_ASSERT(rbb);
@@ -271,7 +271,7 @@ rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
}
}
/* not found */
block = NULL;
block = RT_NULL;
__exit:
@@ -364,7 +364,7 @@ rt_size_t rt_rbb_blk_queue_get(rt_rbb_t rbb, rt_size_t queue_data_len, rt_rbb_bl
rt_base_t level;
rt_size_t data_total_size = 0;
rt_slist_t *node;
rt_rbb_blk_t last_block = NULL, block;
rt_rbb_blk_t last_block = RT_NULL, block;
RT_ASSERT(rbb);
RT_ASSERT(blk_queue);
@@ -388,7 +388,7 @@ rt_size_t rt_rbb_blk_queue_get(rt_rbb_t rbb, rt_size_t queue_data_len, rt_rbb_bl
else
{
/* the first block must be put status */
last_block = NULL;
last_block = RT_NULL;
continue;
}
}
@@ -493,7 +493,7 @@ rt_size_t rt_rbb_next_blk_queue_len(rt_rbb_t rbb)
rt_base_t level;
rt_size_t data_len = 0;
rt_slist_t *node;
rt_rbb_blk_t last_block = NULL, block;
rt_rbb_blk_t last_block = RT_NULL, block;
RT_ASSERT(rbb);
@@ -510,7 +510,7 @@ rt_size_t rt_rbb_next_blk_queue_len(rt_rbb_t rbb)
if (last_block->status != RT_RBB_BLK_PUT)
{
/* the first block must be put status */
last_block = NULL;
last_block = RT_NULL;
continue;
}
}
+20 -1
View File
@@ -209,6 +209,8 @@ int pthread_create(pthread_t *pid,
/* get pthread data */
ptd = _pthread_get_data(pth_id);
RT_ASSERT(ptd != RT_NULL);
if (attr != RT_NULL)
{
ptd->attr = *attr;
@@ -299,6 +301,12 @@ int pthread_detach(pthread_t thread)
{
int ret = 0;
_pthread_data_t *ptd = _pthread_get_data(thread);
if (ptd == RT_NULL)
{
/* invalid pthread id */
ret = EINVAL;
goto __exit;
}
rt_enter_critical();
if (ptd->attr.detachstate == PTHREAD_CREATE_DETACHED)
@@ -360,6 +368,12 @@ int pthread_join(pthread_t thread, void **value_ptr)
rt_err_t result;
ptd = _pthread_get_data(thread);
if (ptd == RT_NULL)
{
return EINVAL; /* invalid pthread id */
}
if (ptd && ptd->tid == rt_thread_self())
{
/* join self */
@@ -367,7 +381,9 @@ int pthread_join(pthread_t thread, void **value_ptr)
}
if (ptd->attr.detachstate == PTHREAD_CREATE_DETACHED)
{
return EINVAL; /* join on a detached pthread */
}
result = rt_sem_take(ptd->joinable_sem, RT_WAITING_FOREVER);
if (result == RT_EOK)
@@ -662,7 +678,10 @@ int pthread_cancel(pthread_t thread)
/* get posix thread data */
ptd = _pthread_get_data(thread);
RT_ASSERT(ptd != RT_NULL);
if (ptd == RT_NULL)
{
return EINVAL;
}
/* cancel self */
if (ptd->tid == rt_thread_self())