src/ssx/occhw/occhw_ocb.c
// Note that OCB_TIMER_FREQUENCY_HZ is in the range of 1-2 MHz.
Note that OCB_TIMER_FREQUENCY_HZ is in the range of 1-2 MHz.
Note that OCB_TIMER_FREQUENCY_HZ is in the range of 1 - 2 MHz .
int
ocb_timer_reset(int timer,
                int auto_reload,
                int timeout_ns)
{
    ocb_otrn_t otr;
    int ticks;
    if (timeout_ns != 0)
    {
        ticks = MAX(1, timeout_ns / (1000000000 / OCB_TIMER_FREQUENCY_HZ));
    }
    else
    {
        ticks = 0;
    }
    if (SSX_ERROR_CHECK_API)
    {
        SSX_ERROR_IF((timer < 0) ||
                     (timer >= OCB_TIMERS) ||
                     (timeout_ns < 0) ||
                     (ticks != ((uint16_t)ticks)),
                     OCB_INVALID_ARGUMENT_TIMER);
    }
    otr.value = 0;
    otr.fields.timeout = 1;
    otr.fields.control = 1;
    otr.fields.auto_reload = (auto_reload != 0);
    otr.fields.timer = ticks;
    out32(OCB_OTRN(timer), otr.value);
    return 0;
}
int ocb_timer_reset ( int timer , int auto_reload , int timeout_ns ) { ocb_otrn_t otr ; int ticks ; if ( timeout_ns != 0 ) { ticks = MAX ( 1 , timeout_ns / ( 1000000000 / OCB_TIMER_FREQUENCY_HZ ) ) ; } else { ticks = 0 ; } if ( SSX_ERROR_CHECK_API ) { SSX_ERROR_IF ( ( timer < 0 ) || ( timer >= OCB_TIMERS ) || ( timeout_ns < 0 ) || ( ticks != ( ( uint16_t ) ticks ) ) , OCB_INVALID_ARGUMENT_TIMER ) ; } otr . value = 0 ; otr . fields . timeout = 1 ; otr . fields . control = 1 ; otr . fields . auto_reload = ( auto_reload != 0 ) ; otr . fields . timer = ticks ; out32 ( OCB_OTRN ( timer ) , otr . value ) ; return 0 ; }
Note that OCB_TIMER_FREQUENCY_HZ is in the range of 1-2 MHz.
Note that OCB_TIMER_FREQUENCY_HZ is in the range of 1 - 2 MHz .
//printk("ocb_timer_reset(%d, %d, %d)\n", //       timer, auto_reload, timeout_ns);