From 563ced5a52a1260c2165435a103c204c39a658f0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 30 Nov 2007 20:46:29 +0000 Subject: Add examples/dhcpd git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@413 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/drivers/net/dm90x0.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'nuttx/drivers/net/dm90x0.c') diff --git a/nuttx/drivers/net/dm90x0.c b/nuttx/drivers/net/dm90x0.c index b6d932cb9..2a63d7383 100644 --- a/nuttx/drivers/net/dm90x0.c +++ b/nuttx/drivers/net/dm90x0.c @@ -294,6 +294,7 @@ union rx_desc_u struct dm9x_driver_s { + boolean dm_bifup; /* TRUE:ifup FALSE:ifdown */ boolean dm_b100M; /* TRUE:speed == 100M; FALSE:speed == 10M */ WDOG_ID dm_txpoll; /* TX poll timer */ WDOG_ID dm_txtimeout; /* TX timeout timer */ @@ -1396,6 +1397,7 @@ static int dm9x_ifup(struct uip_driver_s *dev) /* Enable the DM9X interrupt */ + dm9x->dm_bifup = TRUE; up_enable_irq(CONFIG_DM9X_IRQ); return OK; } @@ -1440,6 +1442,8 @@ static int dm9x_ifdown(struct uip_driver_s *dev) putreg(DM9X_IMR, DM9X_IMRDISABLE); /* Disable all interrupts */ putreg(DM9X_RXC, 0x00); /* Disable RX */ putreg(DM9X_ISR, DM9X_INT_ALL); /* Clear interrupt status */ + + dm9x->dm_bifup = FALSE; irqrestore(flags); /* Dump statistics */ @@ -1475,15 +1479,21 @@ static int dm9x_txavail(struct uip_driver_s *dev) ndbg("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. - */ + /* Ignore the notification if the interface is not yet up */ - if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2)) + if (dm9x->dm_bifup) { - /* If so, then poll uIP for new XMIT data */ - (void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll); + /* 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); return OK; -- cgit v1.2.3