From 10859a834fbc1f3a125db09876b8adf71b147968 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 17 Aug 2013 18:55:38 +0000 Subject: upgraded avr utils git-svn-id: https://svn.spreadspace.org/mur.sat@831 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/avr.lib/util.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'software/avr.lib/util.c') diff --git a/software/avr.lib/util.c b/software/avr.lib/util.c index 3aa1a37..8b74dfb 100644 --- a/software/avr.lib/util.c +++ b/software/avr.lib/util.c @@ -37,6 +37,17 @@ void cpu_init(void) CPU_PRESCALE(0); } +void jtag_disable(void) +{ + uint8_t tempreg; + __asm __volatile("in %[tempreg], %[mcucr]" "\n\t" + "ori %[tempreg], %[jtd]" "\n\t" + "out %[mcucr], %[tempreg]" "\n\t" + "out %[mcucr], %[tempreg]" + : [tempreg] "=d" (tempreg) + : [mcucr] "I" (_SFR_IO_ADDR(MCUCR)), [jtd] "M" (_BV(JTD))); +} + #if defined(__BOARD_teensy1__) #define BOOTLOADER_VEC 0x3E00 #elif defined(__BOARD_teensy2__) @@ -51,6 +62,8 @@ void cpu_init(void) #define BOOTLOADER_VEC 0x3800 #elif defined(__BOARD_hhd70dongle__) || defined(__BOARD_rda1846dongle__) || defined(__BOARD_culV3__) #define BOOTLOADER_VEC 0x3800 +#elif defined(__BOARD_slowpandongle1__) || defined(__BOARD_slowpandongle2__) || defined(__BOARD_teenstep__) + #define BOOTLOADER_VEC 0x3800 #else #define BOOTLOADER_VEC 0x0000 #endif @@ -62,6 +75,7 @@ void reset2bootloader(void) { #if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) || \ defined(__BOARD_hhd70dongle__) || defined(__BOARD_rda1846dongle__) || defined(__BOARD_culV3__) || \ + defined(__BOARD_slowpandongle1__) || defined(__BOARD_slowpandongle2__) || defined(__BOARD_teenstep__) || \ defined(__BOARD_minimus__) || defined(__BOARD_minimus32__) cli(); // disable watchdog, if enabled @@ -90,7 +104,7 @@ void reset2bootloader(void) TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0; DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0; - #elif defined(__BOARD_minimus__) + #elif defined(__BOARD_minimus__) || defined(__BOARD_slowpandongle1__) EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; TIMSK0 = 0; TIMSK1 = 0; UCSR1B = 0; DDRB = 0; DDRC = 0; DDRD = 0; @@ -100,7 +114,8 @@ void reset2bootloader(void) TIMSK0 = 0; TIMSK1 = 0; UCSR1B = 0; DDRB = 0; DDRC = 0; DDRD = 0; PORTB = 0; PORTC = 0; PORTD = 0; - #elif defined(__BOARD_hhd70dongle__) || defined(__BOARD_rda1846dongle__) || defined(__BOARD_culV3__) + #elif defined(__BOARD_hhd70dongle2__) || defined(__BOARD_hhd70dongle__) || defined(__BOARD_rda1846dongle__) || defined(__BOARD_culV3__) || \ + defined(__BOARD_slowpandongle2__) || defined(__BOARD_teenstep__) EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0; TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; TWCR = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; TWCR = 0; -- cgit v1.2.3