Changes between Version 12 and Version 13 of Component/Vci Multi Timer


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

soclib_io

Legend:

Unmodified
Added
Removed
Modified
  • Component/Vci Multi Timer

    v12 v13  
    1818Each timer contains 4 memory mapped registers:
    1919
    20  * `TIMER_VALUE`: ADDRESS![3:0] = 0x0
     20 * `TIMER_VALUE`
    2121This 32 bits register is unconditionally incremented at each cycle.
    2222A read request returns the current time contained in this register.
    2323A write request sets a new value in this register.
    2424
    25  * `TIMER_MODE`: ADDRESS![3:0] = 0x4
     25 * `TIMER_MODE`
    2626   This register contains two flags:
    2727   * Bit 0: TIMER_RUNNING. When 1, the associated timer will decrease on each cycle
    2828   * Bit 1: TIMER_IRQ_ENABLED: When 1, the associated IRQ line will be activated if the timer underflows.
    2929
    30  * `TIMER_PERIOD`: ADDRESS![3:0] = 0x8
     30 * `TIMER_PERIOD`
    3131This 32 bits register defines the period between two successive interrupts.
    3232It may be read or written to.
    3333
    34  * `TIMER_RESETIRQ`: ADDRESS![3:0] = 0xC
     34 * `TIMER_RESETIRQ`
    3535Any write request in this Boolean register will reset the pending IRQ.
    3636A read request returns the zero value when there is no pending interrupt,
     
    5353static timer_test(const size_t timer_no)
    5454{
    55     volatile int *timer = ((int*)timer_address) + timer_no*TIMER_SPAN;
    56 
    5755    // 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 );
    6058
    6159    // 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 );
    6361
    6462    // 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 );
    6765}
    6866}}}