mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-16 19:04:53 +08:00
bsp_clicks_per_usec held the value of BSP_bus_frequency, which this BSP states in kHz. _CPU_Counter_frequency() multiplies it by 1000000, so the product was 10^10 and did not fit in the uint32_t return type. It wrapped to 1410065408. The clock driver installs the same time base register as a timecounter of 10 MHz, so the two disagreed by a factor of 141. ttest01 compared a tick to time round trip and saw 1.099999999 where it expects 1.100000000. rtems_bsp_delay() reads the same variable and therefore spun 1000 times too long. Derive the clicks per microsecond from the bus frequency and the time base divisor, as mvme3100 does. The counter frequency then equals the frequency of the timecounter. Built and run for powerpc/psim on the GDB simulator. ttest01 passes with the change and fails without it. Close #5725. Assisted-by: Claude:claude-opus-5 claude-code Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>