mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-08-21 06:23:35 +08:00
Merge branch 'master' into addAnnotation
This commit is contained in:
@@ -5,10 +5,6 @@ config RT_USING_DEVICE_IPC
|
||||
default y
|
||||
|
||||
if RT_USING_DEVICE_IPC
|
||||
config RT_PIPE_BUFSZ
|
||||
int "Set pipe buffer size"
|
||||
default 512
|
||||
|
||||
config RT_USING_SYSTEM_WORKQUEUE
|
||||
bool "Using system default workqueue"
|
||||
default n
|
||||
@@ -18,7 +14,7 @@ if RT_USING_DEVICE_IPC
|
||||
int "The stack size for system workqueue thread"
|
||||
default 2048
|
||||
|
||||
config RT_SYSTEM_WORKQUEUE_PRIORITY
|
||||
config RT_SYSTEM_WORKQUEUE_PRIORITY
|
||||
int "The priority level of system workqueue thread"
|
||||
default 23
|
||||
endif
|
||||
@@ -149,6 +145,42 @@ config RT_USING_PM
|
||||
bool "Using Power Management device drivers"
|
||||
default n
|
||||
|
||||
if RT_USING_PM
|
||||
config PM_TICKLESS_THRESHOLD_TIME
|
||||
int "PM tickless threashold time"
|
||||
default 2
|
||||
|
||||
config PM_USING_CUSTOM_CONFIG
|
||||
bool "PM using custom pm config"
|
||||
default n
|
||||
|
||||
config PM_ENABLE_DEBUG
|
||||
bool "PM Enable Debug"
|
||||
default n
|
||||
|
||||
config PM_ENABLE_SUSPEND_SLEEP_MODE
|
||||
bool "PM Device suspend change sleep mode"
|
||||
default n
|
||||
|
||||
config PM_ENABLE_THRESHOLD_SLEEP_MODE
|
||||
bool "PM using threshold time change sleep mode"
|
||||
default n
|
||||
|
||||
if PM_ENABLE_THRESHOLD_SLEEP_MODE
|
||||
config PM_LIGHT_THRESHOLD_TIME
|
||||
int "PM light mode threashold time"
|
||||
default 5
|
||||
|
||||
config PM_DEEP_THRESHOLD_TIME
|
||||
int "PM deep mode threashold time"
|
||||
default 20
|
||||
|
||||
config PM_STANDBY_THRESHOLD_TIME
|
||||
int "PM standby mode threashold time"
|
||||
default 100
|
||||
endif
|
||||
endif
|
||||
|
||||
config RT_USING_RTC
|
||||
bool "Using RTC device drivers"
|
||||
default n
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-11 zhangsz the first version
|
||||
*/
|
||||
|
||||
#ifndef __LPTIMER_H__
|
||||
#define __LPTIMER_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
struct rt_lptimer
|
||||
{
|
||||
struct rt_timer timer;
|
||||
rt_list_t list;
|
||||
};
|
||||
typedef struct rt_lptimer *rt_lptimer_t;
|
||||
|
||||
void rt_lptimer_init(rt_lptimer_t timer,
|
||||
const char *name,
|
||||
void (*timeout)(void *parameter),
|
||||
void *parameter,
|
||||
rt_tick_t time,
|
||||
rt_uint8_t flag);
|
||||
|
||||
rt_err_t rt_lptimer_detach(rt_lptimer_t timer);
|
||||
rt_err_t rt_lptimer_start(rt_lptimer_t timer);
|
||||
rt_err_t rt_lptimer_stop(rt_lptimer_t timer);
|
||||
|
||||
rt_err_t rt_lptimer_control(rt_lptimer_t timer, int cmd, void *arg);
|
||||
|
||||
rt_tick_t rt_lptimer_next_timeout_tick(void);
|
||||
|
||||
#endif
|
||||
@@ -17,8 +17,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifndef PM_HAS_CUSTOM_CONFIG
|
||||
#include <drivers/lptimer.h>
|
||||
|
||||
/* All modes used for rt_pm_request() and rt_pm_release() */
|
||||
enum
|
||||
@@ -48,10 +47,6 @@ enum
|
||||
RT_PM_FREQUENCY_PENDING = 0x01,
|
||||
};
|
||||
|
||||
#define RT_PM_DEFAULT_SLEEP_MODE PM_SLEEP_MODE_NONE
|
||||
#define RT_PM_DEFAULT_DEEPSLEEP_MODE PM_SLEEP_MODE_DEEP
|
||||
#define RT_PM_DEFAULT_RUN_MODE PM_RUN_MODE_NORMAL_SPEED
|
||||
|
||||
/* The name of all modes used in the msh command "pm_dump" */
|
||||
#define PM_SLEEP_MODE_NAMES \
|
||||
{ \
|
||||
@@ -71,6 +66,7 @@ enum
|
||||
"Low Mode", \
|
||||
}
|
||||
|
||||
#ifndef PM_USING_CUSTOM_CONFIG
|
||||
/**
|
||||
* Modules used for
|
||||
* pm_module_request(PM_BOARD_ID, PM_SLEEP_MODE_IDLE)
|
||||
@@ -98,11 +94,23 @@ enum pm_module_id {
|
||||
PM_MODULE_MAX_ID, /* enum must! */
|
||||
};
|
||||
|
||||
#else /* PM_HAS_CUSTOM_CONFIG */
|
||||
#else
|
||||
|
||||
#include <pm_cfg.h>
|
||||
|
||||
#endif /* PM_HAS_CUSTOM_CONFIG */
|
||||
#endif /* PM_USING_CUSTOM_CONFIG */
|
||||
|
||||
#ifndef RT_PM_DEFAULT_SLEEP_MODE
|
||||
#define RT_PM_DEFAULT_SLEEP_MODE PM_SLEEP_MODE_NONE
|
||||
#endif
|
||||
|
||||
#ifndef RT_PM_DEFAULT_DEEPSLEEP_MODE
|
||||
#define RT_PM_DEFAULT_DEEPSLEEP_MODE PM_SLEEP_MODE_DEEP
|
||||
#endif
|
||||
|
||||
#ifndef RT_PM_DEFAULT_RUN_MODE
|
||||
#define RT_PM_DEFAULT_RUN_MODE PM_RUN_MODE_NORMAL_SPEED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* device control flag to request or release power
|
||||
@@ -160,6 +168,9 @@ struct rt_pm
|
||||
/* modules request status*/
|
||||
struct rt_pm_module module_status[PM_MODULE_MAX_ID];
|
||||
|
||||
/* sleep request table */
|
||||
rt_uint32_t sleep_status[PM_SLEEP_MODE_MAX - 1][(PM_MODULE_MAX_ID + 31) / 32];
|
||||
|
||||
/* the list of device, which has PM feature */
|
||||
rt_uint8_t device_pm_number;
|
||||
struct rt_device_pm *device_pm;
|
||||
@@ -203,5 +214,16 @@ void rt_pm_module_release_all(uint8_t module_id, rt_uint8_t sleep_mode);
|
||||
void rt_pm_module_delay_sleep(rt_uint8_t module_id, rt_tick_t timeout);
|
||||
rt_uint32_t rt_pm_module_get_status(void);
|
||||
rt_uint8_t rt_pm_get_sleep_mode(void);
|
||||
struct rt_pm *rt_pm_get_handle(void);
|
||||
|
||||
/* sleep : request or release */
|
||||
void rt_pm_sleep_request(rt_uint16_t module_id, rt_uint8_t mode);
|
||||
void rt_pm_sleep_release(rt_uint16_t module_id, rt_uint8_t mode);
|
||||
void rt_pm_sleep_none_request(rt_uint16_t module_id);
|
||||
void rt_pm_sleep_none_release(rt_uint16_t module_id);
|
||||
void rt_pm_sleep_idle_request(rt_uint16_t module_id);
|
||||
void rt_pm_sleep_idle_release(rt_uint16_t module_id);
|
||||
void rt_pm_sleep_light_request(rt_uint16_t module_id);
|
||||
void rt_pm_sleep_light_release(rt_uint16_t module_id);
|
||||
|
||||
#endif /* __PM_H__ */
|
||||
|
||||
@@ -15,12 +15,6 @@
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#ifndef RT_PIPE_BUFSZ
|
||||
#define PIPE_BUFSZ 512
|
||||
#else
|
||||
#define PIPE_BUFSZ RT_PIPE_BUFSZ
|
||||
#endif
|
||||
|
||||
struct rt_pipe_device
|
||||
{
|
||||
struct rt_device parent;
|
||||
|
||||
@@ -7,6 +7,7 @@ group = []
|
||||
|
||||
if GetDepend(['RT_USING_PM']):
|
||||
src = src + ['pm.c']
|
||||
src = src + ['lptimer.c']
|
||||
|
||||
if len(src):
|
||||
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-11 zhangsz the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <drivers/lptimer.h>
|
||||
|
||||
static rt_list_t rt_soft_lptimer_list = RT_LIST_OBJECT_INIT(rt_soft_lptimer_list);
|
||||
|
||||
/* lptimer init */
|
||||
void rt_lptimer_init(rt_lptimer_t timer,
|
||||
const char *name,
|
||||
void (*timeout)(void *parameter),
|
||||
void *parameter,
|
||||
rt_tick_t time,
|
||||
rt_uint8_t flag)
|
||||
{
|
||||
rt_timer_init(&timer->timer, name, timeout, parameter, time, flag);
|
||||
rt_list_init(&timer->list);
|
||||
}
|
||||
|
||||
/* lptimer detach */
|
||||
rt_err_t rt_lptimer_detach(rt_lptimer_t timer)
|
||||
{
|
||||
rt_base_t level;
|
||||
rt_err_t ret = RT_EOK;
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
ret = rt_timer_detach(&timer->timer);
|
||||
rt_list_remove(&timer->list);
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* lptimer start */
|
||||
rt_err_t rt_lptimer_start(rt_lptimer_t timer)
|
||||
{
|
||||
rt_base_t level;
|
||||
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_list_remove(&timer->list); /* remove first */
|
||||
if (rt_timer_start(&timer->timer) == RT_EOK)
|
||||
{
|
||||
/* insert to lptimer list */
|
||||
rt_list_insert_after(&rt_soft_lptimer_list, &(timer->list));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
/* lptimer stop */
|
||||
rt_err_t rt_lptimer_stop(rt_lptimer_t timer)
|
||||
{
|
||||
rt_base_t level;
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_list_remove(&timer->list);
|
||||
if (rt_timer_stop(&timer->timer) == RT_EOK)
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
return RT_EOK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
rt_err_t rt_lptimer_control(rt_lptimer_t timer, int cmd, void *arg)
|
||||
{
|
||||
RT_ASSERT(timer != RT_NULL);
|
||||
|
||||
return rt_timer_control(&timer->timer, cmd, arg);
|
||||
}
|
||||
|
||||
/* get the next soft lptimer timeout */
|
||||
rt_tick_t rt_lptimer_next_timeout_tick(void)
|
||||
{
|
||||
struct rt_lptimer *timer;
|
||||
rt_base_t level;
|
||||
rt_tick_t timeout_tick = RT_TICK_MAX;
|
||||
struct rt_list_node *node = RT_NULL;
|
||||
rt_tick_t temp_tick = 0;
|
||||
rt_tick_t min_tick = RT_TICK_MAX;
|
||||
rt_tick_t cur_tick = rt_tick_get();
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
if (!rt_list_isempty(&rt_soft_lptimer_list))
|
||||
{
|
||||
/* find the first active timer's timeout */
|
||||
rt_list_for_each(node, &rt_soft_lptimer_list)
|
||||
{
|
||||
timer = rt_list_entry(node, struct rt_lptimer, list);
|
||||
if (timer->timer.parent.flag & RT_TIMER_FLAG_ACTIVATED)
|
||||
{
|
||||
temp_tick = timer->timer.timeout_tick - cur_tick;
|
||||
|
||||
/* find the least timeout_tick */
|
||||
if (min_tick > temp_tick)
|
||||
{
|
||||
min_tick = temp_tick;
|
||||
timeout_tick = timer->timer.timeout_tick;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return timeout_tick;
|
||||
}
|
||||
|
||||
void lptimer_dump(void)
|
||||
{
|
||||
struct rt_lptimer *timer;
|
||||
rt_base_t level;
|
||||
struct rt_list_node *node = RT_NULL;
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
rt_kprintf("| lptimer | periodic | timeout | flag |\n");
|
||||
rt_kprintf("+---------------+------------+------------+-------------+\n");
|
||||
|
||||
if (!rt_list_isempty(&rt_soft_lptimer_list))
|
||||
{
|
||||
rt_list_for_each(node, &rt_soft_lptimer_list)
|
||||
{
|
||||
timer = rt_list_entry(node, struct rt_lptimer, list);
|
||||
rt_kprintf("| %-13s | 0x%08x | 0x%08x |",
|
||||
timer->timer.parent.name, timer->timer.init_tick,
|
||||
timer->timer.timeout_tick);
|
||||
if (timer->timer.parent.flag & RT_TIMER_FLAG_ACTIVATED)
|
||||
rt_kprintf(" activated |\n");
|
||||
else
|
||||
rt_kprintf(" deactivated |\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
rt_kprintf("+---------------+------------+------------+-------------+\n");
|
||||
}
|
||||
|
||||
MSH_CMD_EXPORT(lptimer_dump, soft lptimer dump);
|
||||
+394
-33
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef RT_USING_POSIX_TERMIOS
|
||||
#include <posix_termios.h>
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
/* it's possible the 'getc/putc' is defined by stdio.h in gcc/newlib. */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#ifdef RT_USING_POSIX_DEVIO
|
||||
#if defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
|
||||
#include <dfs_file.h>
|
||||
#include <dfs_posix.h>
|
||||
#include <poll.h>
|
||||
@@ -392,7 +392,7 @@ static const struct dfs_file_ops pipe_fops =
|
||||
RT_NULL,
|
||||
pipe_fops_poll,
|
||||
};
|
||||
#endif /* RT_USING_POSIX_DEVIO */
|
||||
#endif /* defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE) */
|
||||
|
||||
/**
|
||||
* @brief This function will open the pipe and actually creates the pipe buffer.
|
||||
@@ -406,7 +406,7 @@ static const struct dfs_file_ops pipe_fops =
|
||||
* When the return value is -RT_EINVAL, it means the device handle is empty.
|
||||
* When the return value is -RT_ENOMEM, it means insufficient memory allocation failed.
|
||||
*/
|
||||
rt_err_t rt_pipe_open(rt_device_t device, rt_uint16_t oflag)
|
||||
static 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;
|
||||
@@ -443,7 +443,7 @@ __exit:
|
||||
* When the return value is RT_EOK, the operation is successful.
|
||||
* When the return value is -RT_EINVAL, it means the device handle is empty.
|
||||
*/
|
||||
rt_err_t rt_pipe_close(rt_device_t device)
|
||||
static rt_err_t rt_pipe_close(rt_device_t device)
|
||||
{
|
||||
rt_pipe_t *pipe = (rt_pipe_t *)device;
|
||||
|
||||
@@ -475,7 +475,7 @@ rt_err_t rt_pipe_close(rt_device_t device)
|
||||
* @return Return the length of data read.
|
||||
* When the return value is 0, it means the pipe device handle is empty or the count is 0.
|
||||
*/
|
||||
rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t count)
|
||||
static rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t count)
|
||||
{
|
||||
uint8_t *pbuf;
|
||||
rt_size_t read_bytes = 0;
|
||||
@@ -517,7 +517,7 @@ rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t
|
||||
* @return Return the length of data written.
|
||||
* When the return value is 0, it means the pipe device handle is empty or the count is 0.
|
||||
*/
|
||||
rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt_size_t count)
|
||||
static rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt_size_t count)
|
||||
{
|
||||
uint8_t *pbuf;
|
||||
rt_size_t write_bytes = 0;
|
||||
@@ -556,7 +556,7 @@ rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt
|
||||
*
|
||||
* @return Always return RT_EOK yet.
|
||||
*/
|
||||
rt_err_t rt_pipe_control(rt_device_t dev, int cmd, void *args)
|
||||
static rt_err_t rt_pipe_control(rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -623,9 +623,9 @@ rt_pipe_t *rt_pipe_create(const char *name, int bufsz)
|
||||
rt_free(pipe);
|
||||
return RT_NULL;
|
||||
}
|
||||
#ifdef RT_USING_POSIX_DEVIO
|
||||
#if defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
|
||||
dev->fops = (void*)&pipe_fops;
|
||||
#endif /* RT_USING_POSIX_DEVIO */
|
||||
#endif
|
||||
|
||||
return pipe;
|
||||
}
|
||||
@@ -683,7 +683,7 @@ int rt_pipe_delete(const char *name)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef RT_USING_POSIX_DEVIO
|
||||
#if defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE)
|
||||
/**
|
||||
* @brief This function will creat a anonymous pipe.
|
||||
*
|
||||
@@ -701,7 +701,7 @@ int pipe(int fildes[2])
|
||||
|
||||
rt_snprintf(dname, sizeof(dname), "pipe%d", pipeno++);
|
||||
|
||||
pipe = rt_pipe_create(dname, PIPE_BUFSZ);
|
||||
pipe = rt_pipe_create(dname, RT_USING_POSIX_PIPE_SIZE);
|
||||
if (pipe == RT_NULL)
|
||||
{
|
||||
return -1;
|
||||
@@ -738,7 +738,7 @@ int mkfifo(const char *path, mode_t mode)
|
||||
{
|
||||
rt_pipe_t *pipe;
|
||||
|
||||
pipe = rt_pipe_create(path, PIPE_BUFSZ);
|
||||
pipe = rt_pipe_create(path, RT_USING_POSIX_PIPE_SIZE);
|
||||
if (pipe == RT_NULL)
|
||||
{
|
||||
return -1;
|
||||
@@ -746,4 +746,4 @@ int mkfifo(const char *path, mode_t mode)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* RT_USING_POSIX_DEVIO */
|
||||
#endif /* defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_POSIX_PIPE) */
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* Date Author Notes
|
||||
* 2020-09-01 Meco Man First Version
|
||||
*/
|
||||
#ifndef _SYS_IOCTL_H
|
||||
#define _SYS_IOCTL_H
|
||||
#ifndef __SYS_IOCTL_H__
|
||||
#define __SYS_IOCTL_H__
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <dfs_posix.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
menu "POSIX (Portable Operating System Interface) layer"
|
||||
|
||||
config RT_USING_POSIX_FS
|
||||
bool "Enable POSIX file system, open()/read()/write()/close() etc"
|
||||
bool "Enable POSIX file system and I/O"
|
||||
select RT_USING_DFS
|
||||
select DFS_USING_POSIX
|
||||
default n
|
||||
@@ -13,13 +13,26 @@ if RT_USING_POSIX_FS
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_POLL
|
||||
bool "Enable poll()"
|
||||
bool "Enable I/O Multiplexing poll() <poll.h>"
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_SELECT
|
||||
bool "Enable select()"
|
||||
bool "Enable I/O Multiplexing select() <sys/select.h>"
|
||||
select RT_USING_POSIX_POLL
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_TERMIOS
|
||||
bool "Enable Terminal I/O <termios.h>"
|
||||
select RT_USING_POSIX_DEVIO
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_AIO
|
||||
bool "Enable Asynchronous I/O <aio.h>"
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_MMAN
|
||||
bool "Enable Memory-Mapped I/O <sys/mman.h>"
|
||||
default n
|
||||
endif
|
||||
|
||||
config RT_USING_POSIX_DELAY
|
||||
@@ -32,19 +45,6 @@ config RT_USING_POSIX_GETLINE
|
||||
select RT_LIBC_USING_FILEIO
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_MMAP
|
||||
bool "Enable mmap()"
|
||||
select RT_USING_POSIX_FS
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_TERMIOS
|
||||
bool "Enable termios APIs"
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_AIO
|
||||
bool "Enable AIO APIs"
|
||||
default n
|
||||
|
||||
config RT_USING_PTHREADS
|
||||
bool "Enable pthreads APIs"
|
||||
default n
|
||||
@@ -55,4 +55,6 @@ if RT_USING_PTHREADS
|
||||
default 8
|
||||
endif
|
||||
|
||||
source "$RTT_DIR/components/libc/posix/ipc/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# RT-Thread building script for component
|
||||
|
||||
import os
|
||||
from building import *
|
||||
|
||||
src = []
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = [cwd]
|
||||
group = []
|
||||
|
||||
flag = False
|
||||
|
||||
if GetDepend('RT_USING_POSIX_DEVIO'):
|
||||
src += ['libc.c']
|
||||
flag = True
|
||||
|
||||
if GetDepend('RT_USING_POSIX_SELECT'):
|
||||
src += ['select.c']
|
||||
flag = True
|
||||
|
||||
if flag == True:
|
||||
group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('group')
|
||||
@@ -3,7 +3,7 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
src = ['aio.c']
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_AIO'], CPPPATH = CPPPATH)
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <stdint.h>
|
||||
#include <rthw.h>
|
||||
#include <dfs_posix.h>
|
||||
#include "posix_aio.h"
|
||||
#include "aio.h"
|
||||
|
||||
struct rt_workqueue* aio_queue = NULL;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* 2017/12/30 Bernard The first version.
|
||||
*/
|
||||
|
||||
#ifndef POSIX_AIO_H__
|
||||
#define POSIX_AIO_H__
|
||||
#ifndef __AIO_H__
|
||||
#define __AIO_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/signal.h>
|
||||
@@ -0,0 +1,11 @@
|
||||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = ['mman.c']
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_MMAN'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <rtthread.h>
|
||||
#include <dfs_posix.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include "sys/mman.h"
|
||||
|
||||
void *mmap(void *addr, size_t length, int prot, int flags,
|
||||
int fd, off_t offset)
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
* 2017/11/30 Bernard The first version.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MMAN_H
|
||||
#define _SYS_MMAN_H
|
||||
#ifndef __SYS_MMAN_H__
|
||||
#define __SYS_MMAN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -0,0 +1,14 @@
|
||||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = []
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if GetDepend('RT_USING_POSIX_POLL'):
|
||||
src += ['poll.c']
|
||||
|
||||
group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <dfs_file.h>
|
||||
#include <poll.h>
|
||||
#include "poll.h"
|
||||
|
||||
struct rt_poll_node;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = ['termios.c']
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <dfs_posix.h>
|
||||
#include <sys/errno.h>
|
||||
#include <termios.h>
|
||||
#include "termios.h"
|
||||
|
||||
int tcgetattr(int fd, struct termios *tio)
|
||||
{
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
* Date Author Notes
|
||||
* 2017/08/30 Bernard The first version
|
||||
*/
|
||||
#ifndef TERMIOS_H__
|
||||
#define TERMIOS_H__
|
||||
#ifndef __TERMIOS_H__
|
||||
#define __TERMIOS_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -0,0 +1,17 @@
|
||||
menu "Interprocess Communication (IPC)"
|
||||
|
||||
config RT_USING_POSIX_PIPE
|
||||
bool "Enable pipe and FIFO"
|
||||
select RT_USING_POSIX_FS
|
||||
select RT_USING_POSIX_DEVIO
|
||||
select RT_USING_POSIX_POLL
|
||||
default n
|
||||
|
||||
config RT_USING_POSIX_PIPE_SIZE
|
||||
int "Set pipe buffer size"
|
||||
depends on RT_USING_POSIX_PIPE
|
||||
default 512
|
||||
|
||||
comment "Socket is in the 'Network' category"
|
||||
|
||||
endmenu
|
||||
@@ -5,4 +5,11 @@
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-07 Meco Man First version
|
||||
*/
|
||||
#ifndef __SYS_IPC_H__
|
||||
#define __SYS_IPC_H__
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -5,15 +5,11 @@
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-07 Meco Man First version
|
||||
*/
|
||||
#ifndef _TERMIOS_H__
|
||||
#define _TERMIOS_H__
|
||||
#ifndef __SYS_MSG_H__
|
||||
#define __SYS_MSG_H__
|
||||
|
||||
#include <rtconfig.h>
|
||||
|
||||
#ifdef RT_USING_POSIX_TERMIOS
|
||||
#include <sys/types.h>
|
||||
#include <posix_termios.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-07 Meco Man First version
|
||||
*/
|
||||
#ifndef __SYS_SEM_H__
|
||||
#define __SYS_SEM_H__
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-07 Meco Man First version
|
||||
*/
|
||||
#ifndef __SYS_SHM_H__
|
||||
#define __SYS_SHM_H__
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -10,26 +10,10 @@ group = []
|
||||
flag = False
|
||||
src += ['unistd.c'] #TODO
|
||||
|
||||
if GetDepend('RT_USING_POSIX_DEVIO'):
|
||||
src += ['libc.c']
|
||||
flag = True
|
||||
|
||||
if GetDepend('RT_USING_POSIX_DELAY'):
|
||||
src += ['delay.c']
|
||||
flag = True
|
||||
|
||||
if GetDepend('RT_USING_POSIX_POLL'):
|
||||
src += ['poll.c']
|
||||
flag = True
|
||||
|
||||
if GetDepend('RT_USING_POSIX_SELECT'):
|
||||
src += ['select.c']
|
||||
flag = True
|
||||
|
||||
if GetDepend('RT_USING_POSIX_MMAP'):
|
||||
src += ['mmap.c']
|
||||
flag = True
|
||||
|
||||
if flag == True:
|
||||
group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c') + Glob('*.cpp')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('POSIX', src, depend = ['RT_USING_LIBC', 'RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -264,6 +264,10 @@ static void client_cli_parser(at_client_t client)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cur_line_len >= FINSH_CMD_SIZE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
rt_kprintf("%c", ch);
|
||||
cur_line[cur_line_len++] = ch;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user