예제 #1
0
void debug_rcv(char ch)
{
	static int  lineptr = 0;
	static char linebuff[256];

	if ((ch=='\r') || (lineptr==255))
	{
		linebuff[lineptr] = 0;
		if (lineptr)
		{
			debug_parse(linebuff);
		}
		lineptr = 0;
		SendDebugPrompt;
	}
	else if (iscntrl(ch))
	{
		switch (ch)
		{
		case BS:
			if (lineptr)
			{
				DebugPutChar(ch);
				lineptr--;
			}
			break;
		}
	}
	else
	{
		linebuff[lineptr++] = ch;
		DebugPutChar(ch);
	}
}
예제 #2
0
파일: debug.c 프로젝트: michalsc/AROS
void DebugPutDec(const char *what, ULONG val)
{
	int i, num;
	DebugPutStr(what);
	DebugPutStr(": ");
	if (val == 0) {
	    DebugPutChar('0');
	    DebugPutChar('\n');
	    return;
	}

	for (i = 1000000000; i > 0; i /= 10) {
	    if (val == 0) {
	    	DebugPutChar('0');
	    	continue;
	    }

	    num = val / i;
	    if (num == 0)
	    	continue;

	    DebugPutChar("0123456789"[num]);
	    val -= num * i;
	}
	DebugPutChar('\n');
}
예제 #3
0
파일: debug.c 프로젝트: michalsc/AROS
void DebugPutHex(const char *what, ULONG val)
{
	DebugPutStr(what);
	DebugPutStr(": ");
	DebugPutHexVal(val);
	DebugPutChar('\n');
}
예제 #4
0
파일: debug.c 프로젝트: michalsc/AROS
void DebugPutHexVal(ULONG val)
{
	int i;
	for (i = 0; i < 8; i ++) {
		DebugPutChar("0123456789abcdef"[(val >> (28 - (i * 4))) & 0xf]);
	}
	DebugPutChar(' ');
}
예제 #5
0
void DebugSend(char *message)
{
	char ch;

	while (*message != '\0')
	{
		ch = *message;
		message++;
		DebugPutChar(ch);
	}
}
예제 #6
0
파일: debug.c 프로젝트: michalsc/AROS
int DebugPutChar(register int chr)
{
	if (chr == '\n')
		DebugPutChar('\r');

	while ((reg_r(SERDATR) & SERDATR_TBE) == 0);
	reg_w(INTREQ, INTF_TBE);

	/* Output a char to the debug UART */
	reg_w(SERDAT, SERDAT_STP8 | SERDAT_DB8(chr));

	return 1;
}
예제 #7
0
파일: debug.c 프로젝트: michalsc/AROS
void DebugPutStr(register const char *buff)
{
	for (; *buff != 0; buff++)
		DebugPutChar(*buff);
}