disable irq stuff and add watchdog
This commit is contained in:
parent
8e2889212a
commit
446c3932ae
@ -405,6 +405,7 @@ int main(void)
|
|||||||
|
|
||||||
while (req_state != REQ_STATUS_AVR){
|
while (req_state != REQ_STATUS_AVR){
|
||||||
usbPoll();
|
usbPoll();
|
||||||
|
#if 0
|
||||||
i = 20;
|
i = 20;
|
||||||
while (--i) { /* fake USB disconnect for > 250 ms */
|
while (--i) { /* fake USB disconnect for > 250 ms */
|
||||||
_delay_ms(100);
|
_delay_ms(100);
|
||||||
@ -421,7 +422,7 @@ int main(void)
|
|||||||
|
|
||||||
sram_bulk_read_start(0x003000);
|
sram_bulk_read_start(0x003000);
|
||||||
printf("Read 0x3000=%c\n",c);
|
printf("Read 0x3000=%c\n",c);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
avr/usbload/watchdog.c
Normal file
10
avr/usbload/watchdog.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "watchdog.h"
|
||||||
|
|
||||||
|
void wdt_init(void)
|
||||||
|
{
|
||||||
|
MCUSR = 0;
|
||||||
|
wdt_disable();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
19
avr/usbload/watchdog.h
Normal file
19
avr/usbload/watchdog.h
Normal 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
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user