Subversion Repositories Projects

Rev

Rev 1307 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1307 Rev 1308
Line -... Line 1...
-
 
1
#ifndef _MEGA644_H_
-
 
2
#define _MEGA644_H_
-
 
3
 
-
 
4
/* I (M. Thomas) could not find an official Boot-ID
-
 
5
   for the ATmega644 so pretend it's an ATmega64 */
-
 
6
/* Part-Code ISP */
-
 
7
#define DEVTYPE_ISP     0x45
-
 
8
/* Part-Code Boot */
-
 
9
#define DEVTYPE_BOOT    0x46
-
 
10
 
-
 
11
#define SIG_BYTE1       0x1E
-
 
12
#define SIG_BYTE2       0x96
-
 
13
#define SIG_BYTE3       0x09
-
 
14
 
-
 
15
#define UART_BAUD_HIGH  UBRR0H
-
 
16
#define UART_BAUD_LOW   UBRR0L
-
 
17
#define UART_STATUS         UCSR0A
-
 
18
#define UART_TXREADY    UDRE0
-
 
19
#define UART_RXREADY    RXC0
-
 
20
#define UART_DOUBLE         U2X0
-
 
21
#define UART_CTRL           UCSR0B
-
 
22
#define UART_CTRL_DATA  ((1<<TXEN0) | (1<<RXEN0))
-
 
23
#define UART_CTRL2          UCSR0C
-
 
24
#define UART_CTRL2_DATA ( (1<<UCSZ01) | (1<<UCSZ00))
-
 
25
#define UART_DATA           UDR0
-
 
26
 
-
 
27
#define WDT_OFF_SPECIAL
-
 
28
static inline void bootloader_wdt_off(void)
-
 
29
{
-
 
30
        cli();
-
 
31
        wdt_reset();
-
 
32
        /* Clear WDRF in MCUSR */
-
 
33
        MCUSR &= ~(1<<WDRF);
-
 
34
        /* Write logical one to WDCE and WDE */
-
 
35
        /* Keep old prescaler setting to prevent unintentional time-out */
-
 
36
        WDTCSR |= (1<<WDCE) | (1<<WDE);
-
 
37
        /* Turn off WDT */
-
 
38
        WDTCSR = 0x00;
-
 
39
}
-
 
40
 
-
 
41
 
-
 
42
#endif // #ifndef _MEGA644_H_