comparison packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c @ 126:518f42066aba ecos-sw-2000-09-19

Merge from eCos master repository on 2000-09-19-06:25:26-BST
author jlarmour
date Tue, 19 Sep 2000 05:53:51 +0000
parents 6bd9d475ed4b
children d397fc472bcf
comparison
equal deleted inserted replaced
125:b4407dc7f59d 126:518f42066aba
57 57
58 #include <pkgconf/system.h> 58 #include <pkgconf/system.h>
59 #include <pkgconf/devs_eth_arm_edb7xxx.h> 59 #include <pkgconf/devs_eth_arm_edb7xxx.h>
60 #ifdef CYGPKG_NET 60 #ifdef CYGPKG_NET
61 #include <pkgconf/net.h> 61 #include <pkgconf/net.h>
62 #include <cyg/kernel/kapi.h>
62 #endif 63 #endif
63 #include <cyg/infra/cyg_type.h> 64 #include <cyg/infra/cyg_type.h>
64 #include <cyg/hal/hal_arch.h> 65 #include <cyg/hal/hal_arch.h>
65 #include <cyg/hal/hal_intr.h> 66 #include <cyg/hal/hal_intr.h>
66 #include <cyg/infra/diag.h> 67 #include <cyg/infra/diag.h>
101 extern int net_debug; // FIXME 102 extern int net_debug; // FIXME
102 103
103 struct cs8900_priv_data { 104 struct cs8900_priv_data {
104 int txbusy; // A packet has been sent 105 int txbusy; // A packet has been sent
105 unsigned long txkey; // Used to ack when packet sent 106 unsigned long txkey; // Used to ack when packet sent
107 #ifdef CYGPKG_NET
108 cyg_tick_count_t txstart;
109 #endif
106 } _cs8900_priv_data; 110 } _cs8900_priv_data;
107 111
108 ETH_DRV_SC(edb7xxx_sc, 112 ETH_DRV_SC(edb7xxx_sc,
109 &_cs8900_priv_data, // Driver specific data 113 &_cs8900_priv_data, // Driver specific data
110 "eth0", // Name for this interface 114 "eth0", // Name for this interface
293 unsigned short stat; 297 unsigned short stat;
294 stat = get_reg(PP_LineStat); 298 stat = get_reg(PP_LineStat);
295 if ((stat & PP_LineStat_LinkOK) == 0) { 299 if ((stat & PP_LineStat_LinkOK) == 0) {
296 return false; // Link not connected 300 return false; // Link not connected
297 } 301 }
302 #ifdef CYGPKG_NET
303 // Horrible hack!
304 if (cpd->txbusy > 0) {
305 cyg_tick_count_t now = cyg_current_time();
306 if ((now - cpd->txstart) > 25) {
307 // 250ms is more than enough to transmit one frame
308 diag_printf("CS8900: Tx interrupt lost\n");
309 cpd->txbusy = 0;
310 // Free up the buffer (with error indication)
311 (sc->funs->eth_drv->tx_done)(sc, cpd->txkey, 1);
312 }
313 }
314 #endif
298 return (cpd->txbusy == 0); 315 return (cpd->txbusy == 0);
299 } 316 }
300 317
301 // 318 //
302 // This routine is called to send data to the hardware. 319 // This routine is called to send data to the hardware.
313 bool odd_byte = false; 330 bool odd_byte = false;
314 331
315 // Mark xmitter busy 332 // Mark xmitter busy
316 cpd->txbusy = 1; 333 cpd->txbusy = 1;
317 cpd->txkey = key; 334 cpd->txkey = key;
335 #ifdef CYGPKG_NET
336 cpd->txstart = cyg_current_time();
337 #endif
318 // Start the xmit sequence 338 // Start the xmit sequence
319 // Note: this can go back once the 'dump' is removed 339 // Note: this can go back once the 'dump' is removed
320 // CS8900_TxCMD = PP_TxCmd_TxStart_5; // Start more-or-less immediately 340 CS8900_TxCMD = PP_TxCmd_TxStart_5; // Start more-or-less immediately
321 CS8900_TxCMD = PP_TxCmd_TxStart_Full; // Start only when all data sent to chip 341 // CS8900_TxCMD = PP_TxCmd_TxStart_Full; // Start only when all data sent to chip
322 CS8900_TxLEN = total_len; 342 CS8900_TxLEN = total_len;
323 stat = get_reg(PP_BusStat); // This actually starts the xmit 343 stat = get_reg(PP_BusStat); // This actually starts the xmit
324 344
325 // Put data into buffer 345 // Put data into buffer
326 for (i = 0; i < sg_len; i++) { 346 for (i = 0; i < sg_len; i++) {