Changes between Version 12 and Version 13 of Component/Vci Multi Timer
- Timestamp:
- Jan 4, 2008, 12:35:55 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Component/Vci Multi Timer
v12 v13 18 18 Each timer contains 4 memory mapped registers: 19 19 20 * `TIMER_VALUE` : ADDRESS![3:0] = 0x020 * `TIMER_VALUE` 21 21 This 32 bits register is unconditionally incremented at each cycle. 22 22 A read request returns the current time contained in this register. 23 23 A write request sets a new value in this register. 24 24 25 * `TIMER_MODE` : ADDRESS![3:0] = 0x425 * `TIMER_MODE` 26 26 This register contains two flags: 27 27 * Bit 0: TIMER_RUNNING. When 1, the associated timer will decrease on each cycle 28 28 * Bit 1: TIMER_IRQ_ENABLED: When 1, the associated IRQ line will be activated if the timer underflows. 29 29 30 * `TIMER_PERIOD` : ADDRESS![3:0] = 0x830 * `TIMER_PERIOD` 31 31 This 32 bits register defines the period between two successive interrupts. 32 32 It may be read or written to. 33 33 34 * `TIMER_RESETIRQ` : ADDRESS![3:0] = 0xC34 * `TIMER_RESETIRQ` 35 35 Any write request in this Boolean register will reset the pending IRQ. 36 36 A read request returns the zero value when there is no pending interrupt, … … 53 53 static timer_test(const size_t timer_no) 54 54 { 55 volatile int *timer = ((int*)timer_address) + timer_no*TIMER_SPAN;56 57 55 // Getting / setting timer current value 58 timer[TIMER_VALUE] = 0x2a00;59 uint32_t foo = timer[TIMER_VALUE];56 soclib_io_set( timer_address, TIMER_SPAN*timer_no + TIMER_VALUE, 0x2a00 ); 57 uint32_t foo = soclib_io_get( timer_address, TIMER_SPAN*timer_no + TIMER_VALUE ); 60 58 61 59 // Enabling timer and interrupt 62 timer[TIMER_MODE] = TIMER_RUNNING | TIMER_IRQ_ENABLED;60 soclib_io_set( timer_address, TIMER_SPAN*timer_no + TIMER_MODE, TIMER_RUNNING | TIMER_IRQ_ENABLED ); 63 61 64 62 // Getting IRQ status, and resetting IRQ 65 if ( timer[TIMER_RESETIRQ])66 timer[TIMER_RESETIRQ] = 0;63 if ( soclib_io_get( timer_address, TIMER_SPAN*timer_no + TIMER_RESETIRQ ) ) 64 soclib_io_set( timer_address, TIMER_SPAN*timer_no + TIMER_RESETIRQ, 0 ); 67 65 } 68 66 }}}