AVR Bootloader (avrboot cleanup)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0KB

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