Author: anonymous
Date: 2002-12-20 03:20:59 -0500 (Fri, 20 Dec 2002)
New Revision: 717
Modified:
trunk/ohci1394.c
Log:
improve iso transmit underflow detection by checking for discontinuity of cycle count
Modified: trunk/ohci1394.c
==============================================================================
--- trunk/ohci1394.c (original)
+++ trunk/ohci1394.c 2002-12-22 09:50:42.000000000 -0500
@@ -1389,6 +1389,7 @@
struct ohci1394_iso_tasklet task;
int task_active;
int pkt_dma;
+ int last_cycle;
u32 ContextControlSet;
u32 ContextControlClear;
@@ -1426,7 +1427,8 @@
xmit->ohci = iso->host->hostdata;
xmit->task_active = 0;
xmit->pkt_dma = iso->first_packet;
-
+ xmit->last_cycle = -1;
+
dma_prog_region_init(&xmit->prog);
prog_size = sizeof(struct iso_xmit_cmd) * iso->buf_packets;
@@ -1509,24 +1511,34 @@
}
if(event != 0x11) {
+ atomic_inc(&iso->overflows);
PRINT(KERN_ERR, xmit->ohci->id, "IT DMA error - OHCI error code 0x%02x\n", event);
}
/* at least one packet went out, so wake up the writer */
wake = 1;
-
- /* predict the timestamp pkt_dma will have next time around the buffer */
+
+ /* parse cycle */
{
struct hpsb_iso_packet_info* info = hpsb_iso_packet_info(iso, xmit->pkt_dma);
unsigned int cycle = cmd->output_last.status & 0x1FFF;
+ /* check for discontinuity */
+ if(xmit->last_cycle != -1 && cycle != (xmit->last_cycle+1) % 8000) {
+ atomic_inc(&iso->overflows);
+ }
+ xmit->last_cycle = cycle;
+
+ /* predict the timestamp pkt_dma will have
+ next time around the buffer */
+
cycle += iso->buf_packets;
- while(cycle > 8000)
+ while(cycle >= 8000)
cycle -= 8000;
-
+
info->cycle = cycle;
}
-
+
/* reset the DMA descriptor for next time */
cmd->output_last.status = 0;
@@ -1646,6 +1658,8 @@
{
struct ohci_iso_xmit *xmit = iso->hostdata;
+ xmit->last_cycle = -1;
+
/* clear out the control register */
reg_write(xmit->ohci, xmit->ContextControlClear, 0xFFFFFFFF);
wmb();
|