From: batt Date: Thu, 7 Jun 2007 14:35:12 +0000 (+0000) Subject: Merge from kseries. X-Git-Tag: 1.0.0~445 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=0628041b72ccf33890a673e46b0cd8035acf3a06;p=bertos.git Merge from kseries. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@796 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/drv/ser.c b/drv/ser.c index 5b9f2a36..8c95a9d7 100755 --- a/drv/ser.c +++ b/drv/ser.c @@ -28,6 +28,9 @@ /*#* *#* $Log$ + *#* Revision 1.37 2007/06/07 14:35:12 batt + *#* Merge from project_ks. + *#* *#* Revision 1.36 2007/01/29 11:30:29 batt *#* Reimplement ser_clearstatus as a macro. *#* @@ -136,6 +139,11 @@ *#*/ #include "ser.h" + +#if CONFIG_WATCHDOG + #include "wdt.h" +#endif + #include "ser_p.h" #include #include @@ -201,6 +209,9 @@ int ser_putchar(int c, struct Serial *port) /* Attende finche' il buffer e' pieno... */ do { +#if CONFIG_WATCHDOG + wdt_reset(); +#endif #if CONFIG_KERNEL && CONFIG_KERN_SCHED /* Give up timeslice to other processes. */ proc_switch(); @@ -245,6 +256,9 @@ int ser_getchar(struct Serial *port) /* Wait while buffer is empty */ do { +#if CONFIG_WATCHDOG + wdt_reset(); +#endif #if CONFIG_KERNEL && CONFIG_KERN_SCHED /* Give up timeslice to other processes. */ proc_switch(); @@ -491,6 +505,9 @@ void ser_drain(struct Serial *ser) /* Give up timeslice to other processes. */ proc_switch(); #endif + #if CONFIG_WATCHDOG + wdt_reset(); + #endif } } diff --git a/drv/timer.h b/drv/timer.h index 5c1d9001..68fdc1df 100755 --- a/drv/timer.h +++ b/drv/timer.h @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.33 2007/06/07 14:35:12 batt + *#* Merge from project_ks. + *#* *#* Revision 1.32 2007/01/09 08:57:19 bernie *#* Remove excess parentheses. *#* @@ -166,7 +169,7 @@ INLINE ticks_t timer_clock(void) * interrupt is disabled (DISABLE_INTS) or overridden by a * higher-priority or non-nesting interrupt. * - * \sa timer_ticks + * \sa timer_clock */ INLINE ticks_t timer_clock_unlocked(void) { diff --git a/drv/timer_avr.c b/drv/timer_avr.c index 28f89349..5f203ad6 100755 --- a/drv/timer_avr.c +++ b/drv/timer_avr.c @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.6 2007/06/07 14:35:12 batt + *#* Merge from project_ks. + *#* *#* Revision 1.5 2007/03/21 11:03:56 batt *#* Add missing support for ATMega1281. *#* @@ -37,10 +40,12 @@ #include #include // BV() +#include + #include #include -#if CPU_AVR_ATMEGA1281 +#if CPU_AVR_ATMEGA1281 || CPU_AVR_ATMEGA168 #define REG_TIFR0 TIFR0 #define REG_TIFR2 TIFR2 @@ -152,7 +157,6 @@ } #elif (CONFIG_TIMER == TIMER_ON_OUTPUT_COMPARE2) - static void timer_hw_init(void) { cpuflags_t flags; @@ -167,8 +171,8 @@ REG_TCCR2A = BV(WGM21); #if TIMER_PRESCALER == 64 - #if CPU_AVR_ATMEGA1281 - // ATMega1281 has undocumented differences in timer2 prescaler! + #if CPU_AVR_ATMEGA1281 || CPU_AVR_ATMEGA168 + // ATMega1281 & ATMega168 have undocumented differences in timer2 prescaler! REG_TCCR2B |= BV(CS22); #else REG_TCCR2B |= BV(CS21) | BV(CS20); diff --git a/drv/timer_avr.h b/drv/timer_avr.h index 252e772f..0155ecc7 100755 --- a/drv/timer_avr.h +++ b/drv/timer_avr.h @@ -16,6 +16,9 @@ /*#* *#* $Log$ + *#* Revision 1.30 2007/06/07 14:35:12 batt + *#* Merge from project_ks. + *#* *#* Revision 1.29 2007/03/21 11:01:36 batt *#* Add missing support for ATMega1281. *#* @@ -100,7 +103,7 @@ #define TIMER_PRESCALER 64 #define TIMER_HW_BITS 8 - #if CPU_AVR_ATMEGA1281 + #if CPU_AVR_ATMEGA1281 || CPU_AVR_ATMEGA168 #define DEFINE_TIMER_ISR SIGNAL(SIG_OUTPUT_COMPARE2A) #else #define DEFINE_TIMER_ISR SIGNAL(SIG_OUTPUT_COMPARE2) diff --git a/drv/twi.c b/drv/twi.c index d0c65374..52112d2f 100755 --- a/drv/twi.c +++ b/drv/twi.c @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.8 2007/06/07 14:35:12 batt + *#* Merge from project_ks. + *#* *#* Revision 1.7 2006/07/19 12:56:26 bernie *#* Convert to new Doxygen style. *#* @@ -43,7 +46,7 @@ #include #include #include // BV() -#include +#include /* CLOCK_FREQ */ #include #include @@ -238,12 +241,12 @@ void twi_init(void) * probably due to some unwanted interaction between the * port pin and the TWI lines. */ -#if defined(__AVR_ATmega64__) +#if CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281 PORTD |= BV(PD0) | BV(PD1); - DDRD |= BV(PD0) | BV(PD1); -#elif defined(__AVR_ATmega8__) + DDRD |= BV(PD0) | BV(PD1); +#elif CPU_AVR_ATMEGA8 PORTC |= BV(PC4) | BV(PC5); - DDRC |= BV(PC4) | BV(PC5); + DDRC |= BV(PC4) | BV(PC5); #else #error Unsupported architecture #endif diff --git a/drv/wdt.h b/drv/wdt.h index 7ff3e8f6..8abba479 100755 --- a/drv/wdt.h +++ b/drv/wdt.h @@ -14,6 +14,9 @@ /*#* *#* $Log$ + *#* Revision 1.12 2007/06/07 14:35:12 batt + *#* Merge from project_ks. + *#* *#* Revision 1.11 2006/07/19 12:56:26 bernie *#* Convert to new Doxygen style. *#* @@ -75,6 +78,9 @@ #elif CPU_AVR #include #include // BV() + #if CPU_AVR_ATMEGA1281 // Name is different in atmega1281 + #define WDTCR WDTCSR + #endif #elif defined(ARCH_FREERTOS) && (ARCH & ARCH_FREERTOS) #include /* taskYIELD() */ #else