/*#*
*#* $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.
*#*
*#*/
#include "ser.h"
+
+#if CONFIG_WATCHDOG
+ #include "wdt.h"
+#endif
+
#include "ser_p.h"
#include <mware/formatwr.h>
#include <cfg/debug.h>
/* 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();
/* 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();
/* Give up timeslice to other processes. */
proc_switch();
#endif
+ #if CONFIG_WATCHDOG
+ wdt_reset();
+ #endif
}
}
/*#*
*#* $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.
*#*
* 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)
{
/*#*
*#* $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.
*#*
#include <drv/timer_avr.h>
#include <cfg/macros.h> // BV()
+#include <cfg/cpu.h>
+
#include <avr/interrupt.h>
#include <avr/io.h>
-#if CPU_AVR_ATMEGA1281
+#if CPU_AVR_ATMEGA1281 || CPU_AVR_ATMEGA168
#define REG_TIFR0 TIFR0
#define REG_TIFR2 TIFR2
}
#elif (CONFIG_TIMER == TIMER_ON_OUTPUT_COMPARE2)
-
static void timer_hw_init(void)
{
cpuflags_t flags;
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);
/*#*
*#* $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.
*#*
#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)
/*#*
*#* $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.
*#*
#include <cfg/debug.h>
#include <cfg/cpu.h>
#include <cfg/macros.h> // BV()
-#include <hw.h>
+#include <hw_cpu.h> /* CLOCK_FREQ */
#include <appconfig.h>
#include <compat/twi.h>
* 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
/*#*
*#* $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.
*#*
#elif CPU_AVR
#include <avr/io.h>
#include <cfg/macros.h> // BV()
+ #if CPU_AVR_ATMEGA1281 // Name is different in atmega1281
+ #define WDTCR WDTCSR
+ #endif
#elif defined(ARCH_FREERTOS) && (ARCH & ARCH_FREERTOS)
#include <task.h> /* taskYIELD() */
#else