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.
3131const uint32_t auxclk_freq_hz = 24000000 ;
3232const uint32_t timer_ms_period = (auxclk_freq_hz / 1000 ) - 1 ;
33+ const uint32_t timer_us_division = auxclk_freq_hz / 1000000 ;
3334
3435/**
3536 * The current tick in milliseconds
@@ -105,17 +106,19 @@ void pbdrv_clock_init(void) {
105106}
106107
107108uint32_t pbdrv_clock_get_us (void ) {
108- // TODO: TIAM1808 implementation.
109- return 0 ;
109+ uint32_t tim_val = TimerCounterGet (SOC_TMR_0_REGS , TMR_TIMER12 );
110+ uint32_t t_us = tim_val / timer_us_division ;
111+ return pbdrv_clock_get_ms () * 1000 + t_us ;
110112}
111113
112114uint32_t pbdrv_clock_get_ms (void ) {
113115 return systick_ms ;
114116}
115117
116118uint32_t pbdrv_clock_get_100us (void ) {
117- // REVISIT: Use actual time since this isn't providing better resolution.
118- return pbdrv_clock_get_ms () * 10 ;
119+ uint32_t tim_val = TimerCounterGet (SOC_TMR_0_REGS , TMR_TIMER12 );
120+ uint32_t t_100_us = tim_val / timer_us_division / 100 ;
121+ return pbdrv_clock_get_ms () * 10 + t_100_us ;
119122}
120123
121124void pbdrv_clock_busy_delay_ms (uint32_t ms ) {
You can’t perform that action at this time.
0 commit comments