runtest.c 654 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Load and switch to test image
  3. */
  4. #include "common.h"
  5. #include "irq.h"
  6. #include "io.h"
  7. #include "sys.h"
  8. extern const char __dram_start[];
  9. extern char __dram_test_start[];
  10. abssymval(_dram_test_size)
  11. extern no_return __start_test(void);
  12. static inline void disable_abcmem(void)
  13. {
  14. volatile uint32_t *pg = &ABCMEMMAP_PAGE(0);
  15. for (unsigned int addr = 0; addr < 0x10000; addr += 512)
  16. *pg++ = 0;
  17. }
  18. void __dram_text run_test_image(void)
  19. {
  20. disable_abcmem();
  21. disable_irqs();
  22. romcopy_download(__dram_test_start,
  23. __dram_test_start - __dram_start,
  24. _dram_test_size());
  25. waitfor(ROMCOPY_IRQ);
  26. __start_test();
  27. }