diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-22 14:42:52 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-22 14:42:52 +0000 |
commit | 7d4b2f6253d8ac898def6839b2ccc2ae61e24135 (patch) | |
tree | 36587b181e76fc8790f7472f64316c9bb620a31e /nuttx/drivers/net | |
parent | 2ad451b8005afc667718569077c816195f8bd9ec (diff) | |
download | px4-nuttx-7d4b2f6253d8ac898def6839b2ccc2ae61e24135.tar.gz px4-nuttx-7d4b2f6253d8ac898def6839b2ccc2ae61e24135.tar.bz2 px4-nuttx-7d4b2f6253d8ac898def6839b2ccc2ae61e24135.zip |
Add TX data notification
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@397 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/net')
-rw-r--r-- | nuttx/drivers/net/dm90x0.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/nuttx/drivers/net/dm90x0.c b/nuttx/drivers/net/dm90x0.c index a604b65a3..aa3b58375 100644 --- a/nuttx/drivers/net/dm90x0.c +++ b/nuttx/drivers/net/dm90x0.c @@ -393,6 +393,7 @@ static void dm9x_txtimeout(int argc, uint32 arg, ...); static int dm9x_ifup(struct uip_driver_s *dev); static int dm9x_ifdown(struct uip_driver_s *dev); +static int dm9x_txavail(struct uip_driver_s *dev); /* Initialization functions */ @@ -825,7 +826,7 @@ static int dm9x_transmit(struct dm9x_driver_s *dm9x) * 3. During normal TX polling * * Parameters: - * dm9x - Reference to the driver state structure + * dev - Reference to the NuttX driver state structure * * Returned Value: * OK on success; a negated errno on failure @@ -1448,6 +1449,46 @@ static int dm9x_ifdown(struct uip_driver_s *dev) } /**************************************************************************** + * Function: dm9x_txavail + * + * Description: + * Driver callback invoked when new TX data is available. This is a + * stimulus perform an out-of-cycle poll and, thereby, reduce the TX + * latency. + * + * Parameters: + * dev - Reference to the NuttX driver state structure + * + * Returned Value: + * None + * + * Assumptions: + * Called in normal user mode + * + ****************************************************************************/ + +static int dm9x_txavail(struct uip_driver_s *dev) +{ + struct dm9x_driver_s *dm9x = (struct dm9x_driver_s *)dev->d_private; + irqstate_t flags; + + dbg("Polling\n"); + flags = irqsave(); + + /* Check if there is room in the DM90x0 to hold another packet. In 100M mode, + * that can be 2 packets, otherwise it is a single packet. + */ + + if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2)) + { + /* If so, then poll uIP for new XMIT data */ + + (void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll); + } + irqrestore(flags); +} + +/**************************************************************************** * Function: dm9x_bringup * * Description: @@ -1659,6 +1700,7 @@ int dm9x_initialize(void) memset(g_dm9x, 0, CONFIG_DM9X_NINTERFACES*sizeof(struct dm9x_driver_s)); g_dm9x[0].dm_dev.d_ifup = dm9x_ifup; /* I/F down callback */ g_dm9x[0].dm_dev.d_ifdown = dm9x_ifdown; /* I/F up (new IP address) callback */ + g_dm9x[0].dm_dev.d_txavail = dm9x_txavail; /* New TX data callback */ g_dm9x[0].dm_dev.d_private = (void*)g_dm9x; /* Used to recover private state from dev */ /* Create a watchdog for timing polling for and timing of transmisstions */ |