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 21:43:21 -05:00
parent 125c31a827
commit 84882c0039
1 changed files with 5 additions and 8 deletions

View File

@ -17,7 +17,8 @@
#include <string.h>
UartPL011* gLoaderUART;
UartPL011 gLoaderUART(uart_base_debug());
static int32 sSerialEnabled = 0;
static char sBuffer[16384];
@ -27,7 +28,7 @@ static uint32 sBufferPosition;
static void
serial_putc(char c)
{
gLoaderUART->PutChar(c);
gLoaderUART.PutChar(c);
}
@ -80,12 +81,8 @@ serial_cleanup(void)
extern "C" void
serial_init(void)
{
gLoaderUART = new(nothrow) UartPL011(uart_base_debug());
if (gLoaderUART == 0)
return;
gLoaderUART->InitEarly();
gLoaderUART->InitPort(9600);
gLoaderUART.InitEarly();
gLoaderUART.InitPort(9600);
serial_enable();