Ejemplo n.º 1
0
static void cb(struct prnt_ctx *ctx, int type)
{
	if(type == 0x200) 
	{
		ctx->len = 0;
	}
	else if(type == 0x201)
	{ 
		usbAsyncWrite(ASYNC_SHELL, ctx->buf, ctx->len);
		ctx->len = 0;
	}
	else
	{
		if(type == '\n')
		{
			cb(ctx, '\r');
		}
		
		ctx->buf[ctx->len++] = type;
		if(ctx->len == CTX_BUF_SIZE)
		{
			usbAsyncWrite(ASYNC_SHELL, ctx->buf, ctx->len);
			ctx->len = 0;
		}
	}
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
	int chan;
	int running = 1;

	pspDebugScreenInit();
	chan = usbAsyncRegister(ASYNC_ALLOC_CHAN, &g_endp);
	if(chan < 0)
	{
		printf("Could not allocate async channel\n");
		return 0;
	}

	usbWaitForConnect();

	printf("Allocated channel %d, connect to localhost port %d and start typing\n", chan, 10000 + chan);
	while(running)
	{
		unsigned char buf[512];
		int len;

		len = usbAsyncRead(chan, buf, sizeof(buf));
		if(len < 0)
		{
			/* Error, most likely shutdown */
			break;
		}

		if(len > 0)
		{
			pspDebugScreenPrintf("Read: %.*s\n", len, buf);
			usbAsyncWrite(chan, buf, len);
		}
	}

	usbAsyncUnregister(chan);

	return 0;
}
Ejemplo n.º 3
0
int usbStderrPrint(const char *data, int size)
{
	usbAsyncWrite(ASYNC_STDERR, data, size);

	return size;
}
Ejemplo n.º 4
0
int usbStdoutPrint(const char *data, int size)
{
	usbAsyncWrite(ASYNC_STDOUT, data, size);

	return size;
}
Ejemplo n.º 5
0
int usbShellPrint(const char *data, int size)
{
	usbAsyncWrite(ASYNC_SHELL, data, size);

	return size;
}
Ejemplo n.º 6
0
int writeDebugData(void *data, int len)
{
	return usbAsyncWrite(ASYNC_GDB, data, len);
}
Ejemplo n.º 7
0
int putDebugChar(unsigned char ch)
{
	return usbAsyncWrite(ASYNC_GDB, &ch, 1);
}