Skip to content

implement legacy support #5277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config RT_USING_USER_MAIN
default 85 if RT_THREAD_PRIORITY_256
endif

config RT_USING_LEGACY
bool "Support legacy version for compatibility"
default n

source "$RTT_DIR/components/cplusplus/Kconfig"

source "$RTT_DIR/components/finsh/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions components/dfs/SConscript
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from building import *
import os

# The set of source files associated with this SConscript file.
src = Split('''
Expand Down
2 changes: 2 additions & 0 deletions components/legacy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# RT-Thread Legacy

22 changes: 22 additions & 0 deletions components/legacy/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from building import *
import os

src = Split('''
ipc/workqueue_legacy.c
''')

cwd = GetCurrentDir()
CPPPATH = [cwd]

if GetDepend('RT_USING_DFS'):
dfs_cwd = os.path.join(cwd,'dfs')
CPPPATH += [dfs_cwd]

group = DefineGroup('Legacy', src, depend = ['RT_USING_LEGACY'], CPPPATH = CPPPATH)

list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))

Return('group')
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
*
* Change Logs:
* Date Author Notes
* 2021-11-14 Meco Man the first version
*/

#ifndef DFS_POLL_H__
#define DFS_POLL_H__

#include <poll.h>

#warning "This file will be obsolete in the next version! Please use <poll.h> to instead."

#endif /* DFS_POLL_H__ */
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
*
* Change Logs:
* Date Author Notes
* 2021-11-14 Meco Man the first version
*/

#ifndef DFS_SELECT_H__
#define DFS_SELECT_H__

#include <sys/select.h>

#warning "This file will be obsolete in the next version! Please use <sys/select.h> to instead."

#endif
18 changes: 18 additions & 0 deletions components/legacy/ipc/workqueue_legacy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-11-14 Meco Man the first version
*/

#include "workqueue_legacy.h"

void rt_delayed_work_init(struct rt_delayed_work *work,
void (*work_func)(struct rt_work *work,
void *work_data), void *work_data)
{
rt_work_init(&work->work, work_func, work_data);
}
25 changes: 25 additions & 0 deletions components/legacy/ipc/workqueue_legacy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-11-14 Meco Man the first version
*/

#ifndef __WORKQUEUE_LEGACY_H__
#define __WORKQUEUE_LEGACY_H__

#include <ipc/workqueue.h>

struct rt_delayed_work
{
struct rt_work work;
};

void rt_delayed_work_init(struct rt_delayed_work *work,
void (*work_func)(struct rt_work *work,
void *work_data), void *work_data);

#endif
27 changes: 27 additions & 0 deletions components/legacy/rtlegacy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-11-14 Meco Man the first version
*/

#ifndef __RT_LEGACY_H__
#define __RT_LEGACY_H__

#include <rtconfig.h>

/* rtlibc */
#include <stdint.h>
#include <stddef.h>

/* IPC */
#ifdef RT_USING_DEVICE_IPC
#include "ipc/workqueue_legacy.h"
#endif /* RT_USING_DEVICE_IPC */

/* FinSH */

#endif /* __RT_LEGACY_H__ */
4 changes: 4 additions & 0 deletions include/rtthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* 2016-08-09 ArdaFu add new thread and interrupt hook.
* 2018-11-22 Jesven add all cpu's lock and ipi handler
* 2021-02-28 Meco Man add RT_KSERVICE_USING_STDLIB
* 2021-11-14 Meco Man add rtlegacy.h for compatibility
*/

#ifndef __RT_THREAD_H__
Expand All @@ -25,6 +26,9 @@
#include <rtdef.h>
#include <rtservice.h>
#include <rtm.h>
#ifdef RT_USING_LEGACY
#include <rtlegacy.h>
#endif

#ifdef __cplusplus
extern "C" {
Expand Down