diff options
| author | Wayne Lin <[email protected]> | 2021-11-10 16:01:38 +0800 |
|---|---|---|
| committer | Wayne Lin <[email protected]> | 2021-11-10 16:01:38 +0800 |
| commit | 9b44e57a6022b8eb46eda7037b719ec918fdcc55 (patch) | |
| tree | 26be9facf0f37d1c38b9e4b6e4abc99d6f8b5a8d /include | |
| parent | 37f5236dfa45b98d02e867536a10ac0b6622b80b (diff) | |
| parent | fdbaa2a808d12d522ad90702795c08ae8443aab9 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into nuvoton
Diffstat (limited to 'include')
| -rw-r--r-- | include/libc/libc_dirent.h | 17 | ||||
| -rw-r--r-- | include/libc/libc_fcntl.h | 98 | ||||
| -rw-r--r-- | include/libc/libc_fdset.h | 60 | ||||
| -rw-r--r-- | include/libc/libc_signal.h | 184 | ||||
| -rw-r--r-- | include/libc/libc_stat.h | 110 | ||||
| -rw-r--r-- | include/rtdebug.h | 13 | ||||
| -rw-r--r-- | include/rtdef.h | 23 | ||||
| -rw-r--r-- | include/rtlibc.h | 35 | ||||
| -rw-r--r-- | include/rtthread.h | 40 |
9 files changed, 44 insertions, 536 deletions
diff --git a/include/libc/libc_dirent.h b/include/libc/libc_dirent.h deleted file mode 100644 index a86332e633..0000000000 --- a/include/libc/libc_dirent.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ - -#ifndef LIBC_DIRENT_H__ -#define LIBC_DIRENT_H__ - -#define DT_UNKNOWN 0x00 -#define DT_REG 0x01 -#define DT_DIR 0x02 - -#endif diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h deleted file mode 100644 index 945e674d35..0000000000 --- a/include/libc/libc_fcntl.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * 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__ - -#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) -#include <fcntl.h> - -#ifndef O_NONBLOCK -#define O_NONBLOCK 0x4000 -#endif - -#if defined(_WIN32) -#define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR) -#endif - -#ifndef F_GETFL -#define F_GETFL 3 -#endif -#ifndef F_SETFL -#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 -#define O_RDWR 02 - -#define O_CREAT 0100 -#define O_EXCL 0200 -#define O_NOCTTY 0400 -#define O_TRUNC 01000 -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_DSYNC 010000 -#define O_SYNC 04010000 -#define O_RSYNC 04010000 -#define O_BINARY 0100000 -#define O_DIRECTORY 0200000 -#define O_NOFOLLOW 0400000 -#define O_CLOEXEC 02000000 - -#define O_ASYNC 020000 -#define O_DIRECT 040000 -#define O_LARGEFILE 0100000 -#define O_NOATIME 01000000 -#define O_PATH 010000000 -#define O_TMPFILE 020200000 -#define O_NDELAY O_NONBLOCK - -#define O_SEARCH O_PATH -#define O_EXEC O_PATH - -#define O_ACCMODE (03|O_SEARCH) - -#define F_DUPFD 0 -#define F_GETFD 1 -#define F_SETFD 2 -#define F_GETFL 3 -#define F_SETFL 4 - -#define F_SETOWN 8 -#define F_GETOWN 9 -#define F_SETSIG 10 -#define F_GETSIG 11 - -#define F_GETLK 12 -#define F_SETLK 13 -#define F_SETLKW 14 - -#define F_SETOWN_EX 15 -#define F_GETOWN_EX 16 - -#define F_GETOWNER_UIDS 17 -#endif - -#endif diff --git a/include/libc/libc_fdset.h b/include/libc/libc_fdset.h deleted file mode 100644 index c542e6855c..0000000000 --- a/include/libc/libc_fdset.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-10-30 Bernard The first version - */ - -#ifndef LIBC_FDSET_H__ -#define LIBC_FDSET_H__ - -#include <rtconfig.h> - -#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> -#endif - -#else - -#ifdef SAL_USING_POSIX - -#ifdef FD_SETSIZE -#undef FD_SETSIZE -#endif - -#define FD_SETSIZE DFS_FD_MAX -#endif - -# ifndef FD_SETSIZE -# define FD_SETSIZE 32 -# endif - -# define NBBY 8 /* number of bits in a byte */ - -typedef long fd_mask; -# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -# ifndef howmany -# define howmany(x,y) (((x)+((y)-1))/(y)) -# endif - -/* We use a macro for fd_set so that including Sockets.h afterwards - can work. */ -typedef struct _types_fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} _types_fd_set; - -#define fd_set _types_fd_set - -# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) -# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) -# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) -# define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) - -#endif - -#endif diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h deleted file mode 100644 index 1fb8194643..0000000000 --- a/include/libc/libc_signal.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-09-12 Bernard The first version - */ - -#ifndef LIBC_SIGNAL_H__ -#define LIBC_SIGNAL_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> -#ifdef HAVE_CCONFIG_H -#include <cconfig.h> -#endif - -#ifndef HAVE_SIGVAL -/* 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. */ - -union sigval -{ - int sival_int; /* Integer signal value */ - void *sival_ptr; /* Pointer signal value */ -}; -#endif - -#ifndef HAVE_SIGEVENT -struct sigevent -{ - int sigev_notify; /* Notification type */ - int sigev_signo; /* Signal number */ - union sigval sigev_value; /* Signal value */ - void (*sigev_notify_function)( union sigval ); - /* Notification function */ - void *sigev_notify_attributes; /* Notification Attributes, really pthread_attr_t */ -}; -#endif - -#ifndef HAVE_SIGINFO -struct siginfo -{ - uint16_t si_signo; - uint16_t si_code; - - 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 - 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 - message on an empty message queue. */ - -#if !defined(RT_USING_NEWLIB) -typedef void (*_sig_func_ptr)(int); -typedef unsigned long sigset_t; -#endif - -#include <signal.h> - -#ifdef __ARMCC_VERSION - -#define SIGHUP 1 -/* #define SIGINT 2 */ -#define SIGQUIT 3 -/* #define SIGILL 4 */ -#define SIGTRAP 5 -/* #define SIGABRT 6 */ -#define SIGEMT 7 -/* #define SIGFPE 8 */ -#define SIGKILL 9 -#define SIGBUS 10 -/* #define SIGSEGV 11 */ -#define SIGSYS 12 -#define SIGPIPE 13 -#define SIGALRM 14 -/* #define SIGTERM 15 */ -#define SIGURG 16 -#define SIGSTOP 17 -#define SIGTSTP 18 -#define SIGCONT 19 -#define SIGCHLD 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGPOLL 23 -#define SIGWINCH 24 -/* #define SIGUSR1 25 */ -/* #define SIGUSR2 26 */ -#define SIGRTMIN 27 -#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 */ - -struct sigaction -{ - _sig_func_ptr sa_handler; - sigset_t sa_mask; - int sa_flags; -}; - -#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0) -#define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0) -#define sigemptyset(what) (*(what) = 0, 0) -#define sigfillset(what) (*(what) = ~(0), 0) -#define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0) - -int sigprocmask (int how, const sigset_t *set, sigset_t *oset); -int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); - -#elif defined(__IAR_SYSTEMS_ICC__) - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -/* #define SIGABRT 6 */ -#define SIGEMT 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGBUS 10 -#define SIGSEGV 11 -#define SIGSYS 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGURG 16 -#define SIGSTOP 17 -#define SIGTSTP 18 -#define SIGCONT 19 -#define SIGCHLD 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGPOLL 23 -#define SIGWINCH 24 -#define SIGUSR1 25 -#define SIGUSR2 26 -#define SIGRTMIN 27 -#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 */ - -struct sigaction -{ - _sig_func_ptr sa_handler; - sigset_t sa_mask; - int sa_flags; -}; - -#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0) -#define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0) -#define sigemptyset(what) (*(what) = 0, 0) -#define sigfillset(what) (*(what) = ~(0), 0) -#define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0) - -int sigprocmask (int how, const sigset_t *set, sigset_t *oset); -int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/include/libc/libc_stat.h b/include/libc/libc_stat.h deleted file mode 100644 index f680de4e06..0000000000 --- a/include/libc/libc_stat.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ - -#ifndef LIBC_STAT_H__ -#define LIBC_STAT_H__ - -#include <rtconfig.h> - -#if defined(RT_USING_NEWLIB) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) -/* use header file of newlib */ -#include <sys/stat.h> - -#elif defined(_WIN32) -#include <sys/stat.h> - -#define S_IRWXU 00700 -#define S_IRUSR 00400 -#define S_IWUSR 00200 -#define S_IXUSR 00100 - -#define S_IRWXG 00070 -#define S_IRGRP 00040 -#define S_IWGRP 00020 -#define S_IXGRP 00010 - -#define S_IRWXO 00007 -#define S_IROTH 00004 -#define S_IWOTH 00002 -#define S_IXOTH 00001 - -#define S_IFSOCK 0140000 -#define S_IFLNK 0120000 -#define S_IFBLK 0060000 -#define S_IFIFO 0010000 -#define S_ISUID 0004000 -#define S_ISGID 0002000 -#define S_ISVTX 0001000 - -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) - -#else -#define S_IFMT 00170000 -#define S_IFSOCK 0140000 -#define S_IFLNK 0120000 -#define S_IFREG 0100000 -#define S_IFBLK 0060000 -#define S_IFDIR 0040000 -#define S_IFCHR 0020000 -#define S_IFIFO 0010000 -#define S_ISUID 0004000 -#define S_ISGID 0002000 -#define S_ISVTX 0001000 - -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) - -#define S_IRWXU 00700 -#define S_IRUSR 00400 -#define S_IWUSR 00200 -#define S_IXUSR 00100 - -#define S_IRWXG 00070 -#define S_IRGRP 00040 -#define S_IWGRP 00020 -#define S_IXGRP 00010 - -#define S_IRWXO 00007 -#define S_IROTH 00004 -#define S_IWOTH 00002 -#define S_IXOTH 00001 - -/* stat structure */ -#include <stdint.h> -#include <time.h> - -struct stat -{ - struct rt_device *st_dev; - uint16_t st_ino; - uint16_t st_mode; - uint16_t st_nlink; - uint16_t st_uid; - uint16_t st_gid; - struct rt_device *st_rdev; - uint32_t st_size; - time_t st_atime; - long st_spare1; - time_t st_mtime; - long st_spare2; - time_t st_ctime; - long st_spare3; - uint32_t st_blksize; - uint32_t st_blocks; - long st_spare4[2]; -}; - -#endif - -#endif diff --git a/include/rtdebug.h b/include/rtdebug.h index 8c7d450ad4..c170d148c1 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -17,18 +17,7 @@ #if !defined(RT_USING_DFS) || !defined(RT_USING_DFS_DEVFS) #error "POSIX poll/select, stdin need file system(RT_USING_DFS) and device file system(RT_USING_DFS_DEVFS)" #endif - -#if !defined(RT_USING_LIBC) -#error "POSIX layer need standard C library(RT_USING_LIBC)" -#endif - -#endif - -#ifdef RT_USING_POSIX_TERMIOS -#if !defined(RT_USING_POSIX) -#error "termios need POSIX layer(RT_USING_POSIX)" -#endif -#endif +#endif /* RT_USING_POSIX */ /* Using this macro to control all kernel debug features. */ #ifdef RT_DEBUG diff --git a/include/rtdef.h b/include/rtdef.h index 394bbca5d2..a324eea122 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -34,6 +34,7 @@ * 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 + * 2021-03-19 Meco Man add security devices * 2021-05-10 armink change version number to v4.0.4 */ @@ -276,7 +277,6 @@ typedef int (*init_fn_t)(void); /* define these to empty, even if not include finsh.h file */ #define FINSH_FUNCTION_EXPORT(name, desc) #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) -#define FINSH_VAR_EXPORT(name, type, desc) #define MSH_CMD_EXPORT(command, desc) #define MSH_CMD_EXPORT_ALIAS(command, alias, desc) @@ -510,7 +510,7 @@ typedef struct rt_timer *rt_timer_t; * @addtogroup Signal */ #ifdef RT_USING_SIGNALS -#include <libc/libc_signal.h> +#include <sys/signal.h> typedef unsigned long rt_sigset_t; typedef void (*rt_sighandler_t)(int signo); typedef siginfo_t rt_siginfo_t; @@ -908,6 +908,7 @@ enum rt_device_class_type RT_Device_Class_I2CBUS, /**< I2C bus device */ RT_Device_Class_USBDevice, /**< USB slave device */ RT_Device_Class_USBHost, /**< USB host bus */ + RT_Device_Class_USBOTG, /**< USB OTG bus */ RT_Device_Class_SPIBUS, /**< SPI bus device */ RT_Device_Class_SPIDevice, /**< SPI device */ RT_Device_Class_SDIO, /**< SDIO bus device */ @@ -919,6 +920,7 @@ enum rt_device_class_type RT_Device_Class_Sensor, /**< Sensor device */ RT_Device_Class_Touch, /**< Touch device */ RT_Device_Class_PHY, /**< PHY device */ + RT_Device_Class_Security, /**< Security device */ RT_Device_Class_Unknown /**< unknown device */ }; @@ -964,13 +966,13 @@ enum rt_device_class_type /** * special device commands */ -#define RT_DEVICE_CTRL_CHAR_STREAM 0x10 /**< stream mode on char device */ -#define RT_DEVICE_CTRL_BLK_GETGEOME 0x10 /**< get geometry information */ -#define RT_DEVICE_CTRL_BLK_SYNC 0x11 /**< flush data to block device */ -#define RT_DEVICE_CTRL_BLK_ERASE 0x12 /**< erase block on block device */ -#define RT_DEVICE_CTRL_BLK_AUTOREFRESH 0x13 /**< block device : enter/exit auto refresh mode */ -#define RT_DEVICE_CTRL_NETIF_GETMAC 0x10 /**< get mac address */ -#define RT_DEVICE_CTRL_MTD_FORMAT 0x10 /**< format a MTD device */ +#define RT_DEVICE_CTRL_CHAR_STREAM 0x20 /**< stream mode on char device */ +#define RT_DEVICE_CTRL_BLK_GETGEOME 0x20 /**< get geometry information */ +#define RT_DEVICE_CTRL_BLK_SYNC 0x21 /**< flush data to block device */ +#define RT_DEVICE_CTRL_BLK_ERASE 0x22 /**< erase block on block device */ +#define RT_DEVICE_CTRL_BLK_AUTOREFRESH 0x23 /**< block device : enter/exit auto refresh mode */ +#define RT_DEVICE_CTRL_NETIF_GETMAC 0x20 /**< get mac address */ +#define RT_DEVICE_CTRL_MTD_FORMAT 0x20 /**< format a MTD device */ typedef struct rt_device *rt_device_t; @@ -1144,9 +1146,6 @@ struct rt_device_graphic_ops /**@}*/ #endif -/* definitions for libc */ -#include "rtlibc.h" - #ifdef __cplusplus } #endif diff --git a/include/rtlibc.h b/include/rtlibc.h deleted file mode 100644 index ac44a97831..0000000000 --- a/include/rtlibc.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-01-21 Bernard the first version - */ - -#ifndef RTLIBC_H__ -#define RTLIBC_H__ - -/* definitions for libc if toolchain has no these definitions */ -#include "libc/libc_stat.h" - -#include "libc/libc_fcntl.h" -#include "libc/libc_dirent.h" -#include "libc/libc_signal.h" -#include "libc/libc_fdset.h" - -#ifndef RT_USING_LIBC -#if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__) -typedef signed long off_t; -typedef int mode_t; -#endif -#endif - -#if defined(__MINGW32__) || defined(_WIN32) -typedef signed long off_t; -typedef int mode_t; -#endif - -#endif - diff --git a/include/rtthread.h b/include/rtthread.h index cf47a48efe..83be7d1ebc 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -48,9 +48,11 @@ void rt_object_init(struct rt_object *object, enum rt_object_class_type type, const char *name); void rt_object_detach(rt_object_t object); +#ifdef RT_USING_HEAP rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name); void rt_object_delete(rt_object_t object); +#endif rt_bool_t rt_object_is_systemobject(rt_object_t object); rt_uint8_t rt_object_get_type(rt_object_t object); rt_object_t rt_object_find(const char *name, rt_uint8_t type); @@ -90,12 +92,14 @@ void rt_timer_init(rt_timer_t timer, rt_tick_t time, rt_uint8_t flag); rt_err_t rt_timer_detach(rt_timer_t timer); +#ifdef RT_USING_HEAP rt_timer_t rt_timer_create(const char *name, void (*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag); rt_err_t rt_timer_delete(rt_timer_t timer); +#endif rt_err_t rt_timer_start(rt_timer_t timer); rt_err_t rt_timer_stop(rt_timer_t timer); rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg); @@ -128,17 +132,18 @@ rt_err_t rt_thread_init(struct rt_thread *thread, rt_uint8_t priority, rt_uint32_t tick); rt_err_t rt_thread_detach(rt_thread_t thread); +#ifdef RT_USING_HEAP rt_thread_t rt_thread_create(const char *name, void (*entry)(void *parameter), void *parameter, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick); +rt_err_t rt_thread_delete(rt_thread_t thread); +#endif rt_thread_t rt_thread_self(void); rt_thread_t rt_thread_find(char *name); rt_err_t rt_thread_startup(rt_thread_t thread); -rt_err_t rt_thread_delete(rt_thread_t thread); - rt_err_t rt_thread_yield(void); rt_err_t rt_thread_delay(rt_tick_t tick); rt_err_t rt_thread_delay_until(rt_tick_t *tick, rt_tick_t inc_tick); @@ -228,10 +233,12 @@ rt_err_t rt_mp_init(struct rt_mempool *mp, rt_size_t size, rt_size_t block_size); rt_err_t rt_mp_detach(struct rt_mempool *mp); +#ifdef RT_USING_HEAP rt_mp_t rt_mp_create(const char *name, rt_size_t block_count, rt_size_t block_size); rt_err_t rt_mp_delete(rt_mp_t mp); +#endif void *rt_mp_alloc(rt_mp_t mp, rt_int32_t time); void rt_mp_free(void *block); @@ -303,8 +310,10 @@ rt_err_t rt_sem_init(rt_sem_t sem, rt_uint32_t value, rt_uint8_t flag); rt_err_t rt_sem_detach(rt_sem_t sem); +#ifdef RT_USING_HEAP rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag); rt_err_t rt_sem_delete(rt_sem_t sem); +#endif rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time); rt_err_t rt_sem_trytake(rt_sem_t sem); @@ -318,8 +327,10 @@ rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg); */ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag); rt_err_t rt_mutex_detach(rt_mutex_t mutex); +#ifdef RT_USING_HEAP rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag); rt_err_t rt_mutex_delete(rt_mutex_t mutex); +#endif rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time); rt_err_t rt_mutex_trytake(rt_mutex_t mutex); @@ -333,8 +344,10 @@ rt_err_t rt_mutex_control(rt_mutex_t mutex, int cmd, void *arg); */ rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag); rt_err_t rt_event_detach(rt_event_t event); +#ifdef RT_USING_HEAP rt_event_t rt_event_create(const char *name, rt_uint8_t flag); rt_err_t rt_event_delete(rt_event_t event); +#endif rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set); rt_err_t rt_event_recv(rt_event_t event, @@ -355,8 +368,10 @@ rt_err_t rt_mb_init(rt_mailbox_t mb, rt_size_t size, rt_uint8_t flag); rt_err_t rt_mb_detach(rt_mailbox_t mb); +#ifdef RT_USING_HEAP rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag); rt_err_t rt_mb_delete(rt_mailbox_t mb); +#endif rt_err_t rt_mb_send(rt_mailbox_t mb, rt_ubase_t value); rt_err_t rt_mb_send_wait(rt_mailbox_t mb, @@ -377,11 +392,13 @@ rt_err_t rt_mq_init(rt_mq_t mq, rt_size_t pool_size, rt_uint8_t flag); rt_err_t rt_mq_detach(rt_mq_t mq); +#ifdef RT_USING_HEAP rt_mq_t rt_mq_create(const char *name, rt_size_t msg_size, rt_size_t max_msgs, rt_uint8_t flag); rt_err_t rt_mq_delete(rt_mq_t mq); +#endif rt_err_t rt_mq_send(rt_mq_t mq, const void *buffer, rt_size_t size); rt_err_t rt_mq_send_wait(rt_mq_t mq, @@ -440,8 +457,10 @@ rt_err_t rt_device_register(rt_device_t dev, rt_uint16_t flags); rt_err_t rt_device_unregister(rt_device_t dev); +#ifdef RT_USING_HEAP rt_device_t rt_device_create(int type, int attach_size); void rt_device_destroy(rt_device_t device); +#endif rt_err_t rt_device_set_rx_indicate(rt_device_t dev, @@ -545,6 +564,7 @@ int __rt_ffs(int value); void *rt_memset(void *src, int c, rt_ubase_t n); void *rt_memcpy(void *dest, const void *src, rt_ubase_t n); +char *rt_strdup(const char *s); #ifndef RT_KSERVICE_USING_STDLIB void *rt_memmove(void *dest, const void *src, rt_ubase_t n); @@ -554,7 +574,6 @@ rt_int32_t rt_strcasecmp(const char *a, const char *b); char *rt_strncpy(char *dest, const char *src, rt_ubase_t n); 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_strnlen(const char *s, rt_ubase_t maxlen); rt_size_t rt_strlen(const char *src); #else #include <string.h> @@ -565,15 +584,20 @@ rt_size_t rt_strlen(const char *src); #define rt_strncpy(dest, src, n) strncpy(dest, src, n) #define rt_strncmp(cs, ct, count) strncmp(cs, ct, count) #define rt_strcmp(cs, ct) strcmp(cs, ct) -#define rt_strnlen(s, maxlen) strnlen(s, maxlen) #define rt_strlen(src) strlen(src) #endif /*RT_KSERVICE_USING_STDLIB*/ -char *rt_strdup(const char *s); +#if !defined(RT_KSERVICE_USING_STDLIB) || defined(__ARMCC_VERSION) +rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen); +#else +#define rt_strnlen(s, maxlen) strnlen(s, maxlen) +#endif /* !defined(RT_KSERVICE_USING_STDLIB) || defined(__ARMCC_VERSION) */ + #ifdef __ARMCC_VERSION -/* lack strdup interface */ +/* MDK doesn't have these APIs */ char* strdup(const char* str); -#endif +rt_size_t strnlen(const char *s, rt_size_t maxlen); +#endif /* __ARMCC_VERSION */ void rt_show_version(void); @@ -585,7 +609,7 @@ 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> +#include <finsh.h> #endif /**@}*/ |
