Skip to content
Snippets Groups Projects
Commit e7f37605 authored by Strozzi's avatar Strozzi
Browse files

interrupt tranmissio in case rx is full

parent 396c2994
Branches
No related tags found
No related merge requests found
......@@ -116,7 +116,7 @@ int int2hex (char *c, int i) {
int main () {
Tcontrol ctrl;
char n[16], f[16], c;
int fib, j, s, val;
int fib, j, s, val, rx, sent;
uart= IO_UART_ADDR;
// initialize UART control
......@@ -135,8 +135,15 @@ int main () {
if (fib < BUF_SZ) {
fib = buf[fib];
s= int2hex(f, fib); // retorna strlen de f
for (j= 0; j< s; j++)
while(!Putc(f[j])); // enquanto fila de tranmissão está cheia
for (j= 0; j< s; j++) {
// full(!rx_q) && !sent
while(((rx = proberx()) < 16) && ((sent=Putc(f[j])!= 0)));
if (rx == 16) { // rx_q is full
// Esvazia rx_q
}
if (sent == 0)
j--; // don't send char in this turn
}
} else
for (j= 0; j<sizeof(BOUND_MESG); j++)
to_stdout(BOUND_MESG[j]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment