From 99c3815a527585127b850f555078de4792ca7caf Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Mon, 4 Apr 2016 23:37:20 -0300 Subject: Fix testhal demos (except for RNG) --- testhal/NRF51/NRF51822/ADC/Makefile | 6 +- testhal/NRF51/NRF51822/ADC/chconf.h | 25 +++++ testhal/NRF51/NRF51822/ADC/halconf.h | 7 ++ testhal/NRF51/NRF51822/EXT/Makefile | 6 +- testhal/NRF51/NRF51822/EXT/chconf.h | 25 +++++ testhal/NRF51/NRF51822/GPT/Makefile | 6 +- testhal/NRF51/NRF51822/GPT/chconf.h | 25 +++++ testhal/NRF51/NRF51822/GPT/halconf.h | 7 ++ testhal/NRF51/NRF51822/I2C/Makefile | 6 +- testhal/NRF51/NRF51822/I2C/chconf.h | 25 +++++ testhal/NRF51/NRF51822/SPI/Makefile | 6 +- testhal/NRF51/NRF51822/SPI/chconf.h | 25 +++++ testhal/NRF51/NRF51822/WDG/Makefile | 20 ++-- testhal/NRF51/NRF51822/WDG/chconf.h | 25 +++++ testhal/NRF51/NRF51822/WDG/halconf.h | 179 +++++++++++++++++++++++++++++++++-- testhal/NRF51/NRF51822/WDG/main.c | 23 ++--- testhal/NRF51/NRF51822/WDG/mcuconf.h | 1 + 17 files changed, 369 insertions(+), 48 deletions(-) (limited to 'testhal/NRF51/NRF51822') diff --git a/testhal/NRF51/NRF51822/ADC/Makefile b/testhal/NRF51/NRF51822/ADC/Makefile index ec06536..69d6e90 100644 --- a/testhal/NRF51/NRF51822/ADC/Makefile +++ b/testhal/NRF51/NRF51822/ADC/Makefile @@ -84,7 +84,7 @@ PROJECT = ch CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib # Startup files. -include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk +include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk @@ -92,7 +92,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -207,5 +207,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/testhal/NRF51/NRF51822/ADC/chconf.h b/testhal/NRF51/NRF51822/ADC/chconf.h index 5b0630c..71b3bb4 100644 --- a/testhal/NRF51/NRF51822/ADC/chconf.h +++ b/testhal/NRF51/NRF51822/ADC/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -444,6 +446,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -488,6 +504,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/ADC/halconf.h b/testhal/NRF51/NRF51822/ADC/halconf.h index c7ab1cd..dc055de 100644 --- a/testhal/NRF51/NRF51822/ADC/halconf.h +++ b/testhal/NRF51/NRF51822/ADC/halconf.h @@ -163,6 +163,13 @@ #define HAL_USE_USB FALSE #endif +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + /*===========================================================================*/ /* ADC driver related settings. */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/EXT/Makefile b/testhal/NRF51/NRF51822/EXT/Makefile index 9770772..564444d 100644 --- a/testhal/NRF51/NRF51822/EXT/Makefile +++ b/testhal/NRF51/NRF51822/EXT/Makefile @@ -83,7 +83,7 @@ PROJECT = ch CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib # Startup files. -include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk +include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk @@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -207,5 +207,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/testhal/NRF51/NRF51822/EXT/chconf.h b/testhal/NRF51/NRF51822/EXT/chconf.h index c049f5c..50218e4 100644 --- a/testhal/NRF51/NRF51822/EXT/chconf.h +++ b/testhal/NRF51/NRF51822/EXT/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -444,6 +446,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -488,6 +504,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/GPT/Makefile b/testhal/NRF51/NRF51822/GPT/Makefile index ec06536..69d6e90 100644 --- a/testhal/NRF51/NRF51822/GPT/Makefile +++ b/testhal/NRF51/NRF51822/GPT/Makefile @@ -84,7 +84,7 @@ PROJECT = ch CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib # Startup files. -include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk +include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk @@ -92,7 +92,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -207,5 +207,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/testhal/NRF51/NRF51822/GPT/chconf.h b/testhal/NRF51/NRF51822/GPT/chconf.h index 5b0630c..71b3bb4 100644 --- a/testhal/NRF51/NRF51822/GPT/chconf.h +++ b/testhal/NRF51/NRF51822/GPT/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -444,6 +446,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -488,6 +504,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/GPT/halconf.h b/testhal/NRF51/NRF51822/GPT/halconf.h index bf63566..6ea7ca6 100644 --- a/testhal/NRF51/NRF51822/GPT/halconf.h +++ b/testhal/NRF51/NRF51822/GPT/halconf.h @@ -163,6 +163,13 @@ #define HAL_USE_USB FALSE #endif +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + /*===========================================================================*/ /* ADC driver related settings. */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/I2C/Makefile b/testhal/NRF51/NRF51822/I2C/Makefile index 7615230..29a66d7 100644 --- a/testhal/NRF51/NRF51822/I2C/Makefile +++ b/testhal/NRF51/NRF51822/I2C/Makefile @@ -83,7 +83,7 @@ PROJECT = ch CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib # Startup files. -include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk +include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk @@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -207,5 +207,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/testhal/NRF51/NRF51822/I2C/chconf.h b/testhal/NRF51/NRF51822/I2C/chconf.h index 9466257..3d441c6 100644 --- a/testhal/NRF51/NRF51822/I2C/chconf.h +++ b/testhal/NRF51/NRF51822/I2C/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -444,6 +446,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -488,6 +504,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/SPI/Makefile b/testhal/NRF51/NRF51822/SPI/Makefile index e918159..92070b1 100644 --- a/testhal/NRF51/NRF51822/SPI/Makefile +++ b/testhal/NRF51/NRF51822/SPI/Makefile @@ -83,7 +83,7 @@ PROJECT = ch CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib # Startup files. -include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk +include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk @@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -207,5 +207,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/testhal/NRF51/NRF51822/SPI/chconf.h b/testhal/NRF51/NRF51822/SPI/chconf.h index 36ba803..f777f9d 100644 --- a/testhal/NRF51/NRF51822/SPI/chconf.h +++ b/testhal/NRF51/NRF51822/SPI/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -444,6 +446,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -488,6 +504,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/WDG/Makefile b/testhal/NRF51/NRF51822/WDG/Makefile index a2df0bf..c316b35 100644 --- a/testhal/NRF51/NRF51822/WDG/Makefile +++ b/testhal/NRF51/NRF51822/WDG/Makefile @@ -81,13 +81,10 @@ endif PROJECT = ch # Imported source files and paths -#CHIBIOS = ../../../../../ChibiOS-RT -#CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib -CHIBIOS = /home/sdalu/ChibiOS/ChibiOS -CHIBIOS_CONTRIB = /home/sdalu/ChibiOS/Y/ChibiOS-Contrib - +CHIBIOS = ../../../../../ChibiOS-RT +CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib # Startup files. -include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk +include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk @@ -95,8 +92,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/NRF51-DK/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk - +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/NRF51822.ld @@ -209,18 +205,16 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk - # Flash JLINK_DEVICE = nrf51422 JLINK_PRE_FLASH = w4 4001e504 1 JLINK_ERASE_ALL = w4 4001e504 2\nw4 4001e50c 1\nsleep 100 - -include /home/sdalu/ChibiOS/W/ChibiOS-Contrib/os/various/jlink.mk -include /home/sdalu/ChibiOS/W/ChibiOS-Contrib/os/various/gdb.mk +include $(CHIBIOS_CONTRIB)/os/various/jlink.mk +include $(CHIBIOS_CONTRIB)/os/various/gdb.mk flash: all jlink-flash debug: gdb-debug diff --git a/testhal/NRF51/NRF51822/WDG/chconf.h b/testhal/NRF51/NRF51822/WDG/chconf.h index 20d7b4b..4477bd5 100644 --- a/testhal/NRF51/NRF51822/WDG/chconf.h +++ b/testhal/NRF51/NRF51822/WDG/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -444,6 +446,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -488,6 +504,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/testhal/NRF51/NRF51822/WDG/halconf.h b/testhal/NRF51/NRF51822/WDG/halconf.h index 90cd842..a1c53f2 100644 --- a/testhal/NRF51/NRF51822/WDG/halconf.h +++ b/testhal/NRF51/NRF51822/WDG/halconf.h @@ -30,11 +30,6 @@ #include "mcuconf.h" -#define HAL_USE_PAL TRUE -#define HAL_USE_WDG TRUE -#define WDG_USE_TIMEOUT_CALLBACK TRUE - - /** * @brief Enables the PAL subsystem. */ @@ -137,7 +132,7 @@ * @brief Enables the SERIAL subsystem. */ #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL TRUE +#define HAL_USE_SERIAL FALSE #endif /** @@ -168,6 +163,178 @@ #define HAL_USE_USB FALSE #endif +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG TRUE +#endif + +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + */ +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif + +/*===========================================================================*/ +/* I2C driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the mutual exclusion APIs on the I2C bus. + */ +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. + */ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intervals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. + */ +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 +#endif + +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif + +/*===========================================================================*/ +/* SERIAL_USB driver related setting. */ +/*===========================================================================*/ + +/** + * @brief Serial over USB buffers size. + * @details Configuration parameter, the buffer size must be a multiple of + * the USB data endpoint maximum packet size. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_USB_BUFFERS_SIZE 256 +#endif + +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif #endif /* _HALCONF_H_ */ diff --git a/testhal/NRF51/NRF51822/WDG/main.c b/testhal/NRF51/NRF51822/WDG/main.c index 741d84f..cdbf89b 100644 --- a/testhal/NRF51/NRF51822/WDG/main.c +++ b/testhal/NRF51/NRF51822/WDG/main.c @@ -16,12 +16,10 @@ #include "ch.h" #include "hal.h" - - void timeout_callback(void) { - palTogglePad(IOPORT1, LED2); - palTogglePad(IOPORT1, LED3); - palTogglePad(IOPORT1, LED4); + palTogglePad(IOPORT1, LED2); + palTogglePad(IOPORT1, LED3); + palTogglePad(IOPORT1, LED4); } /* @@ -39,27 +37,24 @@ int main(void) { halInit(); chSysInit(); - palSetPad(IOPORT1, LED1); WDGConfig WDG_config = { - .flags.pause_on_sleep = 0, - .flags.pause_on_halt = 0, - .timeout_ms = 5000, - .callback = timeout_callback + .flags.pause_on_sleep = 0, + .flags.pause_on_halt = 0, + .timeout_ms = 5000, + .callback = timeout_callback }; wdgStart(&WDGD1, &WDG_config); - - /* * Normal main() thread activity, in this demo it does nothing. */ while (true) { if (palReadPad(IOPORT1, BTN1) == 0) { - palTogglePad(IOPORT1, LED1); - wdgReset(&WDGD1); + palTogglePad(IOPORT1, LED1); + wdgReset(&WDGD1); } chThdSleepMilliseconds(500); } diff --git a/testhal/NRF51/NRF51822/WDG/mcuconf.h b/testhal/NRF51/NRF51822/WDG/mcuconf.h index fb3c717..b891a13 100644 --- a/testhal/NRF51/NRF51822/WDG/mcuconf.h +++ b/testhal/NRF51/NRF51822/WDG/mcuconf.h @@ -17,5 +17,6 @@ #ifndef _MCUCONF_H_ #define _MCUCONF_H_ +#define WDG_USE_TIMEOUT_CALLBACK TRUE #endif /* _MCUCONF_H_ */ -- cgit v1.2.3