mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +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
@@ -34,7 +34,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/mm/iob.h>
|
||||
#include <nuttx/net/net.h>
|
||||
@@ -85,12 +84,6 @@
|
||||
# define LO_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||
#endif
|
||||
|
||||
/* TX poll delay = 1 seconds.
|
||||
* CLK_TCK is the number of clock ticks per second
|
||||
*/
|
||||
|
||||
#define LO_WDDELAY (1*CLK_TCK)
|
||||
|
||||
/* Fake value for MAC header length */
|
||||
|
||||
#define MAC_HDRLEN 9
|
||||
@@ -108,7 +101,6 @@ struct lo_driver_s
|
||||
bool lo_bifup; /* true:ifup false:ifdown */
|
||||
bool lo_pending; /* True: TX poll pending */
|
||||
uint8_t lo_panid[2]; /* Fake PAN ID for testing */
|
||||
struct wdog_s lo_polldog; /* TX poll timer */
|
||||
struct work_s lo_work; /* For deferring poll work to the work queue */
|
||||
FAR struct iob_s *lo_head; /* Head of IOBs queued for loopback */
|
||||
FAR struct iob_s *lo_tail; /* Tail of IOBs queued for loopback */
|
||||
@@ -155,8 +147,6 @@ static inline void lo_netmask(FAR struct net_driver_s *dev);
|
||||
|
||||
static int lo_loopback(FAR struct net_driver_s *dev);
|
||||
static void lo_loopback_work(FAR void *arg);
|
||||
static void lo_poll_work(FAR void *arg);
|
||||
static void lo_poll_expiry(wdparm_t arg);
|
||||
|
||||
/* NuttX callback functions */
|
||||
|
||||
@@ -439,82 +429,6 @@ static void lo_loopback_work(FAR void *arg)
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lo_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:
|
||||
* The network is locked
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void lo_poll_work(FAR void *arg)
|
||||
{
|
||||
FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg;
|
||||
|
||||
/* Perform the poll */
|
||||
|
||||
net_lock();
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached */
|
||||
|
||||
priv->lo_radio.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Then perform the poll */
|
||||
|
||||
devif_timer(&priv->lo_radio.r_dev, LO_WDDELAY, lo_loopback);
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(&priv->lo_polldog, LO_WDDELAY, lo_poll_expiry, (wdparm_t)priv);
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lo_poll_expiry
|
||||
*
|
||||
* Description:
|
||||
* Periodic timer handler. Called from the timer interrupt handler.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The argument
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* The network is locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void lo_poll_expiry(wdparm_t arg)
|
||||
{
|
||||
FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)arg;
|
||||
|
||||
if (!work_available(&priv->lo_work) || priv->lo_head != NULL)
|
||||
{
|
||||
nwarn("WARNING: lo_work NOT available\n");
|
||||
priv->lo_pending = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Schedule to perform the interrupt processing on the worker thread. */
|
||||
|
||||
priv->lo_pending = false;
|
||||
work_queue(LPBKWORK, &priv->lo_work, lo_poll_work, priv, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lo_ifup
|
||||
*
|
||||
@@ -576,11 +490,6 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
wd_start(&priv->lo_polldog, LO_WDDELAY,
|
||||
lo_poll_expiry, (wdparm_t)priv);
|
||||
|
||||
priv->lo_bifup = true;
|
||||
return OK;
|
||||
}
|
||||
@@ -607,10 +516,6 @@ static int lo_ifdown(FAR struct net_driver_s *dev)
|
||||
|
||||
ninfo("IP up: %u\n", priv->lo_bifup);
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(&priv->lo_polldog);
|
||||
|
||||
/* Mark the device "down" */
|
||||
|
||||
priv->lo_bifup = false;
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/mm/iob.h>
|
||||
#include <nuttx/net/arp.h>
|
||||
@@ -104,12 +103,6 @@
|
||||
"CONFIG_IOB_NBUFFERS to avoid waiting on req_data"
|
||||
#endif
|
||||
|
||||
/* TX poll delay = 1 seconds.
|
||||
* CLK_TCK is the number of clock ticks per second
|
||||
*/
|
||||
|
||||
#define TXPOLL_WDDELAY (1*CLK_TCK)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@@ -141,7 +134,6 @@ struct macnet_driver_s
|
||||
struct macnet_callback_s md_cb; /* Callback information */
|
||||
MACHANDLE md_mac; /* Contained MAC interface */
|
||||
bool md_bifup; /* true:ifup false:ifdown */
|
||||
struct wdog_s md_txpoll; /* TX poll timer */
|
||||
struct work_s md_pollwork; /* Defer poll work to the work queue */
|
||||
|
||||
/* Hold a list of events */
|
||||
@@ -184,8 +176,6 @@ static int macnet_rxframe(FAR struct macnet_driver_s *maccb,
|
||||
/* Common TX logic */
|
||||
|
||||
static int macnet_txpoll_callback(FAR struct net_driver_s *dev);
|
||||
static void macnet_txpoll_work(FAR void *arg);
|
||||
static void macnet_txpoll_expiry(wdparm_t arg);
|
||||
|
||||
/* IOCTL support */
|
||||
|
||||
@@ -534,78 +524,6 @@ static int macnet_txpoll_callback(FAR struct net_driver_s *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: macnet_txpoll_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:
|
||||
* The network is locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void macnet_txpoll_work(FAR void *arg)
|
||||
{
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)arg;
|
||||
|
||||
/* 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();
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached */
|
||||
|
||||
priv->md_dev.r_dev.d_buf = priv->md_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Then perform the poll */
|
||||
|
||||
devif_timer(&priv->md_dev.r_dev, TXPOLL_WDDELAY, macnet_txpoll_callback);
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(&priv->md_txpoll, TXPOLL_WDDELAY,
|
||||
macnet_txpoll_expiry, (wdparm_t)priv);
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: macnet_txpoll_expiry
|
||||
*
|
||||
* Description:
|
||||
* Periodic timer handler. Called from the timer interrupt handler.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The argument
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Global interrupts are disabled by the watchdog logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void macnet_txpoll_expiry(wdparm_t arg)
|
||||
{
|
||||
FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)arg;
|
||||
|
||||
/* Schedule to perform the interrupt processing on the worker thread. */
|
||||
|
||||
work_queue(WPANWORK, &priv->md_pollwork, macnet_txpoll_work, priv, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: macnet_coord_eaddr
|
||||
*
|
||||
@@ -760,11 +678,6 @@ static int macnet_ifup(FAR struct net_driver_s *dev)
|
||||
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1]);
|
||||
#endif
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
wd_start(&priv->md_txpoll, TXPOLL_WDDELAY,
|
||||
macnet_txpoll_expiry, (wdparm_t)priv);
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
@@ -800,10 +713,6 @@ static int macnet_ifdown(FAR struct net_driver_s *dev)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(&priv->md_txpoll);
|
||||
|
||||
/* Put the EMAC in its reset, non-operational state. This should be
|
||||
* a known configuration that will guarantee the macnet_ifup() always
|
||||
* successfully brings the interface back up.
|
||||
|
||||
Reference in New Issue
Block a user