RTEMS | dev/serial/zynq: Improve baud calculation and simplify code (!199)
Kinsey Moore (@opticron)
gitlab at rtems.org
Fri Sep 13 03:00:57 UTC 2024
Kinsey Moore started a new discussion on bsps/include/dev/serial/zynq-uart-regs.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/199#note_112017
> + * @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,
It should be made clear that this is explicitly bit 0. I would suggest changing this to a boolean parameter and renaming it accordingly. The original code checked a specific bit where the new code uses this as a scaling factor for a bit shift which can be misleading.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/199#note_112017
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/9eb358d7/attachment-0001.htm>
More information about the bugs
mailing list