<div dir="ltr">I tried the above thing it doesn't work :(<div>Maybe lets stop with this. And try to get RTEMS working on rpi3</div><div>this way, it will also be easier for me to work. Did you take a look at what</div><div>caused the secondary cpu's not to halt? Is there something that I can do?</div><div>Or shall we continue with this? I kind of feel lost and not at all happy with my progress.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 31, 2019 at 8:29 PM Niteesh <<a href="mailto:gsnb.gn@gmail.com">gsnb.gn@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I have an idea to debug this, but not sure whether it will work or not, I could<div>run raspbian on versatilepb using arm1176 as cpu and 256mb ram</div><div>this is very much similar to raspi1, I think this one also uses pl011, I remember</div><div>seeing it in the linux bootup msgs.</div><div>I could run the examples using qemu using raspi2 as the machine but the dtb</div><div>file never gets passed to it. The register r2 is 0.</div><div>qemu-system-arm -M raspi2 -m 1G -kernel fileio.exe -serial mon:stdio -nographic -dtb bcm2709-rpi-2-b.dtb -S -s</div><div>This is the command I use to run my examples and connect to gdb.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 31, 2019 at 7:31 PM Christian Mauderer <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 31/12/2019 14:56, Niteesh wrote:<br>
> If moving uart_probe to output char, then should I move <br>
> rtems_device_handler_install to console_initialize because, my guess<br>
> is that the IO initialization system would not be initialized properly<br>
> at that stage.<br>
<br>
The uart_probe in the output char function should do a really minimal<br>
initialization. Only what is necessary to get the polled uart working.<br>
That one will only be called if you have an exception at a very early<br>
stage. In that case you are working in an exception context.<br>
<br>
> <br>
> When I rename the register_arm_pl011 to init_context_pl011 since it's is<br>
> only initializing<br>
> the pl011 context, rather than registering it.<br>
> <br>
> On Tue, Dec 31, 2019 at 6:32 PM Christian Mauderer <<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 31/12/2019 13:22, Niteesh wrote:<br>
> > It works now, the functions are getting called when used with<br>
> fileio.exe.<br>
> > The function bsp_start wants to print information about the board,<br>
> <br>
> That print maybe should be moved to a later point. It just fetches some<br>
> information and prints it. It doesn't even do anything usefull<br>
> besides that.<br>
> <br>
> > but<br>
> > the console<br>
> > initialization function is called after bsp_start, assuming that<br>
> the FDT<br>
> > works it still<br>
> > crash since the console still isn't initialized, one way of fixing<br>
> this<br>
> > would be to add uart_probe into<br>
> > output_char just like in imx, or we could move the printing to<br>
> somewhere<br>
> > else.<br>
> <br>
> That might would be a good idea regardless whether the print is moved or<br>
> not. It would allow an early exception to print anything.<br>
> <br>
> ><br>
> > On Tue, Dec 31, 2019 at 4:08 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>><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>
> ><br>
> ><br>
> > On 31/12/2019 11:37, Christian Mauderer wrote:<br>
> > > On 31/12/2019 06:11, Niteesh wrote:<br>
> > >> On Tue, Dec 31, 2019 at 1:13 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>
> > >> <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 30/12/2019 19:32, Niteesh wrote:<br>
> > >> > Just to make sure that console_initialize and uart_probe<br>
> > are being<br>
> > >> > called, I manually initialized the pl011 context to print<br>
> > something on<br>
> > >> > serial. But they never got called. Can you just make sure<br>
> > that if I am<br>
> > >> > missing something?<br>
> > >><br>
> > >> I don't think that you are missing something but the<br>
> > executable is<br>
> > >> missing something: The functions are not linked into it.<br>
> > >><br>
> > >> C linker can be an odd thing: It links only object<br>
> files that are<br>
> > >> referenced. You seem to have no reference to<br>
> > console-config.c/o from<br>
> > >> anywhere else.<br>
> > >><br>
> > >> RTEMS_SYSINIT_ITEM(<br>
> > >> uart_probe,<br>
> > >> RTEMS_SYSINIT_BSP_START,<br>
> > >> RTEMS_SYSINIT_ORDER_LAST<br>
> > >> );<br>
> > >><br>
> > >> will be only added to the linker set if the file is<br>
> linked in<br>
> > anyway.<br>
> > >><br>
> > >> That is a bit anoying. For the imx BSP there is a UART<br>
> drain<br>
> > function<br>
> > >> that is called from somewhere else. Thats enough to<br>
> bring the<br>
> > file in.<br>
> > >><br>
> > >> I think you'll need to add a reference from somewhere<br>
> or move<br>
> > that stuff<br>
> > >> into another file that is referenced.<br>
> > >><br>
> > >> If you have some init function that has to be called in<br>
> every<br>
> > case you<br>
> > >> can call it from some other c file where it would fit too.<br>
> > >><br>
> > >> Otherwise it might is necessary to construct some odd<br>
> stuff.<br>
> > I'm not<br>
> > >> sure whether we already had a case like this. Most<br>
> likely it<br>
> > would be<br>
> > >> necessary to use a RTEMS_LINKER_ROSET_ITEM_REFERENCE<br>
> for the<br>
> > >> SYSINIT_ITEM. Maybe to define a new<br>
> > RTEMS_SYSINIT_ITEM_REFERENCE or<br>
> > >> simmilar. This should be definitively a separate commit.<br>
> > Please ask<br>
> > >> again if you have to go that way.<br>
> > >><br>
> > >> I didn't understand the above part. So what I did was<br>
> created a dummy<br>
> > >> function in console-config.c<br>
> > >> and referenced in places that I know we're going to be<br>
> called. But<br>
> > >> still, it didn't work. <br>
> > >><br>
> > ><br>
> > > That's a really mean bug to find:<br>
> > ><br>
> > > 1. My assumption was wrong. The file is linked in. Most<br>
> likely due to<br>
> > > BSP_output_char which is defined in this file.<br>
> > ><br>
> > > 2. Please remove console-termios-init.c. It would define the<br>
> same<br>
> > > console_initialize() function.<br>
> ><br>
> > Just to be clear: Remove it from the<br>
> > c/src/lib/libbsp/arm/raspberrypi/Makefile.am file.<br>
> ><br>
> > ><br>
> > > 3. The real proble just caused a warning which was a bit<br>
> hard to spot:<br>
> > > The compile doesn't know RTEMS_SYSINIT_ITEM. It thinks it's<br>
> a function<br>
> > > body and warns that it defaults the return type to int. In other<br>
> > words:<br>
> > > You missed to include <rtems/sysinit.h>. If you add that the<br>
> > > RTEMS_SYSINIT_ITEM works and uart_probe is linked in.<br>
> > ><br>
> > > 4. console_initialize is still not used. It is really hard<br>
> to spot<br>
> > why:<br>
> > > Most of the tests only use the configuration:<br>
> > ><br>
> > > CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER<br>
> > ><br>
> > > This is a simplified polled console driver. From the samples<br>
> only<br>
> > > capture, fileio and pppd are using the normal console with:<br>
> > ><br>
> > > CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>
> > ><br>
> > > So only for these three the console_initialize will be called.<br>
> > ><br>
> > > By the way: You can use objdump to analyze your elf-files.<br>
> For example<br>
> > > to get a symbol table use:<br>
> > ><br>
> > > arm-rtems5-objdump -t path/to/ticker.exe<br>
> > ><br>
> > > To get the disassembled code with intermixed c-sources use<br>
> > ><br>
> > > arm-rtems5-objdump -dS path/to/ticker.exe<br>
> > ><br>
> > > That's very usefull to find whether a symbol is linked in or<br>
> not.<br>
> > ><br>
> > >> <br>
> > >><br>
> > >> ><br>
> > >> > While going through the messages from devel-request, Joel<br>
> > mentioned<br>
> > >> > about qemu4 rsb package<br>
> > >> > how is it different from the official qemu?<br>
> > >> ><br>
> > >> > On Mon, Dec 30, 2019 at 11:53 PM G S 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> <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> <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>>>>>> wrote:<br>
> > >> ><br>
> > >> > The patch updates the older console interface used by<br>
> > the BSP,<br>
> > >> > to newer one. It also replaces the custom<br>
> usart(PL011)<br>
> > driver<br>
> > >> > with arm-pl011. The fb function's signatures<br>
> where also<br>
> > changed<br>
> > >> > to accommodate with interface update.<br>
> > >> > Update #3034<br>
> > >> > ---<br>
> > >> > bsps/arm/raspberrypi/console/console-config.c | 186<br>
> > >> ++++++++++++++----<br>
> > >> > bsps/arm/raspberrypi/console/console_select.c | 114<br>
> > -----------<br>
> > >> > bsps/arm/raspberrypi/console/fbcons.c | 78<br>
> > ++++----<br>
> > >> > bsps/arm/raspberrypi/console/usart.c | 167<br>
> > >> ----------------<br>
> > >> > bsps/arm/raspberrypi/include/bsp/fbcons.h | <br>
> 21 +-<br>
> > >> > .../arm/raspberrypi/include/bsp/raspberrypi.h | <br>
> 48 ++---<br>
> > >> > bsps/arm/raspberrypi/include/bsp/usart.h | <br>
> 5 +-<br>
> > >> > c/src/lib/libbsp/arm/raspberrypi/Makefile.am | <br>
> 8 +-<br>
> > >> > 8 files changed, 220 insertions(+), 407 deletions(-)<br>
> > >> > delete mode 100644<br>
> > bsps/arm/raspberrypi/console/console_select.c<br>
> > >> > delete mode 100644<br>
> bsps/arm/raspberrypi/console/usart.c<br>
> > >> ><br>
> > >> > diff --git<br>
> a/bsps/arm/raspberrypi/console/console-config.c<br>
> > >> > b/bsps/arm/raspberrypi/console/console-config.c<br>
> > >> > index d2186c918b..021428ff4b 100644<br>
> > >> > --- a/bsps/arm/raspberrypi/console/console-config.c<br>
> > >> > +++ b/bsps/arm/raspberrypi/console/console-config.c<br>
> > >> > @@ -19,50 +19,164 @@<br>
> > >> > */<br>
> > >> ><br>
> > >> > #include <rtems/bspIo.h><br>
> > >> > +#include <rtems/console.h><br>
> > >> ><br>
> > >> > -#include <libchip/serial.h><br>
> > >> ><br>
> > >> > -#include <bspopts.h><br>
> > >> > -#include <bsp/irq.h><br>
> > >> > -#include <bsp/usart.h><br>
> > >> > +#include <bsp.h><br>
> > >> > #include <bsp/raspberrypi.h><br>
> > >> > +#include <bsp/usart.h><br>
> > >> > +#include <bsp/arm-pl011.h><br>
> > >> > #include <bsp/fbcons.h><br>
> > >> > +#include <bsp/console-termios.h><br>
> > >> > +#include <bsp/fdt.h><br>
> > >> > +#include <bsp/fatal.h><br>
> > >> > +<br>
> > >> > +#include <bspopts.h><br>
> > >> > +<br>
> > >> > +#include <libfdt.h><br>
> > >> > +#include <libchip/serial.h><br>
> > >> > +<br>
> > >> > +arm_pl011_context pl011_context;<br>
> > >> > +rpi_fb_context fb_context;<br>
> > >><br>
> > >> These could be static.<br>
> > >><br>
> > >> > +<br>
> > >> > +static void output_char_serial(char c)<br>
> > >> > +{<br>
> > >> > + arm_pl011_write_polled(&pl011_context.base, c);<br>
> > >> > +}<br>
> > >> > +<br>
> > >> > +void output_char_fb(char c)<br>
> > >> > +{<br>
> > >> > + fbcons_write_polled(&fb_context.base, c);<br>
> > >> > +}<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>
> > >> > -};<br>
> > >> > -<br>
> > >> > -#define PORT_COUNT \<br>
> > >> > - (sizeof(Console_Configuration_Ports) \<br>
> > >> > - / sizeof(Console_Configuration_Ports [0]))<br>
> > >> > -<br>
> > >> > -unsigned long Console_Configuration_Count =<br>
> PORT_COUNT;<br>
> > >> > -<br>
> > >> > -static void output_char(char c)<br>
> > >> > +<br>
> > >> > +static void *get_reg_of_node(const void *fdt,<br>
> int node)<br>
> > >> > {<br>
> > >> > - const console_fns *con =<br>
> > >> > - Console_Configuration_Ports<br>
> > [Console_Port_Minor].pDeviceFns;<br>
> > >> > + int len;<br>
> > >> > + const uint32_t *val;<br>
> > >> > +<br>
> > >> > + val = fdt_getprop(fdt, node, "reg", &len);<br>
> > >> > + if (val == NULL || len < 4) {<br>
> > >> > + return NULL;<br>
> > >> > + }<br>
> > >> ><br>
> > >> > - con->deviceWritePolled((int)<br>
> Console_Port_Minor, c);<br>
> > >> > + return (void *) fdt32_to_cpu(val[0]);<br>
> > >> > }<br>
> > >> ><br>
> > >> > -BSP_output_char_function_type BSP_output_char =<br>
> > output_char;<br>
> > >> > +static void register_arm_pl011(<br>
> > >> > + const void *fdt,<br>
> > >> > + const char *serial<br>
> > >> > +)<br>
> > >> > +{<br>
> > >> > + arm_pl011_context *ctx = &pl011_context;<br>
> > >> > + int node;<br>
> > >> > +<br>
> > >> > + if (strcmp(serial, "uart0") == 0) {<br>
> > >> > +<br>
> > >> > + <br>
> > rtems_termios_device_context_initialize(&ctx->base, "UART");<br>
> > >> > + node = fdt_path_offset(fdt, serial);<br>
> > >> > + ctx->regs = get_reg_of_node(fdt, node);<br>
> > >> > + }<br>
> > >> > +<br>
> > >> > + rtems_termios_device_install(<br>
> > >> > + "/dev/ttyuart0",<br>
> > >> > + &arm_pl011_fns,<br>
> > >> > + NULL,<br>
> > >> > + &pl011_context.base<br>
> > >> > + );<br>
> > >> > +}<br>
> > >> > +<br>
> > >> > +static void register_fb( void )<br>
> > >> > +{<br>
> > >> > + if (fbcons_probe(&fb_context.base) == true) {<br>
> > >> > + rtems_termios_device_install(<br>
> > >> > + "/dev/fbcons",<br>
> > >> > + &fbcons_fns,<br>
> > >> > + NULL,<br>
> > >> > + &fb_context.base);<br>
> > >> > + }<br>
> > >> > +}<br>
> > >> > +<br>
> > >> > +static void console_select( const char *console )<br>
> > >> > +{<br>
> > >> > + const char *opt;<br>
> > >> > +<br>
> > >> > + opt = rpi_cmdline_get_arg("--console=");<br>
> > >> > +<br>
> > >> > + if ( opt ) {<br>
> > >> > + if ( strncmp( opt, "fbcons", sizeof(<br>
> "fbcons" ) -<br>
> > 1 ) ==<br>
> > >> 0 ) {<br>
> > >> > + if ( rpi_video_is_initialized() > 0 ) {<br>
> > >> > + BSP_output_char = output_char_fb;<br>
> > >> > + link("/dev/fbcons", CONSOLE_DEVICE_NAME);<br>
> > >> > + }<br>
> > >> > + }else{<br>
> > >> > +<br>
> > >> > + if ( console == NULL ){<br>
> > >> > + bsp_fatal( BSP_FATAL_CONSOLE_NO_DEV );<br>
> > >> > + }<br>
> > >> > + BSP_output_char = output_char_serial;<br>
> > >> > + link("/dev/ttyuart0", CONSOLE_DEVICE_NAME);<br>
> > >> > + }<br>
> > >> > + }<br>
> > >> > +}<br>
> > >> > +<br>
> > >> > +static void uart_probe(void)<br>
> > >> > +{<br>
> > >> > + const void *fdt;<br>
> > >> > + const char *console;<br>
> > >> > + int node;<br>
> > >> > +<br>
> > >> > + fdt = bsp_fdt_get();<br>
> > >> > + node = fdt_path_offset(fdt, "/chosen");<br>
> > >> > +<br>
> > >> > + console = fdt_getprop(fdt, node,<br>
> "stdout-path", NULL);<br>
> > >> > +<br>
> > >> > + node = fdt_path_offset(fdt, "/aliases");<br>
> > >> > +<br>
> > >> > + int offset = fdt_first_property_offset(fdt, node);<br>
> > >> > +<br>
> > >> > + while (offset >= 0) {<br>
> > >> > + const struct fdt_property *prop;<br>
> > >> > +<br>
> > >> > + prop = fdt_get_property_by_offset(fdt,<br>
> offset, NULL);<br>
> > >> > +<br>
> > >> > + if (prop != NULL) {<br>
> > >> > + const char *name;<br>
> > >> > +<br>
> > >> > + name = fdt_string(fdt,<br>
> fdt32_to_cpu(prop->nameoff));<br>
> > >> > + if(strstr(name, "serial") != NULL) {<br>
> > >> > + const char *serial;<br>
> > >> > + serial = prop->data;<br>
> > >> > +<br>
> > >> > + register_arm_pl011(fdt, serial);<br>
> > >> > + }<br>
> > >> > + }<br>
> > >> > +<br>
> > >> > + offset = fdt_next_property_offset(fdt, offset);<br>
> > >> > + }<br>
> > >> > + console_select(console);<br>
> > >> > +}<br>
> > >> > +<br>
> > >> > +<br>
> > >> > +rtems_status_code console_initialize(<br>
> > >> > + rtems_device_major_number major,<br>
> > >> > + rtems_device_minor_number minor,<br>
> > >> > + void *arg<br>
> > >> > +)<br>
> > >> > +{<br>
> > >> > + rtems_termios_initialize();<br>
> > >> > + uart_probe();<br>
> > >> > + register_fb();<br>
> > >> > +<br>
> > >> > + return RTEMS_SUCCESSFUL;<br>
> > >> > +}<br>
> > >> > +<br>
> > >> > +BSP_output_char_function_type BSP_output_char =<br>
> > >> output_char_serial;<br>
> > >> ><br>
> > >> > BSP_polling_getchar_function_type BSP_poll_char<br>
> = NULL;<br>
> > >> > +<br>
> > >> > +RTEMS_SYSINIT_ITEM(<br>
> > >> > + uart_probe,<br>
> > >> > + RTEMS_SYSINIT_BSP_START,<br>
> > >> > + RTEMS_SYSINIT_ORDER_LAST<br>
> > >> > +);<br>
> > >> > \ No newline at end of file<br>
> > >> > diff --git<br>
> a/bsps/arm/raspberrypi/console/console_select.c<br>
> > >> > b/bsps/arm/raspberrypi/console/console_select.c<br>
> > >> > deleted file mode 100644<br>
> > >> > index bd246ca868..0000000000<br>
> > >> > --- a/bsps/arm/raspberrypi/console/console_select.c<br>
> > >> > +++ /dev/null<br>
> > >> > @@ -1,114 +0,0 @@<br>
> > >> > -/**<br>
> > >> > - * @file<br>
> > >> > - *<br>
> > >> > - * @ingroup raspberrypi_console<br>
> > >> > - *<br>
> > >> > - * @brief console select<br>
> > >> > - */<br>
> > >> > -<br>
> > >> > -/*<br>
> > >> > - * Copyright (c) 2015 Yang Qiao<br>
> > >> > - *<br>
> > >> > - * The license and distribution terms for this file<br>
> > may be<br>
> > >> > - * found in the file LICENSE in this<br>
> distribution or at<br>
> > >> > - *<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.h><br>
> > >> > -#include <bsp/fatal.h><br>
> > >> > -#include <rtems/libio.h><br>
> > >> > -#include <stdlib.h><br>
> > >> > -#include <string.h><br>
> > >> > -#include <assert.h><br>
> > >> > -#include <termios.h><br>
> > >> > -<br>
> > >> > -#include <rtems/termiostypes.h><br>
> > >> > -#include <libchip/serial.h><br>
> > >> > -#include "../../shared/dev/serial/legacy-console.h"<br>
> > >> > -#include <bsp/rpi-fb.h><br>
> > >> > -<br>
> > >> > -rtems_device_minor_number BSPPrintkPort = 0;<br>
> > >> > -<br>
> > >> > -/*<br>
> > >> > - * Method to return true if the device<br>
> associated with the<br>
> > >> > - * minor number probs available.<br>
> > >> > - */<br>
> > >> > -static bool bsp_Is_Available(<br>
> > rtems_device_minor_number minor )<br>
> > >> > -{<br>
> > >> > - console_tbl *cptr = Console_Port_Tbl[ minor ];<br>
> > >> > -<br>
> > >> > - /*<br>
> > >> > - * First perform the configuration dependent<br>
> probe,<br>
> > then the<br>
> > >> > - * device dependent probe<br>
> > >> > - */<br>
> > >> > - if ( ( !cptr->deviceProbe || cptr->deviceProbe(<br>
> > 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<br>
> > bsp_First_Available_Device(<br>
> > >> void )<br>
> > >> > -{<br>
> > >> > - rtems_device_minor_number minor;<br>
> > >> > -<br>
> > >> > - for ( minor = 0; minor < Console_Port_Count;<br>
> minor++ ) {<br>
> > >> > - console_tbl *cptr = Console_Port_Tbl[ minor ];<br>
> > >> > -<br>
> > >> > - /*<br>
> > >> > - * First perform the configuration dependent<br>
> > probe, then the<br>
> > >> > - * device dependent probe<br>
> > >> > - */<br>
> > >> > -<br>
> > >> > - if ( ( !cptr->deviceProbe || cptr->deviceProbe(<br>
> > minor ) ) &&<br>
> > >> > - cptr->pDeviceFns->deviceProbe( minor ) ) {<br>
> > >> > - return minor;<br>
> > >> > - }<br>
> > >> > - }<br>
> > >> > -<br>
> > >> > - /*<br>
> > >> > - * Error No devices were found. We will want to<br>
> > bail here.<br>
> > >> > - */<br>
> > >> > - bsp_fatal( BSP_FATAL_CONSOLE_NO_DEV );<br>
> > >> > -}<br>
> > >> > -<br>
> > >> > -void bsp_console_select( void )<br>
> > >> > -{<br>
> > >> > - /*<br>
> > >> > - * Reset Console_Port_Minor and<br>
> > >> > - * BSPPrintkPort here if desired.<br>
> > >> > - *<br>
> > >> > - * This default version allows the bsp to set<br>
> these<br>
> > >> > - * values at creation and will not touch them<br>
> again<br>
> > >> > - * unless the selected port number is not<br>
> available.<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(<br>
> "fbcons" ) -<br>
> > 1 ) ==<br>
> > >> 0 ) {<br>
> > >> > - if ( rpi_video_is_initialized() > 0 ) {<br>
> > >> > - Console_Port_Minor = BSP_CONSOLE_FB;<br>
> > >> > - BSPPrintkPort = BSP_CONSOLE_FB;<br>
> > >> > - }<br>
> > >> > - }<br>
> > >> > - }<br>
> > >> > -<br>
> > >> > - /*<br>
> > >> > - * If the device that was selected isn't<br>
> available then<br>
> > >> > - * let the user know and select the first<br>
> available<br>
> > device.<br>
> > >> > - */<br>
> > >> > - if ( !bsp_Is_Available( Console_Port_Minor ) ) {<br>
> > >> > - Console_Port_Minor =<br>
> 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..0e6a430c54 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>
> > >> > @@ -29,15 +30,6 @@<br>
> > >> > #include <bsp/vc.h><br>
> > >> > #include <bsp/rpi-fb.h><br>
> > >> ><br>
> > >> > -/*<br>
> > >> > - * fbcons_init<br>
> > >> > - *<br>
> > >> > - * This function initializes the fb console to a<br>
> > quiecsent<br>
> > >> state.<br>
> > >> > - */<br>
> > >> > -static void fbcons_init( int minor )<br>
> > >> > -{<br>
> > >> > -}<br>
> > >> > -<br>
> > >> > /*<br>
> > >> > * fbcons_open<br>
> > >> > *<br>
> > >> > @@ -45,13 +37,14 @@ static void fbcons_init( int<br>
> minor )<br>
> > >> > *<br>
> > >> > * Default state is 9600 baud, 8 bits, No<br>
> parity, and<br>
> > 1 stop<br>
> > >> bit.<br>
> > >> > */<br>
> > >> > -static int fbcons_open(<br>
> > >> > - int major,<br>
> > >> > - int minor,<br>
> > >> > - void *arg<br>
> > >> > +static bool fbcons_open(<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>
> > >> > + return true;<br>
> > >> > }<br>
> > >> ><br>
> > >> > /*<br>
> > >> > @@ -59,13 +52,12 @@ static int fbcons_open(<br>
> > >> > *<br>
> > >> > * This function shuts down the requested port.<br>
> > >> > */<br>
> > >> > -static int fbcons_close(<br>
> > >> > - int major,<br>
> > >> > - int minor,<br>
> > >> > - void *arg<br>
> > >> > +static void fbcons_close(<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>
> > >> > }<br>
> > >> ><br>
> > >> > /*<br>
> > >> > @@ -73,8 +65,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>
> > >> > @@ -90,8 +82,8 @@ static void fbcons_write_polled(<br>
> > >> > * Console Termios output entry point when using<br>
> > polled output.<br>
> > >> > *<br>
> > >> > */<br>
> > >> > -static ssize_t fbcons_write_support_polled(<br>
> > >> > - int minor,<br>
> > >> > +static void fbcons_write_support_polled(<br>
> > >> > + rtems_termios_device_context *base,<br>
> > >> > const char *buf,<br>
> > >> > size_t len<br>
> > >> > )<br>
> > >> > @@ -102,14 +94,9 @@ static ssize_t<br>
> > 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>
> > >> > - /*<br>
> > >> > - * return the number of bytes written.<br>
> > >> > - */<br>
> > >> > - return nwrite;<br>
> > >> > }<br>
> > >> ><br>
> > >> > /*<br>
> > >> > @@ -117,7 +104,9 @@ static ssize_t<br>
> > fbcons_write_support_polled(<br>
> > >> > *<br>
> > >> > * Console Termios polling input entry point.<br>
> > >> > */<br>
> > >> > -static int fbcons_inbyte_nonblocking_polled( int<br>
> minor )<br>
> > >> > +int fbcons_inbyte_nonblocking_polled(<br>
> > >> > + rtems_termios_device_context *base<br>
> > >> > +)<br>
> > >> > {<br>
> > >> > // if( rtems_kbpoll() ) {<br>
> > >> > // int c = getch();<br>
> > >> > @@ -133,15 +122,17 @@ static int<br>
> > fbcons_inbyte_nonblocking_polled(<br>
> > >> > int minor )<br>
> > >> > * This function sets the UART channel to<br>
> reflect the<br>
> > requested<br>
> > >> > termios<br>
> > >> > * port settings.<br>
> > >> > */<br>
> > >> > -static int fbcons_set_attributes(<br>
> > >> > - int minor,<br>
> > >> > +static bool fbcons_set_attributes(<br>
> > >> > + rtems_termios_device_context *base,<br>
> > >> > const struct termios *t<br>
> > >> > )<br>
> > >> > {<br>
> > >> > - return 0;<br>
> > >> > + return true;<br>
> > >> > }<br>
> > >> ><br>
> > >> > -bool fbcons_probe( int minor )<br>
> > >> > +bool fbcons_probe(<br>
> > >> > + rtems_termios_device_context *context<br>
> > >> > +)<br>
> > >> > {<br>
> > >> > // rtems_status_code status;<br>
> > >> > static bool firstTime = true;<br>
> > >> > @@ -163,15 +154,12 @@ 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, <br>
> /*<br>
> > >> deviceProbe */<br>
> > >> > - .deviceFirstOpen = fbcons_open, /*<br>
> > >> deviceFirstOpen */<br>
> > >> > - .deviceLastClose = fbcons_close, /*<br>
> > >> deviceLastClose */<br>
> > >> > - .deviceRead = fbcons_inbyte_nonblocking_polled, /*<br>
> > >> deviceRead */<br>
> > >> > - .deviceWrite = fbcons_write_support_polled, /*<br>
> > >> 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>
> > >> > + .set_attributes = fbcons_set_attributes,<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>
> > >> > deleted file mode 100644<br>
> > >> > index 25fb523621..0000000000<br>
> > >> > --- a/bsps/arm/raspberrypi/console/usart.c<br>
> > >> > +++ /dev/null<br>
> > >> > @@ -1,167 +0,0 @@<br>
> > >> > -/**<br>
> > >> > - * @file<br>
> > >> > - *<br>
> > >> > - * @ingroup raspberrypi_usart<br>
> > >> > - *<br>
> > >> > - * @brief USART support.<br>
> > >> > - */<br>
> > >> > -<br>
> > >> > -/*<br>
> > >> > - * Copyright (c) 2013 Alan Cudmore<br>
> > >> > - *<br>
> > >> > - * The license and distribution terms for this file<br>
> > may be<br>
> > >> > - * found in the file LICENSE in this<br>
> distribution or at<br>
> > >> > - *<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 <libchip/sersupp.h><br>
> > >> > -<br>
> > >> > -#include <bsp.h><br>
> > >> > -#include <bsp/irq.h><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<br>
> > interrupt<br>
> > >> driven IO.<br>
> > >> > - */<br>
> > >> > -static rtems_vector_number<br>
> usart_get_irq_number(const<br>
> > >> console_tbl *ct)<br>
> > >> > -{<br>
> > >> > - return ct->ulIntVector;<br>
> > >> > -}<br>
> > >> > -<br>
> > >> > -static uint32_t usart_get_baud(const console_tbl<br>
> *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) =<br>
> (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) =<br>
> BCM2835_UART0_IMSC_RX;<br>
> > >> > -<br>
> > >> > - usart_set_baud(minor, 115000);<br>
> > >> > -}<br>
> > >> > -<br>
> > >> > -static int usart_first_open(int major, int<br>
> minor, void<br>
> > *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<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>
> > >> > -<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<br>
> minor, void<br>
> > *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)) &<br>
> > BCM2835_UART0_FR_RXFE)<br>
> > >> > == 0) {<br>
> > >> > - return((BCM2835_REG(BCM2835_UART0_DR)) &<br>
> 0xFF );<br>
> > >> > - } else {<br>
> > >> > - return -1;<br>
> > >> > - }<br>
> > >> > - } else {<br>
> > >> > - printk("Unknown console minor number: %d\n",<br>
> 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) &<br>
> > >> 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<br>
> struct<br>
> > >> 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<br>
> a/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
> > >> > b/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
> > >> > index d0e126699a..9bdb4b115e 100644<br>
> > >> > --- a/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
> > >> > +++ b/bsps/arm/raspberrypi/include/bsp/fbcons.h<br>
> > >> > @@ -33,12 +33,29 @@ 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>
> > >> > +int fbcons_inbyte_nonblocking_polled(<br>
> > >> > + rtems_termios_device_context *base<br>
> > >> > +);<br>
> > >> > +<br>
> > >> > +void output_char_fb(char c);<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<br>
> fbcons_fns;<br>
> > >> ><br>
> > >> > #ifdef __cplusplus<br>
> > >> > }<br>
> > >> > diff --git<br>
> a/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
> > >> > b/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
> > >> > index 40c80cf408..e052c2becb 100644<br>
> > >> > --- a/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
> > >> > +++ b/bsps/arm/raspberrypi/include/bsp/raspberrypi.h<br>
> > >> > @@ -24,6 +24,7 @@<br>
> > >> > #include <bspopts.h><br>
> > >> > #include <stdint.h><br>
> > >> > #include <bsp/utility.h><br>
> > >> > +#include <rtems/termiostypes.h><br>
> > >> ><br>
> > >> > /**<br>
> > >> > * @defgroup raspberrypi_reg Register Definitions<br>
> > >> > @@ -60,6 +61,17 @@<br>
> > >> ><br>
> > >> > #define RPI_PERIPHERAL_SIZE 0x01000000<br>
> > >> ><br>
> > >> > +/**<br>
> > >> > + * @name Console select definitions<br>
> > >> > + *<br>
> > >> > + * @{<br>
> > >> > + */<br>
> > >> > +<br>
> > >> > +#define PL011 0<br>
> > >> > +#define FB 1<br>
> > >> > +<br>
> > >> > +/** @} */<br>
> > >> > +<br>
> > >> > /**<br>
> > >> > * @name Internal ARM Timer Registers<br>
> > >> > *<br>
> > >> > @@ -184,42 +196,6 @@<br>
> > >> ><br>
> > >> > /** @} */<br>
> > >> ><br>
> > >> > -/**<br>
> > >> > - * @name UART 0 (PL011) Registers<br>
> > >> > - *<br>
> > >> > - * @{<br>
> > >> > - */<br>
> > >> > -<br>
> > >> > -#define BCM2835_UART0_BASE <br>
> (RPI_PERIPHERAL_BASE<br>
> > + 0x201000)<br>
> > >> > -<br>
> > >> > -#define BCM2835_UART0_DR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x00)<br>
> > >> > -#define BCM2835_UART0_RSRECR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x04)<br>
> > >> > -#define BCM2835_UART0_FR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x18)<br>
> > >> > -#define BCM2835_UART0_ILPR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x20)<br>
> > >> > -#define BCM2835_UART0_IBRD <br>
> (BCM2835_UART0_BASE +<br>
> > 0x24)<br>
> > >> > -#define BCM2835_UART0_FBRD <br>
> (BCM2835_UART0_BASE +<br>
> > 0x28)<br>
> > >> > -#define BCM2835_UART0_LCRH <br>
> (BCM2835_UART0_BASE +<br>
> > 0x2C)<br>
> > >> > -#define BCM2835_UART0_CR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x30)<br>
> > >> > -#define BCM2835_UART0_IFLS <br>
> (BCM2835_UART0_BASE +<br>
> > 0x34)<br>
> > >> > -#define BCM2835_UART0_IMSC <br>
> (BCM2835_UART0_BASE +<br>
> > 0x38)<br>
> > >> > -#define BCM2835_UART0_RIS <br>
> (BCM2835_UART0_BASE +<br>
> > 0x3C)<br>
> > >> > -#define BCM2835_UART0_MIS <br>
> (BCM2835_UART0_BASE +<br>
> > 0x40)<br>
> > >> > -#define BCM2835_UART0_ICR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x44)<br>
> > >> > -#define BCM2835_UART0_DMACR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x48)<br>
> > >> > -#define BCM2835_UART0_ITCR <br>
> (BCM2835_UART0_BASE +<br>
> > 0x80)<br>
> > >> > -#define BCM2835_UART0_ITIP <br>
> (BCM2835_UART0_BASE +<br>
> > 0x84)<br>
> > >> > -#define BCM2835_UART0_ITOP <br>
> (BCM2835_UART0_BASE +<br>
> > 0x88)<br>
> > >> > -#define BCM2835_UART0_TDR <br>
> (BCM2835_UART0_BASE +<br>
> > 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 +<br>
> > 0x201000)<br>
> > >> ><br>
> > >> > #ifdef __cplusplus<br>
> > >> > }<br>
> > >> > diff --git<br>
> a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br>
> > >> > b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br>
> > >> > index 11a22f89e3..0e0d5bef67 100644<br>
> > >> > --- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br>
> > >> > +++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br>
> > >> > @@ -42,6 +42,7 @@ librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/shared/start/bspfatal-default.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> > <br>
> ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> > ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> ../../../../../../bsps/shared/start/sbrk.c<br>
> > >> > +librtemsbsp_a_SOURCES +=<br>
> > >> ../../../../../../bsps/shared/start/bsp-fdt.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > ../../../../../../bsps/shared/start/stackalloc.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/arm/shared/start/bsp-start-memcpy.S<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> > ../../../../../../bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c<br>
> > >> > @@ -63,14 +64,13 @@ librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/arm/shared/cp15/arm-cp15-set-exc<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > ../../../../../../bsps/arm/raspberrypi/irq/irq.c<br>
> > >> ><br>
> > >> > # Console<br>
> > >> > -librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/shared/dev/serial/legacy-console.c<br>
> > >> > -librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> > ../../../../../../bsps/shared/dev/serial/legacy-console-control.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> > ../../../../../../bsps/arm/raspberrypi/console/console-config.c<br>
> > >> > -librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> > ../../../../../../bsps/arm/raspberrypi/console/console_select.c<br>
> > >> > -librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/arm/raspberrypi/console/usart.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > ../../../../../../bsps/arm/raspberrypi/console/fb.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/arm/raspberrypi/console/fbcons.c<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/arm/raspberrypi/console/outch.c<br>
> > >> > +librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/shared/dev/serial/console-termios.c<br>
> > >> > +librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> > ../../../../../../bsps/shared/dev/serial/console-termios-init.c<br>
> > >> > +librtemsbsp_a_SOURCES +=<br>
> > >> > ../../../../../../bsps/arm/shared/serial/arm-pl011.c<br>
> > >> ><br>
> > >> > # Mailbox<br>
> > >> > librtemsbsp_a_SOURCES +=<br>
> > >> > <br>
> ../../../../../../bsps/arm/raspberrypi/start/mailbox.c<br>
> > >> > --<br>
> > >> > 2.17.1<br>
> > >> ><br>
> > >><br>
> ><br>
> <br>
</blockquote></div>
</blockquote></div>