<div dir="auto">Looks good to me, thanks for the type fixes too.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 16, 2020, 11:58 PM <<a href="mailto:chrisj@rtems.org">chrisj@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Chris Johns <<a href="mailto:chrisj@rtems.org" target="_blank" rel="noreferrer">chrisj@rtems.org</a>><br>
<br>
---<br>
bsps/i386/pc386/console/conscfg.c | 7 ++--<br>
bsps/i386/pc386/console/printk_support.c | 42 +++++++++++++++++++-----<br>
2 files changed, 37 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/bsps/i386/pc386/console/conscfg.c b/bsps/i386/pc386/console/conscfg.c<br>
index a4ae88626f..8aa8ab5c2a 100644<br>
--- a/bsps/i386/pc386/console/conscfg.c<br>
+++ b/bsps/i386/pc386/console/conscfg.c<br>
@@ -46,15 +46,14 @@<br>
<br>
#define CLOCK_RATE (115200 * 16)<br>
<br>
- static uint8_t com_get_register(uint32_t addr, uint8_t i)<br>
+ static uint8_t com_get_register(uintptr_t addr, uint8_t i)<br>
{<br>
- register uint8_t val;<br>
-<br>
+ uint8_t val;<br>
inport_byte( (addr + i), val );<br>
return val;<br>
}<br>
<br>
- static void com_set_register(uint32_t addr, uint8_t i, uint8_t val)<br>
+ static void com_set_register(uintptr_t addr, uint8_t i, uint8_t val)<br>
{<br>
outport_byte( (addr + i), val );<br>
}<br>
diff --git a/bsps/i386/pc386/console/printk_support.c b/bsps/i386/pc386/console/printk_support.c<br>
index d7bc329868..c9e003dab0 100644<br>
--- a/bsps/i386/pc386/console/printk_support.c<br>
+++ b/bsps/i386/pc386/console/printk_support.c<br>
@@ -29,6 +29,28 @@<br>
<br>
rtems_device_minor_number BSPPrintkPort = 0;<br>
<br>
+static bool serialInit;<br>
+static bool serialOK;<br>
+<br>
+static bool serialValid(console_tbl *port)<br>
+{<br>
+ if (port->pDeviceFns) {<br>
+ if (!serialInit) {<br>
+ serialOK = true;<br>
+ if (port->pDeviceFns->deviceProbe != NULL) {<br>
+ if (!port->pDeviceFns->deviceProbe( BSPPrintkPort ))<br>
+ serialOK = false;<br>
+ else if (port->pDeviceFns->deviceInitialize != NULL)<br>
+ port->pDeviceFns->deviceInitialize( BSPPrintkPort );<br>
+ else<br>
+ serialOK = false;<br>
+ }<br>
+ serialInit = true;<br>
+ }<br>
+ }<br>
+ return serialOK;<br>
+}<br>
+<br>
void BSP_outch(char ch);<br>
int BSP_inch(void);<br>
<br>
@@ -42,10 +64,12 @@ void BSP_outch(char ch)<br>
<br>
if ( !isVga ) {<br>
console_tbl *port = Console_Port_Tbl[BSPPrintkPort];<br>
- if (port->pDeviceFns && port->pDeviceFns->deviceWritePolled) {<br>
- port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );<br>
+ if (serialValid(port)) {<br>
+ if (port->pDeviceFns->deviceWritePolled) {<br>
+ port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );<br>
+ }<br>
+ return;<br>
}<br>
- return;<br>
}<br>
<br>
#if BSP_ENABLE_VGA<br>
@@ -65,11 +89,13 @@ int BSP_inch(void)<br>
<br>
if ( !isVga ) {<br>
console_tbl *port = Console_Port_Tbl[BSPPrintkPort];<br>
- if (port->pDeviceFns && port->pDeviceFns->deviceRead) {<br>
- do {<br>
- result = port->pDeviceFns->deviceRead( BSPPrintkPort );<br>
- } while (result == -1);<br>
- return result;<br>
+ if (serialValid(port)) {<br>
+ if (port->pDeviceFns->deviceRead) {<br>
+ do {<br>
+ result = port->pDeviceFns->deviceRead( BSPPrintkPort );<br>
+ } while (result == -1);<br>
+ return result;<br>
+ }<br>
}<br>
}<br>
<br>
-- <br>
2.24.1<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>