Skip to content

Commit 838d108

Browse files
authored
Merge pull request #5311 from mysterywolf/PSE
[PSE分支] 增加RT_USING_POSIX_FS
2 parents 4e9744c + 7973ede commit 838d108

File tree

9 files changed

+46
-45
lines changed

9 files changed

+46
-45
lines changed

components/drivers/serial/serial.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static void _serial_check_buffer_size(void)
362362
}
363363
}
364364

365-
#if defined(RT_USING_POSIX) || defined(RT_SERIAL_USING_DMA)
365+
#if defined(RT_USING_POSIX_DEVIO) || defined(RT_SERIAL_USING_DMA)
366366
static rt_size_t _serial_fifo_calc_recved_len(struct rt_serial_device *serial)
367367
{
368368
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)
385385
}
386386
}
387387
}
388-
#endif /* RT_USING_POSIX || RT_SERIAL_USING_DMA */
388+
#endif /* RT_USING_POSIX_DEVIO || RT_SERIAL_USING_DMA */
389389

390390
#ifdef RT_SERIAL_USING_DMA
391391
/**
@@ -1133,6 +1133,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
11331133
}
11341134
else
11351135
{
1136+
#include <shell.h>
11361137
#define _TIO_BUFLEN 20
11371138
char _tio_buf[_TIO_BUFLEN];
11381139
unsigned char cnt1, cnt2, cnt3, i;
@@ -1148,7 +1149,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
11481149
i = 0;
11491150
while(i < _TIO_BUFLEN)
11501151
{
1151-
_tio_buf[i] = getchar();
1152+
_tio_buf[i] = finsh_getchar();
11521153
if(_tio_buf[i] != 't')
11531154
{
11541155
i ++;

components/libc/Kconfig

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ menu "POSIX layer and C standard library"
22

33
config RT_USING_LIBC
44
bool "Enable libc APIs from toolchain"
5-
select RT_USING_HEAP
65
default n
76

87
if RT_USING_LIBC
98
config RT_LIBC_USING_TIME
109
default y
1110

1211
config RT_LIBC_USING_FILEIO
13-
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar"
14-
select RT_USING_POSIX
12+
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar/STDIO"
13+
select RT_USING_POSIX_FS
1514
select RT_USING_POSIX_DEVIO
1615
default n
1716

@@ -38,50 +37,50 @@ config RT_LIBC_DEFAULT_TIMEZONE
3837
range -12 12
3938
default 8
4039

41-
config RT_USING_POSIX
42-
bool "Enable basic POSIX layer, open()/read()/write()/close() etc"
40+
config RT_USING_POSIX_FS
41+
bool "Enable POSIX file system, open()/read()/write()/close() etc"
4342
select RT_USING_DFS
43+
select DFS_USING_POSIX
4444
default n
4545

46-
if RT_USING_POSIX
46+
if RT_USING_POSIX_FS
4747
config RT_USING_POSIX_DEVIO
4848
bool "Enable devices as file descriptors"
49-
select RT_USING_DFS
5049
select RT_USING_DFS_DEVFS
5150
default n
5251

5352
config RT_USING_POSIX_POLL
5453
bool "Enable poll()"
55-
select RT_USING_DFS
5654
default n
5755

5856
config RT_USING_POSIX_SELECT
5957
bool "Enable select()"
60-
select RT_USING_DFS
6158
select RT_USING_POSIX_POLL
6259
default n
60+
endif
6361

64-
config RT_USING_POSIX_DELAY
65-
bool "Enable delay APIs, sleep()/usleep()/msleep() etc"
66-
default n
62+
config RT_USING_POSIX_DELAY
63+
bool "Enable delay APIs, sleep()/usleep()/msleep() etc"
64+
default n
6765

68-
config RT_USING_POSIX_GETLINE
69-
bool "Enable getline()/getdelim()"
70-
default n
66+
config RT_USING_POSIX_GETLINE
67+
bool "Enable getline()/getdelim()"
68+
select RT_USING_LIBC
69+
select RT_LIBC_USING_FILEIO
70+
default n
7171

72-
config RT_USING_POSIX_MMAP
73-
bool "Enable mmap()"
74-
select RT_USING_DFS
75-
default n
72+
config RT_USING_POSIX_MMAP
73+
bool "Enable mmap()"
74+
select RT_USING_POSIX_FS
75+
default n
7676

77-
config RT_USING_POSIX_TERMIOS
78-
bool "Enable termios APIs"
79-
default n
77+
config RT_USING_POSIX_TERMIOS
78+
bool "Enable termios APIs"
79+
default n
8080

81-
config RT_USING_POSIX_AIO
82-
bool "Enable AIO APIs"
83-
default n
84-
endif
81+
config RT_USING_POSIX_AIO
82+
bool "Enable AIO APIs"
83+
default n
8584

8685
config RT_USING_PTHREADS
8786
bool "Enable pthreads APIs"

components/libc/compilers/common/sys/time.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz);
7272
struct tm *gmtime_r(const time_t *timep, struct tm *r);
7373
#endif
7474

75-
#ifdef RT_USING_POSIX
7675
/* POSIX clock and timer */
7776
#define MILLISECOND_PER_SECOND 1000UL
7877
#define MICROSECOND_PER_SECOND 1000000UL
@@ -103,8 +102,8 @@ int clock_getres (clockid_t clockid, struct timespec *res);
103102
int clock_gettime (clockid_t clockid, struct timespec *tp);
104103
int clock_settime (clockid_t clockid, const struct timespec *tp);
105104
int rt_timespec_to_tick(const struct timespec *time);
106-
#endif /* RT_USING_POSIX */
107105

106+
/* timezone */
108107
void tz_set(int8_t tz);
109108
int8_t tz_get(void);
110109
int8_t tz_is_dst(void);

components/libc/compilers/common/time.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,6 @@ RTM_EXPORT(settimeofday);
486486
RTM_EXPORT(difftime);
487487
RTM_EXPORT(strftime);
488488

489-
#ifdef RT_USING_POSIX
490-
491489
#ifdef RT_USING_RTC
492490
static volatile struct timeval _timevalue;
493491
static int _rt_clock_time_system_init()
@@ -690,9 +688,6 @@ int rt_timespec_to_tick(const struct timespec *time)
690688
}
691689
RTM_EXPORT(rt_timespec_to_tick);
692690

693-
#endif /* RT_USING_POSIX */
694-
695-
696691
/* timezone */
697692
#ifndef RT_LIBC_DEFAULT_TIMEZONE
698693
#define RT_LIBC_DEFAULT_TIMEZONE 8

components/libc/posix/getline/SConscript

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
from building import *
44

55
cwd = GetCurrentDir()
6-
src = Glob('*.c') + Glob('*.cpp')
6+
src = Glob('*.c')
77
CPPPATH = [cwd]
88

9-
group = DefineGroup('POSIX', src,
10-
depend = ['RT_USING_LIBC', 'RT_USING_POSIX','RT_USING_POSIX_GETLINE'],
11-
CPPPATH = CPPPATH)
9+
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_GETLINE'], CPPPATH = CPPPATH)
1210

1311
Return('group')

components/libc/posix/getline/posix_getline.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,3 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) {
7575
ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
7676
return getdelim(lineptr, n, '\n', stream);
7777
}
78-

components/libc/posix/src/SConscript

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,35 @@
22

33
from building import *
44

5-
src = ['unistd.c']
5+
src = []
66
cwd = GetCurrentDir()
77
CPPPATH = [cwd]
8+
group = []
9+
10+
flag = False
11+
src += ['unistd.c'] #TODO
812

913
if GetDepend('RT_USING_POSIX_DEVIO'):
1014
src += ['libc.c']
15+
flag = True
1116

1217
if GetDepend('RT_USING_POSIX_DELAY'):
1318
src += ['delay.c']
19+
flag = True
1420

1521
if GetDepend('RT_USING_POSIX_POLL'):
1622
src += ['poll.c']
23+
flag = True
1724

1825
if GetDepend('RT_USING_POSIX_SELECT'):
1926
src += ['select.c']
27+
flag = True
2028

2129
if GetDepend('RT_USING_POSIX_MMAP'):
2230
src += ['mmap.c']
31+
flag = True
2332

24-
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX'], CPPPATH = CPPPATH)
33+
if flag == True:
34+
group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
2535

2636
Return('group')

components/lwp/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
config RT_USING_LWP
22
bool "Using light-weight process"
3-
select RT_USING_POSIX
3+
select RT_USING_POSIX_FS
44
select RT_USING_POSIX_SELECT
55
select RT_USING_LIBC
66
depends on ARCH_ARM_CORTEX_M || ARCH_ARM_ARM9 || ARCH_ARM_CORTEX_A

components/net/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ config RT_USING_SAL
4141
config SAL_USING_POSIX
4242
bool "Enable BSD socket operated by file system API"
4343
default n
44-
select RT_USING_POSIX
44+
select RT_USING_POSIX_FS
4545
select RT_USING_POSIX_SELECT
4646
help
4747
Let BSD socket operated by file system API, such as read/write and involveed in select/poll POSIX APIs.

0 commit comments

Comments
 (0)