Merge pull request #5311 from mysterywolf/PSE

[PSE分支] 增加RT_USING_POSIX_FS
This commit is contained in:
guo 2021-11-30 15:28:19 +08:00 committed by GitHub
commit 838d1087a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 49 deletions

View File

@ -362,7 +362,7 @@ static void _serial_check_buffer_size(void)
}
}
#if defined(RT_USING_POSIX) || defined(RT_SERIAL_USING_DMA)
#if defined(RT_USING_POSIX_DEVIO) || defined(RT_SERIAL_USING_DMA)
static rt_size_t _serial_fifo_calc_recved_len(struct rt_serial_device *serial)
{
struct rt_serial_rx_fifo *rx_fifo = (struct rt_serial_rx_fifo *) serial->serial_rx;
@ -385,7 +385,7 @@ static rt_size_t _serial_fifo_calc_recved_len(struct rt_serial_device *serial)
}
}
}
#endif /* RT_USING_POSIX || RT_SERIAL_USING_DMA */
#endif /* RT_USING_POSIX_DEVIO || RT_SERIAL_USING_DMA */
#ifdef RT_SERIAL_USING_DMA
/**
@ -1133,6 +1133,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
}
else
{
#include <shell.h>
#define _TIO_BUFLEN 20
char _tio_buf[_TIO_BUFLEN];
unsigned char cnt1, cnt2, cnt3, i;
@ -1148,7 +1149,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
i = 0;
while(i < _TIO_BUFLEN)
{
_tio_buf[i] = getchar();
_tio_buf[i] = finsh_getchar();
if(_tio_buf[i] != 't')
{
i ++;

View File

@ -2,7 +2,6 @@ menu "POSIX layer and C standard library"
config RT_USING_LIBC
bool "Enable libc APIs from toolchain"
select RT_USING_HEAP
default n
if RT_USING_LIBC
@ -10,8 +9,8 @@ if RT_USING_LIBC
default y
config RT_LIBC_USING_FILEIO
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar"
select RT_USING_POSIX
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar/STDIO"
select RT_USING_POSIX_FS
select RT_USING_POSIX_DEVIO
default n
@ -38,28 +37,27 @@ config RT_LIBC_DEFAULT_TIMEZONE
range -12 12
default 8
config RT_USING_POSIX
bool "Enable basic POSIX layer, open()/read()/write()/close() etc"
config RT_USING_POSIX_FS
bool "Enable POSIX file system, open()/read()/write()/close() etc"
select RT_USING_DFS
select DFS_USING_POSIX
default n
if RT_USING_POSIX
if RT_USING_POSIX_FS
config RT_USING_POSIX_DEVIO
bool "Enable devices as file descriptors"
select RT_USING_DFS
select RT_USING_DFS_DEVFS
default n
config RT_USING_POSIX_POLL
bool "Enable poll()"
select RT_USING_DFS
default n
config RT_USING_POSIX_SELECT
bool "Enable select()"
select RT_USING_DFS
select RT_USING_POSIX_POLL
default n
endif
config RT_USING_POSIX_DELAY
bool "Enable delay APIs, sleep()/usleep()/msleep() etc"
@ -67,11 +65,13 @@ if RT_USING_POSIX
config RT_USING_POSIX_GETLINE
bool "Enable getline()/getdelim()"
select RT_USING_LIBC
select RT_LIBC_USING_FILEIO
default n
config RT_USING_POSIX_MMAP
bool "Enable mmap()"
select RT_USING_DFS
select RT_USING_POSIX_FS
default n
config RT_USING_POSIX_TERMIOS
@ -81,7 +81,6 @@ if RT_USING_POSIX
config RT_USING_POSIX_AIO
bool "Enable AIO APIs"
default n
endif
config RT_USING_PTHREADS
bool "Enable pthreads APIs"

View File

@ -72,7 +72,6 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz);
struct tm *gmtime_r(const time_t *timep, struct tm *r);
#endif
#ifdef RT_USING_POSIX
/* POSIX clock and timer */
#define MILLISECOND_PER_SECOND 1000UL
#define MICROSECOND_PER_SECOND 1000000UL
@ -103,8 +102,8 @@ int clock_getres (clockid_t clockid, struct timespec *res);
int clock_gettime (clockid_t clockid, struct timespec *tp);
int clock_settime (clockid_t clockid, const struct timespec *tp);
int rt_timespec_to_tick(const struct timespec *time);
#endif /* RT_USING_POSIX */
/* timezone */
void tz_set(int8_t tz);
int8_t tz_get(void);
int8_t tz_is_dst(void);

View File

@ -486,8 +486,6 @@ RTM_EXPORT(settimeofday);
RTM_EXPORT(difftime);
RTM_EXPORT(strftime);
#ifdef RT_USING_POSIX
#ifdef RT_USING_RTC
static volatile struct timeval _timevalue;
static int _rt_clock_time_system_init()
@ -690,9 +688,6 @@ int rt_timespec_to_tick(const struct timespec *time)
}
RTM_EXPORT(rt_timespec_to_tick);
#endif /* RT_USING_POSIX */
/* timezone */
#ifndef RT_LIBC_DEFAULT_TIMEZONE
#define RT_LIBC_DEFAULT_TIMEZONE 8

View File

@ -3,11 +3,9 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('POSIX', src,
depend = ['RT_USING_LIBC', 'RT_USING_POSIX','RT_USING_POSIX_GETLINE'],
CPPPATH = CPPPATH)
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_GETLINE'], CPPPATH = CPPPATH)
Return('group')

View File

@ -75,4 +75,3 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) {
ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
return getdelim(lineptr, n, '\n', stream);
}

View File

@ -2,25 +2,35 @@
from building import *
src = ['unistd.c']
src = []
cwd = GetCurrentDir()
CPPPATH = [cwd]
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
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX'], CPPPATH = CPPPATH)
if flag == True:
group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
Return('group')

View File

@ -1,6 +1,6 @@
config RT_USING_LWP
bool "Using light-weight process"
select RT_USING_POSIX
select RT_USING_POSIX_FS
select RT_USING_POSIX_SELECT
select RT_USING_LIBC
depends on ARCH_ARM_CORTEX_M || ARCH_ARM_ARM9 || ARCH_ARM_CORTEX_A

View File

@ -41,7 +41,7 @@ config RT_USING_SAL
config SAL_USING_POSIX
bool "Enable BSD socket operated by file system API"
default n
select RT_USING_POSIX
select RT_USING_POSIX_FS
select RT_USING_POSIX_SELECT
help
Let BSD socket operated by file system API, such as read/write and involveed in select/poll POSIX APIs.