summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-16 08:35:31 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-16 08:35:31 -0600
commit4421b7e8c66af9dee026bf3ad91632f3e42a937f (patch)
tree05f818e25deace3bddd1b470480bf32677645e83 /nuttx
parent67857e3c5b699f1539da1771df2b624ddc861d63 (diff)
downloadnuttx-4421b7e8c66af9dee026bf3ad91632f3e42a937f.tar.gz
nuttx-4421b7e8c66af9dee026bf3ad91632f3e42a937f.tar.bz2
nuttx-4421b7e8c66af9dee026bf3ad91632f3e42a937f.zip
Convert existing board specific PHY interrupt interfaces to use newly defined standard interface
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/configs/Kconfig3
-rw-r--r--nuttx/configs/sama5d3-xplained/include/board.h14
-rw-r--r--nuttx/configs/sama5d3-xplained/src/sam_ethernet.c86
-rw-r--r--nuttx/configs/sama5d3-xplained/src/sama5d3-xplained.h2
-rw-r--r--nuttx/configs/sama5d3x-ek/include/board.h14
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sam_ethernet.c86
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sama5d3x-ek.h2
-rw-r--r--nuttx/configs/sama5d4-ek/include/board.h14
-rw-r--r--nuttx/configs/sama5d4-ek/src/sam_ethernet.c84
9 files changed, 226 insertions, 79 deletions
diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig
index 2caf802ef..4b0c318b2 100644
--- a/nuttx/configs/Kconfig
+++ b/nuttx/configs/Kconfig
@@ -563,6 +563,7 @@ config ARCH_BOARD_SAMA5D3X_EK
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
+ select ARCH_PHY_INTERRUPT
---help---
The port of NuttX to the Atmel SAMA5D3x-EK development board (where x=1,3,4, or 5).
@@ -572,6 +573,7 @@ config ARCH_BOARD_SAMA5D3_XPLAINED
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
+ select ARCH_PHY_INTERRUPT
---help---
The port of NuttX to the Atmel SAMA5D3 Xplained development board.
@@ -581,6 +583,7 @@ config ARCH_BOARD_SAMA5D4_EK
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
+ select ARCH_PHY_INTERRUPT
---help---
The port of NuttX to the Atmel SAMA5D4-EK development board
diff --git a/nuttx/configs/sama5d3-xplained/include/board.h b/nuttx/configs/sama5d3-xplained/include/board.h
index e5d43377b..1232770b8 100644
--- a/nuttx/configs/sama5d3-xplained/include/board.h
+++ b/nuttx/configs/sama5d3-xplained/include/board.h
@@ -332,20 +332,6 @@ extern "C" {
void sam_boardinitialize(void);
/************************************************************************************
- * Name: sam_phyirq
- *
- * Description:
- * This function may be called to register an interrupt handler that will be
- * called when an interrupt is received from a PHY.
- *
- ************************************************************************************/
-
-#if defined(CONFIG_NET) && (defined(CONFIG_SAMA5_EMACA) || defined(CONFIG_SAMA5_GMAC)) && \
- defined(CONFIG_SAMA5_PIOE_IRQ)
-xcpt_t sam_phyirq(int intf, xcpt_t irqhandler);
-#endif
-
-/************************************************************************************
* Name: sam_ledinit, sam_setled, and sam_setleds
*
* Description:
diff --git a/nuttx/configs/sama5d3-xplained/src/sam_ethernet.c b/nuttx/configs/sama5d3-xplained/src/sam_ethernet.c
index 788880805..c180b01bf 100644
--- a/nuttx/configs/sama5d3-xplained/src/sam_ethernet.c
+++ b/nuttx/configs/sama5d3-xplained/src/sam_ethernet.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/sama5d3-xplained/src/sam_ethernet.c
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,11 @@
#include <nuttx/config.h>
+#include <string.h>
+#include <assert.h>
+
#include <nuttx/irq.h>
+#include <nuttx/arch.h>
#include "sam_pio.h"
#include "sam_ethernet.h"
@@ -50,6 +54,18 @@
* Pre-processor Definitions
************************************************************************************/
+#ifndef CONFIG_SAMA5_EMACA
+# undef CONFIG_SAMA5_EMAC_ISETH0
+#endif
+
+#ifdef CONFIG_SAMA5_EMAC_ISETH0
+# SAMA5_EMAC_DEVNAME "eth0"
+# SAMA5_GMAC_DEVNAME "eth1"
+#else
+# SAMA5_GMAC_DEVNAME "eth0"
+# SAMA5_EMAC_DEVNAME "eth1"
+#endif
+
/************************************************************************************
* Private Data
************************************************************************************/
@@ -121,17 +137,61 @@ void weak_function sam_netinitialize(void)
#endif
}
-/************************************************************************************
- * Name: sam_phyirq
+/****************************************************************************
+ * Name: arch_phy_irq
*
* Description:
- * This function may be called to register an interrupt handler that will be
- * called when an interrupt is received from a PHY.
+ * This function may be called to register an interrupt handler that will
+ * be called when a PHY interrupt occurs. This function both attaches
+ * the interrupt handler and enables the interrupt if 'handler' is non-
+ * NULL. If handler is NULL, then the interrupt is detached and disabled
+ * instead.
*
- ************************************************************************************/
+ * This interrupt may or may not be available on a given platform depending
+ * on how the network hardware architecture is implemented. In a typical
+ * case, the PHY interrupt is provided to board-level logic as a GPIO
+ * interrupt (in which case this is a board-specific interface and really
+ * should be called board_phy_irq()); In other cases, the PHY interrupt
+ * may be cause by the chip's MAC logic (in which case arch_phy_irq()) is
+ * an appropriate name. Other other boards, there may be no PHY interrupts
+ * available at all. If client attachable PHY interrupts are available
+ * from the board or from the chip, then CONFIG_ARCH_PHY_INTERRUPT should
+ * be defined to indicate that fact.
+ *
+ * Typical usage:
+ * a. OS service logic (not application logic*) attaches to the PHY
+ * PHY interrupt.
+ * b. When the PHY interrupt occurs, work should be scheduled on the
+ * worker thread (or perhaps a dedicated application thread).
+ * c. That worker thread should use the SIOCGMIIPHY, SIOCGMIIREG,
+ * and SIOCSMIIREG ioctl calls** to communicate with the PHY,
+ * determine what network event took place (Link Up/Down?), and
+ * take the appropriate actions.
+ *
+ * * This is an OS internal interface and should not be used from
+ * application space.
+ * ** This interrupt is really of no use if the Ethernet MAC driver
+ * does not support these ioctl calls.
+ *
+ * Input Parameters:
+ * intf - Identifies the network interface. For example "eth0". Only
+ * useful on platforms that support multiple Ethernet interfaces
+ * and, hence, multiple PHYs and PHY interrupts.
+ * handler - The client interrupt handler to be invoked when the PHY
+ * asserts an interrupt. Must reside in OS space, but can
+ * signal tasks in user space. A value of NULL can be passed
+ * in order to detach and disable the PHY interrupt.
+ *
+ * Returned Value:
+ * The previous PHY interrupt handler address is returned. This allows you
+ * to temporarily replace an interrupt handler, then restore the original
+ * interrupt handler. NULL is returned if there is was not handler in
+ * place when the call was made.
+ *
+ ****************************************************************************/
#ifdef CONFIG_SAMA5_PIOE_IRQ
-xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
+xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
{
irqstate_t flags;
xcpt_t *handler;
@@ -139,8 +199,10 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
pio_pinset_t pinset;
int irq;
+ DEBUGASSERT(intf);
+
#ifdef CONFIG_SAMA5_EMACA
- if (intf == EMAC_INTF)
+ if (strcmp(intf, SAMA5_EMAC_DEVNAME) == 0)
{
handler = &g_emac_handler;
pinset = PIO_INT_ETH1;
@@ -149,7 +211,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
else
#endif
#ifdef CONFIG_SAMA5_GMAC
- if (intf == GMAC_INTF)
+ if (strcmp(intf, SAMA5_GMAC_DEVNAME) == 0)
{
handler = &g_gmac_handler;
pinset = PIO_INT_ETH0;
@@ -158,7 +220,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
else
#endif
{
- ndbg("Unsupported interface: %d\n", intf);
+ ndbg("Unsupported interface: %s\n", intf);
return NULL;
}
@@ -171,12 +233,12 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
/* Get the old button interrupt handler and save the new one */
oldhandler = *handler;
- *handler = irqhandler;
+ *handler = handler;
/* Configure the interrupt */
sam_pioirq(pinset);
- (void)irq_attach(irq, irqhandler);
+ (void)irq_attach(irq, handler);
sam_pioirqenable(irq);
/* Return the old button handler (so that it can be restored) */
diff --git a/nuttx/configs/sama5d3-xplained/src/sama5d3-xplained.h b/nuttx/configs/sama5d3-xplained/src/sama5d3-xplained.h
index 94a63dfff..57a17bdb2 100644
--- a/nuttx/configs/sama5d3-xplained/src/sama5d3-xplained.h
+++ b/nuttx/configs/sama5d3-xplained/src/sama5d3-xplained.h
@@ -435,7 +435,7 @@
* Speed Mode:100Mbps
* Nway Auto-Negotiation:Enable
*
- * The KSZ8051 PHY interrtup is available on PE30 INT_ETH1
+ * The KSZ8051 PHY interrupt is available on PE30 INT_ETH1
*/
#define PIO_INT_ETH1 (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \
diff --git a/nuttx/configs/sama5d3x-ek/include/board.h b/nuttx/configs/sama5d3x-ek/include/board.h
index b682e9d10..fc50b1786 100644
--- a/nuttx/configs/sama5d3x-ek/include/board.h
+++ b/nuttx/configs/sama5d3x-ek/include/board.h
@@ -373,20 +373,6 @@ extern "C" {
void sam_boardinitialize(void);
/************************************************************************************
- * Name: sam_phyirq
- *
- * Description:
- * This function may be called to register an interrupt handler that will be
- * called when an interrupt is received from a PHY.
- *
- ************************************************************************************/
-
-#if defined(CONFIG_NET) && (defined(CONFIG_SAMA5_EMACA) || defined(CONFIG_SAMA5_GMAC)) && \
- defined(CONFIG_SAMA5_PIOE_IRQ)
-xcpt_t sam_phyirq(int intf, xcpt_t irqhandler);
-#endif
-
-/************************************************************************************
* Name: sam_ledinit, sam_setled, and sam_setleds
*
* Description:
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c b/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c
index 813ef3b28..7fcc42bfb 100644
--- a/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c
+++ b/nuttx/configs/sama5d3x-ek/src/sam_ethernet.c
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/sama5d3x-ek/src/sam_ethernet.c
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,11 @@
#include <nuttx/config.h>
+#include <string.h>
+#include <assert.h>
+
#include <nuttx/irq.h>
+#include <nuttx/arch.h>
#include "sam_pio.h"
#include "sam_ethernet.h"
@@ -50,6 +54,18 @@
* Pre-processor Definitions
************************************************************************************/
+#ifndef CONFIG_SAMA5_EMACA
+# undef CONFIG_SAMA5_EMAC_ISETH0
+#endif
+
+#ifdef CONFIG_SAMA5_EMAC_ISETH0
+# SAMA5_EMAC_DEVNAME "eth0"
+# SAMA5_GMAC_DEVNAME "eth1"
+#else
+# SAMA5_GMAC_DEVNAME "eth0"
+# SAMA5_EMAC_DEVNAME "eth1"
+#endif
+
/************************************************************************************
* Private Data
************************************************************************************/
@@ -121,17 +137,61 @@ void weak_function sam_netinitialize(void)
#endif
}
-/************************************************************************************
- * Name: sam_phyirq
+/****************************************************************************
+ * Name: arch_phy_irq
*
* Description:
- * This function may be called to register an interrupt handler that will be
- * called when an interrupt is received from a PHY.
+ * This function may be called to register an interrupt handler that will
+ * be called when a PHY interrupt occurs. This function both attaches
+ * the interrupt handler and enables the interrupt if 'handler' is non-
+ * NULL. If handler is NULL, then the interrupt is detached and disabled
+ * instead.
*
- ************************************************************************************/
+ * This interrupt may or may not be available on a given platform depending
+ * on how the network hardware architecture is implemented. In a typical
+ * case, the PHY interrupt is provided to board-level logic as a GPIO
+ * interrupt (in which case this is a board-specific interface and really
+ * should be called board_phy_irq()); In other cases, the PHY interrupt
+ * may be cause by the chip's MAC logic (in which case arch_phy_irq()) is
+ * an appropriate name. Other other boards, there may be no PHY interrupts
+ * available at all. If client attachable PHY interrupts are available
+ * from the board or from the chip, then CONFIG_ARCH_PHY_INTERRUPT should
+ * be defined to indicate that fact.
+ *
+ * Typical usage:
+ * a. OS service logic (not application logic*) attaches to the PHY
+ * PHY interrupt.
+ * b. When the PHY interrupt occurs, work should be scheduled on the
+ * worker thread (or perhaps a dedicated application thread).
+ * c. That worker thread should use the SIOCGMIIPHY, SIOCGMIIREG,
+ * and SIOCSMIIREG ioctl calls** to communicate with the PHY,
+ * determine what network event took place (Link Up/Down?), and
+ * take the appropriate actions.
+ *
+ * * This is an OS internal interface and should not be used from
+ * application space.
+ * ** This interrupt is really of no use if the Ethernet MAC driver
+ * does not support these ioctl calls.
+ *
+ * Input Parameters:
+ * intf - Identifies the network interface. For example "eth0". Only
+ * useful on platforms that support multiple Ethernet interfaces
+ * and, hence, multiple PHYs and PHY interrupts.
+ * handler - The client interrupt handler to be invoked when the PHY
+ * asserts an interrupt. Must reside in OS space, but can
+ * signal tasks in user space. A value of NULL can be passed
+ * in order to detach and disable the PHY interrupt.
+ *
+ * Returned Value:
+ * The previous PHY interrupt handler address is returned. This allows you
+ * to temporarily replace an interrupt handler, then restore the original
+ * interrupt handler. NULL is returned if there is was not handler in
+ * place when the call was made.
+ *
+ ****************************************************************************/
#ifdef CONFIG_SAMA5_PIOE_IRQ
-xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
+xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
{
irqstate_t flags;
xcpt_t *handler;
@@ -139,8 +199,10 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
pio_pinset_t pinset;
int irq;
+ DEBUGASSERT(intf);
+
#ifdef CONFIG_SAMA5_EMACA
- if (intf == EMAC_INTF)
+ if (strcmp(intf, SAMA5_EMAC_DEVNAME) == 0)
{
handler = &g_emac_handler;
pinset = PIO_INT_ETH1;
@@ -149,7 +211,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
else
#endif
#ifdef CONFIG_SAMA5_GMAC
- if (intf == GMAC_INTF)
+ if (strcmp(intf, SAMA5_GMAC_DEVNAME) == 0)
{
handler = &g_gmac_handler;
pinset = PIO_INT_ETH0;
@@ -158,7 +220,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
else
#endif
{
- ndbg("Unsupported interface: %d\n", intf);
+ ndbg("Unsupported interface: %s\n", intf);
return NULL;
}
@@ -171,12 +233,12 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
/* Get the old button interrupt handler and save the new one */
oldhandler = *handler;
- *handler = irqhandler;
+ *handler = handler;
/* Configure the interrupt */
sam_pioirq(pinset);
- (void)irq_attach(irq, irqhandler);
+ (void)irq_attach(irq, handler);
sam_pioirqenable(irq);
/* Return the old button handler (so that it can be restored) */
diff --git a/nuttx/configs/sama5d3x-ek/src/sama5d3x-ek.h b/nuttx/configs/sama5d3x-ek/src/sama5d3x-ek.h
index d340643af..df02c6a47 100644
--- a/nuttx/configs/sama5d3x-ek/src/sama5d3x-ek.h
+++ b/nuttx/configs/sama5d3x-ek/src/sama5d3x-ek.h
@@ -562,7 +562,7 @@
* Speed Mode:100Mbps
* Nway Auto-Negotiation:Enable
*
- * The KSZ8051 PHY interrtup is available on PE30 INT_ETH1
+ * The KSZ8051 PHY interrupt is available on PE30 INT_ETH1
*/
#define PIO_INT_ETH1 (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \
diff --git a/nuttx/configs/sama5d4-ek/include/board.h b/nuttx/configs/sama5d4-ek/include/board.h
index b1507a5d6..d28b3f39c 100644
--- a/nuttx/configs/sama5d4-ek/include/board.h
+++ b/nuttx/configs/sama5d4-ek/include/board.h
@@ -303,20 +303,6 @@ extern "C" {
void sam_boardinitialize(void);
/************************************************************************************
- * Name: sam_phyirq
- *
- * Description:
- * This function may be called to register an interrupt handler that will be
- * called when an interrupt is received from a PHY.
- *
- ************************************************************************************/
-
-#if defined(CONFIG_NET) && (defined(CONFIG_SAMA5_EMACB) || defined(CONFIG_SAMA5_GMAC)) && \
- defined(CONFIG_SAMA5_PIOE_IRQ)
-xcpt_t sam_phyirq(int intf, xcpt_t irqhandler);
-#endif
-
-/************************************************************************************
* Name: sam_ledinit, sam_setled, and sam_setleds
*
* Description:
diff --git a/nuttx/configs/sama5d4-ek/src/sam_ethernet.c b/nuttx/configs/sama5d4-ek/src/sam_ethernet.c
index 67bcfa549..de115f923 100644
--- a/nuttx/configs/sama5d4-ek/src/sam_ethernet.c
+++ b/nuttx/configs/sama5d4-ek/src/sam_ethernet.c
@@ -39,7 +39,11 @@
#include <nuttx/config.h>
+#include <string.h>
+#include <assert.h>
+
#include <nuttx/irq.h>
+#include <nuttx/arch.h>
#include "sam_pio.h"
#include "sam_ethernet.h"
@@ -50,6 +54,18 @@
* Pre-processor Definitions
************************************************************************************/
+#ifndef CONFIG_SAMA5_EMAC0
+# undef CONFIG_SAMA5_EMAC0_ISETH0
+#endif
+
+#ifdef CONFIG_SAMA5_EMAC0_ISETH0
+# SAMA5_EMAC0_DEVNAME "eth0"
+# SAMA5_EMAC1_DEVNAME "eth1"
+#else
+# SAMA5_EMAC0_DEVNAME "eth1"
+# SAMA5_EMAC1_DEVNAME "eth0"
+#endif
+
/************************************************************************************
* Private Data
************************************************************************************/
@@ -90,17 +106,61 @@ void weak_function sam_netinitialize(void)
#endif
}
-/************************************************************************************
- * Name: sam_phyirq
+/****************************************************************************
+ * Name: arch_phy_irq
*
* Description:
- * This function may be called to register an interrupt handler that will be
- * called when an interrupt is received from a PHY.
+ * This function may be called to register an interrupt handler that will
+ * be called when a PHY interrupt occurs. This function both attaches
+ * the interrupt handler and enables the interrupt if 'handler' is non-
+ * NULL. If handler is NULL, then the interrupt is detached and disabled
+ * instead.
*
- ************************************************************************************/
+ * This interrupt may or may not be available on a given platform depending
+ * on how the network hardware architecture is implemented. In a typical
+ * case, the PHY interrupt is provided to board-level logic as a GPIO
+ * interrupt (in which case this is a board-specific interface and really
+ * should be called board_phy_irq()); In other cases, the PHY interrupt
+ * may be cause by the chip's MAC logic (in which case arch_phy_irq()) is
+ * an appropriate name. Other other boards, there may be no PHY interrupts
+ * available at all. If client attachable PHY interrupts are available
+ * from the board or from the chip, then CONFIG_ARCH_PHY_INTERRUPT should
+ * be defined to indicate that fact.
+ *
+ * Typical usage:
+ * a. OS service logic (not application logic*) attaches to the PHY
+ * PHY interrupt.
+ * b. When the PHY interrupt occurs, work should be scheduled on the
+ * worker thread (or perhaps a dedicated application thread).
+ * c. That worker thread should use the SIOCGMIIPHY, SIOCGMIIREG,
+ * and SIOCSMIIREG ioctl calls** to communicate with the PHY,
+ * determine what network event took place (Link Up/Down?), and
+ * take the appropriate actions.
+ *
+ * * This is an OS internal interface and should not be used from
+ * application space.
+ * ** This interrupt is really of no use if the Ethernet MAC driver
+ * does not support these ioctl calls.
+ *
+ * Input Parameters:
+ * intf - Identifies the network interface. For example "eth0". Only
+ * useful on platforms that support multiple Ethernet interfaces
+ * and, hence, multiple PHYs and PHY interrupts.
+ * handler - The client interrupt handler to be invoked when the PHY
+ * asserts an interrupt. Must reside in OS space, but can
+ * signal tasks in user space. A value of NULL can be passed
+ * in order to detach and disable the PHY interrupt.
+ *
+ * Returned Value:
+ * The previous PHY interrupt handler address is returned. This allows you
+ * to temporarily replace an interrupt handler, then restore the original
+ * interrupt handler. NULL is returned if there is was not handler in
+ * place when the call was made.
+ *
+ ****************************************************************************/
#ifdef CONFIG_SAMA5_PIOE_IRQ
-xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
+xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
{
irqstate_t flags;
xcpt_t *handler;
@@ -108,8 +168,10 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
pio_pinset_t pinset;
int irq;
+ DEBUGASSERT(intf);
+
#ifdef CONFIG_SAMA5_EMAC0
- if (intf == EMAC0_INTF)
+ if (strcmp(intf, SAMA5_EMAC0_DEVNAME) == 0)
{
handler = &g_emac0_handler;
pinset = PIO_INT_ETH0;
@@ -118,7 +180,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
else
#endif
#ifdef CONFIG_SAMA5_EMAC1
- if (intf == EMAC1_INTF)
+ if (strcmp(intf, SAMA5_EMAC1_DEVNAME) == 0)
{
handler = &g_emac1_handler;
pinset = PIO_INT_ETH1;
@@ -127,7 +189,7 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
else
#endif
{
- ndbg("Unsupported interface: %d\n", intf);
+ ndbg("Unsupported interface: %s\n", intf);
return NULL;
}
@@ -140,12 +202,12 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler)
/* Get the old button interrupt handler and save the new one */
oldhandler = *handler;
- *handler = irqhandler;
+ *handler = handler;
/* Configure the interrupt */
sam_pioirq(pinset);
- (void)irq_attach(irq, irqhandler);
+ (void)irq_attach(irq, handler);
sam_pioirqenable(irq);
/* Return the old button handler (so that it can be restored) */