remove big lock in arch_phy_irq
reason: We would like to replace the big lock with a small lock. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
366332a948
commit
2852064501
18 changed files with 154 additions and 40 deletions
|
@ -46,6 +46,7 @@
|
||||||
#include <nuttx/net/mii.h>
|
#include <nuttx/net/mii.h>
|
||||||
#include <nuttx/net/ip.h>
|
#include <nuttx/net/ip.h>
|
||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_PHY_INTERRUPTS
|
#ifdef CONFIG_TIVA_PHY_INTERRUPTS
|
||||||
# include <nuttx/net/phy.h>
|
# include <nuttx/net/phy.h>
|
||||||
|
@ -628,6 +629,7 @@ struct tiva_ethmac_s
|
||||||
struct wdog_s txtimeout; /* TX timeout timer */
|
struct wdog_s txtimeout; /* TX timeout timer */
|
||||||
struct work_s irqwork; /* For deferring interrupt work to the work queue */
|
struct work_s irqwork; /* For deferring interrupt work to the work queue */
|
||||||
struct work_s pollwork; /* For deferring poll work to the work queue */
|
struct work_s pollwork; /* For deferring poll work to the work queue */
|
||||||
|
spinlock_t lock; /* Spinlock */
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_PHY_INTERRUPTS
|
#ifdef CONFIG_TIVA_PHY_INTERRUPTS
|
||||||
xcpt_t handler; /* Attached PHY interrupt handler */
|
xcpt_t handler; /* Attached PHY interrupt handler */
|
||||||
|
@ -2250,7 +2252,7 @@ static int tiva_ifdown(struct net_driver_s *dev)
|
||||||
|
|
||||||
/* Disable the Ethernet interrupt */
|
/* Disable the Ethernet interrupt */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&priv->lock);
|
||||||
up_disable_irq(TIVA_IRQ_ETHCON);
|
up_disable_irq(TIVA_IRQ_ETHCON);
|
||||||
|
|
||||||
/* Cancel the TX timeout timers */
|
/* Cancel the TX timeout timers */
|
||||||
|
@ -2267,7 +2269,7 @@ static int tiva_ifdown(struct net_driver_s *dev)
|
||||||
/* Mark the device "down" */
|
/* Mark the device "down" */
|
||||||
|
|
||||||
priv->ifup = false;
|
priv->ifup = false;
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3180,6 +3182,8 @@ static int tiva_phyinit(struct tiva_ethmac_s *priv)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
spin_lock_init(&priv->lock);
|
||||||
|
|
||||||
ninfo("Duplex: %s Speed: %d MBps\n",
|
ninfo("Duplex: %s Speed: %d MBps\n",
|
||||||
priv->fduplex ? "FULL" : "HALF",
|
priv->fduplex ? "FULL" : "HALF",
|
||||||
priv->mbps100 ? 100 : 10);
|
priv->mbps100 ? 100 : 10);
|
||||||
|
@ -4035,7 +4039,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&priv->lock);
|
||||||
|
|
||||||
/* Save the new interrupt handler information */
|
/* Save the new interrupt handler information */
|
||||||
|
|
||||||
|
@ -4053,7 +4057,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
*enable = handler ? tiva_phy_intenable : NULL;
|
*enable = handler ? tiva_phy_intenable : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_TIVA_PHY_INTERRUPTS */
|
#endif /* CONFIG_TIVA_PHY_INTERRUPTS */
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include <nuttx/net/mii.h>
|
#include <nuttx/net/mii.h>
|
||||||
#include <nuttx/net/ip.h>
|
#include <nuttx/net/ip.h>
|
||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_PHY_INTERRUPT)
|
#if defined(CONFIG_ARCH_PHY_INTERRUPT)
|
||||||
# include <nuttx/net/phy.h>
|
# include <nuttx/net/phy.h>
|
||||||
|
@ -410,6 +411,7 @@ struct rx65n_ethmac_s
|
||||||
|
|
||||||
uint32_t prevlinkstatus; /* Previous link status to ignore multiple link change interrupt (specific to GR-Rose) */
|
uint32_t prevlinkstatus; /* Previous link status to ignore multiple link change interrupt (specific to GR-Rose) */
|
||||||
uint8_t mc_filter_flag; /* Multicast filter */
|
uint8_t mc_filter_flag; /* Multicast filter */
|
||||||
|
spinlock_t lock; /* SpinLock */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -2097,7 +2099,7 @@ static int rx65n_ifdown(struct net_driver_s *dev)
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
ninfo("Taking the network down\n");
|
ninfo("Taking the network down\n");
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&priv->lock);
|
||||||
|
|
||||||
/* Disable the Ethernet interrupt */
|
/* Disable the Ethernet interrupt */
|
||||||
|
|
||||||
|
@ -2125,7 +2127,7 @@ static int rx65n_ifdown(struct net_driver_s *dev)
|
||||||
|
|
||||||
priv->prevlinkstatus = ETHER_LINKDOWN;
|
priv->prevlinkstatus = ETHER_LINKDOWN;
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2648,7 +2650,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_rx65nethmac[0].lock);
|
||||||
rx65n_phyintenable(false);
|
rx65n_phyintenable(false);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
@ -2677,7 +2679,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_rx65nethmac[0].lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3891,6 +3893,8 @@ int rx65n_ethinitialize(int intf)
|
||||||
rx65n_cmtw0_create(RX65N_CMTW0_COUNT_VALUE_FOR_TXPOLL ,
|
rx65n_cmtw0_create(RX65N_CMTW0_COUNT_VALUE_FOR_TXPOLL ,
|
||||||
RX65N_CMTW0_COUNT_VALUE_FOR_TXTIMEOUT);
|
RX65N_CMTW0_COUNT_VALUE_FOR_TXTIMEOUT);
|
||||||
|
|
||||||
|
spin_lock_init(&priv->lock);
|
||||||
|
|
||||||
/* Attach the IRQ to the driver */
|
/* Attach the IRQ to the driver */
|
||||||
|
|
||||||
if (irq_attach(RX65N_ETH_IRQ, rx65n_interrupt, NULL))
|
if (irq_attach(RX65N_ETH_IRQ, rx65n_interrupt, NULL))
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
#include <nuttx/mtd/mtd.h>
|
#include <nuttx/mtd/mtd.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "at32_gpio.h"
|
#include "at32_gpio.h"
|
||||||
#include "at32_eth.h"
|
#include "at32_eth.h"
|
||||||
|
@ -80,6 +81,8 @@
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_ethmac_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
#ifdef HAVE_NETMONITOR
|
#ifdef HAVE_NETMONITOR
|
||||||
static xcpt_t g_ethmac_handler;
|
static xcpt_t g_ethmac_handler;
|
||||||
static void *g_ethmac_arg;
|
static void *g_ethmac_arg;
|
||||||
|
@ -214,7 +217,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
DEBUGASSERT(intf);
|
DEBUGASSERT(intf);
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_ethmac_lock);
|
||||||
|
|
||||||
if (strcmp(intf, AT32_ETHMAC_DEVNAME) == 0)
|
if (strcmp(intf, AT32_ETHMAC_DEVNAME) == 0)
|
||||||
{
|
{
|
||||||
|
@ -234,7 +237,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
*enable = enabler;
|
*enable = enabler;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_ethmac_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -72,6 +72,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -235,7 +241,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = spin_lock_irqsave(NULL);
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -270,7 +276,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
spin_unlock_irqrestore(NULL, flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* GPIO_ENET_IRQ */
|
#endif /* GPIO_ENET_IRQ */
|
||||||
|
|
|
@ -75,6 +75,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -243,7 +249,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = spin_lock_irqsave(NULL);
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -278,7 +284,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
spin_unlock_irqrestore(NULL, flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
||||||
|
|
|
@ -73,6 +73,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -235,7 +241,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = spin_lock_irqsave(NULL);
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -270,7 +276,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
spin_unlock_irqrestore(NULL, flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
||||||
|
|
|
@ -73,6 +73,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -235,7 +241,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = spin_lock_irqsave(NULL);
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -270,7 +276,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
spin_unlock_irqrestore(NULL, flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
||||||
|
|
|
@ -74,6 +74,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -254,7 +260,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = spin_lock_irqsave(NULL);
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -289,7 +295,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
spin_unlock_irqrestore(NULL, flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
||||||
|
|
|
@ -73,6 +73,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -235,7 +241,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = spin_lock_irqsave(NULL);
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -270,7 +276,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
spin_unlock_irqrestore(NULL, flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_gpio.h"
|
#include "sam_gpio.h"
|
||||||
#include "sam_emac.h"
|
#include "sam_emac.h"
|
||||||
|
@ -71,6 +72,14 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAM34_GPIOD_IRQ
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -205,7 +214,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -237,7 +246,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAM34_GPIOD_IRQ */
|
#endif /* CONFIG_SAM34_GPIOD_IRQ */
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_ethernet.h"
|
#include "sam_ethernet.h"
|
||||||
|
@ -81,6 +82,14 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAMA5_PIOE_IRQ
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -290,7 +299,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -322,7 +331,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_ethernet.h"
|
#include "sam_ethernet.h"
|
||||||
|
@ -81,6 +82,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -290,7 +297,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -322,7 +329,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_ethernet.h"
|
#include "sam_ethernet.h"
|
||||||
|
@ -81,6 +82,14 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAMA5_PIOE_IRQ
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -290,7 +299,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -322,7 +331,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_ethernet.h"
|
#include "sam_ethernet.h"
|
||||||
|
@ -81,6 +82,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -290,7 +297,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -322,7 +329,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_ethernet.h"
|
#include "sam_ethernet.h"
|
||||||
|
@ -82,6 +83,14 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAMA5_PIOE_IRQ
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -258,7 +267,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -290,7 +299,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
#endif /* CONFIG_SAMA5_PIOE_IRQ */
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
#include <nuttx/mtd/mtd.h>
|
#include <nuttx/mtd/mtd.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_gpio.h"
|
#include "sam_gpio.h"
|
||||||
#include "sam_twihs.h"
|
#include "sam_twihs.h"
|
||||||
|
@ -77,6 +78,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -310,7 +317,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -342,7 +349,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAMV7_GPIOA_IRQ */
|
#endif /* CONFIG_SAMV7_GPIOA_IRQ */
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
#include <nuttx/mtd/mtd.h>
|
#include <nuttx/mtd/mtd.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "sam_gpio.h"
|
#include "sam_gpio.h"
|
||||||
#include "sam_twihs.h"
|
#include "sam_twihs.h"
|
||||||
|
@ -77,6 +78,12 @@
|
||||||
# define phyinfo(x...)
|
# define phyinfo(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -315,7 +322,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
* following operations are atomic.
|
* following operations are atomic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
/* Configure the interrupt */
|
/* Configure the interrupt */
|
||||||
|
|
||||||
|
@ -347,7 +354,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
/* Return the old handler (so that it can be restored) */
|
/* Return the old handler (so that it can be restored) */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SAMV7_GPIOA_IRQ */
|
#endif /* CONFIG_SAMV7_GPIOA_IRQ */
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
#include <nuttx/mtd/mtd.h>
|
#include <nuttx/mtd/mtd.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
|
|
||||||
#include "stm32_gpio.h"
|
#include "stm32_gpio.h"
|
||||||
#include "stm32_eth.h"
|
#include "stm32_eth.h"
|
||||||
|
@ -80,6 +81,8 @@
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static spinlock_t g_phy_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
#ifdef HAVE_NETMONITOR
|
#ifdef HAVE_NETMONITOR
|
||||||
static xcpt_t g_ethmac_handler;
|
static xcpt_t g_ethmac_handler;
|
||||||
static void *g_ethmac_arg;
|
static void *g_ethmac_arg;
|
||||||
|
@ -214,7 +217,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
|
|
||||||
DEBUGASSERT(intf);
|
DEBUGASSERT(intf);
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_phy_lock);
|
||||||
|
|
||||||
if (strcmp(intf, STM32_ETHMAC_DEVNAME) == 0)
|
if (strcmp(intf, STM32_ETHMAC_DEVNAME) == 0)
|
||||||
{
|
{
|
||||||
|
@ -234,7 +237,7 @@ int arch_phy_irq(const char *intf, xcpt_t handler, void *arg,
|
||||||
*enable = enabler;
|
*enable = enabler;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_phy_lock, flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue