blob: b73e980786a522b5bc2ec20f367d5ea521943283 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#ifdef DEBUG_CONSOLE
#include "debug/console.h"
#include "lib/printf.h"
#include "../hal/serial_com.h"
static char
s_console_getc(void)
{
#ifdef DEBUG_SERIAL
char c = serial_com_getc(SERIAL_COM1);
#endif
serial_com_putc(SERIAL_COM1, c);
return c;
}
int
debug_console_readinput(char *buf, size_t len)
{
serial_com_putc(SERIAL_COM1, '>');
char readc;
int readw = 0;
while((readc = s_console_getc()) != 0xD) {
if(readw > len) break;
buf[readw++] = readc;
}
buf[readw] = 0;
return readw;
}
void debug_console_start(void)
{
char input_buffer[128];
while(1) {
debug_console_readinput(input_buffer, 128);
debug_console_parsecmd(input_buffer);
}
}
#endif
|