Changeset 6ebf376b in rtems


Ignore:
Timestamp:
Feb 22, 2021, 3:39:59 PM (2 months ago)
Author:
Jan Sommer <jan.sommer@…>
Branches:
master
Children:
1eaf4e46
Parents:
f662420
git-author:
Jan Sommer <jan.sommer@…> (02/22/21 15:39:59)
git-committer:
Jan Sommer <jan.sommer@…> (03/05/21 18:06:25)
Message:

bsps/shared: Allow setting baud rate for zynq uart

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/shared/dev/serial/zynq-uart.c

    rf662420 r6ebf376b  
    145145  zynq_uart_context *ctx = (zynq_uart_context *) context;
    146146  volatile zynq_uart *regs = ctx->regs;
     147  int32_t baud;
    147148  uint32_t brgr = 0;
    148149  uint32_t bauddiv = 0;
     
    150151  int rc;
    151152
    152   rc = zynq_cal_baud_rate(115200, &brgr, &bauddiv, regs->mode);
    153   if (rc != 0)
    154     return rc;
     153  /*
     154   * Determine the baud rate
     155   */
     156  baud = rtems_termios_baud_to_number(term->c_ospeed);
     157
     158  if (baud > 0) {
     159    rc = zynq_cal_baud_rate(baud, &brgr, &bauddiv, regs->mode);
     160    if (rc != 0)
     161      return rc;
     162  }
    155163
    156164  /*
     
    203211  regs->control &= ~(ZYNQ_UART_CONTROL_RXEN | ZYNQ_UART_CONTROL_TXEN);
    204212  regs->mode = mode;
    205   regs->baud_rate_gen = ZYNQ_UART_BAUD_RATE_GEN_CD(brgr);
    206   regs->baud_rate_div = ZYNQ_UART_BAUD_RATE_DIV_BDIV(bauddiv);
     213  /* Ignore baud rate of B0. There are no modem control lines to de-assert */
     214  if (baud > 0) {
     215    regs->baud_rate_gen = ZYNQ_UART_BAUD_RATE_GEN_CD(brgr);
     216    regs->baud_rate_div = ZYNQ_UART_BAUD_RATE_DIV_BDIV(bauddiv);
     217  }
    207218  regs->control |= ZYNQ_UART_CONTROL_RXEN | ZYNQ_UART_CONTROL_TXEN;
    208219
Note: See TracChangeset for help on using the changeset viewer.