0 Members and 2 Guests are viewing this topic.
// Idle for n/100 secondsvoid delay(int n) { int irq_mask = *(volatile int *)0xDC000008; *(volatile int *)0xDC00000C = ~(1 << 19); // Disable all IRQs except timer for (; n; n--) { asm ("mcr p15, 0, %0, c7, c0, 4" : : "r" (0)); // Wait for an interrupt to occur *(volatile int *)0x900A0020 = 1; // Acknowledge timer interrupt at source *(volatile int *)0xDC000028; // Make interrupt controller stop asserting nIRQ if there aren't any active IRQs left } *(volatile int *)0xDC000008 = irq_mask; // Re-enable disabled IRQs return 0;}
I think ARM is supposed to handle frequency changes well. I do know that the OS frequently clocks the processor down while idle, then clocks it back up when it needs to do something.