RTEMS | dev/serial/zynq: Improve baud calculation and simplify code (!199)
Sebastian Huber (@sebhub)
gitlab at rtems.org
Fri Sep 13 03:17:54 UTC 2024
Sebastian Huber commented on a discussion on bsps/include/dev/serial/zynq-uart-regs.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/199#note_112019
> + * @param desired_baud is the desired baud for an Zynq UART device.
> + *
> + * @param mode_clks is the value of the CLKS bit of the Zynq UART mode register.
> + *
> + * @param cd_ptr[out] is a reference to an uint32_t object. The function
> + * stores the calculated clock divisor to this object.
> + *
> + * @param bdiv_ptr[out] is a reference to an uint32_t object. The function
> + * stores the calculated baud divisor to this object.
> + *
> + * @return Returns the absolute error of the calculated baud to the desired
> + * baud in Hz.
> + */
> +uint32_t zynq_uart_calculate_baud(
> + uint32_t desired_baud,
> + uint32_t mode_clks,
In the description we have: `@param mode_clks is the value of the CLKS bit of the Zynq UART mode register.`.
Using a bool just leads to more branches. I can add an `_Assert((mode_clks & ~ZYNQ_UART_MODE_CLKS) == 0)` to zynq_uart_calculate_baud().
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/199#note_112019
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/20240913/b93ea783/attachment.htm>
More information about the bugs
mailing list