[PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart
Gedare Bloom
gedare at rtems.org
Fri Mar 5 15:36:21 UTC 2021
On Mon, Feb 22, 2021 at 9:23 AM Jan Sommer <jan.sommer at dlr.de> wrote:
>
> ---
> bsps/shared/dev/serial/zynq-uart.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/bsps/shared/dev/serial/zynq-uart.c b/bsps/shared/dev/serial/zynq-uart.c
> index 8f17d3ca65..dd5a6e1cb8 100644
> --- a/bsps/shared/dev/serial/zynq-uart.c
> +++ b/bsps/shared/dev/serial/zynq-uart.c
> @@ -144,14 +144,22 @@ static bool zynq_uart_set_attributes(
> {
> zynq_uart_context *ctx = (zynq_uart_context *) context;
> volatile zynq_uart *regs = ctx->regs;
> + int32_t baud;
> uint32_t brgr = 0;
> uint32_t bauddiv = 0;
> uint32_t mode = 0;
> int rc;
>
> - rc = zynq_cal_baud_rate(115200, &brgr, &bauddiv, regs->mode);
> - if (rc != 0)
> - return rc;
> + /*
> + * Determine the baud rate
> + */
> + baud = rtems_termios_baud_to_number(term->c_ospeed);
> +
> + if (baud > 0) {
> + rc = zynq_cal_baud_rate(baud, &brgr, &bauddiv, regs->mode);
> + if (rc != 0)
> + return rc;
> + }
What happens if baud == 0?
>
> /*
> * Configure the mode register
> --
> 2.17.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list