Andrew,

That's a great idea; I should have thought of it.

Stephen

>>> Andrew Lunn <[EMAIL PROTECTED]> 09/04/07 12:08PM >>>
> +            stat = get_reg(base, PP_BusStat);
> +            if( stat & PP_BusStat_TxBid )
> +                diag_printf( "cs8900a_send: Bid error!\n" );

Maybe this diag_printf() should be inside a
#if DEBUG & 1

    Andrew

Index: devs/eth/cl/cs8900a/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/cl/cs8900a/current/ChangeLog,v
retrieving revision 1.13
diff -u -5 -p -r1.13 ChangeLog
--- devs/eth/cl/cs8900a/current/ChangeLog       23 Nov 2005 21:26:50 -0000      
1.13
+++ devs/eth/cl/cs8900a/current/ChangeLog       4 Sep 2007 13:26:21 -0000
@@ -1,5 +1,10 @@
+2007-09-04  Stephen Finney <[EMAIL PROTECTED]>
+
+       * add timeout to potential infinite loop in cs8900a_send per 
+       bugzilla report 1000281
+
 2005-11-10  Laurent Gonzalez <[EMAIL PROTECTED]>
 
        * include/cs8900a.h:
        * src/if_cs8900a.c: Added a priority field in cpd
        that makes interrupt priority configurable
Index: devs/eth/cl/cs8900a/current/src/if_cs8900a.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c,v
retrieving revision 1.13
diff -u -5 -p -r1.13 if_cs8900a.c
--- devs/eth/cl/cs8900a/current/src/if_cs8900a.c        23 Nov 2005 21:26:50 
-0000      1.13
+++ devs/eth/cl/cs8900a/current/src/if_cs8900a.c        4 Sep 2007 17:00:04 
-0000
@@ -503,13 +503,28 @@ cs8900a_send(struct eth_drv_sc *sc, stru
     // Start only when all data sent to chip
     HAL_WRITE_UINT16(cpd->base+CS8900A_TxCMD, PP_TxCmd_TxStart_Full);
 
     HAL_WRITE_UINT16(cpd->base+CS8900A_TxLEN, total_len);
     // Wait for controller ready signal
-    do {
-        stat = get_reg(base, PP_BusStat);
-    } while (!(stat & PP_BusStat_TxRDY));
+    {
+        // add timeout per cs8900a bugzilla report 1000281 */
+        int timeout = 1000;
+
+        do {
+            stat = get_reg(base, PP_BusStat);
+#if DEBUG & 1
+            if( stat & PP_BusStat_TxBid )
+                diag_printf( "cs8900a_send: Bid error!\n" );
+#endif
+        } while (!(stat & PP_BusStat_TxRDY) && --timeout);
+
+        if( !timeout ) {
+            // we might as well just return, since if we write the data it will
+            // just get thrown away
+            return;
+        }
+    }
 
     // Put data into buffer
     for (i = 0;  i < sg_len;  i++) {
         data = (cyg_uint8 *)sg_list[i].buf;
         len = sg_list[i].len;

Reply via email to