Esempio n. 1
0
i32 cc_timer_start(cc_hndl hndl, struct u64_time *time_u64, u32 options)
{
        struct sw_timer *swt = (struct sw_timer*) hndl;
        struct u64_time time64_ref = {0, 0}; /* init */
        u32 intr_mask;
        i32 rv = -1;
        
        if((NULL == swt) || 
           (false == has_valid_opts(swt->hwt_obj, options)))
                goto cc_timer_start_exit1;
        
#define IS_LRT_TIMER(hwt) hwt_has_abs_time(hwt) /* LRT:: Low Resolution Timer */
        
        time64_ref.secs = time_u64->secs;
        time64_ref.nsec = time_u64->nsec;

        if(IS_LRT_TIMER(swt->hwt_obj)) {
                /* reducing the precision to milliseconds to avoid floating point ops */
                time64_ref.nsec = U16MS_U32NS(U32NS_U16MS(time_u64->nsec));
        }

        intr_mask = dsbl_irqc();
        rv = timer_start(swt, &time64_ref, options);
        enbl_irqc(intr_mask);

cc_timer_start_exit1:
        
        return rv;
} 
Esempio n. 2
0
i32 cc_timer_start(cc_hndl hndl, struct u64_time *time_u64, u32 options)
{
		u32 intr_mask;
        struct sw_timer *swt = (struct sw_timer*) hndl;
        struct u64_time time_64_loc = {0,0};
        i32 rv = -1;
        
        if((NULL == swt) || 
           (false == has_valid_opts(swt->hwt_obj, options)))
                goto cc_timer_start_exit1;
        
        intr_mask = dsbl_irqc();
        /* reducing the precision to milliseconds to avoid floating point ops */
        time_64_loc.secs = time_u64->secs;
        time_64_loc.nsec = U16MS_U32NS(U32NS_U16MS(time_u64->nsec));
        rv = timer_start(swt, &time_64_loc, options);
        enbl_irqc(intr_mask);

cc_timer_start_exit1:
        
        return rv;
}