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

View File

@ -44,7 +44,7 @@
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "dk-tm4c129x.h"
@ -163,7 +163,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
/* The following should be atomic */
flags = irqsave();
flags = enter_critical_section();
/* 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;

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h>
@ -307,7 +308,7 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* 0 */

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -43,6 +43,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "chip.h"
@ -177,7 +178,7 @@ void stm32_selectlcd(void)
/* Configure LCD GPIO pis */
flags = irqsave();
flags = enter_critical_section();
for (i = 0; i < NLCD_GPIOS; i++)
{
stm32_configgpio(g_lcdconfig[i]);
@ -201,7 +202,7 @@ void stm32_selectlcd(void)
/* Enable the bank by setting the MBKEN bit */
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 */

View File

@ -47,7 +47,7 @@
#include <nuttx/spi/spi.h>
#include <nuttx/sensors/adxl345.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "freedom-kl25z.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.
*/
flags = irqsave();
flags = enter_critical_section();
if (enable)
{
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
static void adxl345_clear(FAR struct adxl345_config_s *state)

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "up_arch.h"
@ -94,7 +94,7 @@ static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq,
* operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */

View File

@ -196,7 +196,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */
flags = irqsave();
flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new
* 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);
(void)irq_detach(irq);
}
irqrestore(flags);
leave_critical_section(flags);
}
return oldhandler;
}

View File

@ -195,7 +195,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */
flags = irqsave();
flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new
* 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);
(void)irq_detach(irq);
}
irqrestore(flags);
leave_critical_section(flags);
}
return oldhandler;
}

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -202,7 +202,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */
flags = irqsave();
flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new
* 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);
(void)irq_detach(irq);
}
irqrestore(flags);
leave_critical_section(flags);
}
return oldhandler;

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -43,6 +43,7 @@
#include <stdbool.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
@ -73,10 +74,10 @@ static uint32_t lmem[21];
void board_spifi_initialize(void)
{
irqstate_t flags = irqsave();
irqstate_t flags = enter_critical_section();
uint32_t regval;
flags = irqsave();
flags = enter_critical_section();
/* 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);
putreg32(regval, LPC43_IDIVE_CTRL);
irqrestore(flags);
leave_critical_section(flags);
}
#endif /* CONFIG_SPIFI_LIBRARY */

View File

@ -49,7 +49,7 @@
#include <nuttx/clock.h>
#include <nuttx/power/pm.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "up_internal.h"
#include "stm32_pm.h"
@ -125,7 +125,7 @@ static void up_idlepm(void)
{
lldbg("newstate= %d oldstate=%d\n", newstate, oldstate);
flags = irqsave();
flags = enter_critical_section();
/* Force the global state change */
@ -214,7 +214,7 @@ static void up_idlepm(void)
oldstate = newstate;
errout:
irqrestore(flags);
leave_critical_section(flags);
}
}
#else

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Modified: May, 2013 by Ken Pettit to adapt for Mikroe-STM32M4 board
@ -50,6 +50,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/board.h>
#include <nuttx/clock.h>
#include <nuttx/wqueue.h>
@ -351,7 +352,7 @@ static void tc_adc_init(void)
* is used by several different drivers.
*/
flags = irqsave();
flags = enter_critical_section();
/* Enable ADC reset state */
@ -459,7 +460,7 @@ static void tc_adc_init(void)
/* Restore the IRQ state */
irqrestore(flags);
leave_critical_section(flags);
}
/************************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -44,6 +44,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.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 */
flags = irqsave();
flags = enter_critical_section();
ajoy_disable();
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 */
flags = irqsave();
flags = enter_critical_section();
for (i = 0; i < AJOY_NGPIOS; i++)
{
(void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL);
}
irqrestore(flags);
leave_critical_section(flags);
/* Nullify the handler and argument */

View File

@ -58,7 +58,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "efm32_gpio.h"
@ -180,7 +180,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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]);
}
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h>
@ -308,7 +309,7 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* 0 */

View File

@ -199,7 +199,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Disable interrupts until we are done */
flags = irqsave();
flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new
* 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);
(void)irq_detach(irq);
}
irqrestore(flags);
leave_critical_section(flags);
}
return oldhandler;
}

View File

@ -151,7 +151,7 @@ static void ssp_cdirqsetup(int irq, xcpt_t irqhandler)
/* Disable interrupts until we are done */
flags = irqsave();
flags = enter_critical_section();
/* Configure the interrupt. Either attach and enable the new
* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
#endif

View File

@ -47,6 +47,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/spi/spi.h>
@ -961,7 +962,7 @@ FAR struct spi_dev_s *str71_spibus_initialize(int port)
#endif
irqstate_t flags;
flags = irqsave();
flags = enter_critical_section();
#ifdef CONFIG_STR71X_BSPI0
if (port == 0)
{
@ -1139,7 +1140,7 @@ FAR struct spi_dev_s *str71_spibus_initialize(int port)
ret = NULL;
}
irqrestore(flags);
leave_critical_section(flags);
return ret;
}

View File

@ -219,7 +219,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
/* Disable interrupts until we are done */
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
}

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "pcduino_a10.h"
@ -132,7 +132,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
(void)irq_attach(xxx, irqhandler);
a1x_pioirqenable(xxx);
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_gpio.h"
@ -89,7 +89,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
* operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_gpio.h"
@ -91,7 +91,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
* operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */

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.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* CONFIG_SAM34_GPIOD_IRQ */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_gpio.h"
@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -46,7 +46,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_gpio.h"
@ -135,7 +135,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_gpio.h"
@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -56,7 +56,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_pio.h"
@ -145,7 +145,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -44,6 +44,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.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 */
flags = irqsave();
flags = enter_critical_section();
ajoy_disable();
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 */
flags = irqsave();
flags = enter_critical_section();
for (i = 0; i < AJOY_NGPIOS; i++)
{
sam_pioirqdisable(g_joyirq[i]);
}
irqrestore(flags);
leave_critical_section(flags);
/* Nullify the handler and argument */

View File

@ -60,7 +60,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_pio.h"
@ -149,7 +149,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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 */
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

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.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* CONFIG_SAMA5_PIOE_IRQ */

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h>
@ -506,7 +507,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
#else

View File

@ -76,10 +76,6 @@
typedef void (*nor_entry_t)(void);
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -60,7 +60,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_pio.h"
@ -149,7 +149,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

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.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* CONFIG_SAMA5_PIOE_IRQ */

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h>
@ -498,7 +499,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
#else

View File

@ -45,6 +45,7 @@
#include <assert.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/audio/i2s.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 */
flags = irqsave();
flags = enter_critical_section();
if (enable != enabled)
{
/* Enable or disable interrupts */
@ -199,7 +200,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable)
}
ret = enabled;
irqrestore(flags);
leave_critical_section(flags);
return ret;
}

View File

@ -72,10 +72,6 @@
typedef void (*dram_entry_t)(void);
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -45,7 +45,7 @@
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <nuttx/clock.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 */
flags = irqsave();
flags = enter_critical_section();
state->enable = enable;
/* 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;
}
irqrestore(flags);
leave_critical_section(flags);
}
/************************************************************************************

View File

@ -56,7 +56,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_pio.h"
@ -145,7 +145,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

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.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* CONFIG_SAMA5_PIOE_IRQ */

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbhost.h>
#include <nuttx/usb/usbdev_trace.h>
@ -499,7 +500,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
#else

View File

@ -1,7 +1,7 @@
/************************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -45,6 +45,7 @@
#include <assert.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/audio/i2s.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 */
flags = irqsave();
flags = enter_critical_section();
if (enable != enabled)
{
/* Enable or disable interrupts */
@ -199,7 +200,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable)
}
ret = enabled;
irqrestore(flags);
leave_critical_section(flags);
return ret;
}

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_port.h"
@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_portirqenable(IRQ_SW0);
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_port.h"
@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_portirqenable(IRQ_SW0);
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "up_arch.h"
@ -98,7 +98,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
* operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
}
irqrestore(flags);
leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */

View File

@ -330,7 +330,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */
@ -367,7 +367,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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* CONFIG_SAMV7_GPIOA_IRQ */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "sam_port.h"
@ -136,7 +136,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* 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);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_portirqenable(IRQ_SW0);
irqrestore(flags);
leave_critical_section(flags);
}
/* Return the old button handler (so that it can be restored) */

View File

@ -45,7 +45,7 @@
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "up_arch.h"
@ -101,7 +101,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
* operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* Get the old button interrupt handler and save the new one */
@ -126,7 +126,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
sam_gpioirqdisable(irq);
}
irqrestore(flags);
leave_critical_section(flags);
/* Return the old button handler (so that it can be restored) */

View File

@ -334,7 +334,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
* following operations are atomic.
*/
flags = irqsave();
flags = enter_critical_section();
/* Get the old interrupt handler and save the new one */
@ -371,7 +371,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) */
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif /* CONFIG_SAMV7_GPIOA_IRQ */

View File

@ -136,7 +136,7 @@
#include <nuttx/lcd/ili9488.h>
#include <nuttx/video/rgbcolors.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "cache.h"
@ -1070,7 +1070,7 @@ static int sam_lcd_txtransfer(FAR struct sam_dev_s *priv,
ret = sam_dmatxsetup(priv->dmach, (uint32_t)SAM_LCD_BASE, (uint32_t)buffer, buflen);
if (ret == OK)
{
flags = irqsave();
flags = enter_critical_section();
/* The setup was successful, start the DMA */
@ -1082,7 +1082,7 @@ static int sam_lcd_txtransfer(FAR struct sam_dev_s *priv,
ret = sam_lcd_dmawait(priv, DMA_TIMEOUT_TICKS);
}
irqrestore(flags);
leave_critical_section(flags);
}
priv->dmabusy = false;
@ -1111,7 +1111,7 @@ static int sam_lcd_rxtransfer(FAR struct sam_dev_s *priv,
ret = sam_dmarxsetup(priv->dmach, (uint32_t)SAM_LCD_BASE, (uint32_t)buffer, buflen);
if (ret == OK)
{
flags = irqsave();
flags = enter_critical_section();
/* The setup was successful, start the DMA */
@ -1123,7 +1123,7 @@ static int sam_lcd_rxtransfer(FAR struct sam_dev_s *priv,
ret = sam_lcd_dmawait(priv, DMA_TIMEOUT_TICKS);
}
irqrestore(flags);
leave_critical_section(flags);
}
priv->dmabusy = false;

View File

@ -1,7 +1,7 @@
/************************************************************************************
* configs/samv71-xult/src/sam_wm8904.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -45,6 +45,7 @@
#include <assert.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/audio/i2s.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 */
flags = irqsave();
flags = enter_critical_section();
if (enable != enabled)
{
/* Enable or disable interrupts */
@ -199,7 +200,7 @@ static bool wm8904_enable(FAR const struct wm8904_lower_s *lower, bool enable)
}
ret = enabled;
irqrestore(flags);
leave_critical_section(flags);
return ret;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/stm3210e-eval/src/stm32_djoystick.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -42,6 +42,7 @@
#include <stdint.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/input/djoystick.h>
@ -173,7 +174,7 @@ static void djoy_enable(FAR const struct djoy_lowerhalf_s *lower,
/* Start with all interrupts disabled */
flags = irqsave();
flags = enter_critical_section();
djoy_disable();
illvdbg("press: %02x release: %02x handler: %p arg: %p\n",
@ -217,7 +218,7 @@ static void djoy_enable(FAR const struct djoy_lowerhalf_s *lower,
}
}
irqrestore(flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -235,13 +236,13 @@ static void djoy_disable(void)
/* Disable each joystick interrupt */
flags = irqsave();
flags = enter_critical_section();
for (i = 0; i < DJOY_NGPIOS; i++)
{
(void)stm32_gpiosetevent(g_joygpio[i], false, false, false, NULL);
}
irqrestore(flags);
leave_critical_section(flags);
/* Nullify the handler and argument */

View File

@ -49,7 +49,7 @@
#include <nuttx/input/touchscreen.h>
#include <nuttx/input/stmpe811.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "stm32.h"
#include "stm3220g-eval.h"
@ -230,7 +230,7 @@ static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable)
* interrupts disabled during the reconfiguration.
*/
flags = irqsave();
flags = enter_critical_section();
if (enable)
{
/* Configure the EXTI interrupt using the SAVED handler */
@ -243,7 +243,7 @@ static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable)
(void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, NULL);
}
irqrestore(flags);
leave_critical_section(flags);
}
static void stmpe811_clear(FAR struct stmpe811_config_s *state)

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -49,7 +49,7 @@
#include <nuttx/input/touchscreen.h>
#include <nuttx/input/stmpe811.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "stm32.h"
#include "stm3240g-eval.h"
@ -230,7 +230,7 @@ static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable)
* interrupts disabled during the reconfiguration.
*/
flags = irqsave();
flags = enter_critical_section();
if (enable)
{
/* Configure the EXTI interrupt using the SAVED handler */
@ -243,7 +243,7 @@ static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable)
(void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, NULL);
}
irqrestore(flags);
leave_critical_section(flags);
}
static void stmpe811_clear(FAR struct stmpe811_config_s *state)

View File

@ -49,7 +49,7 @@
#include <nuttx/clock.h>
#include <nuttx/power/pm.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "up_internal.h"
#include "stm32_pm.h"
@ -125,7 +125,7 @@ static void stm32_idlepm(void)
{
lldbg("newstate= %d oldstate=%d\n", newstate, oldstate);
flags = irqsave();
flags = enter_critical_section();
/* Force the global state change */
@ -214,7 +214,7 @@ static void stm32_idlepm(void)
oldstate = newstate;
errout:
irqrestore(flags);
leave_critical_section(flags);
}
}
#else

View File

@ -46,14 +46,17 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <nuttx/spi/spi.h>
#include <sys/types.h>
#include <stdbool.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "stm32f429i-disco.h"
/****************************************************************************
@ -527,11 +530,11 @@ static uint16_t stm32_ili93414ws_recvword(void)
* enough to stop transmitting by disabling the spi device. So pixels lost but
* not recognized by the driver. This results in a big lock because the driver
* wants to receive missing pixel data.
* The irqsave section here ensures that the spi device is disabled fast
* The critical section here ensures that the spi device is disabled fast
* enough during a pixel is transmitted.
*/
flags = irqsave();
flags = enter_critical_section();
/* Backup the content of the current cr1 register only 1 times */
@ -559,7 +562,7 @@ static uint16_t stm32_ili93414ws_recvword(void)
/* The spi device is in disabled state so it is safe to enable interrupts */
irqrestore(flags);
leave_critical_section(flags);
/*
* Waits until the RX buffer is filled with the received data word signalized
@ -803,7 +806,7 @@ static void stm32_ili93414ws_spiconfig(FAR struct ili9341_lcd_s *lcd)
uint16_t setbitscr2 = 0;
flags = irqsave();
flags = enter_critical_section();
/* Disable spi */
@ -834,7 +837,7 @@ static void stm32_ili93414ws_spiconfig(FAR struct ili9341_lcd_s *lcd)
stm32_ili93414ws_modifycr2(setbitscr2, clrbitscr2);
irqrestore(flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -954,7 +957,7 @@ static void stm32_ili93414ws_deselect(FAR struct ili9341_lcd_s *lcd)
irqstate_t flags;
FAR struct ili93414ws_lcd_s *priv = (FAR struct ili93414ws_lcd_s *)lcd;
flags = irqsave();
flags = enter_critical_section();
/*
* Restore cr1 and cr2 register to be sure they will be usable
@ -973,7 +976,7 @@ static void stm32_ili93414ws_deselect(FAR struct ili9341_lcd_s *lcd)
stm32_ili93414ws_spienable();
irqrestore(flags);
leave_critical_section(flags);
/* de-select ili9341 and relinquish the spi bus. */

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -222,7 +222,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
DEBUGASSERT(intf);
flags = irqsave();
flags = enter_critical_section();
oldhandler = g_ethmac_handler;
if (strcmp(intf, STM32_ETHMAC_DEVNAME) == 0)
@ -242,7 +242,7 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler, phy_enable_t *enable)
*enable = enabler;
}
irqrestore(flags);
leave_critical_section(flags);
return oldhandler;
}
#endif

View File

@ -49,7 +49,7 @@
#include <nuttx/clock.h>
#include <nuttx/power/pm.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "up_internal.h"
#include "stm32_pm.h"
@ -122,7 +122,7 @@ static void stm32_idlepm(void)
{
lldbg("newstate= %d oldstate=%d\n", newstate, oldstate);
flags = irqsave();
flags = enter_critical_section();
/* Force the global state change */
@ -211,7 +211,7 @@ static void stm32_idlepm(void)
oldstate = newstate;
errout:
irqrestore(flags);
leave_critical_section(flags);
}
}
#else

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/stm32f4discovery/src/stm32_zerocross.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -42,6 +42,7 @@
#include <stdint.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/sensors/zerocross.h>
@ -107,7 +108,7 @@ static void zcross_enable(FAR const struct zc_lowerhalf_s *lower,
/* Start with all interrupts disabled */
flags = irqsave();
flags = enter_critical_section();
zcross_disable();
snllvdbg("handler: %p arg: %p\n", handler, arg);
@ -121,7 +122,7 @@ static void zcross_enable(FAR const struct zc_lowerhalf_s *lower,
(void)stm32_gpiosetevent(GPIO_ZEROCROSS, rising, falling,
true, zcross_interrupt);
irqrestore(flags);
leave_critical_section(flags);
}
/****************************************************************************
@ -139,11 +140,11 @@ static void zcross_disable(void)
/* Disable zero cross pin interrupt */
flags = irqsave();
flags = enter_critical_section();
(void)stm32_gpiosetevent(GPIO_ZEROCROSS, false, false, false, NULL);
irqrestore(flags);
leave_critical_section(flags);
/* Nullify the handler and argument */

View File

@ -44,7 +44,7 @@
#include <string.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.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 */
flags = irqsave();
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
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

View File

@ -1,7 +1,7 @@
/************************************************************************************
* configs/viewtools-stm32f107/src/stm32_touchscreen.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -45,6 +45,7 @@
#include <assert.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h>
@ -195,7 +196,7 @@ static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable)
* interrupts disabled during the reconfiguration.
*/
flags = irqsave();
flags = enter_critical_section();
if (enable && priv->handler)
{
/* Configure the EXTI interrupt using the SAVED handler */
@ -209,7 +210,7 @@ static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable)
(void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, false, false, false, NULL);
}
irqrestore(flags);
leave_critical_section(flags);
}
static void tsc_clear(FAR struct ads7843e_config_s *state)

View File

@ -35,21 +35,26 @@
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#ifdef CONFIG_ARCH_LEDS
#include <arch/stm32/irq.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include <arch/stm32/irq.h>
#include "vsn.h"
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -70,7 +75,7 @@
* Private Data
****************************************************************************/
irqstate_t irqidle_mask;
irqstate_t flags;
/****************************************************************************
* Private Functions
@ -89,7 +94,7 @@ void board_autoled_on(int led)
{
if (led == LED_IDLE)
{
irqidle_mask = irqsave();
flags = enter_critical_section();
stm32_gpiowrite(GPIO_LED, true);
}
}
@ -99,7 +104,7 @@ void board_autoled_off(int led)
if (led == LED_IDLE)
{
stm32_gpiowrite(GPIO_LED, false);
irqrestore(irqidle_mask);
leave_critical_section(flags);
}
}

View File

@ -47,6 +47,7 @@
#include <nuttx/board.h>
#include <arch/irq.h>
#include <arch/board/board.h>
#include <arch/stm32/irq.h>
@ -102,7 +103,7 @@ int board_power_off(int status)
/* stop background processes */
irqsave();
(void)irqsave();
/* switch to internal HSI and get the PD0 and PD1 as GPIO */

View File

@ -44,26 +44,6 @@
#include "up_arch.h"
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_irqinitialize
****************************************************************************/

View File

@ -50,7 +50,7 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "up_arch.h"
@ -172,7 +172,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
/* Return the previous value of the interrupt handler */
flags = irqsave();
flags = enter_critical_section();
rethandler = g_oldhandler;
g_oldhandler = irqhandler;
@ -205,7 +205,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
}
irqrestore(flags);
leave_critical_section(flags);
}
return rethandler;