summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorguochuangjian <[email protected]>2018-08-05 15:08:50 +0800
committerguochuangjian <[email protected]>2018-08-05 15:08:50 +0800
commit3de51fe25688f0b6c7cb9f9d424861654fb09e49 (patch)
treedcf4a170b00deace7860187e3ff9c2e6495e0923 /components/drivers/include
parent650f06aa1943d439ac049f6bc276b216999e6a56 (diff)
parent03bf99a56de255d41655bc8486d50cadbcae22f0 (diff)
fix usRcvBufferPos == MB_SER_PDU_SIZE_MAX bug
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/mmcsd_core.h1
-rw-r--r--components/drivers/include/drivers/pin.h6
-rw-r--r--components/drivers/include/drivers/rt_drv_pwm.h54
-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
-rw-r--r--components/drivers/include/rtdevice.h4
7 files changed, 109 insertions, 34 deletions
diff --git a/components/drivers/include/drivers/mmcsd_core.h b/components/drivers/include/drivers/mmcsd_core.h
index 424f9a0c85..2be758bf82 100644
--- a/components/drivers/include/drivers/mmcsd_core.h
+++ b/components/drivers/include/drivers/mmcsd_core.h
@@ -213,7 +213,6 @@ rt_inline rt_uint32_t __rt_fls(rt_uint32_t val)
}
if (!(val & 0x80000000u))
{
- val <<= 1;
bit -= 1;
}
diff --git a/components/drivers/include/drivers/pin.h b/components/drivers/include/drivers/pin.h
index d21fc28bd9..de8fd21acc 100644
--- a/components/drivers/include/drivers/pin.h
+++ b/components/drivers/include/drivers/pin.h
@@ -86,7 +86,7 @@ struct rt_pin_ops
/* TODO: add GPIO interrupt */
rt_err_t (*pin_attach_irq)(struct rt_device *device, rt_int32_t pin,
rt_uint32_t mode, void (*hdr)(void *args), void *args);
- rt_err_t (*pin_dettach_irq)(struct rt_device *device, rt_int32_t pin);
+ rt_err_t (*pin_detach_irq)(struct rt_device *device, rt_int32_t pin);
rt_err_t (*pin_irq_enable)(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
};
@@ -97,11 +97,9 @@ void rt_pin_write(rt_base_t pin, rt_base_t value);
int rt_pin_read(rt_base_t pin);
rt_err_t rt_pin_attach_irq(rt_int32_t pin, rt_uint32_t mode,
void (*hdr)(void *args), void *args);
-rt_err_t rt_pin_dettach_irq(rt_int32_t pin);
+rt_err_t rt_pin_detach_irq(rt_int32_t pin);
rt_err_t rt_pin_irq_enable(rt_base_t pin, rt_uint32_t enabled);
-int rt_device_pin_irq_register(const char *name, const struct rt_pin_ops *ops,
- void *user_data);
#ifdef __cplusplus
}
#endif
diff --git a/components/drivers/include/drivers/rt_drv_pwm.h b/components/drivers/include/drivers/rt_drv_pwm.h
new file mode 100644
index 0000000000..ffd08edabb
--- /dev/null
+++ b/components/drivers/include/drivers/rt_drv_pwm.h
@@ -0,0 +1,54 @@
+/*
+ * File : rt_drv_pwm.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 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-05-07 aozima the first version
+ */
+
+#ifndef __DRV_PWM_H_INCLUDE__
+#define __DRV_PWM_H_INCLUDE__
+
+#define PWM_CMD_ENABLE (128 + 0)
+#define PWM_CMD_DISABLE (128 + 1)
+#define PWM_CMD_SET (128 + 2)
+#define PWM_CMD_GET (128 + 3)
+
+struct rt_pwm_configuration
+{
+ rt_uint32_t channel; /* 0-n */
+ rt_uint32_t period; /* unit:ns 1ns~4.29s:1Ghz~0.23hz */
+ rt_uint32_t pulse; /* unit:ns (pulse<=period) */
+};
+
+struct rt_device_pwm;
+struct rt_pwm_ops
+{
+ rt_err_t (*control)(struct rt_device_pwm *device, int cmd, void *arg);
+};
+
+struct rt_device_pwm
+{
+ struct rt_device parent;
+ const struct rt_pwm_ops *ops;
+};
+
+extern rt_err_t rt_device_pwm_register(struct rt_device_pwm *device, const char *name, const struct rt_pwm_ops *ops, const void *user_data);
+
+#endif /* __DRV_PWM_H_INCLUDE__ */
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);
diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h
index f7aadd8305..e3c826fe53 100644
--- a/components/drivers/include/rtdevice.h
+++ b/components/drivers/include/rtdevice.h
@@ -112,6 +112,10 @@ extern "C" {
#include "drivers/cputime.h"
#endif
+#ifdef RT_USING_PWM
+#include "drivers/rt_drv_pwm.h"
+#endif
+
#ifdef __cplusplus
}
#endif