Merge pull request #1894 from mdejw/patch-1

Send serial data to sim uart only if rx_ready is set.
This commit is contained in:
enjoy-digital 2024-02-22 10:22:05 +01:00 committed by GitHub
commit 7f91baae3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 5 deletions

View File

@ -155,12 +155,14 @@ static int serial2console_tick(void *sess, uint64_t time_ps) {
} }
*s->rx_valid = 0; *s->rx_valid = 0;
if(*s->rx_ready) {
if(s->datalen) { if(s->datalen) {
*s->rx = s->databuf[s->data_start]; *s->rx = s->databuf[s->data_start];
s->data_start = (s->data_start + 1) % 2048; s->data_start = (s->data_start + 1) % 2048;
s->datalen--; s->datalen--;
*s->rx_valid = 1; *s->rx_valid = 1;
} }
}
return RC_OK; return RC_OK;
} }