|
@@ -134,30 +134,47 @@ static void scrub_sdram(void)
|
|
|
*p = 0xdeadbeef;
|
|
|
}
|
|
|
|
|
|
-static void init(void)
|
|
|
+static volatile uint32_t timer_irq_count;
|
|
|
+static bool periodic_irq(unsigned int vector)
|
|
|
{
|
|
|
- con_set_baudrate(115000);
|
|
|
- set_led(0);
|
|
|
+ uint32_t count = timer_irq_count;
|
|
|
+ (void)vector;
|
|
|
+
|
|
|
+ count++;
|
|
|
+ timer_irq_count = count;
|
|
|
+ set_led(count >> 3); /* 4 Hz */
|
|
|
+
|
|
|
+ return true; /* Handled */
|
|
|
}
|
|
|
|
|
|
-void main(void)
|
|
|
+static void init(void)
|
|
|
{
|
|
|
static const char hello[] =
|
|
|
"\n*** Hello, World! ***\n"
|
|
|
"Firmware compiled on: " __DATE__ " " __TIME__ "\n\n";
|
|
|
|
|
|
+ con_set_baudrate(115000);
|
|
|
+ set_led(0);
|
|
|
+
|
|
|
+ con_puts(hello);
|
|
|
+
|
|
|
+ register_irq(3, periodic_irq, true);
|
|
|
+}
|
|
|
+
|
|
|
+void main(void)
|
|
|
+{
|
|
|
/* The data section is not reinitialized on reset */
|
|
|
static unsigned int loops = 1;
|
|
|
|
|
|
- uint8_t led = 0;
|
|
|
uint32_t done;
|
|
|
+ uint32_t irq_count;
|
|
|
|
|
|
while (!ROMCOPY_DONE)
|
|
|
pause();
|
|
|
|
|
|
done = rdtime() - time_zero;
|
|
|
|
|
|
- con_puts(hello);
|
|
|
+ init();
|
|
|
|
|
|
con_printf("This is loop: %u\n", loops++);
|
|
|
con_printf("SDRAM download took %u us\n", done/(CPU_HZ/1000000));
|
|
@@ -165,10 +182,14 @@ void main(void)
|
|
|
test_download();
|
|
|
|
|
|
disk_init();
|
|
|
-
|
|
|
- //test_sdram();
|
|
|
+ test_sdram();
|
|
|
+ scrub_sdram();
|
|
|
+
|
|
|
+ irq_count = timer_irq_count;
|
|
|
+ done = rdtime() - time_zero;
|
|
|
|
|
|
- //scrub_sdram();
|
|
|
+ con_printf("%u timer interrupts received in %u us\n",
|
|
|
+ irq_count, done/(CPU_HZ/1000000));
|
|
|
|
|
|
udelay(1000000);
|
|
|
con_puts("*** Doing reset ***\n");
|