A9 private Timer

The timer is a peripheral that allows the user to measure real-time as a number of clock cycles. A user loads the timer with the number of clock cycles they'd like to wait, and then polls the "Timeout" bit or optionally enables an interrupt to indicate to the processor that the period has elapsed.

DeviceTimer
Configuration 32-bit mapped registers
Input/OutputBoth
Address Base 0xxFFFEC600
Address Map tr> >Interrupt Status bits:
AddressR/WDescription
baseR/WLoad value - pre determined count value set by user
base+4R/Wcurrent value - at any time the counter is running
base+8R/WControl Register bits:
[0] -Eable - write 1 to start timer
[1] - Auto - write 1 - the timer will stop when it reaches 0. Write 1 the timer will reload timer value and start orver.
[2] - Interrupt - write 1 timer will generate an interrupt when timer value goes to 0
[15 - 8] - Prescaler - used to slow down the counting rate [Prescaler + 1 clock cycle])
base+12R/W[0] - F - When the timer values goes to 0 this bit gets set. To clear the interrupt write a 1 to this bit
InitializationNone (though a period must be written before running the timer, or it will immediately timeout)
Interrupts
TriggeredOn timeout
IRQ LineA9 private Timer use IRQ Line 29
EnableBit 0 of Control Register
AcknowledgeWrite 1 to status register to clear timeout bit (see address map above)
Hardware SetupNone
Reference

Notes

The timer counts downwards on a 200MHz clock, and runs in terms of clock cycles (a period of 500000000 will cause the timer to timeout in 1 second).

When a timeout occurs, the Timeout bit in the Control Register will stay as 1 until the user writes 1 to the status register.

When a timeout occurs, the timer's counter is reset to the pre determined period. The A bit determines whether the timer will then wait until 1 is written to the F bit or continue running immediately.

Assembly Example 1: Setting the timer to run for 2000 clock cycles, and continuous no interrupts

   ldr r0, =0xFFFEC600                   // r0 contains the base address for the timer 
   mov r1, #2000
   str r1, [r0]                          // Set the period to be 2000 clock cycles 

   mov r1, #3 
   str r1, [r0, #8]                     //  Start the timer continuing no interrupts