From 4e9f077fb10255dced1da4d5d2ad9f8ae41442a2 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Tue, 1 May 2018 00:26:06 -0700 Subject: [PATCH 1/3] Enable Kinesis on newer ChibiOS --- .../ARMCMx/compilers/GCC/mk/startup_k20x.mk | 1 + .../ARMCMx/compilers/GCC/mk/startup_kl2x.mk | 1 + .../ARMCMx/compilers/GCC/mk/startup_nrf51.mk | 3 ++- .../compilers/GCC/mk/startup_tm4c123x.mk | 3 ++- .../compilers/GCC/mk/startup_tm4c129x.mk | 3 ++- os/hal/ports/KINETIS/LLD/hal_pal_lld.h | 5 ++++ os/hal/ports/KINETIS/LLD/hal_usb_lld.h | 23 +++++++++++++++++++ 7 files changed, 36 insertions(+), 3 deletions(-) diff --git a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x.mk b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x.mk index 0c2ec7d8..f474d195 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x.mk +++ b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x.mk @@ -7,6 +7,7 @@ STARTUPASM = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S STARTUPINC = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC \ $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/devices/K20x \ $(CHIBIOS)/os/common/ext/CMSIS/include \ + $(CHIBIOS)/os/common/ext/ARM/CMSIS/Core/Include \ $(CHIBIOS_CONTRIB)/os/common/ext/CMSIS/KINETIS STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld diff --git a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk index ca67f101..0c9d329f 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk +++ b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk @@ -7,6 +7,7 @@ STARTUPASM = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S STARTUPINC = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC \ $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/devices/KL2x \ $(CHIBIOS)/os/common/ext/CMSIS/include \ + $(CHIBIOS)/os/common/ext/ARM/CMSIS/Core/Include \ $(CHIBIOS_CONTRIB)/os/common/ext/CMSIS/KINETIS STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld diff --git a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk index f005ce00..8ec318f4 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk +++ b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk @@ -5,6 +5,7 @@ STARTUPSRC = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt1.c \ STARTUPASM = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S STARTUPINC = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/devices/NRF51822 \ - $(CHIBIOS)/os/common/ext/CMSIS/include + $(CHIBIOS)/os/common/ext/CMSIS/include \ + $(CHIBIOS)/os/common/ext/ARM/CMSIS/Core/Include STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld diff --git a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c123x.mk b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c123x.mk index e9c97e5f..8457328e 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c123x.mk +++ b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c123x.mk @@ -6,6 +6,7 @@ STARTUPASM = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S STARTUPINC = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC \ $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/devices/TM4C123x \ - $(CHIBIOS)/os/common/ext/CMSIS/include + $(CHIBIOS)/os/common/ext/CMSIS/include \ + $(CHIBIOS)/os/common/ext/ARM/CMSIS/Core/Include STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld diff --git a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk index e151434e..e4885378 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk +++ b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk @@ -6,6 +6,7 @@ STARTUPASM = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S STARTUPINC = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC \ $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/devices/TM4C129x \ - $(CHIBIOS)/os/common/ext/CMSIS/include + $(CHIBIOS)/os/common/ext/CMSIS/include \ + $(CHIBIOS)/os/common/ext/ARM/CMSIS/Core/Include STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld diff --git a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h index 833d95e6..6129f690 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 593ef165..615d10df 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. * From 457afa6202fe9f8e6accb65411629172bb32c41b Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Wed, 2 May 2018 03:36:12 -0700 Subject: [PATCH 2/3] Remove duplication --- os/hal/ports/KINETIS/LLD/hal_usb_lld.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/os/hal/ports/KINETIS/LLD/hal_usb_lld.h b/os/hal/ports/KINETIS/LLD/hal_usb_lld.h index ed65b3b4..bd4eb393 100644 --- a/os/hal/ports/KINETIS/LLD/hal_usb_lld.h +++ b/os/hal/ports/KINETIS/LLD/hal_usb_lld.h @@ -355,25 +355,6 @@ 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. * From 1fefdf78fef847c27d3768cc78de0ee901889465 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Wed, 2 May 2018 03:47:26 -0700 Subject: [PATCH 3/3] Remove duplicate code already in upstream master and add include dir --- os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf52.mk | 3 ++- os/hal/ports/KINETIS/LLD/hal_pal_lld.h | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf52.mk b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf52.mk index 693ae67d..450ec41c 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf52.mk +++ b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf52.mk @@ -5,6 +5,7 @@ STARTUPSRC = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt1.c \ STARTUPASM = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S STARTUPINC = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/devices/NRF52832 \ - $(CHIBIOS)/os/common/ext/CMSIS/include + $(CHIBIOS)/os/common/ext/CMSIS/include \ + $(CHIBIOS)/os/common/ext/ARM/CMSIS/Core/Include STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld diff --git a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h index 6129f690..833d95e6 100644 --- a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h +++ b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h @@ -82,11 +82,6 @@ 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