ATmegaxxxx - refine WDT config

This commit is contained in:
Phillip Stevens 2020-04-10 14:39:14 +10:00
parent d356bfc02f
commit 3ece178dd0
2 changed files with 41 additions and 30 deletions

View file

@ -97,6 +97,8 @@ static void prvSetupTimerInterrupt( void );
Updated to match avr-libc 2.0.0 Updated to match avr-libc 2.0.0
*/ */
#if defined( portUSE_WDTO)
static __inline__ static __inline__
__attribute__ ((__always_inline__)) __attribute__ ((__always_inline__))
void wdt_interrupt_enable (const uint8_t value) void wdt_interrupt_enable (const uint8_t value)
@ -136,6 +138,7 @@ void wdt_interrupt_enable (const uint8_t value)
); );
} }
} }
#endif
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/** /**
@ -160,6 +163,8 @@ void wdt_interrupt_enable (const uint8_t value)
Updated to match avr-libc 2.0.0 Updated to match avr-libc 2.0.0
*/ */
#if defined( portUSE_WDTO)
static __inline__ static __inline__
__attribute__ ((__always_inline__)) __attribute__ ((__always_inline__))
void wdt_interrupt_reset_enable (const uint8_t value) void wdt_interrupt_reset_enable (const uint8_t value)
@ -199,6 +204,7 @@ void wdt_interrupt_reset_enable (const uint8_t value)
); );
} }
} }
#endif
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -87,7 +87,9 @@ typedef uint8_t UBaseType_t;
/* Architecture specifics. */ /* Architecture specifics. */
// System Tick - Scheduler timer // System Tick - Scheduler timer
// Prefer to use the Watchdog timer, but also Timer 0 is ok. // Prefer to use the enhanced Watchdog Timer, but also Timer0 is ok.
#if defined(WDIE) && defined(WDIF) // Enhanced WDT with interrupt capability
#define portUSE_WDTO WDTO_15MS // portUSE_WDTO to use the Watchdog Timer for xTaskIncrementTick #define portUSE_WDTO WDTO_15MS // portUSE_WDTO to use the Watchdog Timer for xTaskIncrementTick
@ -97,11 +99,14 @@ typedef uint8_t UBaseType_t;
WDTO_120MS WDTO_120MS
WDTO_250MS WDTO_250MS
WDTO_500MS WDTO_500MS
WDTO_1S
WDTO_2S
*/ */
#if !defined( portUSE_WDTO ) #else
#define portUSE_TIMER0 // portUSE_TIMER0 to use 8 bit Timer0 for xTaskIncrementTick #define portUSE_TIMER0 // portUSE_TIMER0 to use 8 bit Timer0 for xTaskIncrementTick
#endif #endif
#define portSTACK_GROWTH ( -1 ) #define portSTACK_GROWTH ( -1 )
@ -128,7 +133,7 @@ extern void vPortYield( void ) __attribute__ ( ( naked ) );
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
/* Task function macros as described on the FreeRTOS.org WEB site. */ /* Task function macros as described on the FreeRTOS.org WEB site. */
// Add .lowtext tag for the linker for ATmega2560 and ATmega2561. To make sure they are loaded in low memory. // Add .lowtext tag from the linker script avr6.x for ATmega2560 and ATmega2561. To make sure they are loaded in low memory.
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__ ((section (".lowtext"))) #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__ ((section (".lowtext")))
#else #else
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )