software/bios: switch to standard CRLF

Avoid setting terminal to "implicit CR in every LF" mode.
This commit is contained in:
Florent Kermarrec 2019-08-27 09:45:44 +02:00
parent 0328ba7d6c
commit c179741cf3
3 changed files with 5 additions and 18 deletions

View File

@ -72,7 +72,7 @@ void read_handler(int fd, short event, void *arg)
struct session_s *s = (struct session_s*)arg;
char buffer[1024];
ssize_t read_len;
int i;
read_len = read(fd, buffer, 1024);
for(i = 0; i < read_len; i++) {
@ -137,7 +137,7 @@ static int serial2console_add_pads(void *sess, struct pad_list_s *plist)
litex_sim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid);
litex_sim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready);
}
if(!strcmp(plist->name, "sys_clk"))
litex_sim_module_pads_get(pads, "sys_clk", (void**) &s->sys_clk);
@ -154,8 +154,6 @@ static int serial2console_tick(void *sess) {
*s->tx_ready = 1;
if(*s->tx_valid) {
if(*s->tx == '\n')
printf("\r");
printf("%c", *s->tx);
fflush(stdout);
}

View File

@ -25,6 +25,8 @@ int putchar(int c)
uart_write(c);
if(write_hook != NULL)
write_hook(c);
if (c == '\n')
putchar('\r');
return c;
}

View File

@ -152,8 +152,6 @@ class LiteXTerm:
signal.signal(signal.SIGINT, self.sigint)
self.sigint_time_last = 0
self.lf_insert = True
def open(self, port, baudrate):
if hasattr(self, "port"):
return
@ -261,21 +259,10 @@ class LiteXTerm:
def reader(self):
try:
c_last = 0
while self.reader_alive:
c = self.port.read()
if c_last == b"\r":
if c == b"\n":
self.lf_insert = False
else:
self.lf_insert = True
c_last = c
if self.lf_insert and c == b"\r":
sys.stdout.buffer.write(b"\n")
else:
sys.stdout.buffer.write(c)
sys.stdout.buffer.write(c)
sys.stdout.flush()
if len(self.mem_regions):
if self.serial_boot and self.detect_prompt(c):
self.answer_prompt()