common.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef FW_H
  2. #define FW_H
  3. #include "compiler.h"
  4. #include "picorv32.h"
  5. #include "irq.h"
  6. /* Sometimes useful combination types */
  7. typedef union {
  8. uint8_t b[8];
  9. uint16_t h[4];
  10. uint32_t l[2];
  11. uint64_t q;
  12. } qword_t;
  13. typedef union {
  14. uint8_t b[4];
  15. uint16_t h[2];
  16. uint32_t l;
  17. } lword_t;
  18. typedef union {
  19. uint8_t b[2];
  20. uint16_t h;
  21. } hword_t;
  22. extern const size_t __rom_offset;
  23. extern const uint32_t __dram_checksum;
  24. extern const char __datestamp[];
  25. extern char __esplink_start[], __esplink_end[];
  26. extern char __dram_init_start[], __dram_init_end[];
  27. extern char __dram_bss_start[], __dram_bss_end[];
  28. struct esplink_head;
  29. extern struct esplink_head esplink_head;
  30. extern uint32_t esplink[];
  31. extern no_return _die(void);
  32. extern no_return exit(int);
  33. extern no_return _exit(int);
  34. /* Value of an absolute symbol with one more _ than here given */
  35. #define abssymval(x) \
  36. static inline size_t x (void) { \
  37. extern const char _ ## x []; \
  38. return (size_t) _ ## x; \
  39. }
  40. extern const uint8_t _end[];
  41. extern void *_sbrk(size_t);
  42. extern uint32_t timer_irq_start;
  43. static inline uint32_t timer_count(void)
  44. {
  45. extern volatile uint32_t timer_irq_count;
  46. return timer_irq_count;
  47. }
  48. extern void init(void);
  49. extern void mount_abcdrives(void);
  50. extern void read_rtc(void);
  51. extern void write_rtc(void);
  52. extern volatile bool do_write_rtc;
  53. extern void rtc_abc_init(void);
  54. extern void rtc_abc_io_poll(void);
  55. extern void disk_cache_init(void);
  56. extern void pun80_init(void);
  57. extern void romcopy_download(void *, size_t, size_t);
  58. extern void romcopy_bzero(void *, size_t);
  59. extern void rom_print_serial(void);
  60. extern qword_t rom_serial;
  61. extern void run_test_image(void);
  62. extern void rom_flash_from_memory(void *, size_t);
  63. extern void rom_flash_from_sdcard(void);
  64. extern void esp_init(void);
  65. #endif /* FW_H */