diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-15 19:47:06 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-15 19:47:06 +0000 |
commit | 3831c92f094ef1e0f59d0bc8c11a7119f8835a7a (patch) | |
tree | d17d74b865c60640b39079776a24c11e010b4149 /nuttx | |
parent | cfed92be8b2d93060baa14d7527dfd4e20e02962 (diff) | |
download | px4-nuttx-3831c92f094ef1e0f59d0bc8c11a7119f8835a7a.tar.gz px4-nuttx-3831c92f094ef1e0f59d0bc8c11a7119f8835a7a.tar.bz2 px4-nuttx-3831c92f094ef1e0f59d0bc8c11a7119f8835a7a.zip |
Need to control watchdog timer on AT90USB
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3706 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/avr/src/at90usb/at90usb_lowinit.c | 44 | ||||
-rw-r--r-- | nuttx/configs/micropendous3/README.txt | 14 |
2 files changed, 58 insertions, 0 deletions
diff --git a/nuttx/arch/avr/src/at90usb/at90usb_lowinit.c b/nuttx/arch/avr/src/at90usb/at90usb_lowinit.c index f7e7cfb69..5f8b2e432 100644 --- a/nuttx/arch/avr/src/at90usb/at90usb_lowinit.c +++ b/nuttx/arch/avr/src/at90usb/at90usb_lowinit.c @@ -38,6 +38,7 @@ **************************************************************************/ #include <nuttx/config.h> +#include <avr/wdt.h> #include "at90usb_config.h" #include "up_internal.h" @@ -47,6 +48,28 @@ * Private Definitions **************************************************************************/ +#if defined(CONFIG_WDTO_15MS) +# define WDTO_VALUE WDTO_15MS +#elif defined(CONFIG_WDTO_30MS) +# define WDTO_VALUE WDTO_30MS +#elif defined(CONFIG_WDTO_60MS) +# define WDTO_VALUE WDTO_60MS +#elif defined(CONFIG_WDTO_120MS) +# define WDTO_VALUE WDTO_120MS +#elif defined(CONFIG_WDTO_1250MS) +# define WDTO_VALUE WDTO_250MS +#elif defined(CONFIG_WDTO_500MS) +# define WDTO_VALUE WDTO_500MS +#elif defined(CONFIG_WDTO_1S) +# define WDTO_VALUE WDTO_1S +#elif defined(CONFIG_WDTO_2S) +# define WDTO_VALUE WDTO_2S +#elif defined(CONFIG_WDTO_4S) +# define WDTO_VALUE WDTO_4S +#else /* if defined(CONFIG_WDTO_8S) */ +# define WDTO_VALUE WDTO_8S +#endif + /************************************************************************** * Private Types **************************************************************************/ @@ -68,6 +91,23 @@ **************************************************************************/ /************************************************************************** + * Name: up_wdtinit + * + * Description: + * Initialize the watchdog per the NuttX configuration. + * + **************************************************************************/ + +static inline void up_wdtinit(void) +{ +#ifndef CONFIG_AVR_WDT + wdt_disable(); +#else + wdt_enable(WDTO_VALUE); +#endif +} + +/************************************************************************** * Public Functions **************************************************************************/ @@ -83,6 +123,10 @@ void up_lowinit(void) { + /* Initialize the watchdog timer */ + + up_wdtinit(); + /* Initialize a console (probably a serial console) */ up_consoleinit(); diff --git a/nuttx/configs/micropendous3/README.txt b/nuttx/configs/micropendous3/README.txt index 9c1d76f8d..beb335282 100644 --- a/nuttx/configs/micropendous3/README.txt +++ b/nuttx/configs/micropendous3/README.txt @@ -473,6 +473,20 @@ Micropendous3 Configuration Options CONFIG_AVR_ANACOMP=n CONFIG_AVR_ADC=n CONFIG_AVR_TWI=n + + If the watchdog is enabled, this specifies the initial timeout. Default + is maximum supported value. + + CONFIG_WDTO_15MS + CONFIG_WDTO_30MS + CONFIG_WDTO_60MS + CONFIG_WDTO_120MS + CONFIG_WDTO_1250MS + CONFIG_WDTO_500MS + CONFIG_WDTO_1S + CONFIG_WDTO_2S + CONFIG_WDTO_4S + CONFIG_WDTO_8S AT90USB specific device driver settings |