[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[microblaze-uclinux] [patch] valid data left in rx fifo: no more interrupts
Hi,
In the course of reading interrupt handler in microblaze arch, I found
a bug in xmbserial.c
while ((status=uartp[XUL_STATUS_REG_OFFSET/4]) &
XUL_SR_RX_FIFO_VALID_DATA)
{
if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
break;
}
/* Grab char from RX FIFO */
in_word = uartp[XUL_RX_FIFO_OFFSET/4];
ch = (unsigned char)in_word;
info->stats.rx++;
tty->flip.count++;
*tty->flip.flag_buf_ptr++ = 0;
/* Store recv'd char in buffer */
*tty->flip.char_buf_ptr++ = ch;
}
queue_task(&tty->flip.tqueue, &tq_timer);
If the flip buffer is full, currently, we break out from the while
loop and exit from receive_chars() and xmbrs_interrupt(). The OPB
Interrupt controller will eventually acked.
If there is still valid data in RX fifo, however, interrupt line from
UART lite to interrupt controller is left asserted.
What that means is that, the Interrupt controller won't get
interrupted from UART Lite any more, even if UART lite get new data.
what we sould do is to drop any data in the RX FIFO when flip buffer
is full, instead of breaking out from while loop.
Attached patch is a minimal patch to fix the problem; No error
handling yet.
regards,
--
yashi
Index: xmbserial.c
===================================================================
RCS file: /var/cvs/uClinux-2.4.x/arch/microblaze/kernel/xmbserial.c,v
retrieving revision 1.6
diff -u -r1.6 xmbserial.c
--- xmbserial.c 18 Apr 2004 22:41:33 -0000 1.6
+++ xmbserial.c 4 Jun 2004 09:26:30 -0000
@@ -341,25 +341,10 @@
XUL_SR_RX_FIFO_VALID_DATA)
{
if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
- /*
- * can't take any more data. Turn off receiver
- * so that the interrupt doesn't continually
- * occur.
- */
- /* XUartLite_mDisableIntr(uartp); */
- break;
+ tty_flip_buffer_push(tty);
}
-
- /* Grab char from RX FIFO */
- in_word = uartp[XUL_RX_FIFO_OFFSET/4];
- ch = (unsigned char)in_word;
-
- info->stats.rx++;
- tty->flip.count++;
- *tty->flip.flag_buf_ptr++ = 0;
-
- /* Store recv'd char in buffer */
- *tty->flip.char_buf_ptr++ = ch;
+ info->stats.rx++;
+ tty_insert_flip_char(tty, uartp[XUL_RX_FIFO_OFFSET/4], 0);
}
queue_task(&tty->flip.tqueue, &tq_timer);
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/