mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Finish TX timeout logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@366 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+29
-6
@@ -267,10 +267,14 @@
|
||||
# define CONFIG_DM9X_MODE DM9X_MODE_AUTO
|
||||
#endif
|
||||
|
||||
/* TX poll deley = 5 seconds. CLK_TCK is the number of clock ticks per second */
|
||||
// /* TX poll deley = 5 seconds. CLK_TCK is the number of clock ticks per second */
|
||||
|
||||
#define DM6X_WDDELAY (5*CLK_TCK)
|
||||
|
||||
/* TX timeout = 1 minute */
|
||||
|
||||
#define DM6X_TXTIMEOUT (60*CLK_TCK)
|
||||
|
||||
/* This is a helper pointer for accessing the contents of the Ethernet header */
|
||||
|
||||
#define BUF ((struct uip_eth_hdr *)dm9x->dev.d_buf)
|
||||
@@ -792,6 +796,10 @@ static int dm9x_transmit(struct dm9x_driver_s *dm9x)
|
||||
/* Re-enable DM90x0 interrupts */
|
||||
|
||||
putreg(DM9X_IMR, DM9X_IMRENABLE);
|
||||
|
||||
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
|
||||
|
||||
(void)wd_start(dm9x->txtimeout, DM6X_TXTIMEOUT, dm9x_txtimeout, 1, (uint32)dm9x);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -840,7 +848,7 @@ static int dm9x_uiptxpoll(struct dm9x_driver_s *dm9x)
|
||||
|
||||
if (dm9x->ntxpending > 1 || !dm9x->b100M)
|
||||
{
|
||||
return;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -866,7 +874,7 @@ static int dm9x_uiptxpoll(struct dm9x_driver_s *dm9x)
|
||||
|
||||
if (dm9x->ntxpending > 1 || !dm9x->b100M)
|
||||
{
|
||||
return;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1081,6 +1089,13 @@ static void dm9x_txdone(struct dm9x_driver_s *dm9x)
|
||||
}
|
||||
}
|
||||
|
||||
/* Cancel the TX timeout */
|
||||
|
||||
if (dm9x->ntxpending == 0)
|
||||
{
|
||||
wd_cancel(dm9x->txtimeout);
|
||||
}
|
||||
|
||||
/* Then poll uIP for new XMIT data */
|
||||
|
||||
(void)dm9x_uiptxpoll(dm9x);
|
||||
@@ -1547,7 +1562,8 @@ static void dm9x_bringup(struct dm9x_driver_s *dm9x)
|
||||
* Function: dm9x_reset
|
||||
*
|
||||
* Description:
|
||||
* Stop, reset, re-initialize, and restart the DM90x0 chip and driver
|
||||
* Stop, reset, re-initialize, and restart the DM90x0 chip and driver. At
|
||||
* present, the chip is only reset after a TX timeout.
|
||||
*
|
||||
* Parameters:
|
||||
* dm9x - Reference to the driver state structure
|
||||
@@ -1564,6 +1580,11 @@ static void dm9x_reset(struct dm9x_driver_s *dm9x)
|
||||
uint8 save;
|
||||
int i;
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(dm9x->txpoll);
|
||||
wd_cancel(dm9x->txtimeout);
|
||||
|
||||
/* Save previous register address */
|
||||
|
||||
save = (uint8)DM9X_INDEX;
|
||||
@@ -1648,11 +1669,13 @@ int dm9x_initialize(void)
|
||||
/* Initialize the driver structure */
|
||||
|
||||
memset(g_dm9x, 0, CONFIG_DM9X_NINTERFACES*sizeof(struct dm9x_driver_s));
|
||||
g_dm9x[0].dev.ifup = dm9x_ifup;
|
||||
g_dm9x[0].dev.ifdown = dm9x_ifdown;
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||
|
||||
g_dm9x[0].txpoll = wd_create();
|
||||
g_dm9x[0].txtimeout = wd_create();
|
||||
g_dm9x[0].txpoll = wd_create();
|
||||
g_dm9x[0].txtimeout = wd_create();
|
||||
|
||||
/* Read the MAC address */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user