2012-10-14 19:18:13 +02:00
|
|
|
#include <gccore.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "gecko.h"
|
|
|
|
|
|
|
|
/* init-globals */
|
|
|
|
bool geckoinit = false;
|
|
|
|
char gprintfBuffer[256];
|
|
|
|
void gprintf(const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list va;
|
2012-10-21 17:28:00 +02:00
|
|
|
if(geckoinit)
|
|
|
|
{
|
|
|
|
va_start(va, format);
|
|
|
|
int len = vsnprintf(gprintfBuffer, 255, format, va);
|
|
|
|
u32 level = IRQ_Disable();
|
|
|
|
usb_sendbuffer_safe(1, gprintfBuffer, len);
|
|
|
|
IRQ_Restore(level);
|
|
|
|
va_end(va);
|
|
|
|
}
|
2012-10-14 19:18:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool InitGecko()
|
|
|
|
{
|
2012-10-21 17:28:00 +02:00
|
|
|
memset(gprintfBuffer, 0, 256);
|
2012-10-14 19:18:13 +02:00
|
|
|
u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
|
|
|
|
if(geckoattached)
|
|
|
|
{
|
|
|
|
geckoinit = true;
|
|
|
|
usb_flush(EXI_CHANNEL_1);
|
|
|
|
}
|
|
|
|
return geckoinit;
|
|
|
|
}
|