wait for TXREADY to avoid serial transmit buffer overrun
This commit is contained in:
@@ -66,7 +66,7 @@ static void xputchar(int c)
|
|||||||
"bsr printf_helper\n\t"
|
"bsr printf_helper\n\t"
|
||||||
/* output */:
|
/* output */:
|
||||||
/* input */: "r" (c)
|
/* input */: "r" (c)
|
||||||
/* clobber */: "d0","a0"
|
/* clobber */: "d0","d2","a0"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,3 +380,12 @@ void xvsnprintf(char *str, size_t size, const char *fmt, va_list va)
|
|||||||
*xstring++ = '\0';
|
*xstring++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void display_progress()
|
||||||
|
{
|
||||||
|
static int _progress_index;
|
||||||
|
char progress_char[] = "|/-\\";
|
||||||
|
xputchar(progress_char[_progress_index++ % strlen(progress_char)]);
|
||||||
|
xputchar('\r');
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
.global printf_helper
|
.global printf_helper
|
||||||
printf_helper:
|
printf_helper:
|
||||||
.extern __MBAR
|
.extern __MBAR
|
||||||
lea __MBAR+0x860C,a0
|
.wait_txready:
|
||||||
move.b d0,(a0)
|
move.w __MBAR+0x8604,d2 // PSCSCR0 status register
|
||||||
|
btst #10,d2 // space left in TX fifo?
|
||||||
|
beq.s .wait_txready // no, loop
|
||||||
|
lea __MBAR+0x860C,a0 // PSCSTB0 transmitter buffer register
|
||||||
|
move.b d0,(a0) // send byte
|
||||||
rts
|
rts
|
||||||
|
|||||||
Reference in New Issue
Block a user