Skip to content

Commit f11113f

Browse files
authored
Merge pull request #5277 from mysterywolf/compatibility
implement legacy support
2 parents 940566c + c6c1544 commit f11113f

File tree

10 files changed

+105
-4
lines changed

10 files changed

+105
-4
lines changed

components/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ config RT_USING_USER_MAIN
1919
default 85 if RT_THREAD_PRIORITY_256
2020
endif
2121

22+
config RT_USING_LEGACY
23+
bool "Support legacy version for compatibility"
24+
default n
25+
2226
source "$RTT_DIR/components/cplusplus/Kconfig"
2327

2428
source "$RTT_DIR/components/finsh/Kconfig"

components/dfs/SConscript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from building import *
2+
import os
23

34
# The set of source files associated with this SConscript file.
45
src = Split('''

components/legacy/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# RT-Thread Legacy
2+

components/legacy/SConscript

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from building import *
2+
import os
3+
4+
src = Split('''
5+
ipc/workqueue_legacy.c
6+
''')
7+
8+
cwd = GetCurrentDir()
9+
CPPPATH = [cwd]
10+
11+
if GetDepend('RT_USING_DFS'):
12+
dfs_cwd = os.path.join(cwd,'dfs')
13+
CPPPATH += [dfs_cwd]
14+
15+
group = DefineGroup('Legacy', src, depend = ['RT_USING_LEGACY'], CPPPATH = CPPPATH)
16+
17+
list = os.listdir(cwd)
18+
for item in list:
19+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
20+
group = group + SConscript(os.path.join(item, 'SConscript'))
21+
22+
Return('group')
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
*
66
* Change Logs:
77
* Date Author Notes
8+
* 2021-11-14 Meco Man the first version
89
*/
910

1011
#ifndef DFS_POLL_H__
1112
#define DFS_POLL_H__
1213

1314
#include <poll.h>
1415

15-
#warning "This file will be obsolete in the next version! Please use <poll.h> to instead."
16-
1716
#endif /* DFS_POLL_H__ */
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
*
66
* Change Logs:
77
* Date Author Notes
8+
* 2021-11-14 Meco Man the first version
89
*/
910

1011
#ifndef DFS_SELECT_H__
1112
#define DFS_SELECT_H__
1213

1314
#include <sys/select.h>
1415

15-
#warning "This file will be obsolete in the next version! Please use <sys/select.h> to instead."
16-
1716
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-11-14 Meco Man the first version
9+
*/
10+
11+
#include "workqueue_legacy.h"
12+
13+
void rt_delayed_work_init(struct rt_delayed_work *work,
14+
void (*work_func)(struct rt_work *work,
15+
void *work_data), void *work_data)
16+
{
17+
rt_work_init(&work->work, work_func, work_data);
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-11-14 Meco Man the first version
9+
*/
10+
11+
#ifndef __WORKQUEUE_LEGACY_H__
12+
#define __WORKQUEUE_LEGACY_H__
13+
14+
#include <ipc/workqueue.h>
15+
16+
struct rt_delayed_work
17+
{
18+
struct rt_work work;
19+
};
20+
21+
void rt_delayed_work_init(struct rt_delayed_work *work,
22+
void (*work_func)(struct rt_work *work,
23+
void *work_data), void *work_data);
24+
25+
#endif

components/legacy/rtlegacy.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-11-14 Meco Man the first version
9+
*/
10+
11+
#ifndef __RT_LEGACY_H__
12+
#define __RT_LEGACY_H__
13+
14+
#include <rtconfig.h>
15+
16+
/* rtlibc */
17+
#include <stdint.h>
18+
#include <stddef.h>
19+
20+
/* IPC */
21+
#ifdef RT_USING_DEVICE_IPC
22+
#include "ipc/workqueue_legacy.h"
23+
#endif /* RT_USING_DEVICE_IPC */
24+
25+
/* FinSH */
26+
27+
#endif /* __RT_LEGACY_H__ */

include/rtthread.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* 2016-08-09 ArdaFu add new thread and interrupt hook.
1616
* 2018-11-22 Jesven add all cpu's lock and ipi handler
1717
* 2021-02-28 Meco Man add RT_KSERVICE_USING_STDLIB
18+
* 2021-11-14 Meco Man add rtlegacy.h for compatibility
1819
*/
1920

2021
#ifndef __RT_THREAD_H__
@@ -25,6 +26,9 @@
2526
#include <rtdef.h>
2627
#include <rtservice.h>
2728
#include <rtm.h>
29+
#ifdef RT_USING_LEGACY
30+
#include <rtlegacy.h>
31+
#endif
2832

2933
#ifdef __cplusplus
3034
extern "C" {

0 commit comments

Comments
 (0)