Changes between Version 8 and Version 9 of Component/Vci Multi Timer
- Timestamp:
- May 9, 2007, 3:00:29 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Component/Vci Multi Timer
v8 v9 5 5 This VCI target is a memory mapped peripheral that can 6 6 control up to 256 software controlled timers. 7 Each timer can optionally generate san independent periodic interrupt.7 Each timer can optionally generate an independent periodic interrupt. 8 8 The memory segment allocated to this component must be aligned 9 9 on 4K bytes boundary. 10 The timer index i is defined by the ADDRESS![12:4] bits. 10 11 11 This hardware component cheks for segmentation violation, and can be used 12 12 as a default target. 13 13 14 = Memory region layout = 15 16 The timer index i is defined by the ADDRESS![12:4] bits. 17 14 18 Each timer contains 4 memory mapped registers: 15 19 16 * '''TIMER_VALUE''': ADDRESS![3:0] = 0x017 This 32 bits register is uncondition nally incremented at each cycle.20 * `TIMER_VALUE`: ADDRESS![3:0] = 0x0 21 This 32 bits register is unconditionally incremented at each cycle. 18 22 A read request returns the current time contained in this register. 19 23 A write request sets a new value in this register. 20 24 21 * '''TIMER_RUNNING''' : ADDRESS![3:0] = 0x4 22 When the Boolean value contained in this register is true, 23 the corresponding interrupt is enabled. 24 A write request of a zero gives resets this register. 25 A write request of a non-zero value sets this registe. 25 * `TIMER_MODE`: ADDRESS![3:0] = 0x4 26 This register contains two flags: 27 * Bit 0: TIMER_RUNNING. When 1, the associated timer will decrease on each cycle 28 * Bit 1: TIMER_IRQ_ENABLED: When 1, the associated IRQ line will be activated if the timer underflows. 26 29 27 * '''TIMER_PERIOD''': ADDRESS![3:0] = 0x830 * `TIMER_PERIOD`: ADDRESS![3:0] = 0x8 28 31 This 32 bits register defines the period between two successive interrupts. 29 A write request writes a new value in this register, and the TIMER_RUNNING 30 register is set to false. 31 A read request returns the current value in this register. 32 It may be read or written to. 32 33 33 * '''TIMER_RESETIRQ''': ADDRESS![3:0] = 0xC34 * `TIMER_RESETIRQ`: ADDRESS![3:0] = 0xC 34 35 Any write request in this Boolean register will reset the pending IRQ. 35 36 A read request returns the zero value when there is no pending interrupt, 36 37 and returns a non zero value if there is a pending interrupt. 37 38 39 = Component usage = 40 41 For extensibility issues, you should access your terminal using globally-defined offsets. 42 43 You should include file source:trunk/soclib/include/soclib/timer.h from your software, it 44 defines `TIMER_VALUE`, `TIMER_MODE`, `TIMER_PERIOD`, `TIMER_RESETIRQ`, `TIMER_SPAN`, 45 `TIMER_RUNNING`, `TIMER_IRQ_ENABLED`. 46 47 Sample code: 48 {{{ 49 #include "soclib/tty.h" 50 51 static const volatile void* timer_address = 0xc0000000; 52 53 static timer_test(const size_t timer_no) 54 { 55 volatile int *timer = ((int*)timer_address) + timer_no*TIMER_SPAN; 56 57 // Getting / setting timer current value 58 timer[TIMER_VALUE] = 0x2a00; 59 uint32_t foo = timer[TIMER_VALUE]; 60 61 // Enabling timer and interrupt 62 timer[TIMER_MODE] = TIMER_RUNNING | TIMER_IRQ_ENABLED; 63 64 // Getting IRQ status, and resetting IRQ 65 if ( timer[TIMER_RESETIRQ] ) 66 timer[TIMER_RESETIRQ] = 0; 67 } 68 }}} 69 70 (add -I/path/to/soclib/include to your compilation command-line) 71 38 72 = !VciMultiTimer CABA Implementation = 39 73 40 74 The caba implementation is in 41 * source:trunk/soclib/systemc/include/caba/target/vci_ multi_timer.h42 * source:trunk/soclib/systemc/src/caba/target/vci_ multi_timer.cc75 * source:trunk/soclib/systemc/include/caba/target/vci_timer.h 76 * source:trunk/soclib/systemc/src/caba/target/vci_timer.cc 43 77 44 78 == Template parameters: == 79 45 80 * The VCI parameters 46 81 … … 59 94 * sc_in<bool> '''p_clk''' : Global system clock 60 95 * soclib::caba::!VciTarget<vci_param> '''p_vci''' : The VCI port 61 * sc_out<bool> ''' *p_irq''' : Pointer on Interrupts ports table96 * sc_out<bool> '''p_irq[]''' : Interrupts ports array