summaryrefslogtreecommitdiff
path: root/components/drivers/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 /components/drivers/include
parent41f2f1829f3227b2d405feb75751ac5debfcc1e8 (diff)
parent44712ba2cfd113374986f7a63d7c48ec34c4a8da (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/usb_common.h30
-rw-r--r--components/drivers/include/ipc/pipe.h2
-rw-r--r--components/drivers/include/ipc/waitqueue.h46
3 files changed, 49 insertions, 29 deletions
diff --git a/components/drivers/include/drivers/usb_common.h b/components/drivers/include/drivers/usb_common.h
index 26c1d9aac4..922682b1af 100644
--- a/components/drivers/include/drivers/usb_common.h
+++ b/components/drivers/include/drivers/usb_common.h
@@ -222,26 +222,13 @@ extern "C" {
#define USB_EP_DESC_NUM(addr) (addr & USB_EP_DESC_NUM_MASK)
#define USB_EP_DIR(addr) ((addr & USB_DIR_MASK)>>7)
-#ifdef RT_USB_DEVICE_HID
- #ifdef RT_USB_DEVICE_HID_KEYBOARD
- #define HID_REPORT_ID_KEYBOARD1 1
- #if RT_USB_DEVICE_HID_KEYBOARD_NUMBER>1
- #define HID_REPORT_ID_KEYBOARD2 2
- #if RT_USB_DEVICE_HID_KEYBOARD_NUMBER>2
- #define HID_REPORT_ID_KEYBOARD3 3
- #endif
- #endif
- #endif
- #ifdef RT_USB_DEVICE_HID_MEDIA
- #define HID_REPORT_ID_MEDIA 4
- #endif
- #ifdef RT_USB_DEVICE_HID_GENERAL
- #define HID_REPORT_ID_GENERAL 5
- #endif
- #ifdef RT_USB_DEVICE_HID_MOUSE
- #define HID_REPORT_ID_MOUSE 6
- #endif
-#endif
+#define HID_REPORT_ID_KEYBOARD1 1
+#define HID_REPORT_ID_KEYBOARD2 2
+#define HID_REPORT_ID_KEYBOARD3 3
+#define HID_REPORT_ID_KEYBOARD4 7
+#define HID_REPORT_ID_MEDIA 4
+#define HID_REPORT_ID_GENERAL 5
+#define HID_REPORT_ID_MOUSE 6
#define uswap_32(x) \
((((x) & 0xff000000) >> 24) | \
@@ -473,7 +460,6 @@ typedef struct usb_os_proerty * usb_os_proerty_t;
#define HID_SUB_DESCRIPTOR_MAX 1
#endif
-#ifdef RT_USB_DEVICE_HID
struct uhid_descriptor
{
rt_uint8_t bLength;
@@ -497,7 +483,7 @@ struct hid_report
};
typedef struct hid_report* hid_report_t;
extern void HID_Report_Received(hid_report_t report);
-#endif
+
struct urequest
{
rt_uint8_t request_type;
diff --git a/components/drivers/include/ipc/pipe.h b/components/drivers/include/ipc/pipe.h
index 08aa287c6a..ca20c2a453 100644
--- a/components/drivers/include/ipc/pipe.h
+++ b/components/drivers/include/ipc/pipe.h
@@ -32,5 +32,5 @@ struct rt_pipe_device
typedef struct rt_pipe_device rt_pipe_t;
rt_pipe_t *rt_pipe_create(const char *name, int bufsz);
-
+int rt_pipe_delete(const char *name);
#endif /* PIPE_H__ */
diff --git a/components/drivers/include/ipc/waitqueue.h b/components/drivers/include/ipc/waitqueue.h
index 1746d0f1cd..8cb0989f73 100644
--- a/components/drivers/include/ipc/waitqueue.h
+++ b/components/drivers/include/ipc/waitqueue.h
@@ -1,25 +1,59 @@
+/*
+ * File : waitqueue.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2018/06/26 Bernard Fix the wait queue issue when wakeup a soon
+ * to blocked thread.
+ */
+
#ifndef WAITQUEUE_H__
#define WAITQUEUE_H__
#include <rtthread.h>
-struct rt_wqueue_node;
+#define RT_WQ_FLAG_CLEAN 0x00
+#define RT_WQ_FLAG_WAKEUP 0x01
-typedef rt_list_t rt_wqueue_t;
+struct rt_wqueue_node;
typedef int (*rt_wqueue_func_t)(struct rt_wqueue_node *wait, void *key);
struct rt_wqueue_node
{
- rt_thread_t polling_thread;
- rt_list_t list;
+ rt_thread_t polling_thread;
+ rt_list_t list;
- rt_wqueue_func_t wakeup;
- rt_uint32_t key;
+ rt_wqueue_func_t wakeup;
+ rt_uint32_t key;
};
typedef struct rt_wqueue_node rt_wqueue_node_t;
int __wqueue_default_wake(struct rt_wqueue_node *wait, void *key);
+rt_inline void rt_wqueue_init(rt_wqueue_t *queue)
+{
+ RT_ASSERT(queue != RT_NULL);
+
+ queue->flag = RT_WQ_FLAG_CLEAN;
+ rt_list_init(&(queue->waiting_list));
+}
+
void rt_wqueue_add(rt_wqueue_t *queue, struct rt_wqueue_node *node);
void rt_wqueue_remove(struct rt_wqueue_node *node);
int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int timeout);