Ignore:
Timestamp:
Jan 4, 2020, 7:50:46 PM (3 months ago)
Author:
G S Niteesh <gsnb.gn@…>
Branches:
master
Children:
5e7b3c65
Parents:
eca25ef
git-author:
G S Niteesh <gsnb.gn@…> (01/04/20 19:50:46)
git-committer:
Christian Mauderer <christian.mauderer@…> (01/07/20 17:21:16)
Message:

bsp/raspberrypi: Updated the console API.

Replaces the legacy termios API with new termios API (#3034)
Replaces the custom PL011 serial driver with RTEMS arm-pl011.
Update #3034

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/raspberrypi/console/fbcons.c

    reca25ef r362cf319  
    1919#include <rtems.h>
    2020#include <rtems/libio.h>
     21#include <rtems/termiostypes.h>
    2122
    2223#include <stdlib.h>
     
    3132
    3233/*
    33  *  fbcons_init
    34  *
    35  *  This function initializes the fb console to a quiecsent state.
    36  */
    37 static void fbcons_init( int minor )
    38 {
    39 }
    40 
    41 /*
    4234 *  fbcons_open
    4335 *
     
    4638 *  Default state is 9600 baud, 8 bits, No parity, and 1 stop bit.
    4739 */
    48 static int fbcons_open(
    49   int   major,
    50   int   minor,
    51   void *arg
     40static bool fbcons_open(
     41  struct rtems_termios_tty *tty,
     42  rtems_termios_device_context *base,
     43  struct termios *term,
     44  rtems_libio_open_close_args_t *args
    5245)
    5346{
    54   return RTEMS_SUCCESSFUL;
     47  return true;
    5548}
    5649
     
    6053 *  This function shuts down the requested port.
    6154 */
    62 static int fbcons_close(
    63   int   major,
    64   int   minor,
    65   void *arg
     55static void fbcons_close(
     56  struct rtems_termios_tty *tty,
     57  rtems_termios_device_context *base,
     58  rtems_libio_open_close_args_t *args
    6659)
    6760{
    68   return ( RTEMS_SUCCESSFUL );
    6961}
    7062
     
    7466 *  This routine polls out the requested character.
    7567 */
    76 static void fbcons_write_polled(
    77   int  minor,
     68void fbcons_write_polled(
     69  rtems_termios_device_context *base,
    7870  char c
    7971)
     
    9183 *
    9284 */
    93 static ssize_t fbcons_write_support_polled(
    94   int         minor,
     85static void fbcons_write_support_polled(
     86  rtems_termios_device_context *base,
    9587  const char *buf,
    9688  size_t      len
     
    10395   */
    10496  while ( nwrite < len ) {
    105     fbcons_write_polled( minor, *buf++ );
     97    fbcons_write_polled( base, *buf++ );
    10698    nwrite++;
    10799  }
    108 
    109   /*
    110    * return the number of bytes written.
    111    */
    112   return nwrite;
    113100}
    114101
     
    118105 *  Console Termios polling input entry point.
    119106 */
    120 static int fbcons_inbyte_nonblocking_polled( int minor )
     107static int fbcons_inbyte_nonblocking_polled(
     108  rtems_termios_device_context *base
     109)
    121110{
    122111  // if( rtems_kbpoll() ) {
     
    134123 *  port settings.
    135124 */
    136 static int fbcons_set_attributes(
    137   int                   minor,
     125static bool fbcons_set_attributes(
     126  rtems_termios_device_context *base,
    138127  const struct termios *t
    139128)
    140129{
    141   return 0;
     130  return true;
    142131}
    143132
    144 bool fbcons_probe( int minor )
     133bool fbcons_probe(
     134  rtems_termios_device_context *context
     135)
    145136{
    146137  // rtems_status_code status;
     
    164155}
    165156
    166 const console_fns fbcons_fns =
     157const rtems_termios_device_handler fbcons_fns =
    167158{
    168   .deviceProbe = libchip_serial_default_probe,     /* deviceProbe */
    169   .deviceFirstOpen = fbcons_open,                 /* deviceFirstOpen */
    170   .deviceLastClose = fbcons_close,                /* deviceLastClose */
    171   .deviceRead = fbcons_inbyte_nonblocking_polled, /* deviceRead */
    172   .deviceWrite = fbcons_write_support_polled,     /* deviceWrite */
    173   .deviceInitialize = fbcons_init,                /* deviceInitialize */
    174   .deviceWritePolled = fbcons_write_polled,       /* deviceWritePolled */
    175   .deviceSetAttributes = fbcons_set_attributes,   /* deviceSetAttributes */
    176   .deviceOutputUsesInterrupts = FALSE,           /* deviceOutputUsesInterrupts*/
     159  .first_open = fbcons_open,
     160  .last_close = fbcons_close,
     161  .poll_read = fbcons_inbyte_nonblocking_polled,
     162  .write = fbcons_write_support_polled,
     163  .set_attributes = fbcons_set_attributes,
     164  .mode = TERMIOS_POLLED
    177165};
Note: See TracChangeset for help on using the changeset viewer.