From 1699561bb62f51679cbee10ea1cbebcf8d3a4735 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 13 Feb 2016 12:37:46 -0600 Subject: [PATCH] Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section() --- configs/dk-tm4c129x/src/tm4c_buttons.c | 6 ++--- configs/ea3131/src/lpc31_usbhost.c | 7 +++--- configs/fire-stm32v2/src/stm32_selectlcd.c | 7 +++--- configs/freedom-kl25z/src/kl_adxl345.c | 6 ++--- .../launchxl-tms57004/src/tms570_buttons.c | 6 ++--- configs/lincoln60/src/lpc17_buttons.c | 4 +-- configs/lpc4330-xplorer/src/lpc43_buttons.c | 4 +-- configs/lpc4330-xplorer/src/lpc43_ostest.c | 6 ++--- configs/lpc4357-evb/src/lpc43_buttons.c | 4 +-- configs/lpc4357-evb/src/lpc43_ostest.c | 6 ++--- configs/lpc4370-link2/src/lpc43_ostest.c | 6 ++--- .../lpc4370-link2/src/lpc43_spifilib_init.c | 9 ++++--- configs/mikroe-stm32f4/src/stm32_idle.c | 6 ++--- .../mikroe-stm32f4/src/stm32_touchscreen.c | 7 +++--- configs/nucleo-f4x1re/src/stm32_ajoystick.c | 11 ++++---- .../src/efm32_buttons.c | 6 ++--- configs/olimex-lpc-h3131/src/lpc31_usbhost.c | 7 +++--- configs/olimex-lpc1766stk/src/lpc17_buttons.c | 4 +-- configs/olimex-lpc1766stk/src/lpc17_ssp.c | 4 +-- configs/olimex-strp711/src/str71_spi.c | 5 ++-- configs/open1788/src/lpc17_buttons.c | 4 +-- configs/pcduino-a10/src/a1x_buttons.c | 6 ++--- configs/sam3u-ek/src/sam_buttons.c | 6 ++--- configs/sam4e-ek/src/sam_buttons.c | 6 ++--- configs/sam4e-ek/src/sam_ethernet.c | 4 +-- configs/sam4l-xplained/src/sam_buttons.c | 6 ++--- configs/sam4s-xplained-pro/src/sam_buttons.c | 6 ++--- configs/sam4s-xplained/src/sam_buttons.c | 6 ++--- configs/sama5d2-xult/src/sam_buttons.c | 6 ++--- configs/sama5d3-xplained/src/sam_ajoystick.c | 11 ++++---- configs/sama5d3-xplained/src/sam_buttons.c | 6 ++--- configs/sama5d3-xplained/src/sam_ethernet.c | 4 +-- configs/sama5d3-xplained/src/sam_ostest.c | 6 ++--- configs/sama5d3-xplained/src/sam_usb.c | 7 +++--- configs/sama5d3x-ek/src/nor_main.c | 4 --- configs/sama5d3x-ek/src/sam_buttons.c | 6 ++--- configs/sama5d3x-ek/src/sam_ethernet.c | 4 +-- configs/sama5d3x-ek/src/sam_ostest.c | 6 ++--- configs/sama5d3x-ek/src/sam_usb.c | 7 +++--- configs/sama5d3x-ek/src/sam_wm8904.c | 5 ++-- configs/sama5d4-ek/src/dram_main.c | 4 --- configs/sama5d4-ek/src/sam_automount.c | 6 ++--- configs/sama5d4-ek/src/sam_buttons.c | 6 ++--- configs/sama5d4-ek/src/sam_ethernet.c | 4 +-- configs/sama5d4-ek/src/sam_ostest.c | 6 ++--- configs/sama5d4-ek/src/sam_usb.c | 7 +++--- configs/sama5d4-ek/src/sam_wm8904.c | 7 +++--- configs/samd20-xplained/src/sam_buttons.c | 6 ++--- configs/samd21-xplained/src/sam_buttons.c | 6 ++--- configs/same70-xplained/src/sam_buttons.c | 6 ++--- configs/same70-xplained/src/sam_ethernet.c | 4 +-- configs/saml21-xplained/src/sam_buttons.c | 6 ++--- configs/samv71-xult/src/sam_buttons.c | 6 ++--- configs/samv71-xult/src/sam_ethernet.c | 4 +-- configs/samv71-xult/src/sam_ili9488.c | 10 ++++---- configs/samv71-xult/src/sam_wm8904.c | 7 +++--- configs/stm3210e-eval/src/stm32_djoystick.c | 11 ++++---- configs/stm3220g-eval/src/stm32_stmpe811.c | 6 ++--- configs/stm3240g-eval/src/stm32_ostest.c | 6 ++--- configs/stm3240g-eval/src/stm32_stmpe811.c | 6 ++--- configs/stm32f429i-disco/src/stm32_idle.c | 6 ++--- .../stm32f429i-disco/src/stm32_ili93414ws.c | 21 +++++++++------- configs/stm32f429i-disco/src/stm32_ostest.c | 6 ++--- configs/stm32f4discovery/src/stm32_ethernet.c | 4 +-- configs/stm32f4discovery/src/stm32_idle.c | 6 ++--- .../stm32f4discovery/src/stm32_zerocross.c | 11 ++++---- configs/stm32f746g-disco/src/stm32_ostest.c | 6 ++--- .../src/stm32_touchscreen.c | 7 +++--- configs/vsn/src/leds.c | 25 +++++++++++-------- configs/vsn/src/power.c | 3 ++- configs/xtrs/src/xtr_irq.c | 20 --------------- configs/zkit-arm-1769/src/lpc17_buttons.c | 6 ++--- 72 files changed, 240 insertions(+), 242 deletions(-) diff --git a/configs/dk-tm4c129x/src/tm4c_buttons.c b/configs/dk-tm4c129x/src/tm4c_buttons.c index b91fd5ac2c..829891e7d5 100644 --- a/configs/dk-tm4c129x/src/tm4c_buttons.c +++ b/configs/dk-tm4c129x/src/tm4c_buttons.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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; diff --git a/configs/ea3131/src/lpc31_usbhost.c b/configs/ea3131/src/lpc31_usbhost.c index 5efa5dbcf8..4c7b500233 100644 --- a/configs/ea3131/src/lpc31_usbhost.c +++ b/configs/ea3131/src/lpc31_usbhost.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -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 */ diff --git a/configs/fire-stm32v2/src/stm32_selectlcd.c b/configs/fire-stm32v2/src/stm32_selectlcd.c index 809e2902f2..cf8336101a 100644 --- a/configs/fire-stm32v2/src/stm32_selectlcd.c +++ b/configs/fire-stm32v2/src/stm32_selectlcd.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include +#include #include #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 */ diff --git a/configs/freedom-kl25z/src/kl_adxl345.c b/configs/freedom-kl25z/src/kl_adxl345.c index 8e7d49ed55..0b68d7a832 100644 --- a/configs/freedom-kl25z/src/kl_adxl345.c +++ b/configs/freedom-kl25z/src/kl_adxl345.c @@ -47,7 +47,7 @@ #include #include -#include +#include #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) diff --git a/configs/launchxl-tms57004/src/tms570_buttons.c b/configs/launchxl-tms57004/src/tms570_buttons.c index 2ac5c091fc..2d2741280d 100644 --- a/configs/launchxl-tms57004/src/tms570_buttons.c +++ b/configs/launchxl-tms57004/src/tms570_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/lincoln60/src/lpc17_buttons.c b/configs/lincoln60/src/lpc17_buttons.c index f3367a0919..9018c2ea36 100644 --- a/configs/lincoln60/src/lpc17_buttons.c +++ b/configs/lincoln60/src/lpc17_buttons.c @@ -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; } diff --git a/configs/lpc4330-xplorer/src/lpc43_buttons.c b/configs/lpc4330-xplorer/src/lpc43_buttons.c index 7ee9cd893d..03d27d8489 100644 --- a/configs/lpc4330-xplorer/src/lpc43_buttons.c +++ b/configs/lpc4330-xplorer/src/lpc43_buttons.c @@ -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; } diff --git a/configs/lpc4330-xplorer/src/lpc43_ostest.c b/configs/lpc4330-xplorer/src/lpc43_ostest.c index 7509d88cb5..8bfee95428 100644 --- a/configs/lpc4330-xplorer/src/lpc43_ostest.c +++ b/configs/lpc4330-xplorer/src/lpc43_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/lpc4357-evb/src/lpc43_buttons.c b/configs/lpc4357-evb/src/lpc43_buttons.c index 3d0640fccd..df7f32aef6 100644 --- a/configs/lpc4357-evb/src/lpc43_buttons.c +++ b/configs/lpc4357-evb/src/lpc43_buttons.c @@ -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; diff --git a/configs/lpc4357-evb/src/lpc43_ostest.c b/configs/lpc4357-evb/src/lpc43_ostest.c index 9a9bc734b3..5ad0d477d8 100644 --- a/configs/lpc4357-evb/src/lpc43_ostest.c +++ b/configs/lpc4357-evb/src/lpc43_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/lpc4370-link2/src/lpc43_ostest.c b/configs/lpc4370-link2/src/lpc43_ostest.c index d016639f6a..c1ae98937a 100644 --- a/configs/lpc4370-link2/src/lpc43_ostest.c +++ b/configs/lpc4370-link2/src/lpc43_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/lpc4370-link2/src/lpc43_spifilib_init.c b/configs/lpc4370-link2/src/lpc43_spifilib_init.c index d99fd412e0..bf669f75e8 100644 --- a/configs/lpc4370-link2/src/lpc43_spifilib_init.c +++ b/configs/lpc4370-link2/src/lpc43_spifilib_init.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -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 */ diff --git a/configs/mikroe-stm32f4/src/stm32_idle.c b/configs/mikroe-stm32f4/src/stm32_idle.c index e219438779..9c2ea8ac23 100644 --- a/configs/mikroe-stm32f4/src/stm32_idle.c +++ b/configs/mikroe-stm32f4/src/stm32_idle.c @@ -49,7 +49,7 @@ #include #include -#include +#include #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 diff --git a/configs/mikroe-stm32f4/src/stm32_touchscreen.c b/configs/mikroe-stm32f4/src/stm32_touchscreen.c index 69e8101c20..b9bba5f57a 100644 --- a/configs/mikroe-stm32f4/src/stm32_touchscreen.c +++ b/configs/mikroe-stm32f4/src/stm32_touchscreen.c @@ -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 * * Modified: May, 2013 by Ken Pettit to adapt for Mikroe-STM32M4 board @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -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); } /************************************************************************************ diff --git a/configs/nucleo-f4x1re/src/stm32_ajoystick.c b/configs/nucleo-f4x1re/src/stm32_ajoystick.c index 75e5fb58bd..9d79e99cc7 100644 --- a/configs/nucleo-f4x1re/src/stm32_ajoystick.c +++ b/configs/nucleo-f4x1re/src/stm32_ajoystick.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -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 */ diff --git a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c index 542d1d6041..5545d5dac7 100644 --- a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c +++ b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c @@ -58,7 +58,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c index 7fda1ccfce..f333af6049 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c +++ b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -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 */ diff --git a/configs/olimex-lpc1766stk/src/lpc17_buttons.c b/configs/olimex-lpc1766stk/src/lpc17_buttons.c index 426d4fc474..b2f2d811ca 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_buttons.c +++ b/configs/olimex-lpc1766stk/src/lpc17_buttons.c @@ -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; } diff --git a/configs/olimex-lpc1766stk/src/lpc17_ssp.c b/configs/olimex-lpc1766stk/src/lpc17_ssp.c index 255fc6d8eb..14d426ed37 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_ssp.c +++ b/configs/olimex-lpc1766stk/src/lpc17_ssp.c @@ -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 diff --git a/configs/olimex-strp711/src/str71_spi.c b/configs/olimex-strp711/src/str71_spi.c index acd88ce4dc..f14df15033 100644 --- a/configs/olimex-strp711/src/str71_spi.c +++ b/configs/olimex-strp711/src/str71_spi.c @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -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; } diff --git a/configs/open1788/src/lpc17_buttons.c b/configs/open1788/src/lpc17_buttons.c index 7481334d8c..4509e2fe59 100644 --- a/configs/open1788/src/lpc17_buttons.c +++ b/configs/open1788/src/lpc17_buttons.c @@ -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); } } diff --git a/configs/pcduino-a10/src/a1x_buttons.c b/configs/pcduino-a10/src/a1x_buttons.c index 3fad67ff39..1802b3656d 100644 --- a/configs/pcduino-a10/src/a1x_buttons.c +++ b/configs/pcduino-a10/src/a1x_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sam3u-ek/src/sam_buttons.c b/configs/sam3u-ek/src/sam_buttons.c index f3c977dd3c..57d087792f 100644 --- a/configs/sam3u-ek/src/sam_buttons.c +++ b/configs/sam3u-ek/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sam4e-ek/src/sam_buttons.c b/configs/sam4e-ek/src/sam_buttons.c index 5211adef98..d665004728 100644 --- a/configs/sam4e-ek/src/sam_buttons.c +++ b/configs/sam4e-ek/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sam4e-ek/src/sam_ethernet.c b/configs/sam4e-ek/src/sam_ethernet.c index ea50d6296b..0e1199307d 100644 --- a/configs/sam4e-ek/src/sam_ethernet.c +++ b/configs/sam4e-ek/src/sam_ethernet.c @@ -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 */ diff --git a/configs/sam4l-xplained/src/sam_buttons.c b/configs/sam4l-xplained/src/sam_buttons.c index 083a358894..f57cf79eb5 100644 --- a/configs/sam4l-xplained/src/sam_buttons.c +++ b/configs/sam4l-xplained/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sam4s-xplained-pro/src/sam_buttons.c b/configs/sam4s-xplained-pro/src/sam_buttons.c index 7819113242..85d461217a 100644 --- a/configs/sam4s-xplained-pro/src/sam_buttons.c +++ b/configs/sam4s-xplained-pro/src/sam_buttons.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sam4s-xplained/src/sam_buttons.c b/configs/sam4s-xplained/src/sam_buttons.c index 56e523e19d..b48e88461b 100644 --- a/configs/sam4s-xplained/src/sam_buttons.c +++ b/configs/sam4s-xplained/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sama5d2-xult/src/sam_buttons.c b/configs/sama5d2-xult/src/sam_buttons.c index 04643d509f..2bdef205c0 100644 --- a/configs/sama5d2-xult/src/sam_buttons.c +++ b/configs/sama5d2-xult/src/sam_buttons.c @@ -56,7 +56,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sama5d3-xplained/src/sam_ajoystick.c b/configs/sama5d3-xplained/src/sam_ajoystick.c index f98c496f9b..20c24c424e 100644 --- a/configs/sama5d3-xplained/src/sam_ajoystick.c +++ b/configs/sama5d3-xplained/src/sam_ajoystick.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -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 */ diff --git a/configs/sama5d3-xplained/src/sam_buttons.c b/configs/sama5d3-xplained/src/sam_buttons.c index 0f4b728c73..50636737c4 100644 --- a/configs/sama5d3-xplained/src/sam_buttons.c +++ b/configs/sama5d3-xplained/src/sam_buttons.c @@ -60,7 +60,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sama5d3-xplained/src/sam_ethernet.c b/configs/sama5d3-xplained/src/sam_ethernet.c index 9a14e3d637..ed022800f1 100644 --- a/configs/sama5d3-xplained/src/sam_ethernet.c +++ b/configs/sama5d3-xplained/src/sam_ethernet.c @@ -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 */ diff --git a/configs/sama5d3-xplained/src/sam_ostest.c b/configs/sama5d3-xplained/src/sam_ostest.c index b61375dc0f..bce5794831 100644 --- a/configs/sama5d3-xplained/src/sam_ostest.c +++ b/configs/sama5d3-xplained/src/sam_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/sama5d3-xplained/src/sam_usb.c b/configs/sama5d3-xplained/src/sam_usb.c index fd4bf54b26..ac747277ff 100644 --- a/configs/sama5d3-xplained/src/sam_usb.c +++ b/configs/sama5d3-xplained/src/sam_usb.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -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 diff --git a/configs/sama5d3x-ek/src/nor_main.c b/configs/sama5d3x-ek/src/nor_main.c index be0e0274f9..08bd0afaf7 100644 --- a/configs/sama5d3x-ek/src/nor_main.c +++ b/configs/sama5d3x-ek/src/nor_main.c @@ -76,10 +76,6 @@ typedef void (*nor_entry_t)(void); -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/sama5d3x-ek/src/sam_buttons.c b/configs/sama5d3x-ek/src/sam_buttons.c index 393e1ca72a..0449c3a462 100644 --- a/configs/sama5d3x-ek/src/sam_buttons.c +++ b/configs/sama5d3x-ek/src/sam_buttons.c @@ -60,7 +60,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sama5d3x-ek/src/sam_ethernet.c b/configs/sama5d3x-ek/src/sam_ethernet.c index ccc5e2e28e..1ac9640c69 100644 --- a/configs/sama5d3x-ek/src/sam_ethernet.c +++ b/configs/sama5d3x-ek/src/sam_ethernet.c @@ -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 */ diff --git a/configs/sama5d3x-ek/src/sam_ostest.c b/configs/sama5d3x-ek/src/sam_ostest.c index 6c12d6eb0e..4e521e61ae 100644 --- a/configs/sama5d3x-ek/src/sam_ostest.c +++ b/configs/sama5d3x-ek/src/sam_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index f018d4f961..b9883e8561 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -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 diff --git a/configs/sama5d3x-ek/src/sam_wm8904.c b/configs/sama5d3x-ek/src/sam_wm8904.c index 8d70bdbed1..5639a5a402 100644 --- a/configs/sama5d3x-ek/src/sam_wm8904.c +++ b/configs/sama5d3x-ek/src/sam_wm8904.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -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; } diff --git a/configs/sama5d4-ek/src/dram_main.c b/configs/sama5d4-ek/src/dram_main.c index 54d83ae48f..666ddd4357 100644 --- a/configs/sama5d4-ek/src/dram_main.c +++ b/configs/sama5d4-ek/src/dram_main.c @@ -72,10 +72,6 @@ typedef void (*dram_entry_t)(void); -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/sama5d4-ek/src/sam_automount.c b/configs/sama5d4-ek/src/sam_automount.c index 71d06e177e..e4890687cb 100644 --- a/configs/sama5d4-ek/src/sam_automount.c +++ b/configs/sama5d4-ek/src/sam_automount.c @@ -45,7 +45,7 @@ #include -#include +#include #include #include @@ -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); } /************************************************************************************ diff --git a/configs/sama5d4-ek/src/sam_buttons.c b/configs/sama5d4-ek/src/sam_buttons.c index fdf20942fd..52fc7af11b 100644 --- a/configs/sama5d4-ek/src/sam_buttons.c +++ b/configs/sama5d4-ek/src/sam_buttons.c @@ -56,7 +56,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/sama5d4-ek/src/sam_ethernet.c b/configs/sama5d4-ek/src/sam_ethernet.c index c61082890b..48edbbe5f8 100644 --- a/configs/sama5d4-ek/src/sam_ethernet.c +++ b/configs/sama5d4-ek/src/sam_ethernet.c @@ -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 */ diff --git a/configs/sama5d4-ek/src/sam_ostest.c b/configs/sama5d4-ek/src/sam_ostest.c index 96bdb26dc7..712b10ae50 100644 --- a/configs/sama5d4-ek/src/sam_ostest.c +++ b/configs/sama5d4-ek/src/sam_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/sama5d4-ek/src/sam_usb.c b/configs/sama5d4-ek/src/sam_usb.c index 4ba85b84d8..c043e057a9 100644 --- a/configs/sama5d4-ek/src/sam_usb.c +++ b/configs/sama5d4-ek/src/sam_usb.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -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 diff --git a/configs/sama5d4-ek/src/sam_wm8904.c b/configs/sama5d4-ek/src/sam_wm8904.c index 5a12abdfcb..de0a2194d5 100644 --- a/configs/sama5d4-ek/src/sam_wm8904.c +++ b/configs/sama5d4-ek/src/sam_wm8904.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -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; } diff --git a/configs/samd20-xplained/src/sam_buttons.c b/configs/samd20-xplained/src/sam_buttons.c index 9b7fe3db2c..368014f2bc 100644 --- a/configs/samd20-xplained/src/sam_buttons.c +++ b/configs/samd20-xplained/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/samd21-xplained/src/sam_buttons.c b/configs/samd21-xplained/src/sam_buttons.c index c03f92e576..280475de6d 100644 --- a/configs/samd21-xplained/src/sam_buttons.c +++ b/configs/samd21-xplained/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/same70-xplained/src/sam_buttons.c b/configs/same70-xplained/src/sam_buttons.c index 040af796a5..d1154f70c8 100644 --- a/configs/same70-xplained/src/sam_buttons.c +++ b/configs/same70-xplained/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/same70-xplained/src/sam_ethernet.c b/configs/same70-xplained/src/sam_ethernet.c index e1ff523070..f435028837 100644 --- a/configs/same70-xplained/src/sam_ethernet.c +++ b/configs/same70-xplained/src/sam_ethernet.c @@ -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 */ diff --git a/configs/saml21-xplained/src/sam_buttons.c b/configs/saml21-xplained/src/sam_buttons.c index 43b9e2a836..ea8994df6a 100644 --- a/configs/saml21-xplained/src/sam_buttons.c +++ b/configs/saml21-xplained/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/samv71-xult/src/sam_buttons.c b/configs/samv71-xult/src/sam_buttons.c index c3a2501f8c..2a80362388 100644 --- a/configs/samv71-xult/src/sam_buttons.c +++ b/configs/samv71-xult/src/sam_buttons.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #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) */ diff --git a/configs/samv71-xult/src/sam_ethernet.c b/configs/samv71-xult/src/sam_ethernet.c index 2c2e2a48f8..e6d36ad4cf 100644 --- a/configs/samv71-xult/src/sam_ethernet.c +++ b/configs/samv71-xult/src/sam_ethernet.c @@ -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 */ diff --git a/configs/samv71-xult/src/sam_ili9488.c b/configs/samv71-xult/src/sam_ili9488.c index 294b2fdf88..61742b3fd6 100644 --- a/configs/samv71-xult/src/sam_ili9488.c +++ b/configs/samv71-xult/src/sam_ili9488.c @@ -136,7 +136,7 @@ #include #include -#include +#include #include #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; diff --git a/configs/samv71-xult/src/sam_wm8904.c b/configs/samv71-xult/src/sam_wm8904.c index 7679d8cb65..dff1f69519 100644 --- a/configs/samv71-xult/src/sam_wm8904.c +++ b/configs/samv71-xult/src/sam_wm8904.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -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; } diff --git a/configs/stm3210e-eval/src/stm32_djoystick.c b/configs/stm3210e-eval/src/stm32_djoystick.c index a5023f93bc..a8d9001f7e 100644 --- a/configs/stm3210e-eval/src/stm32_djoystick.c +++ b/configs/stm3210e-eval/src/stm32_djoystick.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -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 */ diff --git a/configs/stm3220g-eval/src/stm32_stmpe811.c b/configs/stm3220g-eval/src/stm32_stmpe811.c index 972d7d53f7..c3fcf6de4b 100644 --- a/configs/stm3220g-eval/src/stm32_stmpe811.c +++ b/configs/stm3220g-eval/src/stm32_stmpe811.c @@ -49,7 +49,7 @@ #include #include -#include +#include #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) diff --git a/configs/stm3240g-eval/src/stm32_ostest.c b/configs/stm3240g-eval/src/stm32_ostest.c index e5b1a5262a..45601e8ac7 100644 --- a/configs/stm3240g-eval/src/stm32_ostest.c +++ b/configs/stm3240g-eval/src/stm32_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/stm3240g-eval/src/stm32_stmpe811.c b/configs/stm3240g-eval/src/stm32_stmpe811.c index 3828f16bf4..30b06c1250 100644 --- a/configs/stm3240g-eval/src/stm32_stmpe811.c +++ b/configs/stm3240g-eval/src/stm32_stmpe811.c @@ -49,7 +49,7 @@ #include #include -#include +#include #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) diff --git a/configs/stm32f429i-disco/src/stm32_idle.c b/configs/stm32f429i-disco/src/stm32_idle.c index 7facee9f88..fbf5b8e212 100644 --- a/configs/stm32f429i-disco/src/stm32_idle.c +++ b/configs/stm32f429i-disco/src/stm32_idle.c @@ -49,7 +49,7 @@ #include #include -#include +#include #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 diff --git a/configs/stm32f429i-disco/src/stm32_ili93414ws.c b/configs/stm32f429i-disco/src/stm32_ili93414ws.c index 72a6245d3c..aea55ea8d6 100644 --- a/configs/stm32f429i-disco/src/stm32_ili93414ws.c +++ b/configs/stm32f429i-disco/src/stm32_ili93414ws.c @@ -46,14 +46,17 @@ ****************************************************************************/ #include -#include -#include + #include #include #include #include +#include +#include +#include #include + #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. */ diff --git a/configs/stm32f429i-disco/src/stm32_ostest.c b/configs/stm32f429i-disco/src/stm32_ostest.c index bebe521830..3237cb9393 100644 --- a/configs/stm32f429i-disco/src/stm32_ostest.c +++ b/configs/stm32f429i-disco/src/stm32_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/stm32f4discovery/src/stm32_ethernet.c b/configs/stm32f4discovery/src/stm32_ethernet.c index b1d420e041..1d0d97d48f 100644 --- a/configs/stm32f4discovery/src/stm32_ethernet.c +++ b/configs/stm32f4discovery/src/stm32_ethernet.c @@ -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 diff --git a/configs/stm32f4discovery/src/stm32_idle.c b/configs/stm32f4discovery/src/stm32_idle.c index b815538fae..7c4e18b641 100644 --- a/configs/stm32f4discovery/src/stm32_idle.c +++ b/configs/stm32f4discovery/src/stm32_idle.c @@ -49,7 +49,7 @@ #include #include -#include +#include #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 diff --git a/configs/stm32f4discovery/src/stm32_zerocross.c b/configs/stm32f4discovery/src/stm32_zerocross.c index 1ed5d6877d..2315476448 100644 --- a/configs/stm32f4discovery/src/stm32_zerocross.c +++ b/configs/stm32f4discovery/src/stm32_zerocross.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -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 */ diff --git a/configs/stm32f746g-disco/src/stm32_ostest.c b/configs/stm32f746g-disco/src/stm32_ostest.c index 7c26785d96..793e48f4dd 100644 --- a/configs/stm32f746g-disco/src/stm32_ostest.c +++ b/configs/stm32f746g-disco/src/stm32_ostest.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #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 diff --git a/configs/viewtool-stm32f107/src/stm32_touchscreen.c b/configs/viewtool-stm32f107/src/stm32_touchscreen.c index 9475d2f6c3..7106fcdc96 100644 --- a/configs/viewtool-stm32f107/src/stm32_touchscreen.c +++ b/configs/viewtool-stm32f107/src/stm32_touchscreen.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -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) diff --git a/configs/vsn/src/leds.c b/configs/vsn/src/leds.c index 0d81e4e032..7fbd4bf8bd 100644 --- a/configs/vsn/src/leds.c +++ b/configs/vsn/src/leds.c @@ -35,21 +35,26 @@ * ****************************************************************************/ +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include -#include -#include - -#ifdef CONFIG_ARCH_LEDS - -#include - #include #include #include +#include +#include +#include + +#include + #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); } } diff --git a/configs/vsn/src/power.c b/configs/vsn/src/power.c index acbfebb053..77800b65f6 100644 --- a/configs/vsn/src/power.c +++ b/configs/vsn/src/power.c @@ -47,6 +47,7 @@ #include +#include #include #include @@ -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 */ diff --git a/configs/xtrs/src/xtr_irq.c b/configs/xtrs/src/xtr_irq.c index 750c3046be..c98620501a 100644 --- a/configs/xtrs/src/xtr_irq.c +++ b/configs/xtrs/src/xtr_irq.c @@ -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 ****************************************************************************/ diff --git a/configs/zkit-arm-1769/src/lpc17_buttons.c b/configs/zkit-arm-1769/src/lpc17_buttons.c index 6a8f0240f5..d33219c98d 100644 --- a/configs/zkit-arm-1769/src/lpc17_buttons.c +++ b/configs/zkit-arm-1769/src/lpc17_buttons.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #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;