bootapp.h 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //language.h
  2. #ifndef BOOTAPP_H
  3. #define BOOTAPP_H
  4. #include "config.h"
  5. #include <avr/io.h>
  6. #include <inttypes.h>
  7. #define RAMSIZE (RAMEND+1-RAMSTART)
  8. #define boot_src_addr (*((uint32_t*)(RAMSIZE - 16)))
  9. #define boot_dst_addr (*((uint32_t*)(RAMSIZE - 12)))
  10. #define boot_copy_size (*((uint16_t*)(RAMSIZE - 8)))
  11. #define boot_reserved (*((uint8_t*)(RAMSIZE - 6)))
  12. #define boot_app_flags (*((uint8_t*)(RAMSIZE - 5)))
  13. #define boot_app_magic (*((uint32_t*)(RAMSIZE - 4)))
  14. #define BOOT_APP_FLG_ERASE 0x01
  15. #define BOOT_APP_FLG_COPY 0x02
  16. #define BOOT_APP_FLG_FLASH 0x04
  17. #define BOOT_APP_FLG_RUN 0x08
  18. #define BOOT_APP_FLG_USER0 0x80
  19. #define BOOT_APP_MAGIC 0x55aa55aa
  20. #if defined(__cplusplus)
  21. extern "C" {
  22. #endif //defined(__cplusplus)
  23. extern void bootapp_print_vars(void);
  24. extern void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size);
  25. extern void bootapp_reboot_user0(uint8_t reserved);
  26. #if defined(__cplusplus)
  27. }
  28. #endif //defined(__cplusplus)
  29. #endif //BOOTAPP_H