summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-07-12 14:09:39 +0800
committerBernard Xiong <[email protected]>2018-07-12 14:09:39 +0800
commit5c420c0c6e23de57ba2f308ec3c99b8da19c8311 (patch)
tree061a3e5bebe25de8152a878f35709ec40d8bea9d /include
parent41f2f1829f3227b2d405feb75751ac5debfcc1e8 (diff)
parent44712ba2cfd113374986f7a63d7c48ec34c4a8da (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'include')
-rw-r--r--include/rtdef.h15
-rw-r--r--include/rtservice.h26
-rw-r--r--include/rtthread.h1
3 files changed, 41 insertions, 1 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index 5f6f728967..642ea0e729 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -848,6 +848,9 @@ enum rt_device_class_type
#define RT_DEVICE_CTRL_RTC_SET_ALARM 0x13 /**< set alarm */
typedef struct rt_device *rt_device_t;
+/**
+ * operations set for device object
+ */
struct rt_device_ops
{
/* common device interface */
@@ -860,6 +863,16 @@ struct rt_device_ops
};
/**
+ * WaitQueue structure
+ */
+struct rt_wqueue
+{
+ rt_uint32_t flag;
+ rt_list_t waiting_list;
+};
+typedef struct rt_wqueue rt_wqueue_t;
+
+/**
* Device structure
*/
struct rt_device
@@ -891,7 +904,7 @@ struct rt_device
#if defined(RT_USING_POSIX)
const struct dfs_file_ops *fops;
- rt_list_t wait_queue;
+ struct rt_wqueue wait_queue;
#endif
void *user_data; /**< device private data */
diff --git a/include/rtservice.h b/include/rtservice.h
index f909f17f86..0bfa424338 100644
--- a/include/rtservice.h
+++ b/include/rtservice.h
@@ -141,6 +141,24 @@ rt_inline unsigned int rt_list_len(const rt_list_t *l)
rt_container_of(node, type, member)
/**
+ * 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.
+ */
+#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.
+ */
+#define rt_list_for_each_safe(pos, n, head) \
+ 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
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
@@ -255,6 +273,14 @@ rt_inline int rt_slist_isempty(rt_slist_t *l)
rt_container_of(node, type, member)
/**
+ * rt_slist_for_each - iterate over a single list
+ * @pos: the rt_slist_t * to use as a loop cursor.
+ * @head: the head for your single list.
+ */
+#define rt_slist_for_each(pos, head) \
+ for (pos = (head)->next; pos != RT_NULL; pos = pos->next)
+
+/**
* rt_slist_for_each_entry - iterate over single list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your single list.
diff --git a/include/rtthread.h b/include/rtthread.h
index 1e9409b97b..b3d7ebd949 100644
--- a/include/rtthread.h
+++ b/include/rtthread.h
@@ -62,6 +62,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type,
const char *name);
void rt_object_delete(rt_object_t object);
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);
#ifdef RT_USING_HOOK