Changeset 31f90a2 in rtems


Ignore:
Timestamp:
07/06/18 11:52:22 (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
1a19239
Parents:
bca36d9
git-author:
Sebastian Huber <sebastian.huber@…> (07/06/18 11:52:22)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/06/18 12:27:29)
Message:

bsp/riscv: Simplify printk() support

This is a prepartion to add NS16550 driver support to the console
driver.

Update #3433.

Location:
bsps/riscv/riscv
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bsps/riscv/riscv/console/console-config.c

    rbca36d9 r31f90a2  
    3232static struct {
    3333  rtems_termios_device_context *context;
    34   void (*write_polled)(
    35     rtems_termios_device_context *base,
    36     const char *buf,
    37     size_t len
    38   );
    39   int (*poll_char)(rtems_termios_device_context *base);
     34  void (*putchar)(rtems_termios_device_context *base, char c);
     35  int (*getchar)(rtems_termios_device_context *base);
    4036} riscv_console;
    4137
    4238static void riscv_output_char(char c)
    4339{
    44   (*riscv_console.write_polled)(riscv_console.context, &c, 1);
     40  (*riscv_console.putchar)(riscv_console.context, c);
    4541}
    4642
     
    7773
    7874      riscv_console.context = &htif_console_instance.base;
    79       riscv_console.write_polled = htif_console_write_polled;
    80       riscv_console.poll_char = htif_console_poll_char;
     75      riscv_console.putchar = htif_console_putchar;
     76      riscv_console.getchar = htif_console_getchar;
    8177    };
    8278#endif
  • bsps/riscv/riscv/console/htif.c

    rbca36d9 r31f90a2  
    7474}
    7575
    76 int htif_console_poll_char(rtems_termios_device_context *base)
     76int htif_console_getchar(rtems_termios_device_context *base)
    7777{
    7878  __check_fromhost();
     
    8686}
    8787
    88 void htif_console_write_polled(
     88void htif_console_putchar(rtems_termios_device_context *base, char c)
     89{
     90  __set_tohost(1, 1, c);
     91}
     92
     93static void htif_console_write_polled(
    8994  rtems_termios_device_context *base,
    9095  const char *buf,
     
    95100
    96101  for (i = 0; i < len; ++i) {
    97     __set_tohost(1, 1, buf[i]);
     102    htif_console_putchar(base, buf[i]);
    98103  }
    99104}
     
    128133  .first_open = htif_console_first_open,
    129134  .write = htif_console_write_polled,
    130   .poll_read = htif_console_poll_char,
     135  .poll_read = htif_console_getchar,
    131136  .mode = TERMIOS_POLLED
    132137};
  • bsps/riscv/riscv/include/dev/serial/htif.h

    rbca36d9 r31f90a2  
    4242);
    4343
    44 void htif_console_write_polled(
    45   rtems_termios_device_context *base,
    46   const char *buf,
    47   size_t len
    48 );
     44void htif_console_putchar(rtems_termios_device_context *base, char c);
    4945
    50 int htif_console_poll_char(rtems_termios_device_context *base);
     46int htif_console_getchar(rtems_termios_device_context *base);
    5147
    5248const rtems_termios_device_handler htif_console_handler;
Note: See TracChangeset for help on using the changeset viewer.