pentabug/firmware/bootloader/mega88.h

39 lines
927 B
C
Raw Normal View History

2012-07-17 01:05:27 +02:00
#ifndef _MEGA88_H_
#define _MEGA88_H_
/* Part-Code ISP */
#define DEVTYPE_ISP 0x76
/* Part-Code BOOT */
#define DEVTYPE_BOOT 0x77
#define SIG_BYTE1 0x1E
#define SIG_BYTE2 0x93
#define SIG_BYTE3 0x0F
#define UART_BAUD_HIGH UBRR0H
#define UART_BAUD_LOW UBRR0L
#define UART_STATUS UCSR0A
#define UART_TXREADY UDRE0
#define UART_RXREADY RXC0
#define UART_DOUBLE U2X0
#define UART_CTRL UCSR0B
#define UART_CTRL_DATA ((1<<TXEN0) | (1<<RXEN0))
#define UART_CTRL2 UCSR0C
#define UART_CTRL2_DATA (1<<UCSZ00)|(1<<UCSZ01)//((1<<URSEL0) | (1<<UCSZ10) | (1<<UCSZ00))
#define UART_DATA UDR0
2012-10-07 02:04:16 +02:00
static inline void bootloader_wdt_off(void) {
2012-07-17 01:05:27 +02:00
// cli();
wdt_reset();
/* Clear WDRF in MCUSR */
2012-10-07 02:04:16 +02:00
MCUSR &= ~(1 << WDRF);
2012-07-17 01:05:27 +02:00
/* Write logical one to WDCE and WDE */
/* Keep old prescaler setting to prevent unintentional time-out */
2012-10-07 02:04:16 +02:00
WDTCSR |= (1 << WDCE) | (1 << WDE);
2012-07-17 01:05:27 +02:00
/* Turn off WDT */
WDTCSR = 0x00;
}
#endif // #ifndef _MEGA88_H_