From: asterix Date: Thu, 5 Jan 2012 17:25:54 +0000 (+0000) Subject: Implement timer_cleanup() function for SAM7. X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=c8f7b2058f1ea7e68cad20bd076e5f5d6b2435d5;p=bertos.git Implement timer_cleanup() function for SAM7. This must be called to stop the system timer in the bootloader before jumping into the application. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5215 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/arm/drv/timer_at91.c b/bertos/cpu/arm/drv/timer_at91.c index beab00d6..0e02d8b4 100644 --- a/bertos/cpu/arm/drv/timer_at91.c +++ b/bertos/cpu/arm/drv/timer_at91.c @@ -75,6 +75,11 @@ IRQ_RESTORE(flags); } + void timer_hw_cleanup(void) + { + PIT_MR &= ~BV(PITEN); + sysirq_setEnable(SYSIRQ_PIT, false); + } #else #error Unimplemented value for CONFIG_TIMER #endif /* CONFIG_TIMER */ diff --git a/bertos/cpu/arm/drv/timer_at91.h b/bertos/cpu/arm/drv/timer_at91.h index 0628d394..433c352c 100644 --- a/bertos/cpu/arm/drv/timer_at91.h +++ b/bertos/cpu/arm/drv/timer_at91.h @@ -103,6 +103,7 @@ #endif /* CONFIG_TIMER */ void timer_hw_init(void); +void timer_hw_cleanup(void); #endif /* DRV_TIMER_AT91_H */ diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index a411dc4e..a59f2a77 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -402,7 +402,7 @@ void timer_init(void) } -#if (ARCH & ARCH_EMUL) +#if (ARCH & ARCH_EMUL) || (CPU_ARM_AT91) /** * Stop timer (only used by emulator) */