File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 3030// The system tick uses the "12" half of the timer, and the PRU1 (TODO) uses the "34" half.
3131static const uint32_t auxclk_freq_hz = SOC_ASYNC_2_FREQ ;
3232static const uint32_t timer_ms_period = (auxclk_freq_hz / 1000 ) - 1 ;
33+ static const uint32_t timer_us_division = auxclk_freq_hz / 1000000 ;
3334
3435/**
3536 * The current tick in milliseconds
@@ -81,17 +82,19 @@ void pbdrv_clock_init(void) {
8182}
8283
8384uint32_t pbdrv_clock_get_us (void ) {
84- // TODO: TIAM1808 implementation.
85- return 0 ;
85+ uint32_t tim_val = TimerCounterGet (SOC_TMR_0_REGS , TMR_TIMER12 );
86+ uint32_t t_us = tim_val / timer_us_division ;
87+ return pbdrv_clock_get_ms () * 1000 + t_us ;
8688}
8789
8890uint32_t pbdrv_clock_get_ms (void ) {
8991 return systick_ms ;
9092}
9193
9294uint32_t pbdrv_clock_get_100us (void ) {
93- // REVISIT: Use actual time since this isn't providing better resolution.
94- return pbdrv_clock_get_ms () * 10 ;
95+ uint32_t tim_val = TimerCounterGet (SOC_TMR_0_REGS , TMR_TIMER12 );
96+ uint32_t t_100_us = tim_val / timer_us_division / 100 ;
97+ return pbdrv_clock_get_ms () * 10 + t_100_us ;
9598}
9699
97100#endif // PBDRV_CONFIG_CLOCK_TIAM1808
You can’t perform that action at this time.
0 commit comments