RTEMS | dev/serial/zynq: Improve baud calculation and simplify code (!199)

Sebastian Huber (@sebhub) gitlab at rtems.org
Fri Sep 13 06:02:57 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_112033

 > + * @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,

Also the callers of zynq_uart_calculate_baud() have to make sure that they write back the CLKS bit as is. I think with the assert, the code should be fine.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/199#note_112033
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/75072246/attachment-0001.htm>


More information about the bugs mailing list