From 4e9f077fb10255dced1da4d5d2ad9f8ae41442a2 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Tue, 1 May 2018 00:26:06 -0700 Subject: Enable Kinesis on newer ChibiOS --- os/hal/ports/KINETIS/LLD/hal_pal_lld.h | 5 +++++ os/hal/ports/KINETIS/LLD/hal_usb_lld.h | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'os/hal/ports/KINETIS') diff --git a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h index 833d95e..6129f69 100644 --- a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h +++ b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h @@ -82,6 +82,11 @@ typedef uint32_t ioline_t; */ typedef GPIO_TypeDef *ioportid_t; +/** + * @brief Type of an pad identifier. + */ +typedef uint32_t iopadid_t; + /** * @brief Port Configuration. * @details This structure stores the configuration parameters of all pads diff --git a/os/hal/ports/KINETIS/LLD/hal_usb_lld.h b/os/hal/ports/KINETIS/LLD/hal_usb_lld.h index 593ef16..615d10d 100644 --- a/os/hal/ports/KINETIS/LLD/hal_usb_lld.h +++ b/os/hal/ports/KINETIS/LLD/hal_usb_lld.h @@ -326,6 +326,10 @@ struct USBDriver { * @brief Current USB device configuration. */ uint8_t configuration; + /** + * @brief State of the driver when a suspend happened. + */ + usbstate_t saved_state; #if defined(USB_DRIVER_EXT_FIELDS) USB_DRIVER_EXT_FIELDS #endif @@ -340,6 +344,25 @@ struct USBDriver { /* Driver macros. */ /*===========================================================================*/ +/** + * @brief Host wake-up procedure duration. + */ +#if !defined(USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__) +#define USB_HOST_WAKEUP_DURATION 2 +#endif + +/** + * @brief Start of host wake-up procedure. + * + * @notapi + */ +#define usb_lld_wakeup_host(usbp) \ + do{ \ + USB0->CTL |= USBx_CTL_RESUME; \ + osalThreadSleepMilliseconds(USB_HOST_WAKEUP_DURATION); \ + USB0->CTL &= ~USBx_CTL_RESUME; \ + } while (false) + /** * @brief Returns the current frame number. * -- cgit v1.2.3