|
@@ -30,6 +30,7 @@
|
|
* 2012-12-30 Bernard add more control command for graphic.
|
|
* 2012-12-30 Bernard add more control command for graphic.
|
|
* 2013-01-09 Bernard change version number.
|
|
* 2013-01-09 Bernard change version number.
|
|
* 2015-02-01 Bernard change version number to v2.1.0
|
|
* 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__
|
|
#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/component/fs/app init routines will be called in init_thread */
|
|
/* device initialization */
|
|
/* device initialization */
|
|
#define INIT_DEVICE_EXPORT(fn) INIT_EXPORT(fn, "2")
|
|
#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, ...) */
|
|
/* components initialization (dfs, lwip, ...) */
|
|
#define INIT_COMPONENT_EXPORT(fn) INIT_EXPORT(fn, "3")
|
|
#define INIT_COMPONENT_EXPORT(fn) INIT_EXPORT(fn, "3")
|
|
/* file system initialization (dfs-elm, dfs-rom, ...) */
|
|
/* 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_ENOSYS 6 /**< No system */
|
|
#define RT_EBUSY 7 /**< Busy */
|
|
#define RT_EBUSY 7 /**< Busy */
|
|
#define RT_EIO 8 /**< IO error */
|
|
#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)
|
|
#define RT_NULL (0)
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Double List structure
|
|
|
|
+ */
|
|
struct rt_list_node
|
|
struct rt_list_node
|
|
{
|
|
{
|
|
struct rt_list_node *next; /**< point to next node. */
|
|
struct rt_list_node *next; /**< point to next node. */
|
|
@@ -295,6 +303,15 @@ struct rt_list_node
|
|
};
|
|
};
|
|
typedef struct rt_list_node rt_list_t; /**< Type for lists. */
|
|
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
|
|
* @addtogroup KernelObject
|
|
*/
|
|
*/
|
|
@@ -446,6 +463,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
|
|
* @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_BLOCK RT_THREAD_SUSPEND /**< Blocked status */
|
|
#define RT_THREAD_CLOSE 0x04 /**< Closed 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
|
|
* thread control command definitions
|
|
*/
|
|
*/
|
|
@@ -501,7 +534,7 @@ struct rt_thread
|
|
/* error code */
|
|
/* error code */
|
|
rt_err_t error; /**< error code */
|
|
rt_err_t error; /**< error code */
|
|
|
|
|
|
- rt_uint8_t stat; /**< thread stat */
|
|
|
|
|
|
+ rt_uint8_t stat; /**< thread status */
|
|
|
|
|
|
/* priority */
|
|
/* priority */
|
|
rt_uint8_t current_priority; /**< current priority */
|
|
rt_uint8_t current_priority; /**< current priority */
|
|
@@ -518,6 +551,15 @@ struct rt_thread
|
|
rt_uint8_t event_info;
|
|
rt_uint8_t event_info;
|
|
#endif
|
|
#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 init_tick; /**< thread's initialized tick */
|
|
rt_ubase_t remaining_tick; /**< remaining 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_SUSPENDED 0x020 /**< device is suspended */
|
|
#define RT_DEVICE_FLAG_STREAM 0x040 /**< stream mode */
|
|
#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_INT_RX 0x100 /**< INT mode on Rx */
|
|
#define RT_DEVICE_FLAG_DMA_RX 0x200 /**< DMA 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 */
|
|
#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_WRONLY 0x002 /**< write only access */
|
|
#define RT_DEVICE_OFLAG_RDWR 0x003 /**< read and write */
|
|
#define RT_DEVICE_OFLAG_RDWR 0x003 /**< read and write */
|
|
#define RT_DEVICE_OFLAG_OPEN 0x008 /**< device is opened */
|
|
#define RT_DEVICE_OFLAG_OPEN 0x008 /**< device is opened */
|
|
|
|
+#define RT_DEVICE_OFLAG_MASK 0xf0f /**< mask of open flag */
|
|
|
|
|
|
/**
|
|
/**
|
|
* general device commands
|
|
* general device commands
|
|
*/
|
|
*/
|
|
#define RT_DEVICE_CTRL_RESUME 0x01 /**< resume device */
|
|
#define RT_DEVICE_CTRL_RESUME 0x01 /**< resume device */
|
|
#define RT_DEVICE_CTRL_SUSPEND 0x02 /**< suspend 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
|
|
* special device commands
|
|
@@ -840,7 +883,12 @@ struct rt_device
|
|
rt_err_t (*close) (rt_device_t dev);
|
|
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 (*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_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 */
|
|
void *user_data; /**< device private data */
|
|
};
|
|
};
|
|
@@ -991,6 +1039,8 @@ struct rt_module
|
|
rt_uint16_t nsym; /**< number of symbol in the module */
|
|
rt_uint16_t nsym; /**< number of symbol in the module */
|
|
struct rt_module_symtab *symtab; /**< module symbol table */
|
|
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 */
|
|
/* object in this module, module object is the last basic object type */
|
|
struct rt_object_information module_object[RT_Object_Class_Unknown];
|
|
struct rt_object_information module_object[RT_Object_Class_Unknown];
|
|
};
|
|
};
|
|
@@ -999,8 +1049,24 @@ typedef struct rt_module *rt_module_t;
|
|
/*@}*/
|
|
/*@}*/
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+/* definitions for libc */
|
|
|
|
+#include "rtlibc.h"
|
|
|
|
+
|
|
#ifdef __cplusplus
|
|
#ifdef __cplusplus
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef __cplusplus
|
|
|
|
+/* RT-Thread definitions for C++ */
|
|
|
|
+namespace rtthread {
|
|
|
|
+
|
|
|
|
+enum TICK_WAIT {
|
|
|
|
+ WAIT_NONE = 0,
|
|
|
|
+ WAIT_FOREVER = -1,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#endif /* end of __cplusplus */
|
|
|
|
+
|
|
#endif
|
|
#endif
|