diff --git a/configs/sama5d3x-ek/include/board.h b/configs/sama5d3x-ek/include/board.h index 4a2eeab9360..fafb3c63986 100644 --- a/configs/sama5d3x-ek/include/board.h +++ b/configs/sama5d3x-ek/include/board.h @@ -191,7 +191,8 @@ void sam_boardinitialize(void); * ************************************************************************************/ -#if defined(CONFIG_NET) && (defined(CONFIG_SAMA5_EMAC) || defined(CONFIG_SAMA5_GMAC)) +#if defined(CONFIG_NET) && (defined(CONFIG_SAMA5_EMAC) || defined(CONFIG_SAMA5_GMAC)) && \ + defined(CONFIG_SAMA5_PIOE_IRQ) xcpt_t sam_phyirq(int intf, xcpt_t irqhandler); #endif diff --git a/configs/sama5d3x-ek/src/sam_buttons.c b/configs/sama5d3x-ek/src/sam_buttons.c index 2a6de2908b2..a5770b011e0 100644 --- a/configs/sama5d3x-ek/src/sam_buttons.c +++ b/configs/sama5d3x-ek/src/sam_buttons.c @@ -151,14 +151,15 @@ xcpt_t up_irqbutton(int id, xcpt_t irqhandler) /* Get the old button interrupt handler and save the new one */ - oldhandler = *g_irquser1; - *g_irquser1 = irqhandler; + oldhandler = g_irquser1; + g_irquser1 = irqhandler; /* Configure the interrupt */ sam_pioirq(IRQ_USER1); (void)irq_attach(IRQ_USER1, irqhandler); sam_pioirqenable(IRQ_USER1); + irqrestore(flags); } /* Return the old button handler (so that it can be restored) */ diff --git a/configs/sama5d3x-ek/src/sam_ethernet.c b/configs/sama5d3x-ek/src/sam_ethernet.c index 54248a3b20b..2a72207ce14 100644 --- a/configs/sama5d3x-ek/src/sam_ethernet.c +++ b/configs/sama5d3x-ek/src/sam_ethernet.c @@ -47,9 +47,22 @@ #ifdef HAVE_NETWORK /************************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************************/ +/************************************************************************************ + * Private Data + ************************************************************************************/ + +#ifdef CONFIG_SAMA5_PIOE_IRQ +#ifdef CONFIG_SAMA5_EMAC +static xcpt g_emac_handler; +#endif +#ifdef CONFIG_SAMA5_GMAC +static xcpt g_gmac_handler; +#endif +#endif + /************************************************************************************ * Private Functions ************************************************************************************/ @@ -117,6 +130,7 @@ void weak_function sam_netinitialize(void) * ************************************************************************************/ +#ifdef CONFIG_SAMA5_PIOE_IRQ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler) { irqstate_t flags; @@ -164,7 +178,9 @@ xcpt_t sam_phyirq(int intf, xcpt_t irqhandler) /* Return the old button handler (so that it can be restored) */ + irqrestore(flags); return oldhandler; } +#endif /* CONFIG_SAMA5_PIOE_IRQ */ #endif /* HAVE_NETWORK */ diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index 2c5b325e933..bbadc788e7e 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -90,7 +90,7 @@ static struct usbhost_connection_s *g_ehciconn; /* Overcurrent interrupt handler */ #if defined(HAVE_USBHOST) && defined(CONFIG_SAMA5_PIOD_IRQ) -static xcpt_t *g_ochandler; +static xcpt_t g_ochandler; #endif /************************************************************************************ @@ -476,8 +476,8 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) /* Get the old button interrupt handler and save the new one */ - oldhandler = *g_ochandler; - *g_ochandler = handler; + oldhandler = g_ochandler; + g_ochandler = handler; /* Configure the interrupt */