Main Page   Compound List   File List   Compound Members   File Members  

wdt.h

Go to the documentation of this file.
00001 /*
00002    wdt.h
00003 
00004    Contributors:
00005      Created by Marek Michalkiewicz <marekm@linux.org.pl>
00006 
00007    THIS SOFTWARE IS NOT COPYRIGHTED
00008 
00009    This source code is offered for use in the public domain.  You may
00010    use, modify or distribute it freely.
00011 
00012    This code is distributed in the hope that it will be useful, but
00013    WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00014    DISCLAIMED.  This includes but is not limited to warranties of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  */
00017 
00018 #ifndef _WDT_H_
00019 #define _WDT_H_
00020 
00021 #include <io.h>
00022 
00023 #define wdt_reset() __asm__ __volatile__ ("wdr")
00024 
00025 #define wdt_enable(timeout)                             \
00026         __asm__ __volatile__ (                          \
00027                 "in __tmp_reg__, __SREG__" "\n\t"       \
00028                 "cli" "\n\t"                            \
00029                 "wdr" "\n\t"                            \
00030                 "out %1, %0" "\n\t"                     \
00031                 "out __SREG__, __tmp_reg__" "\n\t"      \
00032                 : /* no outputs */                      \
00033                 : "r" ((uint8_t)((timeout) | BV(WDE))), \
00034                   "I" (WDTCR)                           \
00035                 : "r0"                                  \
00036         )
00037 
00038 #define wdt_disable()                                   \
00039         __asm__ __volatile__ (                          \
00040                 "in __tmp_reg__, __SREG__" "\n\t"       \
00041                 "cli" "\n\t"                            \
00042                 "wdr" "\n\t"                            \
00043                 "out %1, %0" "\n\t"                     \
00044                 "out %1, __zero_reg__" "\n\t"           \
00045                 "out __SREG__, __tmp_reg__"             \
00046                 : /* no outputs */                      \
00047                 : "r" (BV(WDTOE) | BV(WDE)),            \
00048                   "I" (WDTCR)                           \
00049                 : "r0"                                  \
00050         )
00051 
00052 #endif

Generated at Fri Jul 19 14:55:42 2002 for avrgcc by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001