disable irq stuff and add watchdog

This commit is contained in:
David Voswinkel 2009-07-12 15:14:29 +02:00
parent 8e2889212a
commit 446c3932ae
3 changed files with 31 additions and 1 deletions

View File

@ -405,6 +405,7 @@ int main(void)
while (req_state != REQ_STATUS_AVR){
usbPoll();
#if 0
i = 20;
while (--i) { /* fake USB disconnect for > 250 ms */
_delay_ms(100);
@ -421,7 +422,7 @@ int main(void)
sram_bulk_read_start(0x003000);
printf("Read 0x3000=%c\n",c);
#endif
}
}

10
avr/usbload/watchdog.c Normal file
View File

@ -0,0 +1,10 @@
#include "watchdog.h"
void wdt_init(void)
{
MCUSR = 0;
wdt_disable();
return;
}

19
avr/usbload/watchdog.h Normal file
View File

@ -0,0 +1,19 @@
#include <avr/wdt.h>
#ifndef __WATCHDOG_H__
#define __WATCHDOG_H__
void wdt_init(void) __attribute__((naked)) __attribute__((section(".init3")));
#define soft_reset() \
do \
{ \
wdt_enable(WDTO_500MS );\
for(;;) \
{ \
} \
} while(0)
#endif