summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorguo <[email protected]>2021-11-30 15:28:19 +0800
committerGitHub <[email protected]>2021-11-30 15:28:19 +0800
commit838d1087a05c1565aa8833d6a9dab7d3191e646e (patch)
tree523b091e5f1fc312c0c07c8fef9fc2de4e628f8f /components
parent4e9744c0acd093efd6fb1da1216d918521d14015 (diff)
parent7973ede5a8cacd3a7d4593ae7e76d6fb0dff8e1d (diff)
Merge pull request #5311 from mysterywolf/PSE
[PSE分支] 增加RT_USING_POSIX_FS
Diffstat (limited to 'components')
-rw-r--r--components/drivers/serial/serial.c7
-rw-r--r--components/libc/Kconfig51
-rw-r--r--components/libc/compilers/common/sys/time.h3
-rw-r--r--components/libc/compilers/common/time.c5
-rw-r--r--components/libc/posix/getline/SConscript6
-rw-r--r--components/libc/posix/getline/posix_getline.c1
-rw-r--r--components/libc/posix/src/SConscript14
-rw-r--r--components/lwp/Kconfig2
-rw-r--r--components/net/Kconfig2
9 files changed, 46 insertions, 45 deletions
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c
index c17c7aaebb..0e944b5e95 100644
--- a/components/drivers/serial/serial.c
+++ b/components/drivers/serial/serial.c
@@ -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 ++;
diff --git a/components/libc/Kconfig b/components/libc/Kconfig
index a616754904..dfbe73aa14 100644
--- a/components/libc/Kconfig
+++ b/components/libc/Kconfig
@@ -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,50 +37,50 @@ 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"
- default n
+config RT_USING_POSIX_DELAY
+ bool "Enable delay APIs, sleep()/usleep()/msleep() etc"
+ default n
- config RT_USING_POSIX_GETLINE
- bool "Enable getline()/getdelim()"
- default n
+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
- 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_TERMIOS
+ bool "Enable termios APIs"
+ default n
- config RT_USING_POSIX_AIO
- bool "Enable AIO APIs"
- default n
-endif
+config RT_USING_POSIX_AIO
+ bool "Enable AIO APIs"
+ default n
config RT_USING_PTHREADS
bool "Enable pthreads APIs"
diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h
index d14905ebfb..93e3bb7ba4 100644
--- a/components/libc/compilers/common/sys/time.h
+++ b/components/libc/compilers/common/sys/time.h
@@ -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);
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 5bfff15914..73b6d76352 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -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
diff --git a/components/libc/posix/getline/SConscript b/components/libc/posix/getline/SConscript
index bb18dc04c5..a0077b0ce9 100644
--- a/components/libc/posix/getline/SConscript
+++ b/components/libc/posix/getline/SConscript
@@ -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')
diff --git a/components/libc/posix/getline/posix_getline.c b/components/libc/posix/getline/posix_getline.c
index da80242ecc..63fa33ea42 100644
--- a/components/libc/posix/getline/posix_getline.c
+++ b/components/libc/posix/getline/posix_getline.c
@@ -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);
}
-
diff --git a/components/libc/posix/src/SConscript b/components/libc/posix/src/SConscript
index 067d598b74..4be5ac83cc 100644
--- a/components/libc/posix/src/SConscript
+++ b/components/libc/posix/src/SConscript
@@ -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')
diff --git a/components/lwp/Kconfig b/components/lwp/Kconfig
index 3e1982001e..82193e3b00 100644
--- a/components/lwp/Kconfig
+++ b/components/lwp/Kconfig
@@ -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
diff --git a/components/net/Kconfig b/components/net/Kconfig
index 4d6317bac6..d9ed7d9542 100644
--- a/components/net/Kconfig
+++ b/components/net/Kconfig
@@ -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.