diff options
| author | hathach <[email protected]> | 2018-03-30 15:33:36 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-30 15:33:36 +0700 |
| commit | 82da013dadf2b2f69f362702ca40708fdec52df4 (patch) | |
| tree | bfa9a73206ace7aca38dbf008a8277a6ea2d20bc | |
| parent | 97db3c7c3d7cfbbb19dbda09809aa39bb19608b9 (diff) | |
get freertos build
| -rw-r--r-- | examples/obsolete/device/device_freertos/.cproject | 12 | ||||
| -rw-r--r-- | hw/bsp/board.h | 2 | ||||
| -rw-r--r-- | hw/bsp/ea4357/board_ea4357.c | 2 | ||||
| -rw-r--r-- | hw/bsp/pca10056/board_pca10056.c | 2 | ||||
| -rw-r--r-- | tinyusb/common/timeout_timer.h | 5 | ||||
| -rw-r--r-- | tinyusb/common/tusb_verify.h | 8 | ||||
| -rw-r--r-- | tinyusb/osal/osal.c | 54 | ||||
| -rw-r--r-- | tinyusb/osal/osal_freeRTOS.h | 51 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 17 | ||||
| -rw-r--r-- | tinyusb/tusb_hal.h | 1 | ||||
| -rw-r--r-- | vendor/freertos/FreeRTOSConfig.h | 24 | ||||
| -rw-r--r-- | vendor/freertos/freertos_hook.c | 6 |
12 files changed, 118 insertions, 66 deletions
diff --git a/examples/obsolete/device/device_freertos/.cproject b/examples/obsolete/device/device_freertos/.cproject index 2183c323a..e3c134ea3 100644 --- a/examples/obsolete/device/device_freertos/.cproject +++ b/examples/obsolete/device/device_freertos/.cproject @@ -89,7 +89,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|boards/embedded_artists/oem_base_board|mcu/lpc175x_6x|mcu/lpc11uxx|mcu/lpc43xx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="hw/mcu/nordic|hw/bsp/pca10056|hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|boards/embedded_artists/oem_base_board|mcu/lpc175x_6x|mcu/lpc11uxx|mcu/lpc43xx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -186,7 +186,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|boards/embedded_artists/oem_base_board|mcu/lpc175x_6x|mcu/lpc43xx|mcu/lpc13uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="hw/mcu/nordic|hw/bsp/pca10056|hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|boards/embedded_artists/oem_base_board|mcu/lpc175x_6x|mcu/lpc43xx|mcu/lpc13uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -291,7 +291,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_can.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc175x_6x|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rgu.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_timer.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc11uxx|mcu/lpc13uxx|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdmmc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_pwr.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdif.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_can.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="hw/mcu/nordic|hw/bsp/pca10056|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_can.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc175x_6x|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rgu.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_timer.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc11uxx|mcu/lpc13uxx|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdmmc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_pwr.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdif.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_can.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -387,7 +387,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_pwm.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_libcfg_default.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_timer.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_i2s.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_exti.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_iap.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_rit.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_spi.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_i2c.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_gpdma.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_qei.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_ssp.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_emac.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_mcpwm.c|boards/embedded_artists/oem_base_board|mcu/lpc11uxx|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_rtc.c|mcu/lpc13uxx|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_wdt.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_adc.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/debug_frmwrk.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_dac.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_can.c|mcu/lpc43xx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="hw/mcu/nordic|hw/bsp/pca10056|hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_pwm.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_libcfg_default.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_timer.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_i2s.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_exti.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_iap.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_rit.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_spi.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_i2c.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_gpdma.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_qei.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_ssp.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_emac.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_mcpwm.c|boards/embedded_artists/oem_base_board|mcu/lpc11uxx|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_rtc.c|mcu/lpc13uxx|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_wdt.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_adc.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/debug_frmwrk.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_dac.c|mcu/lpc175x_6x/LPC17xx_DriverLib/source/lpc17xx_can.c|mcu/lpc43xx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -487,7 +487,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_can.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc175x_6x|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rgu.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_timer.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc11uxx|mcu/lpc13uxx|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdmmc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_pwr.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdif.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_can.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="hw/mcu/nordic|hw/bsp/pca10056|hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM0|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_can.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc175x_6x|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rgu.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_lcd.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_ssp.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_i2s.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_evrt.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_timer.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_qei.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_adc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/sdio.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_atimer.c|mcu/lpc11uxx|mcu/lpc13uxx|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdmmc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/LCDTerm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/debug_frmwrk.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sct.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_pwr.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_dac.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rit.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_rtc.c|mcu/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/Font5x7.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_sdif.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c|mcu/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_can.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -583,7 +583,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|boards/embedded_artists/oem_base_board|mcu/lpc175x_6x|mcu/lpc43xx|mcu/lpc13uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="hw/mcu/nordic|hw/bsp/pca10056|hw/mcu/nxp/lpc43xx|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/bsp/ea4357|freertos/freertos/Source/portable/GCC/ARM_CM3|freertos/freertos/Source/portable/GCC/ARM_CM4F|freertos/freertos/Source/portable/GCC/ARM7_LPC23xx|freertos/freertos/Source/portable/GCC/ARM7_LPC2000|freertos/freertos/Source/portable/GCC/ARM7_AT91SAM7S|freertos/freertos/Source/portable/GCC/ARM7_AT91FR40008|freertos/freertos/Source/portable/GCC/ARM_CM3_MPU|freertos/freertos/Source/portable/RVDS|freertos/freertos/Source/portable/IAR|boards/embedded_artists/ea4357|boards/embedded_artists/oem_base_board|mcu/lpc175x_6x|mcu/lpc43xx|mcu/lpc13uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> diff --git a/hw/bsp/board.h b/hw/bsp/board.h index 2c566bb11..827f22d7e 100644 --- a/hw/bsp/board.h +++ b/hw/bsp/board.h @@ -123,6 +123,8 @@ #define BOARD_TICKS_HZ 1000 +#define board_tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / BOARD_TICKS_HZ ) + //--------------------------------------------------------------------+ // Board Common API //--------------------------------------------------------------------+ diff --git a/hw/bsp/ea4357/board_ea4357.c b/hw/bsp/ea4357/board_ea4357.c index 963e7629c..549eb70f7 100644 --- a/hw/bsp/ea4357/board_ea4357.c +++ b/hw/bsp/ea4357/board_ea4357.c @@ -79,7 +79,7 @@ void SysTick_Handler (void) uint32_t tusb_hal_millis(void) { - return (system_ticks*1000) / BOARD_TICKS_HZ; + return board_tick2ms(system_ticks); } #endif diff --git a/hw/bsp/pca10056/board_pca10056.c b/hw/bsp/pca10056/board_pca10056.c index 98071429b..e1668ebb5 100644 --- a/hw/bsp/pca10056/board_pca10056.c +++ b/hw/bsp/pca10056/board_pca10056.c @@ -63,7 +63,7 @@ uint32_t tusb_hal_millis(void) //#define tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / configTICK_RATE_HZ ) //return tick2ms( app_timer_cnt_get() ); - return (system_ticks*1000) / BOARD_TICKS_HZ; + return board_tick2ms(system_ticks); } /*------------------------------------------------------------------*/ diff --git a/tinyusb/common/timeout_timer.h b/tinyusb/common/timeout_timer.h index f504cc91f..aafc8cce2 100644 --- a/tinyusb/common/timeout_timer.h +++ b/tinyusb/common/timeout_timer.h @@ -45,6 +45,7 @@ #define _TUSB_TIMEOUT_TTIMER_H_
#include "tusb_compiler.h"
+#include "tusb_hal.h"
#ifdef __cplusplus
extern "C" {
@@ -58,12 +59,12 @@ typedef struct { static inline void timeout_set(timeout_timer_t* tt, uint32_t msec)
{
tt->interval = msec;
- tt->start = osal_millis();
+ tt->start = tusb_hal_millis();
}
static inline bool timeout_expired(timeout_timer_t* tt)
{
- return ( osal_millis() - tt->start ) >= tt->interval;
+ return ( tusb_hal_millis() - tt->start ) >= tt->interval;
}
#ifdef __cplusplus
diff --git a/tinyusb/common/tusb_verify.h b/tinyusb/common/tusb_verify.h index 856ae7958..516a30a75 100644 --- a/tinyusb/common/tusb_verify.h +++ b/tinyusb/common/tusb_verify.h @@ -71,13 +71,13 @@ // Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7 #if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) -// Cortex M CoreDebug->DHCSR -#define ARM_CM_DHCSR (*((volatile uint32_t*) 0xE000EDF0UL)) - static inline void verify_breakpoint(void) { + // Cortex M CoreDebug->DHCSR + volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); + // Only halt mcu if debugger is attached - if ( ARM_CM_DHCSR & 1UL ) __asm("BKPT #0\n"); + if ( (*ARM_CM_DHCSR) & 1UL ) __asm("BKPT #0\n"); } #else diff --git a/tinyusb/osal/osal.c b/tinyusb/osal/osal.c new file mode 100644 index 000000000..68bafa3ea --- /dev/null +++ b/tinyusb/osal/osal.c @@ -0,0 +1,54 @@ +/**************************************************************************/ +/*! + @file osal.c + @author hathach + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2018, hathach (tinyusb.org) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This file is part of the tinyusb stack. +*/ +/**************************************************************************/ + +#include "tusb_option.h" +#include "osal.h" + + +//--------------------------------------------------------------------+ +// TICK API +//--------------------------------------------------------------------+ +#if TUSB_CFG_OS == TUSB_OS_FREERTOS + +uint32_t tusb_hal_millis(void) +{ + return ( ( ((uint64_t) xTaskGetTickCount()) * 1000) / configTICK_RATE_HZ ); +} + +#endif + diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h index f2fe668ae..b0a99ad38 100644 --- a/tinyusb/osal/osal_freeRTOS.h +++ b/tinyusb/osal/osal_freeRTOS.h @@ -56,10 +56,15 @@ extern "C" { #endif -//--------------------------------------------------------------------+ -// TICK API -//--------------------------------------------------------------------+ -#define osal_millis xTaskGetTickCount +#if 0 +// Helper to determine if we are in ISR to use ISR API (only cover ARM Cortex) +// Note: Actually we don't need this since any event signal (queue send, semaphore post) +// is done in ISR, other event receive (queue receive, semaphore wait ) in in thread +static inline bool in_isr(void) +{ + return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk); +} +#endif //--------------------------------------------------------------------+ // TASK API @@ -92,20 +97,12 @@ static inline osal_queue_t osal_queue_create(uint32_t depth, uint32_t item_size) static inline void osal_queue_receive (osal_queue_t const queue_hdl, void *p_data, uint32_t msec, tusb_error_t *p_error) { uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : pdMS_TO_TICKS(msec); - - portBASE_TYPE result = (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) ? xQueueReceiveFromISR(queue_hdl, p_data, NULL) : xQueueReceive(queue_hdl, p_data, ticks); - (*p_error) = ( result == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT; + (*p_error) = ( xQueueReceive(queue_hdl, p_data, ticks) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT); } static inline bool osal_queue_send(osal_queue_t const queue_hdl, void const * data) { - if (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) - { - return xQueueSendToFrontFromISR(queue_hdl, data, NULL); - }else - { - return xQueueSendToFront(queue_hdl, data, 0); - } + return xQueueSendToFrontFromISR(queue_hdl, data, NULL); } static inline void osal_queue_flush(osal_queue_t const queue_hdl) @@ -126,30 +123,13 @@ static inline osal_semaphore_t osal_semaphore_create(uint32_t max, uint32_t init // TODO add timeout (with instant return from ISR option) for semaphore post & queue send static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl) { - if (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) - { - return xSemaphoreGiveFromISR(sem_hdl, NULL); - }else - { - return xSemaphoreGive(sem_hdl); - } + return xSemaphoreGiveFromISR(sem_hdl, NULL); } static inline void osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec, tusb_error_t *p_error) { uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : pdMS_TO_TICKS(msec); - - BaseType_t result; - - if (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) - { - result = xSemaphoreTakeFromISR(sem_hdl, NULL); - }else - { - result = xSemaphoreTake(sem_hdl, ticks); - } - - (*p_error) = result ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT; + (*p_error) = (xSemaphoreTake(sem_hdl, ticks) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT); } static inline void osal_semaphore_reset(osal_semaphore_t const sem_hdl) @@ -167,12 +147,13 @@ typedef xSemaphoreHandle osal_mutex_t; static inline bool osal_mutex_release(osal_mutex_t mutex_hdl) { - return osal_semaphore_post(mutex_hdl); + return xSemaphoreGive(mutex_hdl); } static inline void osal_mutex_wait(osal_mutex_t mutex_hdl, uint32_t msec, tusb_error_t *p_error) { - osal_semaphore_wait(mutex_hdl, msec, p_error); + uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : pdMS_TO_TICKS(msec); + (*p_error) = (xSemaphoreTake(mutex_hdl, ticks) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT); } // TOOD remove diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index 0b73de4e9..5325fd29e 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -51,11 +51,6 @@ #endif
//--------------------------------------------------------------------+
-// TICK API
-//--------------------------------------------------------------------+
-#define osal_millis tusb_hal_millis
-
-//--------------------------------------------------------------------+
// TASK API
// NOTES: Each blocking OSAL_NONE services such as semaphore wait,
// queue receive embedded return statement, therefore local variable
@@ -97,9 +92,9 @@ static inline osal_task_t osal_task_create(osal_func_t code, const char* name, u #define osal_task_delay(msec) \
do {\
- _timeout = osal_millis();\
+ _timeout = tusb_hal_millis();\
_state = __LINE__; case __LINE__:\
- if ( _timeout + msec > osal_millis() ) \
+ if ( _timeout + msec > tusb_hal_millis() ) \
return TUSB_ERROR_OSAL_WAITING;\
}while(0)
@@ -164,10 +159,10 @@ static inline void osal_queue_flush(osal_queue_t const queue_hdl) #define osal_queue_receive(queue_hdl, p_data, msec, p_error) \
do {\
- _timeout = osal_millis();\
+ _timeout = tusb_hal_millis();\
_state = __LINE__; case __LINE__:\
if( queue_hdl->count == 0 ) {\
- if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && ( _timeout + msec <= osal_millis()) ) /* time out */ \
+ if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && ( _timeout + msec <= tusb_hal_millis()) ) /* time out */ \
*(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\
else\
return TUSB_ERROR_OSAL_WAITING;\
@@ -218,10 +213,10 @@ static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl) #define osal_semaphore_wait(sem_hdl, msec, p_error) \
do {\
- _timeout = osal_millis();\
+ _timeout = tusb_hal_millis();\
_state = __LINE__; case __LINE__:\
if( sem_hdl->count == 0 ) {\
- if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && (_timeout + msec <= osal_millis()) ) /* time out */ \
+ if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && (_timeout + msec <= tusb_hal_millis()) ) /* time out */ \
*(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\
else\
return TUSB_ERROR_OSAL_WAITING;\
diff --git a/tinyusb/tusb_hal.h b/tinyusb/tusb_hal.h index 0025bf844..f09ba0f7d 100644 --- a/tinyusb/tusb_hal.h +++ b/tinyusb/tusb_hal.h @@ -75,6 +75,7 @@ void tusb_hal_int_enable(uint8_t rhport); */
void tusb_hal_int_disable(uint8_t rhport);
+// Only required to implement if using No RTOS (osal_none)
uint32_t tusb_hal_millis(void);
#ifdef __cplusplus
diff --git a/vendor/freertos/FreeRTOSConfig.h b/vendor/freertos/FreeRTOSConfig.h index 09b78988a..fa1707f99 100644 --- a/vendor/freertos/FreeRTOSConfig.h +++ b/vendor/freertos/FreeRTOSConfig.h @@ -1,12 +1,12 @@ #ifndef __FREERTOS_CONFIG__H #define __FREERTOS_CONFIG__H -#include "common/assertion.h" - //--------------------------------------------------------------------+ // See http://www.freertos.org/a00110.html. //--------------------------------------------------------------------+ #if TUSB_CFG_MCU == MCU_LPC43XX + // TODO remove + #include "lpc43xx_cgu.h" #define configCPU_CLOCK_HZ CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) #else #define configCPU_CLOCK_HZ SystemCoreClock @@ -72,7 +72,25 @@ #define INCLUDE_xTimerPendFunctionCall 0 /* Define to trap errors during development. */ -#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); hal_debugger_breakpoint(); } + +// Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7 +#if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) + +static inline void configASSERT_breakpoint(void) +{ + // Cortex M CoreDebug->DHCSR + volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); + + // Only halt mcu if debugger is attached + if ( (*ARM_CM_DHCSR) & 1UL ) __asm("BKPT #0\n"); +} + +#else +#define configASSERT_breakpoint() +#endif + + +#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); configASSERT_breakpoint(); } /* FreeRTOS hooks to NVIC vectors */ #define xPortPendSVHandler PendSV_Handler diff --git a/vendor/freertos/freertos_hook.c b/vendor/freertos/freertos_hook.c index 0800ca0df..6672f72bf 100644 --- a/vendor/freertos/freertos_hook.c +++ b/vendor/freertos/freertos_hook.c @@ -41,7 +41,7 @@ //--------------------------------------------------------------------+ #include "FreeRTOS.h" #include "task.h" -#include "common/common.h" +#include "common/tusb_common.h" //#include "board.h" //--------------------------------------------------------------------+ @@ -58,7 +58,7 @@ void vApplicationMallocFailedHook(void) { taskDISABLE_INTERRUPTS(); - ASSERT_FAILED_MSG(VOID_RETURN, "freeRTOS run out of heap memory"); + TU_ASSERT(false, ); } void vApplicationIdleHook(void) @@ -72,7 +72,7 @@ void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) (void) pxTask; taskDISABLE_INTERRUPTS(); - ASSERT_FAILED_MSG(VOID_RETURN, pcTaskName); + TU_ASSERT(false, ); } // executes from within an ISR |
