summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorxuzhuoyi <[email protected]>2018-11-16 20:09:46 +0800
committerxuzhuoyi <[email protected]>2018-11-16 20:09:46 +0800
commit37db67d94a269e1a9893d076ab2bb6b9883cfa8c (patch)
treefaaea1c497b8b50e638f768ed6fcc4ec83e6a90f /include
parent305307c90c8723dcdb79663f65a8933b5cb1b934 (diff)
parent63a6f6c4d2540b003296594c4b916cc1ba8d0b16 (diff)
Merge remote-tracking branch 'upstream/master'
# Conflicts: # src/thread.c
Diffstat (limited to 'include')
-rw-r--r--include/libc/libc_dirent.h6
-rw-r--r--include/libc/libc_errno.h22
-rw-r--r--include/libc/libc_fcntl.h22
-rw-r--r--include/libc/libc_fdset.h22
-rw-r--r--include/libc/libc_ioctl.h22
-rw-r--r--include/libc/libc_signal.h42
-rw-r--r--include/libc/libc_stat.h6
-rw-r--r--include/rtdbg.h96
-rw-r--r--include/rtdebug.h18
-rw-r--r--include/rtdef.h105
-rw-r--r--include/rthw.h18
-rw-r--r--include/rtlibc.h20
-rw-r--r--include/rtm.h18
-rw-r--r--include/rtservice.h36
-rw-r--r--include/rtthread.h61
15 files changed, 165 insertions, 349 deletions
diff --git a/include/libc/libc_dirent.h b/include/libc/libc_dirent.h
index 5bcbc32478..c3a19878ec 100644
--- a/include/libc/libc_dirent.h
+++ b/include/libc/libc_dirent.h
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
#ifndef LIBC_DIRENT_H__
#define LIBC_DIRENT_H__
diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h
index b4f4410595..82ae8cf943 100644
--- a/include/libc/libc_errno.h
+++ b/include/libc/libc_errno.h
@@ -1,21 +1,11 @@
/*
- * File : libc_errno.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*
+ * File : libc_errno.h
*
* Change Logs:
* Date Author Notes
diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h
index 7c5a075a97..1b7c69b1f4 100644
--- a/include/libc/libc_fcntl.h
+++ b/include/libc/libc_fcntl.h
@@ -1,21 +1,11 @@
/*
- * File : libc_fcntl.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017 - 2018, RT-Thread Development Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*
+ * File : libc_fcntl.h
*
* Change Logs:
* Date Author Notes
diff --git a/include/libc/libc_fdset.h b/include/libc/libc_fdset.h
index 74c4ba1cb2..ecd965cd22 100644
--- a/include/libc/libc_fdset.h
+++ b/include/libc/libc_fdset.h
@@ -1,21 +1,11 @@
/*
- * File : libc_errno.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*
+ * File : libc_errno.h
*
* Change Logs:
* Date Author Notes
diff --git a/include/libc/libc_ioctl.h b/include/libc/libc_ioctl.h
index b61866a524..ef5a5257a8 100644
--- a/include/libc/libc_ioctl.h
+++ b/include/libc/libc_ioctl.h
@@ -1,21 +1,11 @@
/*
- * File : libc_ioctl.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*
+ * File : libc_ioctl.h
*
* Change Logs:
* Date Author Notes
diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h
index d3050bfb54..61a7e445e9 100644
--- a/include/libc/libc_signal.h
+++ b/include/libc/libc_signal.h
@@ -1,21 +1,11 @@
/*
- * File : libc_signal.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*
+ * File : libc_signal.h
*
* Change Logs:
* Date Author Notes
@@ -81,25 +71,25 @@ typedef struct siginfo siginfo_t;
#include <sys/signal.h>
#endif
-#ifdef __CC_ARM
+#if defined(__CC_ARM) || defined(__CLANG_ARM)
#include <signal.h>
typedef unsigned long sigset_t;
#define SIGHUP 1
-// #define SIGINT 2
+/* #define SIGINT 2 */
#define SIGQUIT 3
-// #define SIGILL 4
+/* #define SIGILL 4 */
#define SIGTRAP 5
-// #define SIGABRT 6
+/* #define SIGABRT 6 */
#define SIGEMT 7
-// #define SIGFPE 8
+/* #define SIGFPE 8 */
#define SIGKILL 9
#define SIGBUS 10
-// #define SIGSEGV 11
+/* #define SIGSEGV 11 */
#define SIGSYS 12
#define SIGPIPE 13
#define SIGALRM 14
-// #define SIGTERM 15
+/* #define SIGTERM 15 */
#define SIGURG 16
#define SIGSTOP 17
#define SIGTSTP 18
@@ -109,8 +99,8 @@ typedef unsigned long sigset_t;
#define SIGTTOU 22
#define SIGPOLL 23
#define SIGWINCH 24
-// #define SIGUSR1 25
-// #define SIGUSR2 26
+/* #define SIGUSR1 25 */
+/* #define SIGUSR2 26 */
#define SIGRTMIN 27
#define SIGRTMAX 31
#define NSIG 32
@@ -146,7 +136,7 @@ typedef unsigned long sigset_t;
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
-// #define SIGABRT 6
+/* #define SIGABRT 6 */
#define SIGEMT 7
#define SIGFPE 8
#define SIGKILL 9
diff --git a/include/libc/libc_stat.h b/include/libc/libc_stat.h
index 26752393db..9079d1ef15 100644
--- a/include/libc/libc_stat.h
+++ b/include/libc/libc_stat.h
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
#ifndef LIBC_STAT_H__
#define LIBC_STAT_H__
diff --git a/include/rtdbg.h b/include/rtdbg.h
index f53aba8de9..9036a0cd66 100644
--- a/include/rtdbg.h
+++ b/include/rtdbg.h
@@ -1,21 +1,7 @@
/*
- * File : rtdbg.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2016, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -37,10 +23,7 @@
* #define DBG_LEVEL DBG_INFO
* #include <rtdbg.h> // must after of DEBUG_ENABLE or some other options
*
- * Then in your C/C++ file, you can use dbg_log macro to print out logs:
- * dbg_log(DBG_INFO, "this is a log!\n");
- *
- * Or if you want to using the simple API, you can
+ * Then in your C/C++ file, you can use LOG_X macro to print out logs:
* LOG_D("this is a debug log!");
* LOG_E("this is a error log!");
*
@@ -53,11 +36,16 @@
#include <rtconfig.h>
+#if defined(RT_USING_ULOG) && defined(DBG_ENABLE)
+/* using ulog compatible with rtdbg */
+#include <ulog.h>
+#else
+
/* DEBUG level */
-#define DBG_LOG 0
-#define DBG_INFO 1
-#define DBG_WARNING 2
-#define DBG_ERROR 3
+#define DBG_ERROR 0
+#define DBG_WARNING 1
+#define DBG_INFO 2
+#define DBG_LOG 3
#ifndef DBG_SECTION_NAME
#define DBG_SECTION_NAME "DBG"
@@ -84,17 +72,23 @@
#define _DBG_COLOR(n) rt_kprintf("\033["#n"m")
#define _DBG_LOG_HDR(lvl_name, color_n) \
rt_kprintf("\033["#color_n"m["lvl_name"/"DBG_SECTION_NAME"] ")
+#define _DBG_LOG_X_END \
+ rt_kprintf("\033[0m\n")
#else
#define _DBG_COLOR(n)
#define _DBG_LOG_HDR(lvl_name, color_n) \
rt_kprintf("["lvl_name"/"DBG_SECTION_NAME"] ")
+#define _DBG_LOG_X_END \
+ rt_kprintf("\n")
#endif /* DBG_COLOR */
/*
* static debug routine
+ * NOTE: This is a NOT RECOMMENDED API. Please using LOG_X API.
+ * It will be DISCARDED later. Because it will take up more resources.
*/
#define dbg_log(level, fmt, ...) \
- if ((level) >= DBG_LEVEL) \
+ if ((level) <= DBG_LEVEL) \
{ \
switch(level) \
{ \
@@ -109,13 +103,13 @@
}
#define dbg_here \
- if ((DBG_LEVEL) >= DBG_LOG){ \
+ if ((DBG_LEVEL) <= DBG_LOG){ \
rt_kprintf(DBG_SECTION_NAME " Here %s:%d\n", \
__FUNCTION__, __LINE__); \
}
#define dbg_enter \
- if ((DBG_LEVEL) >= DBG_LOG){ \
+ if ((DBG_LEVEL) <= DBG_LOG){ \
_DBG_COLOR(32); \
rt_kprintf(DBG_SECTION_NAME " Enter %s\n", \
__FUNCTION__); \
@@ -123,18 +117,22 @@
}
#define dbg_exit \
- if ((DBG_LEVEL) >= DBG_LOG){ \
+ if ((DBG_LEVEL) <= DBG_LOG){ \
_DBG_COLOR(32); \
rt_kprintf(DBG_SECTION_NAME " Exit %s:%d\n", \
__FUNCTION__); \
_DBG_COLOR(0); \
}
-#define dbg_log_line(level, ...) \
- dbg_log(level, __VA_ARGS__); \
- if ((level) >= DBG_LEVEL) { \
- rt_kprintf("\n"); \
- }
+
+#define dbg_log_line(lvl, color_n, fmt, ...) \
+ do \
+ { \
+ _DBG_LOG_HDR(lvl, color_n); \
+ rt_kprintf(fmt, ##__VA_ARGS__); \
+ _DBG_LOG_X_END; \
+ } \
+ while (0)
#define dbg_raw(...) rt_kprintf(__VA_ARGS__);
@@ -143,14 +141,36 @@
#define dbg_here
#define dbg_enter
#define dbg_exit
-#define dbg_log_line(level, ...)
+#define dbg_log_line(lvl, color_n, fmt, ...)
#define dbg_raw(...)
+#endif /* DBG_ENABLE */
+
+#if (DBG_LEVEL >= DBG_LOG)
+#define LOG_D(fmt, ...) dbg_log_line("D", 0, fmt, ##__VA_ARGS__)
+#else
+#define LOG_D(...)
+#endif
+
+#if (DBG_LEVEL >= DBG_INFO)
+#define LOG_I(fmt, ...) dbg_log_line("I", 32, fmt, ##__VA_ARGS__)
+#else
+#define LOG_I(...)
+#endif
+
+#if (DBG_LEVEL >= DBG_WARNING)
+#define LOG_W(fmt, ...) dbg_log_line("W", 33, fmt, ##__VA_ARGS__)
+#else
+#define LOG_W(...)
+#endif
+
+#if (DBG_LEVEL >= DBG_ERROR)
+#define LOG_E(fmt, ...) dbg_log_line("E", 31, fmt, ##__VA_ARGS__)
+#else
+#define LOG_E(...)
#endif
-#define LOG_D(...) dbg_log_line(DBG_LOG , __VA_ARGS__)
-#define LOG_I(...) dbg_log_line(DBG_INFO , __VA_ARGS__)
-#define LOG_W(...) dbg_log_line(DBG_WARNING, __VA_ARGS__)
-#define LOG_E(...) dbg_log_line(DBG_ERROR , __VA_ARGS__)
#define LOG_RAW(...) dbg_raw(__VA_ARGS__)
+#endif /* defined(RT_USING_ULOG) && define(DBG_ENABLE) */
+
#endif /* RT_DBG_H__ */
diff --git a/include/rtdebug.h b/include/rtdebug.h
index e403d51e06..b66cd6fc69 100644
--- a/include/rtdebug.h
+++ b/include/rtdebug.h
@@ -1,21 +1,7 @@
/*
- * File : rtdebug.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*/
#ifndef __RTDEBUG_H__
diff --git a/include/rtdef.h b/include/rtdef.h
index f8d90ceadb..deb3295e27 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -1,21 +1,7 @@
/*
- * File : rtdef.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -36,6 +22,8 @@
* 2018-02-24 Bernard change version number to v3.0.3
* 2018-04-25 Bernard change version number to v3.0.4
* 2018-05-31 Bernard change version number to v3.1.0
+ * 2018-09-04 Bernard change version number to v3.1.1
+ * 2018-09-14 Bernard apply Apache License v2.0 to RT-Thread Kernel
*/
#ifndef __RT_DEF_H__
@@ -57,7 +45,7 @@ extern "C" {
/* RT-Thread version information */
#define RT_VERSION 3L /**< major version number */
#define RT_SUBVERSION 1L /**< minor version number */
-#define RT_REVISION 0L /**< revise version number */
+#define RT_REVISION 1L /**< revise version number */
/* RT-Thread version */
#define RTTHREAD_VERSION ((RT_VERSION * 10000) + \
@@ -96,14 +84,19 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define RT_UINT32_MAX 0xffffffff /**< Maxium number of UINT32 */
#define RT_TICK_MAX RT_UINT32_MAX /**< Maxium number of tick */
+#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+#define __CLANG_ARM
+#endif
+
/* Compiler Related Definitions */
-#ifdef __CC_ARM /* ARM Compiler */
+#if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM Compiler */
#include <stdarg.h>
#define SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
- #define RT_WEAK __weak
+
+ #define RT_WEAK __attribute__((weak))
#define rt_inline static __inline
/* module compiling */
#ifdef RT_USING_MODULE
@@ -189,13 +182,13 @@ typedef int (*init_fn_t)(void);
const char* fn_name;
const init_fn_t fn;
};
- #define INIT_EXPORT(fn, level) \
- const char __rti_##fn##_name[] = #fn; \
- const struct rt_init_desc __rt_init_desc_##fn SECTION(".rti_fn."level) = \
+ #define INIT_EXPORT(fn, level) \
+ const char __rti_##fn##_name[] = #fn; \
+ RT_USED const struct rt_init_desc __rt_init_desc_##fn SECTION(".rti_fn."level) = \
{ __rti_##fn##_name, fn};
#else
- #define INIT_EXPORT(fn, level) \
- const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn
+ #define INIT_EXPORT(fn, level) \
+ RT_USED const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn
#endif
#endif
#else
@@ -496,10 +489,6 @@ typedef siginfo_t rt_siginfo_t;
#define RT_THREAD_CTRL_CHANGE_PRIORITY 0x02 /**< Change thread priority. */
#define RT_THREAD_CTRL_INFO 0x03 /**< Get thread information. */
-#ifdef RT_USING_LWP
-struct rt_lwp;
-#endif
-
/**
* Thread structure
*/
@@ -560,11 +549,12 @@ struct rt_thread
void (*cleanup)(struct rt_thread *tid); /**< cleanup function when thread exit */
- rt_uint32_t user_data; /**< private user data beyond this thread */
-
+ /* light weight process if present */
#ifdef RT_USING_LWP
- struct rt_lwp *lwp; /**< if NULL it's a kernel thread */
+ void *lwp;
#endif
+
+ rt_uint32_t user_data; /**< private user data beyond this thread */
};
typedef struct rt_thread *rt_thread_t;
@@ -1021,59 +1011,6 @@ struct rt_device_graphic_ops
/*@}*/
#endif
-#ifdef RT_USING_MODULE
-/**
- * @addtogroup Module
- */
-
-/*@{*/
-
-/*
- * module system
- */
-
-#define RT_MODULE_FLAG_WITHENTRY 0x00 /**< with entry point */
-#define RT_MODULE_FLAG_WITHOUTENTRY 0x01 /**< without entry point */
-
-/**
- * Application Module structure
- */
-struct rt_module
-{
- struct rt_object parent; /**< inherit from object */
-
- rt_uint32_t vstart_addr; /**< VMA base address for the
- first LOAD segment. */
- rt_uint8_t *module_space; /**< module memory space */
-
- void *module_entry; /**< the entry address of module */
- rt_thread_t module_thread; /**< the main thread of module */
-
- rt_uint8_t *module_cmd_line; /**< module command line */
- rt_uint32_t module_cmd_size; /**< the size of module command line */
-
-#ifdef RT_USING_SLAB
- /* module memory allocator */
- void *mem_list; /**< module's free memory list */
- void *page_array; /**< module's using pages */
- rt_uint32_t page_cnt; /**< module's using pages count */
-#endif
-
- rt_uint16_t nref; /**< reference count */
-
- rt_uint16_t nsym; /**< number of symbol in the module */
- struct rt_module_symtab *symtab; /**< module symbol table */
-
- rt_uint32_t user_data; /**< arch data in the module */
-
- void (*module_init)(void);
- void (*module_cleanup)(void);
-};
-typedef struct rt_module *rt_module_t;
-
-/*@}*/
-#endif
-
/* definitions for libc */
#include "rtlibc.h"
diff --git a/include/rthw.h b/include/rthw.h
index d517228083..c6af392e62 100644
--- a/include/rthw.h
+++ b/include/rthw.h
@@ -1,21 +1,7 @@
/*
- * File : rthw.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/include/rtlibc.h b/include/rtlibc.h
index db5236edb1..b3a548beb1 100644
--- a/include/rtlibc.h
+++ b/include/rtlibc.h
@@ -1,21 +1,7 @@
/*
- * File : rtlibc.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -35,7 +21,7 @@
#include "libc/libc_signal.h"
#include "libc/libc_fdset.h"
-#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
+#if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__IAR_SYSTEMS_ICC__)
typedef signed long off_t;
typedef int mode_t;
#endif
diff --git a/include/rtm.h b/include/rtm.h
index 05419e4420..7e07a2239c 100644
--- a/include/rtm.h
+++ b/include/rtm.h
@@ -1,21 +1,7 @@
/*
- * File : rtm.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*/
#ifndef __RTM_H__
diff --git a/include/rtservice.h b/include/rtservice.h
index 0bfa424338..3b6fc94c92 100644
--- a/include/rtservice.h
+++ b/include/rtservice.h
@@ -1,21 +1,7 @@
/*
- * File : rtservice.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -253,6 +239,13 @@ rt_inline rt_slist_t *rt_slist_first(rt_slist_t *l)
return l->next;
}
+rt_inline rt_slist_t *rt_slist_tail(rt_slist_t *l)
+{
+ while (l->next) l = l->next;
+
+ return l;
+}
+
rt_inline rt_slist_t *rt_slist_next(rt_slist_t *n)
{
return n->next;
@@ -302,6 +295,17 @@ rt_inline int rt_slist_isempty(rt_slist_t *l)
#define rt_slist_first_entry(ptr, type, member) \
rt_slist_entry((ptr)->next, type, member)
+/**
+ * rt_slist_tail_entry - get the tail element from a slist
+ * @ptr: the slist head to take the element from.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the slist_struct within the struct.
+ *
+ * Note, that slist is expected to be not empty.
+ */
+#define rt_slist_tail_entry(ptr, type, member) \
+ rt_slist_entry(rt_slist_tail(ptr), type, member)
+
/*@}*/
#ifdef __cplusplus
diff --git a/include/rtthread.h b/include/rtthread.h
index 86a1664f83..96ebe1940a 100644
--- a/include/rtthread.h
+++ b/include/rtthread.h
@@ -1,21 +1,7 @@
/*
- * File : rtthread.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -114,7 +100,8 @@ rt_tick_t rt_timer_next_timeout_tick(void);
void rt_timer_check(void);
#ifdef RT_USING_HOOK
-void rt_timer_timeout_sethook(void (*hook)(struct rt_timer *timer));
+void rt_timer_enter_sethook(void (*hook)(struct rt_timer *timer));
+void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer));
#endif
/**@}*/
@@ -442,44 +429,6 @@ rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg);
/**@}*/
#endif
-#ifdef RT_USING_MODULE
-/**
- * @addtogroup Module
- */
-
-/**@{*/
-
-/*
- * module interface
- */
-rt_module_t rt_module_load(const char *name, void *module_ptr);
-rt_err_t rt_module_unload(rt_module_t module);
-#ifdef RT_USING_DFS
-rt_module_t rt_module_open(const char *filename);
-rt_module_t rt_module_exec_cmd(const char *path, const char *cmd_line, int size);
-#endif
-void *rt_module_malloc(rt_size_t size);
-void *rt_module_realloc(void *ptr, rt_size_t size);
-void rt_module_free(rt_module_t module, void *addr);
-rt_module_t rt_module_self(void);
-rt_module_t rt_module_find(const char *name);
-
-#ifdef RT_USING_HOOK
-void rt_module_load_sethook(void (*hook)(rt_module_t module));
-void rt_module_unload_sethook(void (*hook)(rt_module_t module));
-#endif
-
-void rt_module_init_object_container(struct rt_module *module);
-rt_err_t rt_module_destroy(rt_module_t module);
-
-/*
- * application module system initialization
- */
-int rt_system_module_init(void);
-
-/**@}*/
-#endif
-
/*
* interrupt service
*/
@@ -549,7 +498,7 @@ rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count);
rt_int32_t rt_strcmp(const char *cs, const char *ct);
rt_size_t rt_strlen(const char *src);
char *rt_strdup(const char *s);
-#ifdef __CC_ARM
+#if defined(__CC_ARM) || defined(__CLANG_ARM)
/* leak strdup interface */
char* strdup(const char* str);
#endif