xmega compiling (not flashing yet)
This commit is contained in:
parent
5836d1a06a
commit
6b58b0c7dd
11 changed files with 152 additions and 2 deletions
|
@ -6,7 +6,9 @@
|
|||
#include <avr/wdt.h>
|
||||
#include <util/delay.h>
|
||||
#include "bootloader.h"
|
||||
#include <avr/boot.h>
|
||||
#ifndef __AVR_XMEGA__
|
||||
#include <avr/boot.h>
|
||||
#endif
|
||||
|
||||
#ifdef PROTOCOL_LUFA
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
|
@ -152,7 +154,7 @@ void bootloader_jump(void) {
|
|||
|
||||
#else // Assume remaining boards are DFU, even if the flag isn't set
|
||||
|
||||
#ifndef __AVR_ATmega32A__ // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
|
||||
#ifdef BOOTLOADER_BOOTLOADHID // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
|
||||
UDCON = 1;
|
||||
USBCON = (1<<FRZCLK); // disable USB
|
||||
UCSR1B = 0;
|
||||
|
@ -178,6 +180,11 @@ void bootloader_jump(void) {
|
|||
#define MCUSR MCUCSR
|
||||
#endif
|
||||
|
||||
#ifdef __AVR_XMEGA__
|
||||
#define MCUSR RST_STATUS
|
||||
#define WDRF RST_WDRF_bp
|
||||
#endif
|
||||
|
||||
/* this runs before main() */
|
||||
void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3")));
|
||||
void bootloader_jump_after_watchdog_reset(void)
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
#endif /* AUDIO_ENABLE */
|
||||
|
||||
|
||||
#ifdef __AVR_XMEGA__
|
||||
|
||||
#define wdt_intr_enable(value) wdt_enable(value)
|
||||
|
||||
#else
|
||||
|
||||
#define wdt_intr_enable(value) \
|
||||
__asm__ __volatile__ ( \
|
||||
|
@ -37,6 +42,7 @@ __asm__ __volatile__ ( \
|
|||
: "r0" \
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
void suspend_idle(uint8_t time)
|
||||
{
|
||||
|
@ -134,6 +140,7 @@ void suspend_wakeup_init(void)
|
|||
led_set(host_keyboard_leds());
|
||||
}
|
||||
|
||||
#ifndef __AVR_XMEGA__
|
||||
#ifndef NO_SUSPEND_POWER_DOWN
|
||||
/* watchdog timeout */
|
||||
ISR(WDT_vect)
|
||||
|
@ -148,3 +155,4 @@ ISR(WDT_vect)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <avr/wdt.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#ifndef __AVR_XMEGA__
|
||||
|
||||
#define wdt_intr_enable(value) \
|
||||
__asm__ __volatile__ ( \
|
||||
|
@ -25,3 +26,5 @@ __asm__ __volatile__ ( \
|
|||
)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,6 +43,7 @@ void timer_init(void)
|
|||
# error "Timer prescaler value is NOT vaild."
|
||||
#endif
|
||||
|
||||
#ifndef __AVR_XMEGA__
|
||||
#ifndef __AVR_ATmega32A__
|
||||
// Timer0 CTC mode
|
||||
TCCR0A = 0x02;
|
||||
|
@ -58,6 +59,13 @@ void timer_init(void)
|
|||
OCR0 = TIMER_RAW_TOP;
|
||||
TIMSK = (1 << OCIE0);
|
||||
#endif
|
||||
#else
|
||||
TCC0.CTRLE = 0x01; // set timer in 8bit mode (default is 16 bits)
|
||||
TCC0.INTCTRLA = 0x02; // Interrupt Enable register A (enable INT for tc0 (medium level))
|
||||
TCC0.PER = 132; // set period to 228 khz
|
||||
TCC0.PERBUF = 132; // buffer for writing to TCC0.PER.
|
||||
TCC0.CTRLA = prescaler; // clk=30324000 H
|
||||
#endif
|
||||
}
|
||||
|
||||
inline
|
||||
|
@ -117,11 +125,15 @@ uint32_t timer_elapsed32(uint32_t last)
|
|||
}
|
||||
|
||||
// excecuted once per 1ms.(excess for just timer count?)
|
||||
#ifndef __AVR_XMEGA__
|
||||
#ifndef __AVR_ATmega32A__
|
||||
#define TIMER_INTERRUPT_VECTOR TIMER0_COMPA_vect
|
||||
#else
|
||||
#define TIMER_INTERRUPT_VECTOR TIMER0_COMP_vect
|
||||
#endif
|
||||
#else
|
||||
#define TIMER_INTERRUPT_VECTOR TCE0_OVF_vect
|
||||
#endif
|
||||
ISR(TIMER_INTERRUPT_VECTOR, ISR_NOBLOCK)
|
||||
{
|
||||
timer_count++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue