Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()

This commit is contained in:
Gregory Nutt
2016-02-13 12:37:46 -06:00
parent 255cc9041b
commit 1699561bb6
72 changed files with 240 additions and 242 deletions
+3 -3
View File
@@ -44,7 +44,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "dk-tm4c129x.h" #include "dk-tm4c129x.h"
@@ -163,7 +163,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{ {
/* The following should be atomic */ /* The following should be atomic */
flags = irqsave(); flags = enter_critical_section();
/* Detach and disable the button interrupt */ /* Detach and disable the button interrupt */
@@ -183,7 +183,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
} }
} }
irqrestore(flags); leave_critical_section(flags);
} }
return oldhandler; return oldhandler;
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/ea3131/src/lpc31_usbhost.c * configs/ea3131/src/lpc31_usbhost.c
* *
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h> #include <nuttx/usb/usbdev_trace.h>
@@ -307,7 +308,7 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -319,7 +320,7 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler)
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
} }
#endif /* 0 */ #endif /* 0 */
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/fire-stm32v2/src/stm32_selectlcd.c * configs/fire-stm32v2/src/stm32_selectlcd.c
* *
* Copyright (C) 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "chip.h" #include "chip.h"
@@ -177,7 +178,7 @@ void stm32_selectlcd(void)
/* Configure LCD GPIO pis */ /* Configure LCD GPIO pis */
flags = irqsave(); flags = enter_critical_section();
for (i = 0; i < NLCD_GPIOS; i++) for (i = 0; i < NLCD_GPIOS; i++)
{ {
stm32_configgpio(g_lcdconfig[i]); stm32_configgpio(g_lcdconfig[i]);
@@ -201,7 +202,7 @@ void stm32_selectlcd(void)
/* Enable the bank by setting the MBKEN bit */ /* Enable the bank by setting the MBKEN bit */
putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR1); putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR1);
irqrestore(flags); leave_critical_section(flags);
} }
#endif /* CONFIG_STM32_FSMC */ #endif /* CONFIG_STM32_FSMC */
+3 -3
View File
@@ -47,7 +47,7 @@
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/sensors/adxl345.h> #include <nuttx/sensors/adxl345.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include "freedom-kl25z.h" #include "freedom-kl25z.h"
#include "kl_gpio.h" #include "kl_gpio.h"
@@ -205,7 +205,7 @@ static void adxl345_enable(FAR struct adxl345_config_s *state, bool enable)
* interrupts disabled during the reconfiguration. * interrupts disabled during the reconfiguration.
*/ */
flags = irqsave(); flags = enter_critical_section();
if (enable) if (enable)
{ {
/* Configure the interrupt using the SAVED handler */ /* Configure the interrupt using the SAVED handler */
@@ -222,7 +222,7 @@ static void adxl345_enable(FAR struct adxl345_config_s *state, bool enable)
kl_gpioirqdisable(GPIO_ADXL345_INT1); kl_gpioirqdisable(GPIO_ADXL345_INT1);
} }
irqrestore(flags); leave_critical_section(flags);
} }
static void adxl345_clear(FAR struct adxl345_config_s *state) static void adxl345_clear(FAR struct adxl345_config_s *state)
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -94,7 +94,7 @@ static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq,
* operations are atomic. * operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -119,7 +119,7 @@ static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq,
tms570_gioirqdisable(irq); tms570_gioirqdisable(irq);
} }
irqrestore(flags); leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+2 -2
View File
@@ -196,7 +196,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */ /* Disable interrupts until we are done */
flags = irqsave(); flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new /* Configure the interrupt. Either attach and enable the new
* interrupt or disable and detach the old interrupt handler. * interrupt or disable and detach the old interrupt handler.
@@ -217,7 +217,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
up_disable_irq(irq); up_disable_irq(irq);
(void)irq_detach(irq); (void)irq_detach(irq);
} }
irqrestore(flags); leave_critical_section(flags);
} }
return oldhandler; return oldhandler;
} }
+2 -2
View File
@@ -195,7 +195,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */ /* Disable interrupts until we are done */
flags = irqsave(); flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new /* Configure the interrupt. Either attach and enable the new
* interrupt or disable and detach the old interrupt handler. * interrupt or disable and detach the old interrupt handler.
@@ -216,7 +216,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
up_disable_irq(irq); up_disable_irq(irq);
(void)irq_detach(irq); (void)irq_detach(irq);
} }
irqrestore(flags); leave_critical_section(flags);
} }
return oldhandler; return oldhandler;
} }
+3 -3
View File
@@ -44,7 +44,7 @@
#include <string.h> #include <string.h>
#include <debug.h> #include <debug.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -92,13 +92,13 @@ void arch_getfpu(FAR uint32_t *fpusave)
/* Take a snapshot of the thread context right now */ /* Take a snapshot of the thread context right now */
flags = irqsave(); flags = enter_critical_section();
up_saveusercontext(g_saveregs); up_saveusercontext(g_saveregs);
/* Return only the floating register values */ /* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS)); memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
irqrestore(flags); leave_critical_section(flags);
} }
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function /* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
+2 -2
View File
@@ -202,7 +202,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */ /* Disable interrupts until we are done */
flags = irqsave(); flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new /* Configure the interrupt. Either attach and enable the new
* interrupt or disable and detach the old interrupt handler. * interrupt or disable and detach the old interrupt handler.
@@ -223,7 +223,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
up_disable_irq(irq); up_disable_irq(irq);
(void)irq_detach(irq); (void)irq_detach(irq);
} }
irqrestore(flags); leave_critical_section(flags);
} }
return oldhandler; return oldhandler;
+3 -3
View File
@@ -44,7 +44,7 @@
#include <string.h> #include <string.h>
#include <debug.h> #include <debug.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -92,13 +92,13 @@ void arch_getfpu(FAR uint32_t *fpusave)
/* Take a snapshot of the thread context right now */ /* Take a snapshot of the thread context right now */
flags = irqsave(); flags = enter_critical_section();
up_saveusercontext(g_saveregs); up_saveusercontext(g_saveregs);
/* Return only the floating register values */ /* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS)); memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
irqrestore(flags); leave_critical_section(flags);
} }
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function /* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
+3 -3
View File
@@ -44,7 +44,7 @@
#include <string.h> #include <string.h>
#include <debug.h> #include <debug.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -92,13 +92,13 @@ void arch_getfpu(FAR uint32_t *fpusave)
/* Take a snapshot of the thread context right now */ /* Take a snapshot of the thread context right now */
flags = irqsave(); flags = enter_critical_section();
up_saveusercontext(g_saveregs); up_saveusercontext(g_saveregs);
/* Return only the floating register values */ /* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS)); memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
irqrestore(flags); leave_critical_section(flags);
} }
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function /* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/lpc4370-link2/src/lpc43_spifilib_init.c * configs/lpc4370-link2/src/lpc43_spifilib_init.c
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <arch/board/board.h> #include <arch/board/board.h>
@@ -73,10 +74,10 @@ static uint32_t lmem[21];
void board_spifi_initialize(void) void board_spifi_initialize(void)
{ {
irqstate_t flags = irqsave(); irqstate_t flags = enter_critical_section();
uint32_t regval; uint32_t regval;
flags = irqsave(); flags = enter_critical_section();
/* Initial frequency is set by boot ROM in IDIVE */ /* Initial frequency is set by boot ROM in IDIVE */
@@ -124,7 +125,7 @@ void board_spifi_initialize(void)
IDIVE_CTRL_IDIV(SPIFI_DEVICE_REQUENCY_DIVIDER); IDIVE_CTRL_IDIV(SPIFI_DEVICE_REQUENCY_DIVIDER);
putreg32(regval, LPC43_IDIVE_CTRL); putreg32(regval, LPC43_IDIVE_CTRL);
irqrestore(flags); leave_critical_section(flags);
} }
#endif /* CONFIG_SPIFI_LIBRARY */ #endif /* CONFIG_SPIFI_LIBRARY */
+3 -3
View File
@@ -49,7 +49,7 @@
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/power/pm.h> #include <nuttx/power/pm.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include "up_internal.h" #include "up_internal.h"
#include "stm32_pm.h" #include "stm32_pm.h"
@@ -125,7 +125,7 @@ static void up_idlepm(void)
{ {
lldbg("newstate= %d oldstate=%d\n", newstate, oldstate); lldbg("newstate= %d oldstate=%d\n", newstate, oldstate);
flags = irqsave(); flags = enter_critical_section();
/* Force the global state change */ /* Force the global state change */
@@ -214,7 +214,7 @@ static void up_idlepm(void)
oldstate = newstate; oldstate = newstate;
errout: errout:
irqrestore(flags); leave_critical_section(flags);
} }
} }
#else #else
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/mikroe-stm32f4/src/stm32_touchscreen.c * configs/mikroe-stm32f4/src/stm32_touchscreen.c
* *
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Modified: May, 2013 by Ken Pettit to adapt for Mikroe-STM32M4 board * Modified: May, 2013 by Ken Pettit to adapt for Mikroe-STM32M4 board
@@ -50,6 +50,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/wqueue.h> #include <nuttx/wqueue.h>
@@ -351,7 +352,7 @@ static void tc_adc_init(void)
* is used by several different drivers. * is used by several different drivers.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Enable ADC reset state */ /* Enable ADC reset state */
@@ -459,7 +460,7 @@ static void tc_adc_init(void)
/* Restore the IRQ state */ /* Restore the IRQ state */
irqrestore(flags); leave_critical_section(flags);
} }
/************************************************************************************ /************************************************************************************
+6 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/nucleo-f3x1re/src/stm32_ajoystick.c * configs/nucleo-f3x1re/src/stm32_ajoystick.c
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/input/ajoystick.h> #include <nuttx/input/ajoystick.h>
@@ -339,7 +340,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
/* Start with all interrupts disabled */ /* Start with all interrupts disabled */
flags = irqsave(); flags = enter_critical_section();
ajoy_disable(); ajoy_disable();
illvdbg("press: %02x release: %02x handler: %p arg: %p\n", illvdbg("press: %02x release: %02x handler: %p arg: %p\n",
@@ -383,7 +384,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
} }
} }
irqrestore(flags); leave_critical_section(flags);
} }
/**************************************************************************** /****************************************************************************
@@ -401,13 +402,13 @@ static void ajoy_disable(void)
/* Disable each joystick interrupt */ /* Disable each joystick interrupt */
flags = irqsave(); flags = enter_critical_section();
for (i = 0; i < AJOY_NGPIOS; i++) for (i = 0; i < AJOY_NGPIOS; i++)
{ {
(void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL); (void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL);
} }
irqrestore(flags); leave_critical_section(flags);
/* Nullify the handler and argument */ /* Nullify the handler and argument */
@@ -58,7 +58,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "efm32_gpio.h" #include "efm32_gpio.h"
@@ -180,7 +180,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get/set the old button handler /* Get/set the old button handler
* *
@@ -216,7 +216,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
(void)irq_detach(g_button_irqs[id]); (void)irq_detach(g_button_irqs[id]);
} }
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/olimex-lpc-h3131/src/lpc31_usbhost.c * configs/olimex-lpc-h3131/src/lpc31_usbhost.c
* *
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h> #include <nuttx/usb/usbdev_trace.h>
@@ -308,7 +309,7 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -320,7 +321,7 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler)
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
} }
#endif /* 0 */ #endif /* 0 */
@@ -199,7 +199,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */ /* Disable interrupts until we are done */
flags = irqsave(); flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new /* Configure the interrupt. Either attach and enable the new
* interrupt or disable and detach the old interrupt handler. * interrupt or disable and detach the old interrupt handler.
@@ -220,7 +220,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
up_disable_irq(irq); up_disable_irq(irq);
(void)irq_detach(irq); (void)irq_detach(irq);
} }
irqrestore(flags); leave_critical_section(flags);
} }
return oldhandler; return oldhandler;
} }
+2 -2
View File
@@ -151,7 +151,7 @@ static void ssp_cdirqsetup(int irq, xcpt_t irqhandler)
/* Disable interrupts until we are done */ /* Disable interrupts until we are done */
flags = irqsave(); flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new /* Configure the interrupt. Either attach and enable the new
* interrupt or disable and detach the old interrupt handler. * interrupt or disable and detach the old interrupt handler.
@@ -172,7 +172,7 @@ static void ssp_cdirqsetup(int irq, xcpt_t irqhandler)
(void)irq_detach(irq); (void)irq_detach(irq);
} }
irqrestore(flags); leave_critical_section(flags);
} }
#endif #endif
+3 -2
View File
@@ -47,6 +47,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
@@ -961,7 +962,7 @@ FAR struct spi_dev_s *str71_spibus_initialize(int port)
#endif #endif
irqstate_t flags; irqstate_t flags;
flags = irqsave(); flags = enter_critical_section();
#ifdef CONFIG_STR71X_BSPI0 #ifdef CONFIG_STR71X_BSPI0
if (port == 0) if (port == 0)
{ {
@@ -1139,7 +1140,7 @@ FAR struct spi_dev_s *str71_spibus_initialize(int port)
ret = NULL; ret = NULL;
} }
irqrestore(flags); leave_critical_section(flags);
return ret; return ret;
} }
+2 -2
View File
@@ -219,7 +219,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{ {
/* Disable interrupts until we are done */ /* Disable interrupts until we are done */
flags = irqsave(); flags = enter_critical_section();
/* Return the current button handler and set the new interrupt handler */ /* Return the current button handler and set the new interrupt handler */
@@ -245,7 +245,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
(void)irq_detach(irq); (void)irq_detach(irq);
} }
irqrestore(flags); leave_critical_section(flags);
} }
} }
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "pcduino_a10.h" #include "pcduino_a10.h"
@@ -132,7 +132,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -144,7 +144,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
a1x_pioirq(xxx); a1x_pioirq(xxx);
(void)irq_attach(xxx, irqhandler); (void)irq_attach(xxx, irqhandler);
a1x_pioirqenable(xxx); a1x_pioirqenable(xxx);
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_gpio.h" #include "sam_gpio.h"
@@ -89,7 +89,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
* operations are atomic. * operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -114,7 +114,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
sam_gpioirqdisable(irq); sam_gpioirqdisable(irq);
} }
irqrestore(flags); leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_gpio.h" #include "sam_gpio.h"
@@ -91,7 +91,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
* operations are atomic. * operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -116,7 +116,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
sam_gpioirqdisable(irq); sam_gpioirqdisable(irq);
} }
irqrestore(flags); leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+2 -2
View File
@@ -226,7 +226,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */ /* Get the old interrupt handler and save the new one */
@@ -263,7 +263,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
/* Return the old handler (so that it can be restored) */ /* Return the old handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
} }
#endif /* CONFIG_SAM34_GPIOD_IRQ */ #endif /* CONFIG_SAM34_GPIOD_IRQ */
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_gpio.h" #include "sam_gpio.h"
@@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -161,7 +161,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
sam_gpioirqdisable(IRQ_SW0); sam_gpioirqdisable(IRQ_SW0);
} }
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+3 -3
View File
@@ -46,7 +46,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_gpio.h" #include "sam_gpio.h"
@@ -135,7 +135,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -160,7 +160,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
sam_gpioirqdisable(IRQ_SW0); sam_gpioirqdisable(IRQ_SW0);
} }
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_gpio.h" #include "sam_gpio.h"
@@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -161,7 +161,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
sam_gpioirqdisable(IRQ_BP2); sam_gpioirqdisable(IRQ_BP2);
} }
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+3 -3
View File
@@ -56,7 +56,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_pio.h" #include "sam_pio.h"
@@ -145,7 +145,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -170,7 +170,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
(void)irq_detach(IRQ_BTN_USER); (void)irq_detach(IRQ_BTN_USER);
} }
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+6 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/sama5d3-xplained/src/sam_ajoystick.c * configs/sama5d3-xplained/src/sam_ajoystick.c
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/input/ajoystick.h> #include <nuttx/input/ajoystick.h>
@@ -300,7 +301,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
/* Start with all interrupts disabled */ /* Start with all interrupts disabled */
flags = irqsave(); flags = enter_critical_section();
ajoy_disable(); ajoy_disable();
illvdbg("press: %02x release: %02x handler: %p arg: %p\n", illvdbg("press: %02x release: %02x handler: %p arg: %p\n",
@@ -338,7 +339,7 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
} }
} }
irqrestore(flags); leave_critical_section(flags);
} }
/**************************************************************************** /****************************************************************************
@@ -356,13 +357,13 @@ static void ajoy_disable(void)
/* Disable each joystick interrupt */ /* Disable each joystick interrupt */
flags = irqsave(); flags = enter_critical_section();
for (i = 0; i < AJOY_NGPIOS; i++) for (i = 0; i < AJOY_NGPIOS; i++)
{ {
sam_pioirqdisable(g_joyirq[i]); sam_pioirqdisable(g_joyirq[i]);
} }
irqrestore(flags); leave_critical_section(flags);
/* Nullify the handler and argument */ /* Nullify the handler and argument */
+3 -3
View File
@@ -60,7 +60,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_pio.h" #include "sam_pio.h"
@@ -149,7 +149,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -175,7 +175,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
} }
/* Configure the interrupt */ /* Configure the interrupt */
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+2 -2
View File
@@ -315,7 +315,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */ /* Get the old interrupt handler and save the new one */
@@ -352,7 +352,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
/* Return the old handler (so that it can be restored) */ /* Return the old handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
} }
#endif /* CONFIG_SAMA5_PIOE_IRQ */ #endif /* CONFIG_SAMA5_PIOE_IRQ */
+3 -3
View File
@@ -44,7 +44,7 @@
#include <string.h> #include <string.h>
#include <debug.h> #include <debug.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -92,13 +92,13 @@ void arch_getfpu(FAR uint32_t *fpusave)
/* Take a snapshot of the thread context right now */ /* Take a snapshot of the thread context right now */
flags = irqsave(); flags = enter_critical_section();
up_saveusercontext(g_saveregs); up_saveusercontext(g_saveregs);
/* Return only the floating register values */ /* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*FPU_CONTEXT_REGS)); memcpy(fpusave, &g_saveregs[REG_S0], (4*FPU_CONTEXT_REGS));
irqrestore(flags); leave_critical_section(flags);
} }
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function /* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d3-xplained/src/sam_usb.c * configs/sama5d3-xplained/src/sam_usb.c
* *
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h> #include <nuttx/usb/usbdev_trace.h>
@@ -506,7 +507,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */ /* Get the old interrupt handler and save the new one */
@@ -521,7 +522,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
/* Return the old handler (so that it can be restored) */ /* Return the old handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
#else #else
-4
View File
@@ -76,10 +76,6 @@
typedef void (*nor_entry_t)(void); typedef void (*nor_entry_t)(void);
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
+3 -3
View File
@@ -60,7 +60,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_pio.h" #include "sam_pio.h"
@@ -149,7 +149,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -174,7 +174,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
(void)irq_detach(IRQ_USER1); (void)irq_detach(IRQ_USER1);
} }
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+2 -2
View File
@@ -315,7 +315,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */ /* Get the old interrupt handler and save the new one */
@@ -352,7 +352,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
/* Return the old handler (so that it can be restored) */ /* Return the old handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
} }
#endif /* CONFIG_SAMA5_PIOE_IRQ */ #endif /* CONFIG_SAMA5_PIOE_IRQ */
+3 -3
View File
@@ -44,7 +44,7 @@
#include <string.h> #include <string.h>
#include <debug.h> #include <debug.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -92,13 +92,13 @@ void arch_getfpu(FAR uint32_t *fpusave)
/* Take a snapshot of the thread context right now */ /* Take a snapshot of the thread context right now */
flags = irqsave(); flags = enter_critical_section();
up_saveusercontext(g_saveregs); up_saveusercontext(g_saveregs);
/* Return only the floating register values */ /* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*FPU_CONTEXT_REGS)); memcpy(fpusave, &g_saveregs[REG_S0], (4*FPU_CONTEXT_REGS));
irqrestore(flags); leave_critical_section(flags);
} }
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function /* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d3x-ek/src/sam_usb.c * configs/sama5d3x-ek/src/sam_usb.c
* *
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h> #include <nuttx/usb/usbdev_trace.h>
@@ -498,7 +499,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */ /* Get the old interrupt handler and save the new one */
@@ -513,7 +514,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
/* Return the old handler (so that it can be restored) */ /* Return the old handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
#else #else
+3 -2
View File
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
#include <nuttx/audio/i2s.h> #include <nuttx/audio/i2s.h>
#include <nuttx/audio/pcm.h> #include <nuttx/audio/pcm.h>
@@ -179,7 +180,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable)
/* Has the interrupt state changed */ /* Has the interrupt state changed */
flags = irqsave(); flags = enter_critical_section();
if (enable != enabled) if (enable != enabled)
{ {
/* Enable or disable interrupts */ /* Enable or disable interrupts */
@@ -199,7 +200,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable)
} }
ret = enabled; ret = enabled;
irqrestore(flags); leave_critical_section(flags);
return ret; return ret;
} }
-4
View File
@@ -72,10 +72,6 @@
typedef void (*dram_entry_t)(void); typedef void (*dram_entry_t)(void);
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
+3 -3
View File
@@ -45,7 +45,7 @@
#include <debug.h> #include <debug.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/fs/automount.h> #include <nuttx/fs/automount.h>
@@ -218,7 +218,7 @@ static void sam_enable(FAR const struct automount_lower_s *lower, bool enable)
/* Save the fake enable setting */ /* Save the fake enable setting */
flags = irqsave(); flags = enter_critical_section();
state->enable = enable; state->enable = enable;
/* Did an interrupt occur while interrupts were disabled? */ /* Did an interrupt occur while interrupts were disabled? */
@@ -236,7 +236,7 @@ static void sam_enable(FAR const struct automount_lower_s *lower, bool enable)
state->pending = false; state->pending = false;
} }
irqrestore(flags); leave_critical_section(flags);
} }
/************************************************************************************ /************************************************************************************
+3 -3
View File
@@ -56,7 +56,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_pio.h" #include "sam_pio.h"
@@ -145,7 +145,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -170,7 +170,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
(void)irq_detach(IRQ_BTN_USER); (void)irq_detach(IRQ_BTN_USER);
} }
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+2 -2
View File
@@ -284,7 +284,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */ /* Get the old interrupt handler and save the new one */
@@ -321,7 +321,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
/* Return the old handler (so that it can be restored) */ /* Return the old handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
} }
#endif /* CONFIG_SAMA5_PIOE_IRQ */ #endif /* CONFIG_SAMA5_PIOE_IRQ */
+3 -3
View File
@@ -44,7 +44,7 @@
#include <string.h> #include <string.h>
#include <debug.h> #include <debug.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -92,13 +92,13 @@ void arch_getfpu(FAR uint32_t *fpusave)
/* Take a snapshot of the thread context right now */ /* Take a snapshot of the thread context right now */
flags = irqsave(); flags = enter_critical_section();
up_saveusercontext(g_saveregs); up_saveusercontext(g_saveregs);
/* Return only the floating register values */ /* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*FPU_CONTEXT_REGS)); memcpy(fpusave, &g_saveregs[REG_S0], (4*FPU_CONTEXT_REGS));
irqrestore(flags); leave_critical_section(flags);
} }
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function /* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d4-ek/src/sam_usb.c * configs/sama5d4-ek/src/sam_usb.c
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h> #include <nuttx/usb/usbdev_trace.h>
@@ -499,7 +500,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */ /* Get the old interrupt handler and save the new one */
@@ -514,7 +515,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
/* Return the old handler (so that it can be restored) */ /* Return the old handler (so that it can be restored) */
irqrestore(flags); leave_critical_section(flags);
return oldhandler; return oldhandler;
#else #else
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d4-ek/src/sam_wm8904.c * configs/sama5d4-ek/src/sam_wm8904.c
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
#include <nuttx/audio/i2s.h> #include <nuttx/audio/i2s.h>
#include <nuttx/audio/pcm.h> #include <nuttx/audio/pcm.h>
@@ -179,7 +180,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable)
/* Has the interrupt state changed */ /* Has the interrupt state changed */
flags = irqsave(); flags = enter_critical_section();
if (enable != enabled) if (enable != enabled)
{ {
/* Enable or disable interrupts */ /* Enable or disable interrupts */
@@ -199,7 +200,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable)
} }
ret = enabled; ret = enabled;
irqrestore(flags); leave_critical_section(flags);
return ret; return ret;
} }
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_port.h" #include "sam_port.h"
@@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -148,7 +148,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
sam_portirq(IRQ_SW0); sam_portirq(IRQ_SW0);
(void)irq_attach(IRQ_SW0, irqhandler); (void)irq_attach(IRQ_SW0, irqhandler);
sam_portirqenable(IRQ_SW0); sam_portirqenable(IRQ_SW0);
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "sam_port.h" #include "sam_port.h"
@@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic. * following operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -148,7 +148,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
sam_portirq(IRQ_SW0); sam_portirq(IRQ_SW0);
(void)irq_attach(IRQ_SW0, irqhandler); (void)irq_attach(IRQ_SW0, irqhandler);
sam_portirqenable(IRQ_SW0); sam_portirqenable(IRQ_SW0);
irqrestore(flags); leave_critical_section(flags);
} }
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */
+3 -3
View File
@@ -45,7 +45,7 @@
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <nuttx/irq.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
@@ -98,7 +98,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
* operations are atomic. * operations are atomic.
*/ */
flags = irqsave(); flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */ /* Get the old button interrupt handler and save the new one */
@@ -123,7 +123,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
sam_gpioirqdisable(irq); sam_gpioirqdisable(irq);
} }
irqrestore(flags); leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */ /* Return the old button handler (so that it can be restored) */

Some files were not shown because too many files have changed in this diff Show More