rpi serial: C++ constructors not getting called

* Make a global
* Thanks to pfoetchen + OmniMancer for figuring it out
This commit is contained in:
Alexander von Gluck IV
2012-05-14 22:35:02 -05:00
parent 125c31a827
commit 84882c0039
@@ -17,7 +17,8 @@
#include <string.h> #include <string.h>
UartPL011* gLoaderUART; UartPL011 gLoaderUART(uart_base_debug());
static int32 sSerialEnabled = 0; static int32 sSerialEnabled = 0;
static char sBuffer[16384]; static char sBuffer[16384];
@@ -27,7 +28,7 @@ static uint32 sBufferPosition;
static void static void
serial_putc(char c) serial_putc(char c)
{ {
gLoaderUART->PutChar(c); gLoaderUART.PutChar(c);
} }
@@ -80,12 +81,8 @@ serial_cleanup(void)
extern "C" void extern "C" void
serial_init(void) serial_init(void)
{ {
gLoaderUART = new(nothrow) UartPL011(uart_base_debug()); gLoaderUART.InitEarly();
if (gLoaderUART == 0) gLoaderUART.InitPort(9600);
return;
gLoaderUART->InitEarly();
gLoaderUART->InitPort(9600);
serial_enable(); serial_enable();