summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author孙冬梅 <[email protected]>2018-03-10 18:33:45 +0800
committerGitHub <[email protected]>2018-03-10 18:33:45 +0800
commit6e987b2350badd1777454b7324fc88d3275407d6 (patch)
tree1bbd5fc2cdaff0719d76122c91e0e736bf3f8116 /include
parent351f15be4bdf575789be2e1d74934e830bd60554 (diff)
parent5534bab89ee767757a451b2efeb5341c1fb74872 (diff)
Merge pull request #2 from RT-Thread/master
update form origin
Diffstat (limited to 'include')
-rw-r--r--include/libc/libc_fcntl.h42
-rw-r--r--include/libc/libc_signal.h38
-rw-r--r--include/rtdbg.h8
-rw-r--r--include/rtdebug.h4
-rw-r--r--include/rtdef.h9
-rw-r--r--include/rtthread.h5
6 files changed, 74 insertions, 32 deletions
diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h
index f8dd66c7fd..7c5a075a97 100644
--- a/include/libc/libc_fcntl.h
+++ b/include/libc/libc_fcntl.h
@@ -1,6 +1,28 @@
/*
- * fcntl.h file in libc
- */
+ * 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.
+ *
+ * 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.
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2018-02-07 Bernard Add O_DIRECTORY definition in NEWLIB mode.
+ * 2018-02-09 Bernard Add O_BINARY definition
+ */
+
#ifndef LIBC_FCNTL_H__
#define LIBC_FCNTL_H__
@@ -8,11 +30,10 @@
#include <fcntl.h>
#ifndef O_NONBLOCK
-#define O_NONBLOCK 04000
+#define O_NONBLOCK 0x4000
#endif
#if defined(_WIN32)
-#define O_DIRECTORY 0200000
#define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR)
#endif
@@ -23,6 +44,18 @@
#define F_SETFL 4
#endif
+#ifndef O_DIRECTORY
+#define O_DIRECTORY 0x200000
+#endif
+
+#ifndef O_BINARY
+#ifdef _O_BINARY
+#define O_BINARY _O_BINARY
+#else
+#define O_BINARY 0
+#endif
+#endif
+
#else
#define O_RDONLY 00
#define O_WRONLY 01
@@ -77,4 +110,3 @@
#endif
#endif
-
diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h
index cc4552f990..dabcad1a34 100644
--- a/include/libc/libc_signal.h
+++ b/include/libc/libc_signal.h
@@ -30,6 +30,7 @@
extern "C" {
#endif
+#ifndef HAVE_SYS_SIGNALS
/* Signal Generation and Delivery, P1003.1b-1993, p. 63
NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
sigev_notify_attributes to the sigevent structure. */
@@ -59,14 +60,15 @@ struct siginfo
union sigval si_value;
};
typedef struct siginfo siginfo_t;
+#endif
-#define SI_USER 0x01 /* Signal sent by kill(). */
-#define SI_QUEUE 0x02 /* Signal sent by sigqueue(). */
-#define SI_TIMER 0x03 /* Signal generated by expiration of a
+#define SI_USER 0x01 /* Signal sent by kill(). */
+#define SI_QUEUE 0x02 /* Signal sent by sigqueue(). */
+#define SI_TIMER 0x03 /* Signal generated by expiration of a
timer set by timer_settime(). */
-#define SI_ASYNCIO 0x04 /* Signal generated by completion of an
- asynchronous I/O request. */
-#define SI_MESGQ 0x05 /* Signal generated by arrival of a
+#define SI_ASYNCIO 0x04 /* Signal generated by completion of an
+ asynchronous I/O request. */
+#define SI_MESGQ 0x05 /* Signal generated by arrival of a
message on an empty message queue. */
#ifdef RT_USING_NEWLIB
@@ -107,17 +109,17 @@ typedef unsigned long sigset_t;
#define SIGRTMAX 31
#define NSIG 32
-#define SIG_SETMASK 0 /* set mask with sigprocmask() */
-#define SIG_BLOCK 1 /* set of signals to block */
-#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
+#define SIG_SETMASK 0 /* set mask with sigprocmask() */
+#define SIG_BLOCK 1 /* set of signals to block */
+#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
typedef void (*_sig_func_ptr)(int);
struct sigaction
{
- _sig_func_ptr sa_handler;
- sigset_t sa_mask;
- int sa_flags;
+ _sig_func_ptr sa_handler;
+ sigset_t sa_mask;
+ int sa_flags;
};
#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
@@ -163,17 +165,17 @@ typedef unsigned long sigset_t;
#define SIGRTMAX 31
#define NSIG 32
-#define SIG_SETMASK 0 /* set mask with sigprocmask() */
-#define SIG_BLOCK 1 /* set of signals to block */
-#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
+#define SIG_SETMASK 0 /* set mask with sigprocmask() */
+#define SIG_BLOCK 1 /* set of signals to block */
+#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
typedef void (*_sig_func_ptr)(int);
struct sigaction
{
- _sig_func_ptr sa_handler;
- sigset_t sa_mask;
- int sa_flags;
+ _sig_func_ptr sa_handler;
+ sigset_t sa_mask;
+ int sa_flags;
};
#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
diff --git a/include/rtdbg.h b/include/rtdbg.h
index 637390a1cd..26e289eff6 100644
--- a/include/rtdbg.h
+++ b/include/rtdbg.h
@@ -32,15 +32,15 @@
* header file.
*
* #define DBG_SECTION_NAME "[ MOD]"
- * #define DEBUG_ENABLE // enable debug macro
- * #define DEBUG_LEVEL DBG_INFO
- * #include <rtdbg.h> // must after of DEBUG_ENABLE or some other options
+ * #define DBG_ENABLE // enable debug macro
+ * #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 use different color for different kinds log, you can
- * #define DEBUG_COLOR
+ * #define DBG_COLOR
*/
#ifndef RT_DBG_H__
diff --git a/include/rtdebug.h b/include/rtdebug.h
index e600320361..a9c0c0372f 100644
--- a/include/rtdebug.h
+++ b/include/rtdebug.h
@@ -1,7 +1,7 @@
/*
* File : rtdebug.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
@@ -117,7 +117,7 @@ do \
level = rt_hw_interrupt_disable(); \
if (rt_interrupt_get_nest() != 0) \
{ \
- rt_kprintf("Function[%s] shall not used in ISR\n", __FUNCTION__); \
+ rt_kprintf("Function[%s] shall not ne used in ISR\n", __FUNCTION__); \
RT_ASSERT(0) \
} \
rt_hw_interrupt_enable(level); \
diff --git a/include/rtdef.h b/include/rtdef.h
index ce451e7be1..2404f7a364 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -1,7 +1,7 @@
/*
* File : rtdef.h
* This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 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
@@ -33,6 +33,7 @@
* 2017-08-31 Bernard change version number to v3.0.0
* 2017-11-30 Bernard change version number to v3.0.1
* 2017-12-27 Bernard change version number to v3.0.2
+ * 2018-02-24 Bernard change version number to v3.0.3
*/
#ifndef __RT_DEF_H__
@@ -54,7 +55,7 @@ extern "C" {
/* RT-Thread version information */
#define RT_VERSION 3L /**< major version number */
#define RT_SUBVERSION 0L /**< minor version number */
-#define RT_REVISION 2L /**< revise version number */
+#define RT_REVISION 3L /**< revise version number */
/* RT-Thread version */
#define RTTHREAD_VERSION ((RT_VERSION * 10000) + \
@@ -450,8 +451,10 @@ typedef struct rt_timer *rt_timer_t;
* @addtogroup Signal
*/
#ifdef RT_USING_SIGNALS
+#include <libc/libc_signal.h>
typedef unsigned long rt_sigset_t;
typedef void (*rt_sighandler_t)(int signo);
+typedef siginfo_t rt_siginfo_t;
#define RT_SIG_MAX 32
#endif
@@ -480,7 +483,7 @@ typedef void (*rt_sighandler_t)(int signo);
#define RT_THREAD_STAT_SIGNAL 0x10
#define RT_THREAD_STAT_SIGNAL_READY (RT_THREAD_STAT_SIGNAL | RT_THREAD_READY)
-#define RT_THREAD_STAT_SIGNAL_SUSPEND 0x20
+#define RT_THREAD_STAT_SIGNAL_WAIT 0x20
#define RT_THREAD_STAT_SIGNAL_MASK 0xf0
/**
diff --git a/include/rtthread.h b/include/rtthread.h
index 61cd82d97e..9378b83cf7 100644
--- a/include/rtthread.h
+++ b/include/rtthread.h
@@ -204,6 +204,7 @@ void rt_scheduler_sethook(void (*hook)(rt_thread_t from, rt_thread_t to));
void rt_signal_mask(int signo);
void rt_signal_unmask(int signo);
rt_sighandler_t rt_signal_install(int signo, rt_sighandler_t handler);
+int rt_signal_wait(const rt_sigset_t *set, rt_siginfo_t *si, rt_int32_t timeout);
int rt_system_signal_init(void);
#endif
@@ -562,6 +563,10 @@ void rt_assert_set_hook(void (*hook)(const char *ex, const char *func, rt_size_t
void rt_assert_handler(const char *ex, const char *func, rt_size_t line);
#endif /* RT_DEBUG */
+#ifdef RT_USING_FINSH
+#include <finsh_api.h>
+#endif
+
/**@}*/
#ifdef __cplusplus