diff options
| author | WangHuachen <[email protected]> | 2020-11-08 19:30:50 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-11-08 19:30:50 +0800 |
| commit | 9756c77f0447f9ce4f00a37600298a1f1fd90cda (patch) | |
| tree | 093247a1719c087dba33783be3a4ee44c1026b2d /include | |
| parent | 9545529b33cbaae137f1e389dd0e3a5233d516da (diff) | |
| parent | 4b2b9a87c6f0a87b125e5c5a18bcfcf663de9fbb (diff) | |
Merge pull request #1 from RT-Thread/master
同步原有仓库
Diffstat (limited to 'include')
| -rw-r--r-- | include/libc/libc_errno.h | 4 | ||||
| -rw-r--r-- | include/libc/libc_fcntl.h | 6 | ||||
| -rw-r--r-- | include/libc/libc_fdset.h | 6 | ||||
| -rw-r--r-- | include/libc/libc_ioctl.h | 4 | ||||
| -rw-r--r-- | include/libc/libc_limits.h | 25 | ||||
| -rw-r--r-- | include/libc/libc_signal.h | 5 | ||||
| -rw-r--r-- | include/libc/libc_stat.h | 2 | ||||
| -rw-r--r-- | include/libc/libc_stdio.h | 22 | ||||
| -rw-r--r-- | include/rtdef.h | 42 | ||||
| -rw-r--r-- | include/rtlibc.h | 2 | ||||
| -rw-r--r-- | include/rtservice.h | 14 | ||||
| -rw-r--r-- | include/rtthread.h | 3 |
12 files changed, 94 insertions, 41 deletions
diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h index 0f3bc7635a..9143c841f2 100644 --- a/include/libc/libc_errno.h +++ b/include/libc/libc_errno.h @@ -13,7 +13,7 @@ #include <rtconfig.h> -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) /* use errno.h file in toolchains */ #include <errno.h> #endif @@ -45,7 +45,7 @@ defined in armcc/errno.h #define ERROR_BASE_NO 0 #endif -#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) +#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) && !(defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #define EPERM (ERROR_BASE_NO + 1) #define ENOENT (ERROR_BASE_NO + 2) diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index 1b7c69b1f4..d149d86964 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_fcntl.h * * Change Logs: * Date Author Notes @@ -16,7 +12,7 @@ #ifndef LIBC_FCNTL_H__ #define LIBC_FCNTL_H__ -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #include <fcntl.h> #ifndef O_NONBLOCK diff --git a/include/libc/libc_fdset.h b/include/libc/libc_fdset.h index ecd965cd22..9700c7e83e 100644 --- a/include/libc/libc_fdset.h +++ b/include/libc/libc_fdset.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_errno.h * * Change Logs: * Date Author Notes @@ -17,7 +13,7 @@ #include <rtconfig.h> -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #include <sys/types.h> #if defined(HAVE_SYS_SELECT_H) #include <sys/select.h> diff --git a/include/libc/libc_ioctl.h b/include/libc/libc_ioctl.h index ef5a5257a8..42a21a2cea 100644 --- a/include/libc/libc_ioctl.h +++ b/include/libc/libc_ioctl.h @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : libc_ioctl.h * * Change Logs: * Date Author Notes diff --git a/include/libc/libc_limits.h b/include/libc/libc_limits.h new file mode 100644 index 0000000000..b8368160df --- /dev/null +++ b/include/libc/libc_limits.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-05 Meco Manthe first version + */ + +#ifndef LIBC_LIMITS_H__ +#define LIBC_LIMITS_H__ + +#include <limits.h> +#include <rtconfig.h> + +#ifdef RT_USING_POSIX + +#ifndef SSIZE_MAX +# define SSIZE_MAX LONG_MAX +#endif + +#endif + +#endif diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index 898fe13f43..539685de3e 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -15,6 +15,7 @@ extern "C" { #endif +#include <stdint.h> #ifdef HAVE_CCONFIG_H #include <cconfig.h> #endif @@ -46,8 +47,8 @@ struct sigevent #ifndef HAVE_SIGINFO struct siginfo { - rt_uint16_t si_signo; - rt_uint16_t si_code; + uint16_t si_signo; + uint16_t si_code; union sigval si_value; }; diff --git a/include/libc/libc_stat.h b/include/libc/libc_stat.h index 9079d1ef15..6497cfe12c 100644 --- a/include/libc/libc_stat.h +++ b/include/libc/libc_stat.h @@ -9,7 +9,7 @@ #include <rtconfig.h> -#if defined(RT_USING_NEWLIB) +#if defined(RT_USING_NEWLIB) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) /* use header file of newlib */ #include <sys/stat.h> diff --git a/include/libc/libc_stdio.h b/include/libc/libc_stdio.h new file mode 100644 index 0000000000..85ba509852 --- /dev/null +++ b/include/libc/libc_stdio.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-05 Meco Manthe first version + */ + +#ifndef LIBC_STDIO_H__ +#define LIBC_STDIO_H__ + +#include <rtconfig.h> + +#ifdef RT_USING_POSIX_GETLINE + +#include <posix_getline.h> + +#endif + +#endif diff --git a/include/rtdef.h b/include/rtdef.h index f2b546f75e..0690371c6d 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -32,6 +32,8 @@ * 2019-01-27 Bernard change version number to v4.0.1 * 2019-05-17 Bernard change version number to v4.0.2 * 2019-12-20 Bernard change version number to v4.0.3 + * 2020-08-10 Meco Man add macro for struct rt_device_ops + * 2020-10-23 Meco Man define maximum value of ipc type */ #ifndef __RT_DEF_H__ @@ -101,6 +103,13 @@ 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 */ +/* maximum value of ipc type */ +#define RT_SEM_VALUE_MAX RT_UINT16_MAX /**< Maxium number of semaphore .value */ +#define RT_MUTEX_VALUE_MAX RT_UINT16_MAX /**< Maxium number of mutex .value */ +#define RT_MUTEX_HOLD_MAX RT_UINT8_MAX /**< Maxium number of mutex .hold */ +#define RT_MB_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of mailbox .entry */ +#define RT_MQ_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of message queue .entry */ + #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) #define __CLANG_ARM #endif @@ -372,20 +381,20 @@ typedef struct rt_object *rt_object_t; /**< Type for kernel obj */ enum rt_object_class_type { - RT_Object_Class_Null = 0, /**< The object is not used. */ - RT_Object_Class_Thread, /**< The object is a thread. */ - RT_Object_Class_Semaphore, /**< The object is a semaphore. */ - RT_Object_Class_Mutex, /**< The object is a mutex. */ - RT_Object_Class_Event, /**< The object is a event. */ - RT_Object_Class_MailBox, /**< The object is a mail box. */ - RT_Object_Class_MessageQueue, /**< The object is a message queue. */ - RT_Object_Class_MemHeap, /**< The object is a memory heap */ - RT_Object_Class_MemPool, /**< The object is a memory pool. */ - RT_Object_Class_Device, /**< The object is a device */ - RT_Object_Class_Timer, /**< The object is a timer. */ - RT_Object_Class_Module, /**< The object is a module. */ - RT_Object_Class_Unknown, /**< The object is unknown. */ - RT_Object_Class_Static = 0x80 /**< The object is a static object. */ + RT_Object_Class_Null = 0x00, /**< The object is not used. */ + RT_Object_Class_Thread = 0x01, /**< The object is a thread. */ + RT_Object_Class_Semaphore = 0x02, /**< The object is a semaphore. */ + RT_Object_Class_Mutex = 0x03, /**< The object is a mutex. */ + RT_Object_Class_Event = 0x04, /**< The object is a event. */ + RT_Object_Class_MailBox = 0x05, /**< The object is a mail box. */ + RT_Object_Class_MessageQueue = 0x06, /**< The object is a message queue. */ + RT_Object_Class_MemHeap = 0x07, /**< The object is a memory heap. */ + RT_Object_Class_MemPool = 0x08, /**< The object is a memory pool. */ + RT_Object_Class_Device = 0x09, /**< The object is a device. */ + RT_Object_Class_Timer = 0x0a, /**< The object is a timer. */ + RT_Object_Class_Module = 0x0b, /**< The object is a module. */ + RT_Object_Class_Unknown = 0x0c, /**< The object is unknown. */ + RT_Object_Class_Static = 0x80 /**< The object is a static object. */ }; /** @@ -623,7 +632,7 @@ struct rt_thread void *lwp; #endif - rt_uint32_t user_data; /**< private user data beyond this thread */ + rt_ubase_t user_data; /**< private user data beyond this thread */ }; typedef struct rt_thread *rt_thread_t; @@ -920,6 +929,8 @@ enum rt_device_class_type #define RT_DEVICE_CTRL_RTC_SET_ALARM 0x13 /**< set alarm */ typedef struct rt_device *rt_device_t; + +#ifdef RT_USING_DEVICE_OPS /** * operations set for device object */ @@ -933,6 +944,7 @@ struct rt_device_ops rt_size_t (*write) (rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size); rt_err_t (*control)(rt_device_t dev, int cmd, void *args); }; +#endif /** * WaitQueue structure diff --git a/include/rtlibc.h b/include/rtlibc.h index b3a548beb1..fb8c782095 100644 --- a/include/rtlibc.h +++ b/include/rtlibc.h @@ -20,6 +20,8 @@ #include "libc/libc_dirent.h" #include "libc/libc_signal.h" #include "libc/libc_fdset.h" +#include "libc/libc_limits.h" +#include "libc/libc_stdio.h" #if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__IAR_SYSTEMS_ICC__) typedef signed long off_t; diff --git a/include/rtservice.h b/include/rtservice.h index 81d6c71f17..5bd2b1c23b 100644 --- a/include/rtservice.h +++ b/include/rtservice.h @@ -128,21 +128,21 @@ rt_inline unsigned int rt_list_len(const rt_list_t *l) /** * rt_list_for_each - iterate over a list - * @pos: the rt_list_t * to use as a loop cursor. - * @head: the head for your list. + * @pos: the rt_list_t * to use as a loop cursor. + * @head: the head for your list. */ #define rt_list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** * rt_list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the rt_list_t * to use as a loop cursor. - * @n: another rt_list_t * to use as temporary storage - * @head: the head for your list. + * @pos: the rt_list_t * to use as a loop cursor. + * @n: another rt_list_t * to use as temporary storage + * @head: the head for your list. */ #define rt_list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) /** * rt_list_for_each_entry - iterate over list of given type diff --git a/include/rtthread.h b/include/rtthread.h index 70d4f38896..a76601a3bf 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -41,6 +41,9 @@ extern "C" { void rt_system_object_init(void); struct rt_object_information * rt_object_get_information(enum rt_object_class_type type); +int rt_object_get_length(enum rt_object_class_type type); +int rt_object_get_pointers(enum rt_object_class_type type, rt_object_t *pointers, int maxlen); + void rt_object_init(struct rt_object *object, enum rt_object_class_type type, const char *name); |
