diff options
| author | hathach <[email protected]> | 2018-07-23 23:41:14 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-07-23 23:41:14 +0700 |
| commit | 5f6cd4903101b0486771efdb2bb435ddf6cf8e7a (patch) | |
| tree | 6491459014c35ac6a8e4ec7ac46ef2e3486b0222 | |
| parent | 51903a60c51bd1006bec9266dbe1bfb35e282675 (diff) | |
clean up include
| -rw-r--r-- | src/class/hid/hid_device.c | 1 | ||||
| -rw-r--r-- | src/common/tusb_common.h | 6 | ||||
| -rw-r--r-- | src/common/tusb_timeout.h | 15 | ||||
| -rw-r--r-- | src/host/ehci/ehci.c | 1 | ||||
| -rw-r--r-- | src/host/ohci/ohci.c | 1 | ||||
| -rw-r--r-- | src/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c | 1 | ||||
| -rw-r--r-- | src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c | 1 |
7 files changed, 16 insertions, 10 deletions
diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index 82c7e3d3f..7aca8ef8e 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -45,7 +45,6 @@ // INCLUDE
//--------------------------------------------------------------------+
#include "common/tusb_common.h"
-#include "common/tusb_timeout.h"
#include "hid_device.h"
#include "device/usbd_pvt.h"
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index ddfceabdb..44f31ffe0 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -61,15 +61,13 @@ //------------- TUSB Option Header -------------//
#include "tusb_option.h"
-//------------- General Header -------------//
+//------------- Common Header -------------//
#include "tusb_compiler.h"
#include "tusb_verify.h"
#include "binary.h"
#include "tusb_error.h"
-#include "tusb_hal.h"
#include "tusb_fifo.h"
-
-//------------- TUSB Header -------------//
+#include "tusb_timeout.h"
#include "tusb_types.h"
//--------------------------------------------------------------------+
diff --git a/src/common/tusb_timeout.h b/src/common/tusb_timeout.h index 7c51ff36f..9d80f5fe7 100644 --- a/src/common/tusb_timeout.h +++ b/src/common/tusb_timeout.h @@ -45,7 +45,6 @@ #define _TUSB_TIMEOUT_H_
#include "tusb_compiler.h"
-#include "tusb_hal.h"
#ifdef __cplusplus
extern "C" {
@@ -56,6 +55,8 @@ typedef struct { uint32_t interval;
}tu_timeout_t;
+extern uint32_t tusb_hal_millis(void);
+
static inline void tu_timeout_set(tu_timeout_t* tt, uint32_t msec)
{
tt->interval = msec;
@@ -67,6 +68,18 @@ static inline bool tu_timeout_expired(tu_timeout_t* tt) return ( tusb_hal_millis() - tt->start ) >= tt->interval;
}
+// For used with periodic event to prevent drift
+static inline void tu_timeout_reset(tu_timeout_t* tt)
+{
+ tt->start += tt->interval;
+}
+
+static inline void tu_timeout_restart(tu_timeout_t* tt)
+{
+ tt->start = tusb_hal_millis();
+}
+
+
static inline void tu_timeout_wait(uint32_t msec)
{
tu_timeout_t tt;
diff --git a/src/host/ehci/ehci.c b/src/host/ehci/ehci.c index ba23319ca..09f2f573a 100644 --- a/src/host/ehci/ehci.c +++ b/src/host/ehci/ehci.c @@ -44,7 +44,6 @@ //--------------------------------------------------------------------+
#include "hal/hal.h"
#include "osal/osal.h"
-#include "common/tusb_timeout.h"
#include "../hcd.h"
#include "../usbh_hcd.h"
diff --git a/src/host/ohci/ohci.c b/src/host/ohci/ohci.c index 73e9d887e..644dbfa0f 100644 --- a/src/host/ohci/ohci.c +++ b/src/host/ohci/ohci.c @@ -44,7 +44,6 @@ //--------------------------------------------------------------------+
#include "hal/hal.h"
#include "osal/osal.h"
-#include "common/tusb_timeout.h"
#include "../hcd.h"
#include "../usbh_hcd.h"
diff --git a/src/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c b/src/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c index 0bb79090e..68eef47e1 100644 --- a/src/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c +++ b/src/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c @@ -51,7 +51,6 @@ #include "common/tusb_common.h"
#include "hal/hal.h"
#include "osal/osal.h"
-#include "common/tusb_timeout.h"
#include "device/dcd.h"
#include "usbd_dcd.h"
diff --git a/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c b/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c index 6c076baa8..0b48ad1e6 100644 --- a/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c +++ b/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c @@ -46,7 +46,6 @@ #include "common/tusb_common.h"
#include "tusb_hal.h"
#include "osal/osal.h"
-#include "common/tusb_timeout.h"
#include "device/dcd.h"
#include "dcd_lpc43xx.h"
|
