max80.c 823 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "common.h"
  2. #include "io.h"
  3. #include "abcio.h"
  4. #include "sys.h"
  5. #include "console.h"
  6. #include "config.h"
  7. #include "boardinfo_fpga.h"
  8. void __hot main(void)
  9. {
  10. unsigned int max_abc_latency = 0;
  11. unsigned int abc_latency;
  12. init();
  13. while (1) {
  14. wait_for_irq();
  15. if (unlikely(do_write_rtc))
  16. write_rtc();
  17. if (unlikely(do_update_boardinfo))
  18. rom_update_boardinfo();
  19. if (unlikely(do_update_config)) {
  20. update_config();
  21. abc_init_memmap();
  22. rtc_abc_config();
  23. abcdisk_config();
  24. pun80_config();
  25. }
  26. abcdisk_io_poll();
  27. abc_latency = ABC_LATENCY;
  28. if (abc_latency > max_abc_latency) {
  29. max_abc_latency = abc_latency;
  30. con_printf("\nWorst ABC-bus latency: %u SDRAM cycles%s\n",
  31. abc_latency & 255,
  32. (abc_latency >> 8) ? " UNDERRUN" : "");
  33. }
  34. }
  35. }