static uint32_t bsp_clock_nanoseconds_since_last_tick(void) { uint32_t clicks; uint32_t usecs; clicks = LEON_REG.Timer_Counter_1; if ( LEON_Is_interrupt_pending( LEON_INTERRUPT_TIMER1 ) ) { clicks = LEON_REG.Timer_Counter_1; usecs = (2*rtems_configuration_get_microseconds_per_tick() - clicks); } else { usecs = (rtems_configuration_get_microseconds_per_tick() - clicks); } return usecs * 1000; }
static uint32_t bsp_clock_nanoseconds_since_last_tick(void) { uint32_t clicks; uint32_t usecs; if ( !LEON3_Timer_Regs ) return 0; clicks = LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].value; if ( LEON_Is_interrupt_pending( clkirq ) ) { clicks = LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].value; usecs = (2*rtems_configuration_get_microseconds_per_tick() - clicks); } else { usecs = (rtems_configuration_get_microseconds_per_tick() - clicks); } return usecs * 1000; }