Mercurial > ecos-v3_0-branch
changeset 2428:c4195ff791d2
* add timeout to potential infinite loop in cs8900a_send per
bugzilla report 1000281
| author | asl |
|---|---|
| date | Tue, 11 Sep 2007 17:37:22 +0000 |
| parents | 9b5bc3c72ac4 |
| children | b0a173ce7ffd |
| files | packages/devs/eth/cl/cs8900a/current/ChangeLog packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c |
| diffstat | 2 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/devs/eth/cl/cs8900a/current/ChangeLog +++ b/packages/devs/eth/cl/cs8900a/current/ChangeLog @@ -1,3 +1,8 @@ +2007-09-04 Stephen Finney <shf@pfinc.com> + + * add timeout to potential infinite loop in cs8900a_send per + bugzilla report 1000281 + 2005-11-10 Laurent Gonzalez <laurent.gonzalez@trango-systems.com> * include/cs8900a.h:
--- a/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c +++ b/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c @@ -505,9 +505,24 @@ cs8900a_send(struct eth_drv_sc *sc, stru 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++) {
