mirror of
https://github.com/apache/nuttx.git
synced 2026-03-27 02:29:15 +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
@@ -37,7 +37,6 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/mm/iob.h>
|
||||
@@ -92,12 +91,6 @@
|
||||
# define XBEENET_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||
#endif
|
||||
|
||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per
|
||||
* second.
|
||||
*/
|
||||
|
||||
#define TXPOLL_WDDELAY (1*CLK_TCK)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@@ -130,7 +123,6 @@ struct xbeenet_driver_s
|
||||
struct xbeenet_callback_s xd_cb; /* Callback information */
|
||||
XBEEHANDLE xd_mac; /* Contained XBee MAC interface */
|
||||
bool xd_bifup; /* true:ifup false:ifdown */
|
||||
struct wdog_s xd_txpoll; /* TX poll timer */
|
||||
struct work_s xd_pollwork; /* Defer poll work to the work queue */
|
||||
|
||||
/* Hold a list of events */
|
||||
@@ -169,8 +161,6 @@ static int xbeenet_rxframe(FAR struct xbeenet_driver_s *maccb,
|
||||
/* Common TX logic */
|
||||
|
||||
static int xbeenet_txpoll_callback(FAR struct net_driver_s *dev);
|
||||
static void xbeenet_txpoll_work(FAR void *arg);
|
||||
static void xbeenet_txpoll_expiry(wdparm_t arg);
|
||||
|
||||
/* IOCTL support */
|
||||
|
||||
@@ -566,78 +556,6 @@ static int xbeenet_txpoll_callback(FAR struct net_driver_s *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xbeenet_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 xbeenet_txpoll_work(FAR void *arg)
|
||||
{
|
||||
FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_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->xd_dev.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Then perform the poll */
|
||||
|
||||
devif_timer(&priv->xd_dev.r_dev, TXPOLL_WDDELAY, xbeenet_txpoll_callback);
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(&priv->xd_txpoll, TXPOLL_WDDELAY,
|
||||
xbeenet_txpoll_expiry, (wdparm_t)priv);
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xbeenet_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 xbeenet_txpoll_expiry(wdparm_t arg)
|
||||
{
|
||||
FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)arg;
|
||||
|
||||
/* Schedule to perform the interrupt processing on the worker thread. */
|
||||
|
||||
work_queue(XBEENET_WORK, &priv->xd_pollwork, xbeenet_txpoll_work, priv, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xbeenet_coord_eaddr
|
||||
*
|
||||
@@ -755,10 +673,6 @@ static int xbeenet_ifup(FAR struct net_driver_s *dev)
|
||||
wlinfo(" Node: %02x:%02x\n",
|
||||
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1]);
|
||||
#endif
|
||||
/* Set and activate a timer process */
|
||||
|
||||
wd_start(&priv->xd_txpoll, TXPOLL_WDDELAY,
|
||||
xbeenet_txpoll_expiry, (wdparm_t)priv);
|
||||
|
||||
/* The interface is now up */
|
||||
|
||||
@@ -795,10 +709,6 @@ static int xbeenet_ifdown(FAR struct net_driver_s *dev)
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(&priv->xd_txpoll);
|
||||
|
||||
/* TODO: Put the xbee driver in its reset, non-operational state. This
|
||||
* should be a known configuration that will guarantee the xbeenet_ifup()
|
||||
* always successfully brings the interface back up.
|
||||
@@ -854,7 +764,7 @@ static void xbeenet_txavail_work(FAR void *arg)
|
||||
|
||||
/* Then poll the network for new XMIT data */
|
||||
|
||||
devif_timer(&priv->xd_dev.r_dev, 0, xbeenet_txpoll_callback);
|
||||
devif_poll(&priv->xd_dev.r_dev, xbeenet_txpoll_callback);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
||||
Reference in New Issue
Block a user