Changeset 336fe3b in rtems


Ignore:
Timestamp:
Nov 8, 2017, 7:19:15 AM (18 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
fdf0e55
Parents:
791469bd
git-author:
Sebastian Huber <sebastian.huber@…> (11/08/17 07:19:15)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/08/17 07:43:27)
Message:

bsp/imx: Better utilize UART transmit FIFO

Update #3090.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/imx/console/console-config.c

    r791469bd r336fe3b  
    1313 */
    1414
     15#include <sys/param.h>
     16
    1517#include <rtems/bspIo.h>
    1618#include <rtems/console.h>
     
    2628#include <libfdt.h>
    2729
     30#define IMX_UART_TX_FIFO_LEVEL 16
     31
    2832typedef struct {
    2933  rtems_termios_device_context base;
     
    3135#ifdef CONSOLE_USE_INTERRUPTS
    3236  rtems_vector_number irq;
    33   bool transmitting;
     37  int tx_in_progress;
    3438#endif
    3539} imx_uart_context;
     
    178182  }
    179183
    180   if (ctx->transmitting && (regs->usr1 & IMX_UART_USR1_TRDY) != 0) {
    181     rtems_termios_dequeue_characters(tty, 1);
     184  if (ctx->tx_in_progress > 0 && (regs->usr1 & IMX_UART_USR1_TRDY) != 0) {
     185    rtems_termios_dequeue_characters(tty, ctx->tx_in_progress);
    182186  }
    183187}
     
    219223  ufcr = regs->ufcr;
    220224  ufcr = IMX_UART_UFCR_RXTL_SET(ufcr, 16);
    221   ufcr = IMX_UART_UFCR_TXTL_SET(ufcr, 16);
     225  ufcr = IMX_UART_UFCR_TXTL_SET(ufcr, IMX_UART_TX_FIFO_LEVEL);
    222226  regs->ufcr = ufcr;
    223227  regs->ucr1 |= IMX_UART_UCR1_RRDYEN;
     
    261265  imx_uart_context *ctx;
    262266  volatile imx_uart *regs;
     267  int n;
    263268  uint32_t ucr1;
    264269
     
    268273
    269274  if (len > 0) {
    270     ctx->transmitting = true;
    271     regs->utxd = IMX_UART_UTXD_TX_DATA(buf[0]);
     275    int i;
     276
     277    n = (int) MIN(len, IMX_UART_TX_FIFO_LEVEL);
    272278    ucr1 |= IMX_UART_UCR1_TRDYEN;
     279
     280    for (i = 0; i < n; ++i) {
     281      regs->utxd = IMX_UART_UTXD_TX_DATA(buf[i]);
     282    }
    273283  } else {
    274     ctx->transmitting = false;
     284    n = 0;
    275285    ucr1 &= ~IMX_UART_UCR1_TRDYEN;
    276286  }
    277287
    278288  regs->ucr1 = ucr1;
     289  ctx->tx_in_progress = n;
    279290#else
    280291  size_t i;
Note: See TracChangeset for help on using the changeset viewer.