<div dir="ltr"><div dir="ltr">On Fri, Dec 27, 2019 at 3:38 PM Christian Mauderer <<a href="mailto:list@c-mauderer.de">list@c-mauderer.de</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 27/12/2019 11:03, Niteesh wrote:<br>
> I tried building it. I basically ran make in previously create rpi2 BSP<br>
> folder.<br>
> I did get some compile-time error, but I have fixed them. Now I get<br>
> an*undefined reference to `arm_pl011_write_polled'*<br>
> How to include the arm_pl011.c file?<br>
<br>
You have to add the file here:<br>
<br>
c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br></blockquote><div>Did you mean the <a href="http://header.am">header.am</a> file? Or should I make a Makefile.am? </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Note that you will have to execute a bootstrap again as soon as you<br>
change anything there.<br>
<br>
These files still follow an old folder structure. But they will be<br>
replaced soon by Sebastians work on the new build system.<br>
<br>
> <br>
> On Fri, Dec 27, 2019 at 3:15 PM Niteesh <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>> wrote:<br>
> <br>
>     The changes I have made so far<br>
> <br>
>     diff --git a/bsps/arm/raspberrypi/console/console-config.c<br>
>     b/bsps/arm/raspberrypi/console/console-config.c<br>
>     index d2186c918b..d982b2c9c2 100644<br>
>     --- a/bsps/arm/raspberrypi/console/console-config.c<br>
>     +++ b/bsps/arm/raspberrypi/console/console-config.c<br>
>     @@ -22,45 +22,53 @@<br>
>      <br>
>      #include <libchip/serial.h><br>
>      <br>
>     -#include <bspopts.h><br>
>      #include <bsp/irq.h><br>
>      #include <bsp/usart.h><br>
>      #include <bsp/raspberrypi.h><br>
>     +#include <bsp/arm-pl011.h><br>
>      #include <bsp/fbcons.h><br>
>      <br>
>     -console_tbl Console_Configuration_Ports [] = {<br>
>     -    {<br>
>     -      .sDeviceName = "/dev/ttyS0",<br>
>     -      .deviceType = SERIAL_CUSTOM,<br>
>     -      .pDeviceFns = &bcm2835_usart_fns,<br>
>     -      .deviceProbe = NULL,<br>
>     -      .pDeviceFlow = NULL,<br>
>     -      .ulCtrlPort1 = BCM2835_UART0_BASE,<br>
>     -      .ulCtrlPort2 = 0,<br>
>     -      .ulClock = USART0_DEFAULT_BAUD,<br>
>     -      .ulIntVector = BCM2835_IRQ_ID_UART<br>
>     -    },<br>
>     -    {<br>
>     -      .sDeviceName ="/dev/fbcons",<br>
>     -      .deviceType = SERIAL_CUSTOM,<br>
>     -      .pDeviceFns = &fbcons_fns,<br>
>     -      .deviceProbe = fbcons_probe,<br>
>     -      .pDeviceFlow = NULL,<br>
>     -    },<br>
>     +#include <bspopts.h><br>
>     +<br>
>     +arm_pl011_context pl011_context = {<br>
>     +  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),<br>
>     +  .regs = (volatile pl011 *) BCM2835_PL011_BASE,<br>
>     +  .initial_baud = PL011_DEFAULT_BAUD<br>
>      };<br>
>      <br>
>     -#define PORT_COUNT \<br>
>     -  (sizeof(Console_Configuration_Ports) \<br>
>     -    / sizeof(Console_Configuration_Ports [0]))<br>
>     +rpi_fb_context fb_context = {<br>
>     +  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("FB")<br>
>     +};<br>
>      <br>
>     -unsigned long Console_Configuration_Count = PORT_COUNT;<br>
>     +const console_device console_device_table[] = {<br>
>     +  {<br>
>     +    .device_file = "/dev/ttyS0",<br>
>     +    .probe = console_device_probe_default,<br>
>     +    .handler = &arm_pl011_fns,<br>
>     +    .context = &pl011_context.base<br>
>     +  },<br>
>     +  {<br>
>     +    .device_file = "/dev/fb0",<br>
>     +    // Should be changed to fbcons_probe (but it still use old<br>
>     interface)<br>
>     +    .probe = fbcons_probe,<br>
>     +    .handler = &fbcons_fns,<br>
>     +    .context = &fb_context.base<br>
>     +  }<br>
>     +}<br>
>     +<br>
>     +const size_t console_device_count =<br>
>     RTEMS_ARRAY_SIZE(console_device_table);<br>
>      <br>
>      static void output_char(char c)<br>
>      {<br>
>     -  const console_fns *con =<br>
>     -    Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;<br>
>     -<br>
>     -  con->deviceWritePolled((int) Console_Port_Minor, c);<br>
>     +  switch(SERIAL){<br>
>     +    case FB:<br>
>     +      fbcons_write_polled(&fb_context.base, c);<br>
>     +      break;<br>
>     +    case PL011:<br>
>     +      arm_pl011_write_polled(&pl011_context.base, c);<br>
>     +      break;<br>
>     +  }<br>
>     +  <br>
>      }<br>
>      <br>
>      BSP_output_char_function_type BSP_output_char = output_char;<br>
>     diff --git a/bsps/arm/raspberrypi/console/console_select.c<br>
>     b/bsps/arm/raspberrypi/console/console_select.c<br>
>     index bd246ca868..dbca5c324f 100644<br>
>     --- a/bsps/arm/raspberrypi/console/console_select.c<br>
>     +++ b/bsps/arm/raspberrypi/console/console_select.c<br>
>     @@ -15,7 +15,7 @@<br>
>       *  <a href="http://www.rtems.org/license/LICENSE" rel="noreferrer" target="_blank">http://www.rtems.org/license/LICENSE</a><br>
>       *<br>
>       */<br>
>     -<br>
>     +#include <bsp/raspberrypi.h><br>
>      #include <bsp.h><br>
>      #include <bsp/fatal.h><br>
>      #include <rtems/libio.h><br>
>     @@ -30,53 +30,7 @@<br>
>      #include <bsp/rpi-fb.h><br>
>      <br>
>      rtems_device_minor_number BSPPrintkPort = 0;<br>
>     -<br>
>     -/*<br>
>     - * Method to return true if the device associated with the<br>
>     - * minor number probs available.<br>
>     - */<br>
>     -static bool bsp_Is_Available( rtems_device_minor_number minor )<br>
>     -{<br>
>     -  console_tbl *cptr = Console_Port_Tbl[ minor ];<br>
>     -<br>
>     -  /*<br>
>     -   * First perform the configuration dependent probe, then the<br>
>     -   * device dependent probe<br>
>     -   */<br>
>     -  if ( ( !cptr->deviceProbe || cptr->deviceProbe( minor ) ) &&<br>
>     -       cptr->pDeviceFns->deviceProbe( minor ) ) {<br>
>     -    return true;<br>
>     -  }<br>
>     -<br>
>     -  return false;<br>
>     -}<br>
>     -<br>
>     -/*<br>
>     - * Method to return the first available device.<br>
>     - */<br>
>     -static rtems_device_minor_number bsp_First_Available_Device( void )<br>
>     -{<br>
>     -  rtems_device_minor_number minor;<br>
>     -<br>
>     -  for ( minor = 0; minor < Console_Port_Count; minor++ ) {<br>
>     -    console_tbl *cptr = Console_Port_Tbl[ minor ];<br>
>     -<br>
>     -    /*<br>
>     -     * First perform the configuration dependent probe, then the<br>
>     -     * device dependent probe<br>
>     -     */<br>
>     -<br>
>     -    if ( ( !cptr->deviceProbe || cptr->deviceProbe( minor ) ) &&<br>
>     -         cptr->pDeviceFns->deviceProbe( minor ) ) {<br>
>     -      return minor;<br>
>     -    }<br>
>     -  }<br>
>     -<br>
>     -  /*<br>
>     -   *  Error No devices were found.  We will want to bail here.<br>
>     -   */<br>
>     -  bsp_fatal( BSP_FATAL_CONSOLE_NO_DEV );<br>
>     -}<br>
>     +CURRENT_SERIAL SERIAL = PL011;<br>
>      <br>
>      void bsp_console_select( void )<br>
>      {<br>
>     @@ -90,25 +44,13 @@ void bsp_console_select( void )<br>
>         */<br>
>        const char *opt;<br>
>      <br>
>     -  Console_Port_Minor = BSP_CONSOLE_UART0;<br>
>     -  BSPPrintkPort = BSP_CONSOLE_UART0;<br>
>     -<br>
>        opt = rpi_cmdline_get_arg( "--console=" );<br>
>      <br>
>        if ( opt ) {<br>
>          if ( strncmp( opt, "fbcons", sizeof( "fbcons" ) - 1 ) == 0 ) {<br>
>            if ( rpi_video_is_initialized() > 0 ) {<br>
>     -        Console_Port_Minor = BSP_CONSOLE_FB;<br>
>     -        BSPPrintkPort = BSP_CONSOLE_FB;<br>
>     +        SERIAL = FB;<br>
>            }<br>
>          }<br>
>        }<br>
>     -<br>
>     -  /*<br>
>     -   * If the device that was selected isn't available then<br>
>     -   * let the user know and select the first available device.<br>
>     -   */<br>
>     -  if ( !bsp_Is_Available( Console_Port_Minor ) ) {<br>
>     -    Console_Port_Minor = bsp_First_Available_Device();<br>
>     -  }<br>
>      }<br>
>     diff --git a/bsps/arm/raspberrypi/console/fbcons.c<br>
>     b/bsps/arm/raspberrypi/console/fbcons.c<br>
>     index 3669ba458d..26a694ac9f 100644<br>
>     --- a/bsps/arm/raspberrypi/console/fbcons.c<br>
>     +++ b/bsps/arm/raspberrypi/console/fbcons.c<br>
>     @@ -18,6 +18,7 @@<br>
>      <br>
>      #include <rtems.h><br>
>      #include <rtems/libio.h><br>
>     +#include <rtems/termiostypes.h><br>
>      <br>
>      #include <stdlib.h><br>
>      <br>
>     @@ -46,9 +47,10 @@ static void fbcons_init( int minor )<br>
>       *  Default state is 9600 baud, 8 bits, No parity, and 1 stop bit.<br>
>       */<br>
>      static int fbcons_open(<br>
>     -  int   major,<br>
>     -  int   minor,<br>
>     -  void *arg<br>
>     +  struct rtems_termios_tty *tty,<br>
>     +  rtems_termios_device_context *base,<br>
>     +  struct termios *term,<br>
>     +  rtems_libio_open_close_args_t *args<br>
>      )<br>
>      {<br>
>        return RTEMS_SUCCESSFUL;<br>
>     @@ -60,9 +62,9 @@ static int fbcons_open(<br>
>       *  This function shuts down the requested port.<br>
>       */<br>
>      static int fbcons_close(<br>
>     -  int   major,<br>
>     -  int   minor,<br>
>     -  void *arg<br>
>     +  struct rtems_termios_tty *tty,<br>
>     +  rtems_termios_device_context *base,<br>
>     +  rtems_libio_open_close_args_t *args<br>
>      )<br>
>      {<br>
>        return ( RTEMS_SUCCESSFUL );<br>
>     @@ -73,8 +75,8 @@ static int fbcons_close(<br>
>       *<br>
>       *  This routine polls out the requested character.<br>
>       */<br>
>     -static void fbcons_write_polled(<br>
>     -  int  minor,<br>
>     +void fbcons_write_polled(<br>
>     +  rtems_termios_device_context *base,<br>
>        char c<br>
>      )<br>
>      {<br>
>     @@ -91,7 +93,7 @@ static void fbcons_write_polled(<br>
>       *<br>
>       */<br>
>      static ssize_t fbcons_write_support_polled(<br>
>     -  int         minor,<br>
>     +  rtems_termios_device_context *base,<br>
>        const char *buf,<br>
>        size_t      len<br>
>      )<br>
>     @@ -102,7 +104,7 @@ static ssize_t fbcons_write_support_polled(<br>
>         * poll each byte in the string out of the port.<br>
>         */<br>
>        while ( nwrite < len ) {<br>
>     -    fbcons_write_polled( minor, *buf++ );<br>
>     +    fbcons_write_polled( base, *buf++ );<br>
>          nwrite++;<br>
>        }<br>
>      <br>
>     @@ -117,7 +119,9 @@ static ssize_t fbcons_write_support_polled(<br>
>       *<br>
>       *  Console Termios polling input entry point.<br>
>       */<br>
>     -static int fbcons_inbyte_nonblocking_polled( int minor )<br>
>     +static int fbcons_inbyte_nonblocking_polled(<br>
>     +  rtems_termios_device_context *base,<br>
>     +)<br>
>      {<br>
>        // if( rtems_kbpoll() ) {<br>
>        //   int c = getch();<br>
>     @@ -134,14 +138,16 @@ static int fbcons_inbyte_nonblocking_polled(<br>
>     int minor )<br>
>       *  port settings.<br>
>       */<br>
>      static int fbcons_set_attributes(<br>
>     -  int                   minor,<br>
>     +  rtems_termios_device_context *base,<br>
>        const struct termios *t<br>
>      )<br>
>      {<br>
>        return 0;<br>
>      }<br>
>      <br>
>     -bool fbcons_probe( int minor )<br>
>     +bool fbcons_probe(<br>
>     +  rtems_termios_device_context *base,<br>
>     +)<br>
>      {<br>
>        // rtems_status_code status;<br>
>        static bool firstTime = true;<br>
>     @@ -163,15 +169,11 @@ bool fbcons_probe( int minor )<br>
>        return ret;<br>
>      }<br>
>      <br>
>     -const console_fns fbcons_fns =<br>
>     +const rtems_termios_device_handler fbcons_fns =<br>
>      {<br>
>     -  .deviceProbe = libchip_serial_default_probe,     /* deviceProbe */<br>
>     -  .deviceFirstOpen = fbcons_open,                 /* deviceFirstOpen */<br>
>     -  .deviceLastClose = fbcons_close,                /* deviceLastClose */<br>
>     -  .deviceRead = fbcons_inbyte_nonblocking_polled, /* deviceRead */<br>
>     -  .deviceWrite = fbcons_write_support_polled,     /* deviceWrite */<br>
>     -  .deviceInitialize = fbcons_init,                /*<br>
>     deviceInitialize */<br>
>     -  .deviceWritePolled = fbcons_write_polled,       /*<br>
>     deviceWritePolled */<br>
>     -  .deviceSetAttributes = fbcons_set_attributes,   /*<br>
>     deviceSetAttributes */<br>
>     -  .deviceOutputUsesInterrupts = FALSE,           /*<br>
>     deviceOutputUsesInterrupts*/<br>
>     -};<br>
>     +  .first_open = fbcons_open,<br>
>     +  .last_close = fbcons_close,<br>
>     +  .poll_read = fbcons_inbyte_nonblocking_polled,<br>
>     +  .write = fbcons_write_support_polled,<br>
>     +  .mode = TERMIOS_POLLED<br>
>     +};<br>
>     \ No newline at end of file<br>
>     diff --git a/bsps/arm/raspberrypi/console/usart.c<br>
>     b/bsps/arm/raspberrypi/console/usart.c<br>
>     index 25fb523621..471d0c553f 100644<br>
>     --- a/bsps/arm/raspberrypi/console/usart.c<br>
>     +++ b/bsps/arm/raspberrypi/console/usart.c<br>
>     @@ -23,145 +23,3 @@<br>
>      #include <bsp/usart.h><br>
>      #include <bsp/raspberrypi.h><br>
>      #include <rtems/bspIo.h><br>
>     -<br>
>     -static void usart_delay(uint32_t n)<br>
>     -{<br>
>     - volatile uint32_t i = 0;<br>
>     -<br>
>     - for(i = 0; i < n; i++)<br>
>     -   ;<br>
>     -}<br>
>     -<br>
>     -#if 0<br>
>     -/*<br>
>     - *  These will be useful when the driver supports interrupt driven IO.<br>
>     - */<br>
>     -static rtems_vector_number usart_get_irq_number(const console_tbl *ct)<br>
>     -{<br>
>     -  return ct->ulIntVector;<br>
>     -}<br>
>     -<br>
>     -static uint32_t usart_get_baud(const console_tbl *ct)<br>
>     -{<br>
>     -  return ct->ulClock;<br>
>     -}<br>
>     -#endif<br>
>     -<br>
>     -static void usart_set_baud(int minor, int baud)<br>
>     -{<br>
>     - /*<br>
>     -  * Nothing for now<br>
>     -  */<br>
>     - return;<br>
>     -}<br>
>     -<br>
>     -static void usart_initialize(int minor)<br>
>     -{<br>
>     -  unsigned int gpio_reg;<br>
>     -<br>
>     -  /*<br>
>     -  ** Program GPIO pins for UART 0<br>
>     -  */<br>
>     -  gpio_reg = BCM2835_REG(BCM2835_GPIO_GPFSEL1);<br>
>     -  gpio_reg &= ~(7<<12);    /* gpio14 */<br>
>     -  gpio_reg |=  (4<<12);    /* alt0   */<br>
>     -  gpio_reg &= ~(7<<15);    /* gpio15 */<br>
>     -  gpio_reg |=  (4<<15);    /* alt0   */<br>
>     -  BCM2835_REG(BCM2835_GPIO_GPFSEL1) = gpio_reg;<br>
>     -<br>
>     -  BCM2835_REG(BCM2835_GPIO_GPPUD) = 0;<br>
>     -  usart_delay(150);<br>
>     -  BCM2835_REG(BCM2835_GPIO_GPPUDCLK0) = (1<<14)|(1<<15);<br>
>     -  usart_delay(150);<br>
>     -  BCM2835_REG(BCM2835_GPIO_GPPUDCLK0) = 0;<br>
>     -<br>
>     -  /*<br>
>     -  ** Init the PL011 UART<br>
>     -  */<br>
>     -  BCM2835_REG(BCM2835_UART0_CR)   = 0;<br>
>     -  BCM2835_REG(BCM2835_UART0_ICR)  = 0x7FF;<br>
>     -  BCM2835_REG(BCM2835_UART0_IMSC) = 0;<br>
>     -  BCM2835_REG(BCM2835_UART0_IBRD) = 1;<br>
>     -  BCM2835_REG(BCM2835_UART0_FBRD) = 40;<br>
>     -  BCM2835_REG(BCM2835_UART0_LCRH) = 0x70;<br>
>     -  BCM2835_REG(BCM2835_UART0_RSRECR) =  0;<br>
>     -<br>
>     -  BCM2835_REG(BCM2835_UART0_CR)   = 0x301;<br>
>     -<br>
>     -  BCM2835_REG(BCM2835_UART0_IMSC) = BCM2835_UART0_IMSC_RX;<br>
>     -<br>
>     -  usart_set_baud(minor, 115000);<br>
>     -}<br>
>     -<br>
>     -static int usart_first_open(int major, int minor, void *arg)<br>
>     -{<br>
>     -  rtems_libio_open_close_args_t *oc =<br>
>     (rtems_libio_open_close_args_t *) arg;<br>
>     -  struct rtems_termios_tty *tty = (struct rtems_termios_tty *)<br>
>     oc->iop->data1;<br>
>     -  const console_tbl *ct = Console_Port_Tbl [minor];<br>
>     -  console_data *cd = &Console_Port_Data [minor];<br>
>     -<br>
>     -  cd->termios_data = tty;<br>
>     -  rtems_termios_set_initial_baud(tty, ct->ulClock);<br>
>     -<br>
>     -  return 0;<br>
>     -}<br>
>     -<br>
>     -static int usart_last_close(int major, int minor, void *arg)<br>
>     -{<br>
>     -  return 0;<br>
>     -}<br>
>     -<br>
>     -static int usart_read_polled(int minor)<br>
>     -{<br>
>     -  if (minor == 0) {<br>
>     -    if (((BCM2835_REG(BCM2835_UART0_FR)) & BCM2835_UART0_FR_RXFE)<br>
>     == 0) {<br>
>     -       return((BCM2835_REG(BCM2835_UART0_DR)) & 0xFF );<br>
>     -    } else {<br>
>     -      return -1;<br>
>     -    }<br>
>     -  } else {<br>
>     -    printk("Unknown console minor number: %d\n", minor);<br>
>     -    return -1;<br>
>     -  }<br>
>     -}<br>
>     -<br>
>     -static void usart_write_polled(int minor, char c)<br>
>     -{<br>
>     -   while (1) {<br>
>     -     if ((BCM2835_REG(BCM2835_UART0_FR) & BCM2835_UART0_FR_TXFF) == 0)<br>
>     -       break;<br>
>     -   }<br>
>     -   BCM2835_REG(BCM2835_UART0_DR) = c;<br>
>     -}<br>
>     -<br>
>     -static ssize_t usart_write_support_polled(<br>
>     -  int minor,<br>
>     -  const char *s,<br>
>     -  size_t n<br>
>     -)<br>
>     -{<br>
>     -  ssize_t i = 0;<br>
>     -<br>
>     -  for (i = 0; i < n; ++i) {<br>
>     -    usart_write_polled(minor, s [i]);<br>
>     -  }<br>
>     -<br>
>     -  return n;<br>
>     -}<br>
>     -<br>
>     -static int usart_set_attributes(int minor, const struct termios *term)<br>
>     -{<br>
>     -  return -1;<br>
>     -}<br>
>     -<br>
>     -const console_fns bcm2835_usart_fns = {<br>
>     -  .deviceProbe = libchip_serial_default_probe,<br>
>     -  .deviceFirstOpen = usart_first_open,<br>
>     -  .deviceLastClose = usart_last_close,<br>
>     -  .deviceRead = usart_read_polled,<br>
>     -  .deviceWrite = usart_write_support_polled,<br>
>     -  .deviceInitialize = usart_initialize,<br>
>     -  .deviceWritePolled = usart_write_polled,<br>
>     -  .deviceSetAttributes = usart_set_attributes,<br>
>     -  .deviceOutputUsesInterrupts = false<br>
>     -};<br>
>     diff --git a/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
>     b/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
>     index d0e126699a..f2ff25dc63 100644<br>
>     --- a/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
>     +++ b/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
>     @@ -33,12 +33,23 @@ extern "C" {<br>
>      <br>
>      #define FB_CONSOLE 0x50492835<br>
>      <br>
>     -bool fbcons_probe( int minor );<br>
>     +bool fbcons_probe(<br>
>     +  rtems_termios_device_context *base,<br>
>     + );<br>
>     +<br>
>     +void fbcons_write_polled(<br>
>     +  rtems_termios_device_context *base,<br>
>     +  char c<br>
>     +);<br>
>     +<br>
>     +typedef struct {<br>
>     +    rtems_termios_device_context base;<br>
>     +} rpi_fb_context ;<br>
>      <br>
>      /*<br>
>       * Driver function table<br>
>       */<br>
>     -extern const console_fns fbcons_fns;<br>
>     +extern const rtems_termios_device_handler fbcons_fns;<br>
>      <br>
>      #ifdef __cplusplus<br>
>      }<br>
>     diff --git a/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
>     b/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
>     index 40c80cf408..4e5c84c741 100644<br>
>     --- a/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
>     +++ b/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
>     @@ -60,6 +60,22 @@<br>
>      <br>
>      #define RPI_PERIPHERAL_SIZE         0x01000000<br>
>      <br>
>     +/**<br>
>     + * @name Current Serial Device<br>
>     + *<br>
>     + * @{<br>
>     + */<br>
>     +<br>
>     +typedef enum {<br>
>     +  PL011 = 0,<br>
>     +  AUX_UART,<br>
>     +  FB<br>
>     +}CURRENT_SERIAL;<br>
>     +<br>
>     +extern CURRENT_SERIAL SERIAL;<br>
>     +<br>
>     +/** @} */<br>
>     +<br>
>      /**<br>
>       * @name Internal ARM Timer Registers<br>
>       *<br>
>     @@ -184,42 +200,6 @@<br>
>      <br>
>      /** @} */<br>
>      <br>
>     -/**<br>
>     - * @name UART 0 (PL011) Registers<br>
>     - *<br>
>     - * @{<br>
>     - */<br>
>     -<br>
>     -#define BCM2835_UART0_BASE       (RPI_PERIPHERAL_BASE + 0x201000)<br>
>     -<br>
>     -#define BCM2835_UART0_DR         (BCM2835_UART0_BASE + 0x00)<br>
>     -#define BCM2835_UART0_RSRECR     (BCM2835_UART0_BASE + 0x04)<br>
>     -#define BCM2835_UART0_FR         (BCM2835_UART0_BASE + 0x18)<br>
>     -#define BCM2835_UART0_ILPR       (BCM2835_UART0_BASE + 0x20)<br>
>     -#define BCM2835_UART0_IBRD       (BCM2835_UART0_BASE + 0x24)<br>
>     -#define BCM2835_UART0_FBRD       (BCM2835_UART0_BASE + 0x28)<br>
>     -#define BCM2835_UART0_LCRH       (BCM2835_UART0_BASE + 0x2C)<br>
>     -#define BCM2835_UART0_CR         (BCM2835_UART0_BASE + 0x30)<br>
>     -#define BCM2835_UART0_IFLS       (BCM2835_UART0_BASE + 0x34)<br>
>     -#define BCM2835_UART0_IMSC       (BCM2835_UART0_BASE + 0x38)<br>
>     -#define BCM2835_UART0_RIS        (BCM2835_UART0_BASE + 0x3C)<br>
>     -#define BCM2835_UART0_MIS        (BCM2835_UART0_BASE + 0x40)<br>
>     -#define BCM2835_UART0_ICR        (BCM2835_UART0_BASE + 0x44)<br>
>     -#define BCM2835_UART0_DMACR      (BCM2835_UART0_BASE + 0x48)<br>
>     -#define BCM2835_UART0_ITCR       (BCM2835_UART0_BASE + 0x80)<br>
>     -#define BCM2835_UART0_ITIP       (BCM2835_UART0_BASE + 0x84)<br>
>     -#define BCM2835_UART0_ITOP       (BCM2835_UART0_BASE + 0x88)<br>
>     -#define BCM2835_UART0_TDR        (BCM2835_UART0_BASE + 0x8C)<br>
>     -<br>
>     -#define BCM2835_UART0_MIS_RX    0x10<br>
>     -#define BCM2835_UART0_MIS_TX    0x20<br>
>     -#define BCM2835_UART0_IMSC_RX   0x10<br>
>     -#define BCM2835_UART0_IMSC_TX   0x20<br>
>     -#define BCM2835_UART0_FR_RXFE   0x10<br>
>     -#define BCM2835_UART0_FR_TXFF   0x20<br>
>     -#define BCM2835_UART0_ICR_RX    0x10<br>
>     -#define BCM2835_UART0_ICR_TX    0x20<br>
>     -<br>
>      /** @} */<br>
>      <br>
>      /**<br>
>     diff --git a/bsps/arm/raspberrypi/include/bsp/usart.h<br>
>     b/bsps/arm/raspberrypi/include/bsp/usart.h<br>
>     index d3e710c5e9..abbf53626c 100644<br>
>     --- a/bsps/arm/raspberrypi/include/bsp/usart.h<br>
>     +++ b/bsps/arm/raspberrypi/include/bsp/usart.h<br>
>     @@ -32,9 +32,8 @@<br>
>      extern "C" {<br>
>      #endif /* __cplusplus */<br>
>      <br>
>     -#define USART0_DEFAULT_BAUD 115000<br>
>     -<br>
>     -extern const console_fns bcm2835_usart_fns;<br>
>     +#define PL011_DEFAULT_BAUD 115000<br>
>     +#define BCM2835_PL011_BASE (RPI_PERIPHERAL_BASE + 0x201000)<br>
>      <br>
>      #ifdef __cplusplus<br>
>      }<br>
> <br>
>     On Fri, Dec 27, 2019 at 3:12 PM Niteesh <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>> wrote:<br>
> <br>
>         On Fri, Dec 27, 2019 at 2:53 PM Christian Mauderer<br>
>         <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>> wrote:<br>
> <br>
>             Hello Niteesh,<br>
> <br>
>             let me repeat two important questions:<br>
> <br>
>             - How do you plan to test the changes? Simulator is OK for<br>
>             me but<br>
>             untested is not OK.<br>
> <br>
>         Since I don't have the older pi's, the simulator will be my only<br>
>         option. And did you<br>
>         take a look at the exception?<br>
> <br>
> <br>
>             - Isn't it possible to just use the driver from<br>
>             bsps/arm/shared/serial/arm-pl011.c and remove the BSP<br>
>             specific completely?<br>
> <br>
>         Yes, I have done this. I usart.c file is now completely empty.<br>
>         All we have to define was<br>
>         the start address for the PL011 peripheral in usart.h.<br>
> <br>
> <br>
>             On 27/12/2019 06:29, Niteesh wrote:<br>
>             > On Fri, Dec 27, 2019 at 1:58 AM Christian Mauderer<br>
>             <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             > <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>><br>
>             wrote:<br>
>             ><br>
>             >     Hello Niteesh,<br>
>             ><br>
>             >     sorry for not answering earlier. During this time of<br>
>             the year you have<br>
>             >     to expect some delays on the mailing list due to<br>
>             public holydays and<br>
>             >     vacations.<br>
>             ><br>
>             > That's okay, I understand. <br>
>             ><br>
>             >      <br>
>             ><br>
>             >     On 25/12/2019 10:50, Niteesh wrote:<br>
>             >     > Just to make sure I am going in the right track.<br>
>             >     > I moved the uart register definitions to bsp/usart.h<br>
>             into a struct of<br>
>             >     > uint32_t called usart0_regs<br>
>             >     > here is git diff of usart.c after changing it to the<br>
>             latest console<br>
>             >     > interface.<br>
>             ><br>
>             >     Do you have a plan how you want to test these changes?<br>
>             ><br>
>             >     The direction looks OK. Some notes below.<br>
>             ><br>
>             >     By the way: Maybe it would be a better idea to just<br>
>             remove it completely<br>
>             >     and use the bsps/arm/shared/serial/arm-pl011.c driver<br>
>             instead? That<br>
>             >     reduces the ammount of code and therefore ammount of<br>
>             bugs we have in<br>
>             >     this BSP. <br>
>             ><br>
>             >      <br>
>             ><br>
>             >     ><br>
>             >     > diff --git a/bsps/arm/raspberrypi/console/usart.c<br>
>             >     > b/bsps/arm/raspberrypi/console/usart.c<br>
>             >     > index 25fb523621..b12f375a1c 100644<br>
>             >     > --- a/bsps/arm/raspberrypi/console/usart.c<br>
>             >     > +++ b/bsps/arm/raspberrypi/console/usart.c<br>
>             >     > @@ -47,6 +47,12 @@ static uint32_t usart_get_baud(const<br>
>             >     console_tbl *ct)<br>
>             >     >  }<br>
>             >     >  #endif<br>
>             >     >  <br>
>             >     > +typedef struct {<br>
>             >     > +  rtems_termios_device_context base;<br>
>             >     > +  const char *device_name;<br>
>             >     > +  volatile usart0_regs *regs;<br>
>             >     > +}uart0_context;<br>
>             ><br>
>             >     Why uart0_context and not usart_context? All other<br>
>             names in this file<br>
>             >     are called usart_...<br>
>             ><br>
>             > Sorry, for the inconsistent naming, should I rename it as<br>
>             pl011_context<br>
>             > since we will be adding<br>
>             > mini uart for rpi3, IMHO it would be better.<br>
> <br>
>             If you touch nearly all locations where the name is used:<br>
>             Yes. But<br>
>             again: There is already a generic pl011 driver. Use that<br>
>             driver if possible.<br>
> <br>
>             ><br>
>             >     > +<br>
>             >     >  static void usart_set_baud(int minor, int baud)<br>
>             >     >  {<br>
>             >     >   /*<br>
>             >     > @@ -55,10 +61,17 @@ static void usart_set_baud(int<br>
>             minor, int baud)<br>
>             >     >   return;<br>
>             >     >  }<br>
>             >     >  <br>
>             >     > -static void usart_initialize(int minor)<br>
>             >     > +static volatile usart0_regs<br>
>             >     > *rpi_uart_get_regs(rtems_termios_device_context *base)<br>
>             >     >  {<br>
>             >     > -  unsigned int gpio_reg;<br>
>             >     > +  uart0_context *ctx;<br>
>             >     > +<br>
>             >     > +  ctx = (usart0_regs *) base;<br>
>             >     > +  return ctx->regs;<br>
>             >     > +}<br>
>             >     >  <br>
>             >     > +static void<br>
>             usart_initialize(rtems_termios_device_context *base)<br>
>             >     > +{<br>
>             >     > +  unsigned int gpio_reg;<br>
>             >     >    /*<br>
>             >     >    ** Program GPIO pins for UART 0<br>
>             >     >    */<br>
>             >     > @@ -75,67 +88,81 @@ static void usart_initialize(int<br>
>             minor)<br>
>             >     >    usart_delay(150);<br>
>             >     >    BCM2835_REG(BCM2835_GPIO_GPPUDCLK0) = 0;<br>
>             >     >  <br>
>             >     > +  volatile uint32_t *uart_regs =<br>
>             rpi_uart_get_regs(base);<br>
>             >     > +<br>
>             >     >    /*<br>
>             >     >    ** Init the PL011 UART<br>
>             >     >    */<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_CR)   = 0;<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_ICR)  = 0x7FF;<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_IMSC) = 0;<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_IBRD) = 1;<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_FBRD) = 40;<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_LCRH) = 0x70;<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_RSRECR) =  0;<br>
>             >     > -<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_CR)   = 0x301;<br>
>             >     > -<br>
>             >     > -  BCM2835_REG(BCM2835_UART0_IMSC) =<br>
>             BCM2835_UART0_IMSC_RX;<br>
>             >     > -<br>
>             >     > -  usart_set_baud(minor, 115000);<br>
>             >     > +  uart_regs->cr  = 0;<br>
>             >     > +  uart_regs->icr = 0x7ff;<br>
>             >     > +  uart_regs->imsc = 0;<br>
>             >     > +  uart_regs->ibrd = 1;<br>
>             >     > +  uart_regs->fbrd= 40;<br>
>             >     > +  uart_regs->lcrh= 0x70;<br>
>             >     > +  uart_regs->rsrecr= 0;<br>
>             >     > +  uart_regs->cr = 0x301;<br>
>             >     > +  uart_regs->imsc = BCM2835_UART0_IMSC_RX;<br>
>             >     > +  // usart_set_baud(minor, 115000);<br>
>             ><br>
>             >     Why is this line commented now?<br>
>             ><br>
>             > It actually does nothing. The function body was empty. The<br>
>             current baud<br>
>             > rate is set directly<br>
>             > in the initialization function. I was planning to update<br>
>             it once, I was<br>
>             > finished with the interface. <br>
>             ><br>
> <br>
>             If it is empty: Is it necessary? There is a<br>
>             rtems_termios_set_initial_baud(...) which should do the same.<br>
> <br>
>             ><br>
>             >     >  }<br>
>             >     >  <br>
>             >     > -static int usart_first_open(int major, int minor,<br>
>             void *arg)<br>
>             >     > +static bool usart_first_open(<br>
>             >     > +  rtems_termios_tty *tty,<br>
>             >     > +  rtems_termios_device_context *base,<br>
>             >     > +  struct termios *term,<br>
>             >     > +  rtems_libio_open_close_args_t *args<br>
>             >     > +)<br>
>             >     >  {<br>
>             >     > -  rtems_libio_open_close_args_t *oc =<br>
>             >     (rtems_libio_open_close_args_t *)<br>
>             >     > arg;<br>
>             >     > -  struct rtems_termios_tty *tty = (struct<br>
>             rtems_termios_tty *)<br>
>             >     > oc->iop->data1;<br>
>             >     > -  const console_tbl *ct = Console_Port_Tbl [minor];<br>
>             >     > -  console_data *cd = &Console_Port_Data [minor];<br>
>             >     > +  rtems_status_code sc;<br>
>             >     > +  uart0_context *ctx;<br>
>             >     > +  bool ok;<br>
>             >     >  <br>
>             >     > -  cd->termios_data = tty;<br>
>             >     > -  rtems_termios_set_initial_baud(tty, ct->ulClock);<br>
>             >     > +  ctx = (uart0_context *) base;<br>
>             >     >  <br>
>             >     > -  return 0;<br>
>             >     > +  usart_initialize(base);<br>
>             >     > +<br>
>             >     > +  sc = rtems_termios_set_initial_baud(tty,<br>
>              USART0_DEFAULT_BAUD);<br>
>             >     > +  if ( sc != RTEMS_SUCCESSFUL ){<br>
>             >     > +    printk("Error setting the baud for termios\n");<br>
>             >     > +    return false;<br>
>             >     > +  }<br>
>             ><br>
>             >     There is a return missing here. Did you compile the<br>
>             code? The compiler<br>
>             >     should give you a warning about that. <br>
>             ><br>
>             >     >  }<br>
>             >     >  <br>
>             >     > -static int usart_last_close(int major, int minor,<br>
>             void *arg)<br>
>             >     > +static int usart_last_close(<br>
>             ><br>
>             >     The first_open returns a bool but last_close returns<br>
>             still an int? Is<br>
>             >     this correct? I don't have the interface memorized.<br>
>             ><br>
>             > last_close return type is void.<br>
> <br>
>             Then you should fix that here.<br>
> <br>
>             >  <br>
>             ><br>
>             >     > +  rtems_termios_tty *tty,<br>
>             >     > +  rtems_termios_device_context *base,<br>
>             >     > +  rtems_termios_open_close_args_t *arg)<br>
>             >     >  {<br>
>             >     >    return 0;<br>
>             >     >  }<br>
>             >     >  <br>
>             >     > -static int usart_read_polled(int minor)<br>
>             >     > +static int<br>
>             usart_read_polled(rtems_termios_device_context *base)<br>
>             >     >  {<br>
>             >     > -  if (minor == 0) {<br>
>             >     > -    if (((BCM2835_REG(BCM2835_UART0_FR)) &<br>
>             BCM2835_UART0_FR_RXFE)<br>
>             >     == 0) {<br>
>             >     > -       return((BCM2835_REG(BCM2835_UART0_DR)) & 0xFF );<br>
>             >     > -    } else {<br>
>             >     > -      return -1;<br>
>             >     > -    }<br>
>             >     > -  } else {<br>
>             >     > -    printk("Unknown console minor number: %d\n",<br>
>             minor);<br>
>             >     > -    return -1;<br>
>             >     > +  volatile usart0_regs *regs;<br>
>             >     > +<br>
>             >     > +  regs = rpi_uart_get_regs(base);<br>
>             ><br>
>             >     Just noted that here: Why rpi_uart_get_regs and not<br>
>             usart_get_regs?<br>
>             >     Please use a consitent naming scheme.<br>
>             ><br>
>             >     > +<br>
>             >     > +  if ((regs->fr & BCM2835_UART0_FR_RXFE) == 0) {<br>
>             >     > +    return (regs->dr & 0xFF);<br>
>             >     >    }<br>
>             >     > +<br>
>             >     > +  return -1;<br>
>             >     >  }<br>
>             >     >  <br>
>             >     > -static void usart_write_polled(int minor, char c)<br>
>             >     > +static void<br>
>             usart_write_polled(rtems_termios_device_context<br>
>             >     *base, char c)<br>
>             >     >  {<br>
>             >     > -   while (1) {<br>
>             >     > -     if ((BCM2835_REG(BCM2835_UART0_FR) &<br>
>             BCM2835_UART0_FR_TXFF)<br>
>             >     == 0)<br>
>             >     > -       break;<br>
>             >     > -   }<br>
>             >     > -   BCM2835_REG(BCM2835_UART0_DR) = c;<br>
>             >     > +  volatile usart0_regs *regs;<br>
>             >     > +<br>
>             >     > +  regs = rpi_uart_get_regs(base);<br>
>             >     > +<br>
>             >     > +  while (1) {<br>
>             >     > +    if (((regs->fr) & BCM2835_UART0_FR_TXFF) == 0)<br>
>             >     > +      break;<br>
>             >     > +  }<br>
>             >     > +  regs->dr = c;<br>
>             >     >  }<br>
>             >     >  <br>
>             >     >  static ssize_t usart_write_support_polled(<br>
>             >     > -  int minor,<br>
>             >     > +  rtems_termios_device_context *base,<br>
>             >     >    const char *s,<br>
>             >     >    size_t n<br>
>             >     >  )<br>
>             >     > @@ -143,7 +170,7 @@ static ssize_t<br>
>             usart_write_support_polled(<br>
>             >     >    ssize_t i = 0;<br>
>             >     >  <br>
>             >     >    for (i = 0; i < n; ++i) {<br>
>             >     > -    usart_write_polled(minor, s [i]);<br>
>             >     > +    usart_write_polled(base, s[i]);<br>
>             >     >    }<br>
>             >     >  <br>
>             >     >    return n;<br>
>             >     > @@ -154,14 +181,11 @@ static int<br>
>             usart_set_attributes(int minor, const<br>
>             >     > struct termios *term)<br>
>             >     >    return -1;<br>
>             >     >  }<br>
>             >     >  <br>
>             >     > -const console_fns bcm2835_usart_fns = {<br>
>             >     > -  .deviceProbe = libchip_serial_default_probe,<br>
>             >     > -  .deviceFirstOpen = usart_first_open,<br>
>             >     > -  .deviceLastClose = usart_last_close,<br>
>             >     > -  .deviceRead = usart_read_polled,<br>
>             >     > -  .deviceWrite = usart_write_support_polled,<br>
>             >     > -  .deviceInitialize = usart_initialize,<br>
>             >     > -  .deviceWritePolled = usart_write_polled,<br>
>             >     > -  .deviceSetAttributes = usart_set_attributes,<br>
>             >     > -  .deviceOutputUsesInterrupts = false<br>
>             >     > -};<br>
>             >     > +const rtems_termios_device_handler<br>
>             bcm2835_uart0_handler_polled = {<br>
>             >     > +  .first_open = usart_first_open,<br>
>             >     > +  .last_close = usart_last_close,<br>
>             >     > +  .poll_read = usart_read_polled,<br>
>             >     > +  .set_attributes = usart_set_attributes,<br>
>             >     > +  .write = usart_write_support_polled,<br>
>             >     > +  .mode = TERMIOS_POLLED<br>
>             >     > +}<br>
>             >     > \ No newline at end of file<br>
>             >     ><br>
>             >     > On Wed, Dec 25, 2019 at 12:36 AM Joel Sherrill<br>
>             <<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a> <mailto:<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>><br>
>             >     <mailto:<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a> <mailto:<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>>><br>
>             >     > <mailto:<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a> <mailto:<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>><br>
>             <mailto:<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a> <mailto:<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>>>>> wrote:<br>
>             >     ><br>
>             >     ><br>
>             >     ><br>
>             >     >     On Tue, Dec 24, 2019, 12:19 PM Niteesh<br>
>             <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>> wrote:<br>
>             >     ><br>
>             >     >         And also the register definitions are in<br>
>             raspberrpi.h file<br>
>             >     >         should I move them to usart.h.<br>
>             >     ><br>
>             >     ><br>
>             >     >     Sounds right if you mean bsp/usart.h<br>
>             >     ><br>
>             >     >         I have a doubt we have a register field in<br>
>             device_context<br>
>             >     >         typedef struct { <br>
>             >     ><br>
>             >     >             rtems_termios_device_context base; <br>
>             >     ><br>
>             >     >             const char *device_name; <br>
>             >     ><br>
>             >     >             volatile some_chip_registers *regs;<br>
>             >     ><br>
>             >     >         } my_driver_context;<br>
>             >     ><br>
>             >     >         How does the reg field point to the correct<br>
>             >     memory location? for<br>
>             >     >         instance in IMX BSP,<br>
>             >     >         there is a struct with register field's but<br>
>             none of the<br>
>             >     define a<br>
>             >     >         memory location?<br>
>             >     ><br>
>             >     ><br>
>             >     >     Make sure the structure has volatiles and proper<br>
>             alignment. :)<br>
>             >     ><br>
>             >     ><br>
>             >     >         On Tue, Dec 24, 2019 at 11:37 PM Niteesh<br>
>             >     <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >         <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>> wrote:<br>
>             >     ><br>
>             >     >             How to handle different serial devices?<br>
>             In other BSPs the<br>
>             >     >             uart devices are the same, so<br>
>             >     >             they were able to put it under a single<br>
>             array? But here we<br>
>             >     >             have 2 uarts and a FB?<br>
>             >     ><br>
>             >     ><br>
>             >     >             On Tue, Dec 24, 2019 at 8:18 PM<br>
>             Christian Mauderer<br>
>             >     >             <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>> wrote:<br>
>             >     ><br>
>             >     >                 On 24/12/2019 12:06, Niteesh wrote:<br>
>             >     >                 > The current raspi console section<br>
>             is like this:<br>
>             >     >                 > The bsp_console_select in<br>
>             console_select.c is<br>
>             >     >                 responsible for selecting<br>
>             >     >                 > between uart and the framebuffer.<br>
>             It does so<br>
>             >     >                 > by setting the Console_port_minor.<br>
>             >     >                 > The console_config is responsible<br>
>             for output_char<br>
>             >     >                 function.<br>
>             >     >                 > And other files are driver code.<br>
>             >     >                 > If rewriting, this would be my<br>
>             approach,<br>
>             >     >                 > Rewrite the bsp_console_select to<br>
>             set some kind of a<br>
>             >     >                 variable like in<br>
>             >     >                 > IMX, then in console_initialize<br>
>             function<br>
>             >     >                 > link the right driver to /dev/console.<br>
>             >     >                 > Replace the console_tbl with the<br>
>             device_context and<br>
>             >     >                 console_fns with<br>
>             >     >                 > termios_device_handlers and<br>
>             >     >                 > finally add in the<br>
>             console_initialization function.<br>
>             >     ><br>
>             >     >                 I agree that this would be a clean<br>
>             solution. So if you<br>
>             >     >                 want you can do<br>
>             >     >                 that. But there might is a hurdle:<br>
>             As far as I<br>
>             >     >                 understood you you only<br>
>             >     >                 have a Pi3? So you might have a hard<br>
>             time testing the<br>
>             >     >                 changes. Maybe the<br>
>             >     >                 simulator could work.<br>
>             >     ><br>
>             >     >                 Another possibility could be to set the<br>
>             >     >                 "Console_port_minor" to<br>
>             >     >                 something unused (for example -1).<br>
>             In that case<br>
>             >     you can<br>
>             >     >                 define another<br>
>             >     >                 /dev/console.<br>
>             >     ><br>
>             >     >                 Best regards and merry Christmas (in<br>
>             case you<br>
>             >     celebrate)<br>
>             >     ><br>
>             >     >                 Christian<br>
>             >     ><br>
>             >     >                 ><br>
>             >     >                 > On Tue, Dec 24, 2019 at 2:13 PM<br>
>             Niteesh<br>
>             >     >                 <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             >     >                 > <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>>><br>
>             >     >                 wrote:<br>
>             >     >                 ><br>
>             >     >                 >     Thank you so much, for such a<br>
>             detailed<br>
>             >     answer. Now<br>
>             >     >                 things make<br>
>             >     >                 >     really good sense to me, <br>
>             >     >                 >     going through the code now is<br>
>             just a breeze.<br>
>             >     But I<br>
>             >     >                 still have one<br>
>             >     >                 >     question<br>
>             >     >                 >     for the newer driver interface is<br>
>             >     >                 console_initialize the function<br>
>             >     >                 >     which RTEMS calls while<br>
>             initializing<br>
>             >     >                 >     the console? Which means I<br>
>             can't mess with the<br>
>             >     >                 name right? It is<br>
>             >     >                 >     similar to the main function,<br>
>             right?<br>
>             >     >                 ><br>
>             >     >                 >     The current driver is a legacy<br>
>             one, how do you<br>
>             >     >                 want me to proceed,<br>
>             >     >                 >     shall I rewrite the legacy to a<br>
>             >     >                 >     the new one, this is will be a<br>
>             great<br>
>             >     >                 learning experience for me also<br>
>             >     >                 >     and we also get the BSP<br>
>             updated to the latest<br>
>             >     >                 interface.<br>
>             >     >                 ><br>
>             >     >                 ><br>
>             >     >                 >     On Tue, Dec 24, 2019 at 3:20<br>
>             AM Christian<br>
>             >     Mauderer<br>
>             >     >                 >     <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>>><br>
>             >     >                 wrote:<br>
>             >     >                 ><br>
>             >     >                 >         Hello Niteesh,<br>
>             >     >                 ><br>
>             >     >                 >         quite a lot of questions.<br>
>             I'll try to answer<br>
>             >     >                 them. Note that it<br>
>             >     >                 >         has been<br>
>             >     >                 >         some time since I had a<br>
>             detailed look at<br>
>             >     that<br>
>             >     >                 code so if something I<br>
>             >     >                 >         tell seems odd please<br>
>             don't hesitate to<br>
>             >     >                 question it.<br>
>             >     >                 ><br>
>             >     >                 >         Please note that in RTEMS<br>
>             their are more or<br>
>             >     >                 less two "levels" of<br>
>             >     >                 >         support<br>
>             >     >                 >         for a serial console:<br>
>             >     >                 ><br>
>             >     >                 >         1. A very basic polled<br>
>             system console (also<br>
>             >     >                 known as<br>
>             >     >                 >         "debug-console" in<br>
>             >     >                 >         some BSPs). This one is<br>
>             used for printk and<br>
>             >     >                 should work in basically<br>
>             >     >                 >         every case. It is used for<br>
>             critical system<br>
>             >     >                 messages like<br>
>             >     >                 >         printing the<br>
>             >     >                 >         exception frame. For that<br>
>             a BSP has to<br>
>             >     provide a<br>
>             >     >                 >         "BSP_output_char" function.<br>
>             >     >                 ><br>
>             >     >                 >         2. A full featured UART driver<br>
>             >     integrated into<br>
>             >     >                 Termios. That one<br>
>             >     >                 >         will be<br>
>             >     >                 >         used for all normal I/O on<br>
>             the UARTs.<br>
>             >     >                 ><br>
>             >     >                 >         As far as I know the<br>
>             "console_tbl<br>
>             >     >                 Console_Configuration_Ports"<br>
>             >     >                 >         belongs<br>
>             >     >                 >         to a table based legacy<br>
>             interface. It is<br>
>             >     >                 handled in the file<br>
>             >     >                 >       <br>
>              bsps/shared/dev/serial/legacy-console.c. I'm<br>
>             >     >                 not sure whether it is<br>
>             >     >                 >         documented in the BSP<br>
>             guide because it<br>
>             >     >                 shouldn't be used for new<br>
>             >     >                 >         BSPs.<br>
>             >     >                 >         Same is true for the<br>
>             "major" and "minor"<br>
>             >     >                 stuff: It's not really<br>
>             >     >                 >         used for<br>
>             >     >                 >         new drivers.<br>
>             >     >                 ><br>
>             >     >                 >         Newer drivers use the<br>
>             initialization that is<br>
>             >     >                 described in the manual<br>
>             >     >                 >         that you have already<br>
>             found. Basically<br>
>             >     they use<br>
>             >     >                 >       <br>
>              "rtems_termios_device_install" to register a<br>
>             >     >                 new UART as<br>
>             >     >                 >         "/dev/ttySomething". Some<br>
>             recent (ARM) BSPs<br>
>             >     >                 that do that are the<br>
>             >     >                 >         imx or<br>
>             >     >                 >         the atsam.<br>
>             >     >                 ><br>
>             >     >                 >         The console that is used<br>
>             for stdin,<br>
>             >     stdout and<br>
>             >     >                 stderr (printf,<br>
>             >     >                 >         scanf,<br>
>             >     >                 >         ...) is the one called<br>
>             "/dev/console"<br>
>             >     (defined in<br>
>             >     >                 >         CONSOLE_DEVICE_NAME).<br>
>             >     >                 >         For the legacy table based<br>
>             interface<br>
>             >     it's the<br>
>             >     >                 one with the index of<br>
>             >     >                 >         "Console_Port_Minor".<br>
>             >     >                 ><br>
>             >     >                 ><br>
>             >     >                 >         If you want to access any<br>
>             UART other<br>
>             >     than the<br>
>             >     >                 one for stdin and<br>
>             >     >                 >         stdout<br>
>             >     >                 >         you do that the same way<br>
>             like on Linux: Just<br>
>             >     >                 use the "open"<br>
>             >     >                 >         function on<br>
>             >     >                 >         the "/dev/ttySomething"<br>
>             and use "read",<br>
>             >     >                 "write" and simmilar or use<br>
>             >     >                 >         "fopen" together with<br>
>             "fread", "fwrite",<br>
>             >     >                 "fprintf", ...<br>
>             >     >                 ><br>
>             >     >                 ><br>
>             >     >                 >         "printf" (and family) is a<br>
>             function<br>
>             >     belonging<br>
>             >     >                 to the C library.<br>
>             >     >                 >         In our<br>
>             >     >                 >         case that's newlib. It<br>
>             will format your<br>
>             >     >                 message and after some other<br>
>             >     >                 >         preprocessing will call<br>
>             the "write" function<br>
>             >     >                 of the file that is<br>
>             >     >                 >         opened<br>
>             >     >                 >         as stdout (which is<br>
>             "/dev/console" in the<br>
>             >     >                 default case).<br>
>             >     >                 ><br>
>             >     >                 ><br>
>             >     >                 >         I hope that I helped you<br>
>             with that<br>
>             >     >                 explanation. Please feel free<br>
>             >     >                 >         to ask<br>
>             >     >                 >         anything if it isn't clear.<br>
>             >     >                 ><br>
>             >     >                 >         Best regards<br>
>             >     >                 ><br>
>             >     >                 >         Christian<br>
>             >     >                 ><br>
>             >     >                 >         On 23/12/2019 19:50,<br>
>             Niteesh wrote:<br>
>             >     >                 >         > And finally, how does<br>
>             printf work? It is a<br>
>             >     >                 macro? In that<br>
>             >     >                 >         case, how does<br>
>             >     >                 >         > any write to<br>
>             >     >                 >         > a console work?<br>
>             >     >                 >         ><br>
>             >     >                 >         > On Tue, Dec 24, 2019 at<br>
>             12:18 AM Niteesh<br>
>             >     >                 <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             >     >                 >         <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>><br>
>             >     >                 >         ><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>>>> wrote:<br>
>             >     >                 >         ><br>
>             >     >                 >         >     Is the correct port<br>
>             minor number set<br>
>             >     >                 during the<br>
>             >     >                 >         initialization? What<br>
>             >     >                 >         >     is the application<br>
>             want's to<br>
>             >     >                 >         >     access some other port?<br>
>             >     >                 >         ><br>
>             >     >                 >         >     On Tue, Dec 24, 2019<br>
>             at 12:16 AM<br>
>             >     Niteesh<br>
>             >     >                 >         <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>><br>
>             >     >                 >         >   <br>
>              <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>>>> wrote:<br>
>             >     >                 >         ><br>
>             >     >                 >         >         I would like to<br>
>             clarify my doubts<br>
>             >     >                 regarding the<br>
>             >     >                 >         console driver.<br>
>             >     >                 >         >         I went through<br>
>             the documentation<br>
>             >     >                 >         >         for the console<br>
>             >     >                 >         >       <br>
>             >     >                 >       <br>
>             >     >               <br>
>             >   <br>
>                 driver <a href="https://docs.rtems.org/branches/master/bsp-howto/console.html#introduction" rel="noreferrer" target="_blank">https://docs.rtems.org/branches/master/bsp-howto/console.html#introduction</a>.<br>
>             >     >                 >         >         But it is quite<br>
>             different from how<br>
>             >     >                 some BSPs initialize.<br>
>             >     >                 >         >         Correct me if I<br>
>             am wrong<br>
>             >     >                 >         >         The console_tbl<br>
>             contains the<br>
>             >     various<br>
>             >     >                 entries of serial<br>
>             >     >                 >         ports.<br>
>             >     >                 >         >         The console_fns<br>
>             is a struct of<br>
>             >     >                 function pointers,<br>
>             >     >                 >         which point to<br>
>             >     >                 >         >         the BSP uart<br>
>             functions.<br>
>             >     >                 >         >         The<br>
>             >     BSP_output_char_function_type is<br>
>             >     >                 what will be<br>
>             >     >                 >         called for<br>
>             >     >                 >         >         printing a char<br>
>             on to the console.<br>
>             >     >                 >         >         How does RTEMS<br>
>             initialize the<br>
>             >     uart?<br>
>             >     >                 It's seems not to<br>
>             >     >                 >         be same<br>
>             >     >                 >         >         for all BSPs.<br>
>             >     >                 >         >         The doc says<br>
>             that the driver's<br>
>             >     >                 initialization function<br>
>             >     >                 >         is called<br>
>             >     >                 >         >         once during the<br>
>             rtems<br>
>             >     initialization<br>
>             >     >                 process.<br>
>             >     >                 >         >         The console init<br>
>             function install<br>
>             >     >                 the serial driver using<br>
>             >     >                 >         >       <br>
>              rtems_termios_device_install but<br>
>             >     >                 there seems to be<br>
>             >     >                 >         >         no such function<br>
>             in the raspberry<br>
>             >     >                 pi? But there is a<br>
>             >     >                 >         entry in<br>
>             >     >                 >         >         console_fns for<br>
>             init function, but<br>
>             >     >                 then how does it<br>
>             >     >                 >         >         gets called?<br>
>             >     >                 >         >         And for BSP's<br>
>             with multiple<br>
>             >     >                 serial's, the output function<br>
>             >     >                 >         >         chooses the<br>
>             right serial using<br>
>             >     >                 console_port_minor,<br>
>             >     >                 >         >         Is it during<br>
>             initialization?<br>
>             >     >                 >         >         What is the need<br>
>             for get and set<br>
>             >     >                 register functions? <br>
>             >     >                 >         ><br>
>             >     >                 >         >         On Mon, Dec 23,<br>
>             2019 at 1:04 AM<br>
>             >     >                 Christian Mauderer<br>
>             >     >                 >         >       <br>
>              <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>><br>
>             >     >                 >         <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>>>> wrote:<br>
>             >     >                 >         ><br>
>             >     >                 >         >             On<br>
>             22/12/2019 19:45, Joel<br>
>             >     >                 Sherrill wrote:<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             > On Sun,<br>
>             Dec 22, 2019,<br>
>             >     12:29 PM<br>
>             >     >                 Niteesh<br>
>             >     >                 >         <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>><br>
>             >     >                 >         >           <br>
>              <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>>><br>
>             >     >                 >         >             ><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             >     >                 >         <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>><br>
>             >     >                 >         <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a> <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>><br>
>             >     >                 <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>><br>
>             >     <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a><br>
>             <mailto:<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>>>>>>>> wrote:<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >     On<br>
>             Sun, Dec 22, 2019 at<br>
>             >     >                 8:44 PM Christian<br>
>             >     >                 >         Mauderer<br>
>             >     >                 >         >             >   <br>
>              <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>><br>
>             >     >                 >         <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>><br>
>             >     >                 >         <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>>><br>
>             >     >                 >         >           <br>
>              <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>><br>
>             >     >                 >         <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>><br>
>             >     >                 >         <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>><br>
>             >     >                 <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>><br>
>             >     <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
>             <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>>>>>>> wrote:<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >       <br>
>              Hello Niteesh,<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >       <br>
>              thanks for doing<br>
>             >     that<br>
>             >     >                 work.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         On<br>
>             22/12/2019 12:10,<br>
>             >     >                 Niteesh wrote:<br>
>             >     >                 >         >             >         ><br>
>             The rpi1 and rpi2<br>
>             >     >                 use the PL011 UART,<br>
>             >     >                 >         whereas,<br>
>             >     >                 >         >             with RPI's<br>
>             >     >                 >         >             >       <br>
>              equipped with<br>
>             >     >                 >         >             >         ><br>
>             wireless/Bluetooth<br>
>             >     >                 module, the PL011 is<br>
>             >     >                 >         >             connected to<br>
>             the Bluetooth<br>
>             >     >                 >         >             >         ><br>
>             module, and<br>
>             >     the mini<br>
>             >     >                 UART is used as<br>
>             >     >                 >         the primary<br>
>             >     >                 >         >             UART.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         In<br>
>             my opinion it<br>
>             >     would<br>
>             >     >                 be great if you<br>
>             >     >                 >         could use<br>
>             >     >                 >         >             the FDT to<br>
>             >     >                 >         >             >       <br>
>              distinguish<br>
>             >     >                 >         >             >       <br>
>              between the boards.<br>
>             >     >                 That should allow to add<br>
>             >     >                 >         >             raspberry 3 (and<br>
>             >     >                 >         >             >       <br>
>              maybe 4)<br>
>             >     >                 >         >             >       <br>
>              support without<br>
>             >     adding<br>
>             >     >                 another BSP. More<br>
>             >     >                 >         BSPs mean<br>
>             >     >                 >         >             a bigger<br>
>             >     >                 >         >             >       <br>
>              maintenance<br>
>             >     >                 >         >             >       <br>
>              effort for the RTEMS<br>
>             >     >                 community.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >   <br>
>              Learning more about<br>
>             >     FDT is<br>
>             >     >                 on my list for a long<br>
>             >     >                 >         >             time.  I<br>
>             would love<br>
>             >     >                 >         >             >     to<br>
>             work on that<br>
>             >     >                 >         >             >     but I<br>
>             have almost no exp<br>
>             >     >                 with FDT's.<br>
>             >     >                 >         >             >     But<br>
>             another thing could<br>
>             >     >                 also be done, in<br>
>             >     >                 >         >             >   <br>
>             >     >                  raspberrypi/start/bspstart.c we get the<br>
>             >     >                 >         revision and<br>
>             >     >                 >         >             >     model<br>
>             of the board using<br>
>             >     >                 the mailbox. Every<br>
>             >     >                 >         board has<br>
>             >     >                 >         >             a unique id,<br>
>             >     >                 >         >             >     which<br>
>             we could use to<br>
>             >     >                 initialize<br>
>             >     >                 >         >             >     the<br>
>             BSP. But using FDT<br>
>             >     >                 seems to be a more<br>
>             >     >                 >         elegant<br>
>             >     >                 >         >             option, it is a<br>
>             >     >                 >         >             >     lot of<br>
>             work I think, but<br>
>             >     >                 we could take<br>
>             >     >                 >         >             >     help<br>
>             from libbsd and<br>
>             >     linux<br>
>             >     >                 I suppose. What<br>
>             >     >                 >         do you think?<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             > I think<br>
>             there are almost<br>
>             >     >                 always two steps to a<br>
>             >     >                 >         project<br>
>             >     >                 >         >             like this:<br>
>             get it<br>
>             >     >                 >         >             > to work<br>
>             and make it nice. :)<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             > If you fix<br>
>             the startup<br>
>             >     code to<br>
>             >     >                 read the board<br>
>             >     >                 >         revision and<br>
>             >     >                 >         >             memory size,<br>
>             >     >                 >         >             > you can<br>
>             get a working<br>
>             >     BSP that<br>
>             >     >                 dynamically<br>
>             >     >                 >         adapts to the<br>
>             >     >                 >         >             models and<br>
>             >     >                 >         >             > memory<br>
>             variations with<br>
>             >     minimal<br>
>             >     >                 modifications. If<br>
>             >     >                 >         you want<br>
>             >     >                 >         >             to then<br>
>             >     >                 >         >             > convert<br>
>             the BSP to FDT, it<br>
>             >     >                 will be a LOT easier<br>
>             >     >                 >         to debug<br>
>             >     >                 >         >             with a<br>
>             working BSP.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             > Plus you<br>
>             may be able to<br>
>             >     >                 identify every variation<br>
>             >     >                 >         point<br>
>             >     >                 >         >             based on<br>
>             just the<br>
>             >     >                 >         >             > model<br>
>             info. Then FDT is<br>
>             >     just a<br>
>             >     >                 matter of<br>
>             >     >                 >         switching the<br>
>             >     >                 >         >             source of<br>
>             >     >                 >         >             > some/all<br>
>             of the info.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             > That would<br>
>             be my work<br>
>             >     plan anyway.<br>
>             >     >                 >         ><br>
>             >     >                 >         >             I agree with<br>
>             Joel that a<br>
>             >     secure<br>
>             >     >                 development basis<br>
>             >     >                 >         (also<br>
>             >     >                 >         >             known as "hack")<br>
>             >     >                 >         >             as a first<br>
>             step is a good<br>
>             >     idea.<br>
>             >     >                 You maybe even<br>
>             >     >                 >         just make the<br>
>             >     >                 >         >             mini UART<br>
>             >     >                 >         >             the default<br>
>             driver while<br>
>             >     you are<br>
>             >     >                 developing. Then<br>
>             >     >                 >         you can be<br>
>             >     >                 >         >             sure that<br>
>             >     >                 >         >             you have the<br>
>             right driver.<br>
>             >     >                 >         ><br>
>             >     >                 >         >             As soon as<br>
>             that works you can<br>
>             >     >                 either change to the<br>
>             >     >                 >         revision<br>
>             >     >                 >         >             method or<br>
>             >     >                 >         >             (better) to<br>
>             the FDT one and<br>
>             >     >                 after that the patches<br>
>             >     >                 >         can be<br>
>             >     >                 >         >             merged. Using<br>
>             >     >                 >         >             the FDT<br>
>             isn't that<br>
>             >     complicated.<br>
>             >     >                 Basically you<br>
>             >     >                 >         search for a<br>
>             >     >                 >         >             node based on<br>
>             >     >                 >         >             different<br>
>             parameters. For an<br>
>             >     >                 example you can take<br>
>             >     >                 >         a look at<br>
>             >     >                 >         >             the imx BSP.<br>
>             >     >                 >         >             In<br>
>             imx_uart_probe<br>
>             >     >                 >       <br>
>              (bsps/arm/imx/console/console-config.c) a<br>
>             >     >                 >         >             fdt node is<br>
>             >     >                 >         >             searched and<br>
>             based on that a<br>
>             >     >                 UART driver is used.<br>
>             >     >                 >         But again:<br>
>             >     >                 >         >             Follow<br>
>             >     >                 >         >             Joels<br>
>             suggestion to start<br>
>             >     simple<br>
>             >     >                 and secure.<br>
>             >     >                 >         ><br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         ><br>
>             >     >                 >         >             >         ><br>
>             >     >                 >         >             >       <br>
>             >     >                 >         >           <br>
>             >     >                 >       <br>
>             >     >               <br>
>             >   <br>
>                  <a href="https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf" rel="noreferrer" target="_blank">https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf</a><br>
>             >     >                 >         >             >         ><br>
>             But from the above<br>
>             >     >                 doc (PAGE 10), the<br>
>             >     >                 >         mini uart<br>
>             >     >                 >         >             has 16550 like<br>
>             >     >                 >         >             >       <br>
>              registers<br>
>             >     >                 >         >             >         ><br>
>             and RTEMS already<br>
>             >     >                 has the driver for it<br>
>             >     >                 >         >             >         ><br>
>             >     >                 bsps/shared/dev/serial/ns16550.c. But<br>
>             >     >                 >         I am not<br>
>             >     >                 >         >             sure how<br>
>             >     >                 >         >             >       <br>
>              compatible they<br>
>             >     >                 >         >             >         ><br>
>             are? Should a new<br>
>             >     >                 driver be<br>
>             >     >                 >         implemented from<br>
>             >     >                 >         >             scratch or use<br>
>             >     >                 >         >             >       <br>
>              ns16550 if<br>
>             >     >                 >         >             >         ><br>
>             possible?<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         In<br>
>             general it's<br>
>             >     better<br>
>             >     >                 to re-use<br>
>             >     >                 >         existing code.<br>
>             >     >                 >         >             That has<br>
>             multiple<br>
>             >     >                 >         >             >       <br>
>              advantages:<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         -<br>
>             It reduces the<br>
>             >     >                 maintenance effort.<br>
>             >     >                 >         Fewer code<br>
>             >     >                 >         >             means fewer<br>
>             work.<br>
>             >     >                 >         >             >         -<br>
>             If you have<br>
>             >     multiple<br>
>             >     >                 driver for the<br>
>             >     >                 >         same or<br>
>             >     >                 >         >             similar hardware<br>
>             >     >                 >         >             >         it can<br>
>             >     >                 >         >             >       <br>
>              happen that a bug is<br>
>             >     >                 fixed in one but<br>
>             >     >                 >         not the other.<br>
>             >     >                 >         >             >         -<br>
>             It's simpler<br>
>             >     to find<br>
>             >     >                 a hardware to<br>
>             >     >                 >         test changes.<br>
>             >     >                 >         >             >         -<br>
>             The driver becomes<br>
>             >     >                 more universal with<br>
>             >     >                 >         every new<br>
>             >     >                 >         >             supported<br>
>             >     >                 >         >             >       <br>
>              hardware.<br>
>             >     >                 >         >             >       <br>
>              That increases the<br>
>             >     >                 chance that it fits<br>
>             >     >                 >         the next<br>
>             >     >                 >         >             new hardware.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >       <br>
>              I'm sure there are<br>
>             >     >                 some more if you ask<br>
>             >     >                 >         someone else.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >     I do<br>
>             understand the<br>
>             >     >                 issues, I just spent<br>
>             >     >                 >         some time<br>
>             >     >                 >         >             reading the<br>
>             >     >                 >         >             >     driver<br>
>             code.<br>
>             >     >                 >         >             >     I<br>
>             think we could most<br>
>             >     >                 probably use it. I<br>
>             >     >                 >         will take a<br>
>             >     >                 >         >             closer look and<br>
>             >     >                 >         >             >     will<br>
>             update.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         ><br>
>             >     >                 >         >             Great.<br>
>             >     >                 >         ><br>
>             >     >                 >         >             >          <br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         ><br>
>             >     >                 >         >             >         ><br>
>             Also, the core<br>
>             >     clock<br>
>             >     >                 on which the<br>
>             >     >                 >         PL011 is based<br>
>             >     >                 >         >             on is changed<br>
>             >     >                 >         >             >         in<br>
>             rpi3.<br>
>             >     >                 >         >             >         ><br>
>             Rpi1 and 2 use<br>
>             >     >                 250Mhz as the default<br>
>             >     >                 >         clock but<br>
>             >     >                 >         >             it was changed<br>
>             >     >                 >         >             >         to<br>
>             400Mhz<br>
>             >     >                 >         >             >         ><br>
>             in Rpi3 and newer<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >       <br>
>              Again: Would be<br>
>             >     great<br>
>             >     >                 if that could be<br>
>             >     >                 >         adapted<br>
>             >     >                 >         >             based on FDT<br>
>             or by<br>
>             >     >                 >         >             >       <br>
>              reading the right<br>
>             >     >                 registers.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         ><br>
>             >     >                 >         >             >         ><br>
>             Few differences<br>
>             >     >                 between PL011 and Mini<br>
>             >     >                 >         uart<br>
>             >     >                 >         >             >         ><br>
>             The mini UART has<br>
>             >     >                 smaller FIFOs.<br>
>             >     >                 >         Combined with<br>
>             >     >                 >         >             the lack of<br>
>             >     >                 >         >             >       <br>
>              flow control,<br>
>             >     >                 >         >             >         ><br>
>             this makes it more<br>
>             >     >                 prone to losing<br>
>             >     >                 >         characters at<br>
>             >     >                 >         >             higher baud<br>
>             >     >                 >         >             >       <br>
>              rates. It<br>
>             >     >                 >         >             >         ><br>
>             is also generally<br>
>             >     >                 less capable than<br>
>             >     >                 >         the PL011,<br>
>             >     >                 >         >             mainly due to<br>
>             >     >                 >         >             >       <br>
>              its baud<br>
>             >     >                 >         >             >         ><br>
>             rate link to<br>
>             >     the VPU<br>
>             >     >                 clock speed.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >       <br>
>              That shouldn't<br>
>             >     really<br>
>             >     >                 be a problem for<br>
>             >     >                 >         the system<br>
>             >     >                 >         >             console.<br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >         ><br>
>             >     >                 >         >             >         ><br>
>             The particular<br>
>             >     >                 deficiencies of the<br>
>             >     >                 >         mini UART<br>
>             >     >                 >         >             compared to the<br>
>             >     >                 >         >             >       <br>
>              PL011 are :<br>
>             >     >                 >         >             >         ><br>
>             >     >                 >         >             >         ><br>
>             No break detection<br>
>             >     >                 >         >             >         ><br>
>             No framing errors<br>
>             >     >                 detection<br>
>             >     >                 >         >             >         ><br>
>             No parity bit<br>
>             >     >                 >         >             >         ><br>
>             No receive timeout<br>
>             >     >                 interrupt<br>
>             >     >                 >         >             >         ><br>
>             No DCD, DSR,<br>
>             >     DTR or<br>
>             >     >                 RI signals<br>
>             >     >                 >         >             >         ><br>
>             >     >                 >         >             ><br>
>             >     >                 >         >             >   <br>
>             >     >               <br>
>               _______________________________________________<br>
>             >     >                 >         >             >     devel<br>
>             mailing list<br>
>             >     >                 >         >             >   <br>
>              <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>>><br>
>             >     >                 >         <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>>>><br>
>             >     >                 >         >           <br>
>              <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>>><br>
>             >     >                 >         <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>><br>
>             >     <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>><br>
>             >     >                 <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>             <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>>>>>>><br>
>             >     >                 >         >             >   <br>
>             >     >               <br>
>               <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
>             >     >                 >         >             ><br>
>             >     >                 >         ><br>
>             >     >                 ><br>
>             >     ><br>
>             ><br>
> <br>
</blockquote></div></div>