Defines | |
#define | Is_ext_reset() ((MCUSR&(1<<EXTRF)) ? TRUE:FALSE) |
#define | Ack_ext_reset() (MCUSR= ~(1<<EXTRF)) |
#define | Is_POR_reset() ((MCUSR&(1<<(MCUSR= ~(1<<PORF)))) ? TRUE:FALSE) |
#define | Ack_POR_reset() (MCUSR= ~(1<<PORF)) |
#define | Is_BOD_reset() ((MCUSR&(1<<BORF)) ? TRUE:FALSE) |
#define | Ack_BOD_reset() (MCUSR= ~(1<<BORF)) |
#define | Is_wdt_reset() ((MCUSR&(1<<WDRF)) ? TRUE:FALSE) |
#define | Ack_wdt_reset() (MCUSR= ~(1<<WDRF)) |
#define | Wdt_ack_interrupt() (WDTCSR = (U8)(1<<WDIF)) |
#define | Is_wdt_interrupt() (WDTCSR&(1<<WDIF) ? TRUE:FALSE) |
#define | Is_not_wdt_interrupt() (WDTCSR&(1<<WDIF) ? FALSE:TRUE) |
#define | Is_wdt_early_warning() (WDTCKD&(1<<WDEWIF) ? TRUE:FALSE) |
#define | Is_not_wdt_early_warning() (WDTCKD&(1<<WDEWIF) ? FALSE:TRUE) |
#define | WDTO_16MS 0 |
#define | WDTO_32MS 1 |
#define | WDTO_64MS 2 |
#define | WDTO_125MS 3 |
#define | WDTO_250MS 4 |
#define | WDTO_500MS 5 |
#define | WDTO_1S 6 |
#define | WDTO_2S 7 |
#define | WDTO_4S 8 |
#define | WDTO_8S 9 |
#define | Soft_reset() {asm("jmp 0000");} |
Functions | |
void | wdtdrv_disable (void) |
This functions stops the hardware watchdog timer. | |
void | wdtdrv_enable (U8 timeout) |
This functions activates the hardware watchdog timer. | |
void | wdtdrv_interrupt_enable (U8 timeout) |
This functions activates the hardware watchdog timer Interrupt Mode only. | |
void | wdtdrv_interrupt_reset_enable (U8 timeout) |
This functions activates the hardware watchdog timer Interrupt & System Reset Mode. |
#define Is_POR_reset | ( | ) | ((MCUSR&(1<<(MCUSR= ~(1<<PORF)))) ? TRUE:FALSE) |
#define Ack_wdt_reset | ( | ) | (MCUSR= ~(1<<WDRF)) |
Definition at line 67 of file wdt_drv.h.
Referenced by wdtdrv_disable(), wdtdrv_enable(), wdtdrv_interrupt_enable(), and wdtdrv_interrupt_reset_enable().
#define Is_wdt_interrupt | ( | ) | (WDTCSR&(1<<WDIF) ? TRUE:FALSE) |
#define Is_not_wdt_interrupt | ( | ) | (WDTCSR&(1<<WDIF) ? FALSE:TRUE) |
#define Is_wdt_early_warning | ( | ) | (WDTCKD&(1<<WDEWIF) ? TRUE:FALSE) |
#define Is_not_wdt_early_warning | ( | ) | (WDTCKD&(1<<WDEWIF) ? FALSE:TRUE) |
#define WDTO_500MS 5 |
void wdtdrv_disable | ( | void | ) |
This functions stops the hardware watchdog timer.
Definition at line 64 of file wdt_drv.c.
References Ack_wdt_reset, and Wdt_reset_instruction.
00065 { 00066 U8 save_int=Get_interrupt_state(); 00067 Disable_interrupt(); 00068 #ifdef __GNUC__ 00069 Ack_wdt_reset(); 00070 wdt_disable(); 00071 #else 00072 Ack_wdt_reset(); 00073 Wdt_reset_instruction(); 00074 WDTCSR = (1<<WDCE) | (1<<WDE); 00075 WDTCSR = 0x00; 00076 #endif 00077 if(save_int) { Enable_interrupt(); } 00078 }
void wdtdrv_enable | ( | U8 | timeout | ) |
This functions activates the hardware watchdog timer.
timeout | (WDTO_x) |
timeout | (WDTO_x) |
Definition at line 89 of file wdt_drv.c.
References Ack_wdt_reset, and Wdt_reset_instruction.
00090 { 00091 U8 save_int=Get_interrupt_state(); 00092 Disable_interrupt(); 00093 #ifdef __GNUC__ 00094 Ack_wdt_reset(); 00095 wdt_enable(timeout); 00096 #else 00097 timeout = (1<<WDE)| (timeout & 0x08 ? (1<<WDP3) : 0x00) | (timeout & 0x07); 00098 Disable_interrupt(); 00099 Wdt_reset_instruction(); 00100 WDTCSR = (1<<WDCE) | (1<<WDE); 00101 WDTCSR = timeout; 00102 #endif 00103 if(save_int) { Enable_interrupt(); } 00104 }
void wdtdrv_interrupt_enable | ( | U8 | timeout | ) |
This functions activates the hardware watchdog timer Interrupt Mode only.
timeout | (WDTO_x) |
Definition at line 115 of file wdt_drv.c.
References Ack_wdt_reset, and Wdt_reset_instruction.
00116 { 00117 U8 save_int=Get_interrupt_state(); 00118 #ifdef __GNUC__ 00119 Ack_wdt_reset(); 00120 __asm__ __volatile__ ( \ 00121 "in __tmp_reg__,__SREG__" "\n\t" \ 00122 "cli" "\n\t" \ 00123 "wdr" "\n\t" \ 00124 "sts %0,%1" "\n\t" \ 00125 "out __SREG__,__tmp_reg__" "\n\t" \ 00126 "sts %0,%2" \ 00127 : /* no outputs */ \ 00128 : "M" (_SFR_MEM_ADDR(_WD_CONTROL_REG)), \ 00129 "r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)), \ 00130 "r" ((uint8_t) ((timeout & 0x08 ? _WD_PS3_MASK : 0x00) | \ 00131 _BV(WDIE) | (timeout & 0x07)) ) \ 00132 : "r0" \ 00133 ); 00134 #else 00135 timeout = (1<<WDIE)| (timeout & 0x08 ? (1<<WDP3) : 0x00) | (timeout & 0x07); 00136 Disable_interrupt(); 00137 Wdt_reset_instruction(); 00138 WDTCSR = (1<<WDCE) | (1<<WDE); 00139 WDTCSR = timeout; 00140 #endif 00141 if(save_int) { Enable_interrupt(); } 00142 }
void wdtdrv_interrupt_reset_enable | ( | U8 | timeout | ) |
This functions activates the hardware watchdog timer Interrupt & System Reset Mode.
timeout | (WDTO_x) |
Definition at line 153 of file wdt_drv.c.
References Ack_wdt_reset, and Wdt_reset_instruction.
00154 { 00155 U8 save_int=Get_interrupt_state(); 00156 Disable_interrupt(); 00157 #ifdef __GNUC__ 00158 Ack_wdt_reset(); 00159 __asm__ __volatile__ ( \ 00160 "in __tmp_reg__,__SREG__" "\n\t" \ 00161 "cli" "\n\t" \ 00162 "wdr" "\n\t" \ 00163 "sts %0,%1" "\n\t" \ 00164 "out __SREG__,__tmp_reg__" "\n\t" \ 00165 "sts %0,%2" \ 00166 : /* no outputs */ \ 00167 : "M" (_SFR_MEM_ADDR(_WD_CONTROL_REG)), \ 00168 "r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)), \ 00169 "r" ((uint8_t) ((timeout & 0x08 ? _WD_PS3_MASK : 0x00) | \ 00170 _BV(WDE) | _BV(WDIE) | (timeout & 0x07)) ) \ 00171 : "r0" \ 00172 ); 00173 #else 00174 timeout = (1<<WDIE)|(1<<WDE)| (timeout & 0x08 ? (1<<WDP3) : 0x00) | (timeout & 0x07); 00175 Disable_interrupt(); 00176 Wdt_reset_instruction(); 00177 WDTCSR = (1<<WDCE) | (1<<WDE); 00178 WDTCSR = timeout; 00179 #endif 00180 if(save_int) { Enable_interrupt(); } 00181 }