diff options
| author | bernard <[email protected]> | 2017-10-15 22:30:05 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2017-10-15 22:30:05 +0800 |
| commit | cd215b25455bf06dfeb8885fe4d8f5b30174a8c3 (patch) | |
| tree | d8fd2bac165526449fb9eccc004d5563374a722d /include/rtdef.h | |
| parent | 8bdf993bfc38f9b652a7af60cb071c708ad7dea6 (diff) | |
[Kernel] header files
1. Remove components.h file;
2. Add libc_* files for standard libc definitions;
3. Add rtdbg.h file for simple debug log;
4. Add single list implementation;
5. Change the 'rt_uint8_t' type of cmd to 'int'.
Diffstat (limited to 'include/rtdef.h')
| -rw-r--r-- | include/rtdef.h | 80 |
1 files changed, 73 insertions, 7 deletions
diff --git a/include/rtdef.h b/include/rtdef.h index 5bc2ba2ce1..5c3f774226 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -30,6 +30,7 @@ * 2012-12-30 Bernard add more control command for graphic. * 2013-01-09 Bernard change version number. * 2015-02-01 Bernard change version number to v2.1.0 + * 2016-08-31 Bernard change version number to v3.0.0 */ #ifndef __RT_DEF_H__ @@ -201,6 +202,8 @@ typedef int (*init_fn_t)(void); /* device/component/fs/app init routines will be called in init_thread */ /* device initialization */ #define INIT_DEVICE_EXPORT(fn) INIT_EXPORT(fn, "2") +/* components pre-initialization (pure software initilization) */ +#define INIT_PREV_EXPORT(fn) INIT_EXPORT(fn, "2") /* components initialization (dfs, lwip, ...) */ #define INIT_COMPONENT_EXPORT(fn) INIT_EXPORT(fn, "3") /* file system initialization (dfs-elm, dfs-rom, ...) */ @@ -259,6 +262,8 @@ typedef int (*init_fn_t)(void); #define RT_ENOSYS 6 /**< No system */ #define RT_EBUSY 7 /**< Busy */ #define RT_EIO 8 /**< IO error */ +#define RT_EINTR 9 /**< Interrupted system call */ +#define RT_EINVAL 10 /**< Invalid argument */ /*@}*/ @@ -288,6 +293,9 @@ typedef int (*init_fn_t)(void); */ #define RT_NULL (0) +/** + * Double List structure + */ struct rt_list_node { struct rt_list_node *next; /**< point to next node. */ @@ -296,6 +304,15 @@ struct rt_list_node typedef struct rt_list_node rt_list_t; /**< Type for lists. */ /** + * Single List structure + */ +struct rt_slist_node +{ + struct rt_slist_node *next; /**< point to next node. */ +}; +typedef struct rt_slist_node rt_slist_t; /**< Type for single list. */ + +/** * @addtogroup KernelObject */ @@ -447,6 +464,17 @@ typedef struct rt_timer *rt_timer_t; /*@}*/ /** + * @addtogroup Signal + */ +#ifdef RT_USING_SIGNALS +typedef unsigned long rt_sigset_t; +typedef void (*rt_sighandler_t)(int signo); + +#define RT_SIG_MAX 32 +#endif +/*@}*/ + +/** * @addtogroup Thread */ @@ -466,6 +494,11 @@ typedef struct rt_timer *rt_timer_t; #define RT_THREAD_BLOCK RT_THREAD_SUSPEND /**< Blocked status */ #define RT_THREAD_CLOSE 0x04 /**< Closed status */ +#define RT_THREAD_STAT_MASK 0x0f + +#define RT_THREAD_STAT_SIGNAL 0x10 +#define RT_THREAD_STAT_SIGNAL_READY (RT_THREAD_STAT_SIGNAL | RT_THREAD_READY) + /** * thread control command definitions */ @@ -501,7 +534,7 @@ struct rt_thread /* error code */ rt_err_t error; /**< error code */ - rt_uint8_t stat; /**< thread stat */ + rt_uint8_t stat; /**< thread status */ /* priority */ rt_uint8_t current_priority; /**< current priority */ @@ -518,6 +551,15 @@ struct rt_thread rt_uint8_t event_info; #endif +#if defined(RT_USING_SIGNALS) + rt_sigset_t sig_pending; /**< the pending signals */ + rt_sigset_t sig_mask; /**< the mask bits of signal */ + + void *sig_ret; /**< the return stack pointer from signal */ + rt_sighandler_t *sig_vectors; /**< vectors of signal handler */ + void *si_list; /**< the signal infor list */ +#endif + rt_ubase_t init_tick; /**< thread's initialized tick */ rt_ubase_t remaining_tick; /**< remaining tick */ @@ -778,11 +820,6 @@ enum rt_device_class_type #define RT_DEVICE_FLAG_SUSPENDED 0x020 /**< device is suspended */ #define RT_DEVICE_FLAG_STREAM 0x040 /**< stream mode */ -#define RT_DEVICE_CTRL_CONFIG 0x03 /* configure device */ -#define RT_DEVICE_CTRL_SET_INT 0x10 /* enable receive irq */ -#define RT_DEVICE_CTRL_CLR_INT 0x11 /* disable receive irq */ -#define RT_DEVICE_CTRL_GET_INT 0x12 - #define RT_DEVICE_FLAG_INT_RX 0x100 /**< INT mode on Rx */ #define RT_DEVICE_FLAG_DMA_RX 0x200 /**< DMA mode on Rx */ #define RT_DEVICE_FLAG_INT_TX 0x400 /**< INT mode on Tx */ @@ -793,12 +830,18 @@ enum rt_device_class_type #define RT_DEVICE_OFLAG_WRONLY 0x002 /**< write only access */ #define RT_DEVICE_OFLAG_RDWR 0x003 /**< read and write */ #define RT_DEVICE_OFLAG_OPEN 0x008 /**< device is opened */ +#define RT_DEVICE_OFLAG_MASK 0xf0f /**< mask of open flag */ /** * general device commands */ #define RT_DEVICE_CTRL_RESUME 0x01 /**< resume device */ #define RT_DEVICE_CTRL_SUSPEND 0x02 /**< suspend device */ +#define RT_DEVICE_CTRL_CONFIG 0x03 /**< configure device */ + +#define RT_DEVICE_CTRL_SET_INT 0x10 /**< set interrupt */ +#define RT_DEVICE_CTRL_CLR_INT 0x11 /**< clear interrupt */ +#define RT_DEVICE_CTRL_GET_INT 0x12 /**< get interrupt status */ /** * special device commands @@ -840,7 +883,12 @@ struct rt_device rt_err_t (*close) (rt_device_t dev); rt_size_t (*read) (rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size); 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, rt_uint8_t cmd, void *args); + rt_err_t (*control)(rt_device_t dev, int cmd, void *args); + +#if defined(RT_USING_DFS) && defined(RT_USING_DFS_DEVFS) + const struct dfs_file_ops *fops; + rt_list_t wait_queue; +#endif void *user_data; /**< device private data */ }; @@ -991,6 +1039,8 @@ struct rt_module 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 */ + /* object in this module, module object is the last basic object type */ struct rt_object_information module_object[RT_Object_Class_Unknown]; }; @@ -999,8 +1049,24 @@ typedef struct rt_module *rt_module_t; /*@}*/ #endif +/* definitions for libc */ +#include "rtlibc.h" + #ifdef __cplusplus } #endif +#ifdef __cplusplus +/* RT-Thread definitions for C++ */ +namespace rtthread { + +enum TICK_WAIT { + WAIT_NONE = 0, + WAIT_FOREVER = -1, +}; + +} + +#endif /* end of __cplusplus */ + #endif |
