Changes between Version 10 and Version 11 of Component/Vci Icu
- Timestamp:
- Jan 4, 2008, 12:32:17 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Component/Vci Icu
v10 v11 23 23 This component contains 5 memory mapped registers: 24 24 25 * `ICU_INT` : ADDRESS![4:0] = 0x025 * `ICU_INT` 26 26 Each bit in this register reflects the state of the corresponding interrupt line. 27 27 This is read-only. 28 28 29 * `ICU_MASK` : ADDRESS![4:0] = 0x429 * `ICU_MASK` 30 30 Each bit in this register reflects the state of the enable for the corresponding interrupt line. 31 31 This is read-only. 32 32 33 * `ICU_MASK_SET` : ADDRESS![4:0] = 0x833 * `ICU_MASK_SET` 34 34 Each bit set in the written word will be set in the ICU MASK. (ICU_MASK = ICU_MASK | written_data). 35 35 This is write-only. 36 36 37 * `ICU_MASK_CLEAR` : ADDRESS![4:0] = 0xc37 * `ICU_MASK_CLEAR` 38 38 Each bit set in the written word will be reset in the ICU MASK. (ICU_MASK = ICU_MASK & ~written_data). 39 39 This is write-only. 40 40 41 * `ICU_IT_VECTOR` : ADDRESS![4:0] = 0x1041 * `ICU_IT_VECTOR` 42 42 This register gives the number of the highest-priority active interrupt. 43 43 If no interrupt is active, (-1) is returned. … … 59 59 static icu_test(const size_t icu_no) 60 60 { 61 volatile int *icu = ((int*)icu_address) + timer_no*ICU_SPAN;62 63 61 // Getting / setting interrupt mask 64 uint32_t current_interrupt_mask = icu[ICU_MASK];62 uint32_t current_interrupt_mask = soclib_io_get( timer_address, ICU_SPAN*icu_no + ICU_MASK ); 65 63 66 64 // Enabling IRQ #5 67 icu[ICU_MASK_SET] = 0x20;65 soclib_io_set( timer_address, ICU_SPAN*icu_no + ICU_MASK_SET, 1<<5 ); 68 66 // Disabling IRQ #0 69 icu[ICU_MASK_CLEAR] = 0x1;67 soclib_io_set( timer_address, ICU_SPAN*icu_no + ICU_MASK_CLEAR, 1<<0 ); 70 68 71 69 // When interrupt is raised, you may do: 72 int irq_to_serve = icu[ICU_IT_VECTOR];70 int irq_to_serve = soclib_io_get( timer_address, ICU_SPAN*icu_no + ICU_IT_VECTOR ); 73 71 // This should be equivalent to (see man 3 ffs) 74 int irq_to_serve = ffs(icu[ICU_IT_VECTOR] & icu[ICU_MASK]); 72 int irq_to_serve = ffs( soclib_io_get( timer_address, ICU_SPAN*icu_no + ICU_IT_VECTOR ) 73 & soclib_io_get( timer_address, ICU_SPAN*icu_no + ICU_MASK ) ); 75 74 } 76 75 }}}