RTEMS | dev/serial/zynq: Improve baud calculation and simplify code (!199)
Kinsey Moore (@opticron)
gitlab at rtems.org
Tue Sep 17 02:22:30 UTC 2024
Kinsey Moore started a new discussion on bsps/shared/dev/serial/zynq-uart-polled.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/199#note_112136
> + uint32_t desired_baud,
> + uint32_t mode_clks,
> + uint32_t *cd_ptr,
> + uint32_t *bdiv_ptr
> +)
> +{
> + uint32_t best_error = UINT32_MAX;
> + uint32_t best_cd;
> + uint32_t best_bdiv_plus_one;
> + uint32_t bdiv_plus_one;
> + uint32_t selected_clock;
> +
> + _Assert((mode_clks & ~ZYNQ_UART_MODE_CLKS) == 0);
> + selected_clock = zynq_uart_input_clock() / (1U << (3 * mode_clks));
> +
> + for (bdiv_plus_one = 5; bdiv_plus_one <= 256; ++bdiv_plus_one) {
The previous implementation only checked bdiv=4 to bdiv=254. The new implementation checks up to bdiv=255. Was that an intentional change? The commit that makes this change is very similar in logic, but it is completely reorganized so I've had to spend quite a bit of time unwinding the modifications to verify what parts of the logic have changed.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/199#note_112136
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240917/f4fbfa7b/attachment-0001.htm>
More information about the bugs
mailing list