Changeset 5857e83c in rtems


Ignore:
Timestamp:
Feb 9, 2020, 7:21:43 PM (4 months ago)
Author:
G S Niteesh <gsnb.gn@…>
Branches:
master
Children:
f53473f
Parents:
b89b442
git-author:
G S Niteesh <gsnb.gn@…> (02/09/20 19:21:43)
git-committer:
Christian Mauderer <oss@…> (02/16/20 15:55:20)
Message:

libchip/ns16550: Allow user calculate baud divisor

This patch will allow the user to pass a function to calculate
the baud divisor.
This will allow for more flexibility, since for some BSPs
like raspberrypi, the calculation of baud divisor is different
from what is in the current driver.

Location:
bsps
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bsps/include/libchip/ns16550.h

    rb89b442 r5857e83c  
    6161typedef void (*ns16550_set_reg)(uintptr_t port, uint8_t reg, uint8_t value);
    6262
    63 typedef struct {
     63typedef struct ns16550_context ns16550_context;
     64
     65typedef uint32_t (*ns16550_calculate_baud_divisor)(ns16550_context *ctx, uint32_t baud);
     66
     67struct ns16550_context{
    6468  rtems_termios_device_context base;
    6569  ns16550_get_reg get_reg;
     
    7983  const char *out_buf;
    8084  rtems_termios_tty *tty;
    81 } ns16550_context;
     85  ns16550_calculate_baud_divisor calculate_baud_divisor;
     86};
    8287
    8388extern const rtems_termios_device_handler ns16550_handler_interrupt;
  • bsps/shared/dev/serial/ns16550-context.c

    rb89b442 r5857e83c  
    113113      fractionalDivider
    114114    );
     115  } else if (ctx->calculate_baud_divisor != NULL) {
     116    baudDivisor = ctx->calculate_baud_divisor(ctx, baud);
    115117  }
    116118
Note: See TracChangeset for help on using the changeset viewer.