Changes between Version 10 and Version 11 of Component/Vci Icu


Ignore:
Timestamp:
Jan 4, 2008, 12:32:17 PM (16 years ago)
Author:
Nicolas Pouillon
Comment:

soclib_io

Legend:

Unmodified
Added
Removed
Modified
  • Component/Vci Icu

    v10 v11  
    2323This component contains 5 memory mapped registers:
    2424
    25  * `ICU_INT`: ADDRESS![4:0] = 0x0
     25 * `ICU_INT`
    2626   Each bit in this register reflects the state of the corresponding interrupt line.
    2727   This is read-only.
    2828
    29  * `ICU_MASK`: ADDRESS![4:0] = 0x4
     29 * `ICU_MASK`
    3030   Each bit in this register reflects the state of the enable for the corresponding interrupt line.
    3131   This is read-only.
    3232
    33  * `ICU_MASK_SET`: ADDRESS![4:0] = 0x8
     33 * `ICU_MASK_SET`
    3434   Each bit set in the written word will be set in the ICU MASK. (ICU_MASK = ICU_MASK | written_data).
    3535   This is write-only.
    3636
    37  * `ICU_MASK_CLEAR`: ADDRESS![4:0] = 0xc
     37 * `ICU_MASK_CLEAR`
    3838   Each bit set in the written word will be reset in the ICU MASK. (ICU_MASK = ICU_MASK & ~written_data).
    3939   This is write-only.
    4040
    41  * `ICU_IT_VECTOR`: ADDRESS![4:0] = 0x10
     41 * `ICU_IT_VECTOR`
    4242   This register gives the number of the highest-priority active interrupt.
    4343   If no interrupt is active, (-1) is returned.
     
    5959static icu_test(const size_t icu_no)
    6060{
    61     volatile int *icu = ((int*)icu_address) + timer_no*ICU_SPAN;
    62 
    6361    // 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 );
    6563
    6664    // Enabling IRQ #5
    67     icu[ICU_MASK_SET] = 0x20;
     65    soclib_io_set( timer_address, ICU_SPAN*icu_no + ICU_MASK_SET, 1<<5 );
    6866    // Disabling IRQ #0
    69     icu[ICU_MASK_CLEAR] = 0x1;
     67    soclib_io_set( timer_address, ICU_SPAN*icu_no + ICU_MASK_CLEAR, 1<<0 );
    7068
    7169    // 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 );
    7371    // 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 ) );
    7574}
    7675}}}