mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
devif: remove all devif_timer
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
406e1effed
commit
035d925864
+1
-96
@@ -43,7 +43,6 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/arp.h>
|
||||
@@ -90,12 +89,6 @@
|
||||
# define CONFIG_CDCECM_NINTERFACES 1
|
||||
#endif
|
||||
|
||||
/* TX poll delay = 1 seconds.
|
||||
* CLK_TCK is the number of clock ticks per second
|
||||
*/
|
||||
|
||||
#define CDCECM_WDDELAY (1*CLK_TCK)
|
||||
|
||||
/* TX timeout = 1 minute */
|
||||
|
||||
#define CDCECM_TXTIMEOUT (60*CLK_TCK)
|
||||
@@ -137,7 +130,6 @@ struct cdcecm_driver_s
|
||||
/* Network device */
|
||||
|
||||
bool bifup; /* true:ifup false:ifdown */
|
||||
struct wdog_s txpoll; /* TX poll timer */
|
||||
struct work_s irqwork; /* For deferring interrupt work
|
||||
* to the work queue */
|
||||
struct work_s pollwork; /* For deferring poll work to
|
||||
@@ -169,11 +161,6 @@ static void cdcecm_txdone(FAR struct cdcecm_driver_s *priv);
|
||||
|
||||
static void cdcecm_interrupt_work(FAR void *arg);
|
||||
|
||||
/* Watchdog timer expirations */
|
||||
|
||||
static void cdcecm_poll_work(FAR void *arg);
|
||||
static void cdcecm_poll_expiry(wdparm_t arg);
|
||||
|
||||
/* NuttX callback functions */
|
||||
|
||||
static int cdcecm_ifup(FAR struct net_driver_s *dev);
|
||||
@@ -646,79 +633,6 @@ static void cdcecm_interrupt_work(FAR void *arg)
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cdcecm_poll_work
|
||||
*
|
||||
* Description:
|
||||
* Perform periodic polling from the worker thread
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The argument passed when work_queue() as called.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success
|
||||
*
|
||||
* Assumptions:
|
||||
* Run on a work queue thread.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void cdcecm_poll_work(FAR void *arg)
|
||||
{
|
||||
FAR struct cdcecm_driver_s *self = (FAR struct cdcecm_driver_s *)arg;
|
||||
|
||||
ninfo("rxpending: %d, txdone: %d\n", self->rxpending, self->txdone);
|
||||
|
||||
/* Lock the network and serialize driver operations if necessary.
|
||||
* NOTE: Serialization is only required in the case where the driver work
|
||||
* is performed on an LP worker thread and where more than one LP worker
|
||||
* thread has been configured.
|
||||
*/
|
||||
|
||||
net_lock();
|
||||
|
||||
/* Perform the poll. We are always able to accept another packet, since
|
||||
* cdcecm_transmit will just wait until the USB device write request will
|
||||
* become available.
|
||||
*/
|
||||
|
||||
devif_timer(&self->dev, CDCECM_WDDELAY, cdcecm_txpoll);
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(&self->txpoll, CDCECM_WDDELAY,
|
||||
cdcecm_poll_expiry, (wdparm_t)self);
|
||||
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cdcecm_poll_expiry
|
||||
*
|
||||
* Description:
|
||||
* Periodic timer handler. Called from the timer interrupt handler.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The argument
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Runs in the context of a the timer interrupt handler. Local
|
||||
* interrupts are disabled by the interrupt logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void cdcecm_poll_expiry(wdparm_t arg)
|
||||
{
|
||||
FAR struct cdcecm_driver_s *priv = (FAR struct cdcecm_driver_s *)arg;
|
||||
|
||||
/* Schedule to perform the interrupt processing on the worker thread. */
|
||||
|
||||
work_queue(ETHWORK, &priv->pollwork, cdcecm_poll_work, priv, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cdcecm_ifup
|
||||
*
|
||||
@@ -766,11 +680,6 @@ static int cdcecm_ifup(FAR struct net_driver_s *dev)
|
||||
cdcecm_ipv6multicast(priv);
|
||||
#endif
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
wd_start(&priv->txpoll, CDCECM_WDDELAY,
|
||||
cdcecm_poll_expiry, (wdparm_t)priv);
|
||||
|
||||
priv->bifup = true;
|
||||
return OK;
|
||||
}
|
||||
@@ -802,10 +711,6 @@ static int cdcecm_ifdown(FAR struct net_driver_s *dev)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(&priv->txpoll);
|
||||
|
||||
/* Put the EMAC in its reset, non-operational state. This should be
|
||||
* a known configuration that will guarantee the cdcecm_ifup() always
|
||||
* successfully brings the interface back up.
|
||||
@@ -851,7 +756,7 @@ static void cdcecm_txavail_work(FAR void *arg)
|
||||
|
||||
if (self->bifup)
|
||||
{
|
||||
devif_timer(&self->dev, 0, cdcecm_txpoll);
|
||||
devif_poll(&self->dev, cdcecm_txpoll);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
||||
+1
-73
@@ -46,7 +46,6 @@
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
#include <nuttx/usb/rndis.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
|
||||
#ifdef CONFIG_RNDIS_BOARD_SERIALSTR
|
||||
@@ -94,12 +93,6 @@
|
||||
#define RNDIS_BUFFER_SIZE CONFIG_NET_ETH_PKTSIZE
|
||||
#define RNDIS_BUFFER_COUNT 4
|
||||
|
||||
/* TX poll delay = 1 seconds.
|
||||
* CLK_TCK is the number of clock ticks per second
|
||||
*/
|
||||
|
||||
#define RNDIS_WDDELAY (1*CLK_TCK)
|
||||
|
||||
/* Work queue to use for network operations. LPWORK should be used here */
|
||||
|
||||
#define ETHWORK LPWORK
|
||||
@@ -145,7 +138,6 @@ struct rndis_dev_s
|
||||
struct rndis_req_s wrreqs[CONFIG_RNDIS_NWRREQS];
|
||||
|
||||
struct work_s rxwork; /* Worker for dispatching RX packets */
|
||||
struct wdog_s txpoll; /* TX poll watchdog */
|
||||
struct work_s pollwork; /* TX poll worker */
|
||||
|
||||
bool registered; /* Has netdev_register() been called */
|
||||
@@ -221,7 +213,6 @@ static int rndis_ifdown(FAR struct net_driver_s *dev);
|
||||
static int rndis_txavail(FAR struct net_driver_s *dev);
|
||||
static int rndis_transmit(FAR struct rndis_dev_s *priv);
|
||||
static int rndis_txpoll(FAR struct net_driver_s *dev);
|
||||
static void rndis_polltimer(wdparm_t arg);
|
||||
|
||||
/* usbclass callbacks */
|
||||
|
||||
@@ -1066,62 +1057,6 @@ static int rndis_transmit(FAR struct rndis_dev_s *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rndis_pollworker
|
||||
*
|
||||
* Description:
|
||||
* Worker function called by txpoll worker.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void rndis_pollworker(FAR void *arg)
|
||||
{
|
||||
FAR struct rndis_dev_s *priv = (struct rndis_dev_s *)arg;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
|
||||
net_lock();
|
||||
|
||||
if (rndis_allocnetreq(priv))
|
||||
{
|
||||
devif_timer(&priv->netdev, RNDIS_WDDELAY, rndis_txpoll);
|
||||
|
||||
if (priv->net_req != NULL)
|
||||
{
|
||||
rndis_freenetreq(priv);
|
||||
}
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rndis_polltimer
|
||||
*
|
||||
* Description:
|
||||
* Network poll watchdog timer callback
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void rndis_polltimer(wdparm_t arg)
|
||||
{
|
||||
FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)arg;
|
||||
int ret;
|
||||
|
||||
if (work_available(&priv->pollwork))
|
||||
{
|
||||
ret = work_queue(ETHWORK, &priv->pollwork, rndis_pollworker,
|
||||
(FAR void *)priv, 0);
|
||||
DEBUGASSERT(ret == OK);
|
||||
UNUSED(ret);
|
||||
}
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(&priv->txpoll, RNDIS_WDDELAY,
|
||||
rndis_polltimer, (wdparm_t)arg);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rndis_ifup
|
||||
*
|
||||
@@ -1132,10 +1067,6 @@ static void rndis_polltimer(wdparm_t arg)
|
||||
|
||||
static int rndis_ifup(FAR struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)dev->d_private;
|
||||
|
||||
wd_start(&priv->txpoll, RNDIS_WDDELAY,
|
||||
rndis_polltimer, (wdparm_t)priv);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1149,9 +1080,6 @@ static int rndis_ifup(FAR struct net_driver_s *dev)
|
||||
|
||||
static int rndis_ifdown(FAR struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)dev->d_private;
|
||||
|
||||
wd_cancel(&priv->txpoll);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1171,7 +1099,7 @@ static void rndis_txavail_work(FAR void *arg)
|
||||
|
||||
if (rndis_allocnetreq(priv))
|
||||
{
|
||||
devif_timer(&priv->netdev, 0, rndis_txpoll);
|
||||
devif_poll(&priv->netdev, rndis_txpoll);
|
||||
if (priv->net_req != NULL)
|
||||
{
|
||||
rndis_freenetreq(priv);
|
||||
|
||||
Reference in New Issue
Block a user