arch: Disable priority inheritance on all semaphores used for signaling in the rest of the MCU drivers

This commit is contained in:
Gregory Nutt
2016-11-03 17:38:26 -06:00
parent d8fecba333
commit 0a5b4f684a
10 changed files with 77 additions and 7 deletions
+6 -1
View File
@@ -36,6 +36,7 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <nuttx/semaphore.h>
#include <nuttx/irq.h>
#include <nuttx/fs/fs.h>
@@ -360,9 +361,13 @@ int calypso_kbd_irq(int irq, uint32_t * regs)
void up_keypad(void)
{
/* Semaphore; helps leaving IRQ ctx as soon as possible */
/* kbssem semaphore helps leaving IRQ ctx as soon as possible. This
* semaphore is used for signaling and, hence, should not have priority
* inheritance enabled.
*/
sem_init(&kbdsem, 0, 0);
sem_setprotocol(&kbdsem, SEM_PRIO_NONE);
/* Drive cols low in idle state such that all buttons cause events */
+13 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/sama5/sam_nand.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
@@ -58,6 +58,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/semaphore.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/mtd/mtd.h>
#include <nuttx/mtd/nand.h>
@@ -2944,7 +2945,12 @@ struct mtd_dev_s *sam_nand_initialize(int cs)
priv->cs = cs;
#ifdef CONFIG_SAMA5_NAND_DMA
/* The waitsem semaphore is used for signaling and, hence, should not have
* priority inheritance enabled.
*/
sem_init(&priv->waitsem, 0, 0);
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
#endif
/* Perform one-time, global NFC/PMECC initialization */
@@ -2956,8 +2962,14 @@ struct mtd_dev_s *sam_nand_initialize(int cs)
#if NAND_NBANKS > 1
sem_init(&g_nand.exclsem, 0, 1);
#endif
#ifdef CONFIG_SAMA5_NAND_HSMCINTERRUPTS
/* The waitsem semaphore is used for signaling and, hence, should not
* have priority inheritance enabled.
*/
sem_init(&g_nand.waitsem, 0, 0);
sem_setprotocol(&g_nand.waitsem, SEM_PRIO_NONE);
#endif
/* Enable the NAND FLASH Controller (The NFC is always used) */
+7 -1
View File
@@ -66,6 +66,7 @@
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
#include <nuttx/clock.h>
#include <nuttx/semaphore.h>
#include <nuttx/input/touchscreen.h>
#include <arch/board/board.h>
@@ -1669,7 +1670,12 @@ int sam_tsd_register(struct sam_adc_s *adc, int minor)
priv->threshx = INVALID_THRESHOLD; /* Initialize thresholding logic */
priv->threshy = INVALID_THRESHOLD; /* Initialize thresholding logic */
sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */
/* Initialize pen event wait semaphore. This semaphore is used for
* signaling and, hence, should not have priority inheritance enabled.
*/
sem_init(&priv->waitsem, 0, 0);
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
/* Register the device as an input device */
+7
View File
@@ -56,6 +56,7 @@
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/semaphore.h>
#include <nuttx/drivers/1wire.h>
#include <arch/board/board.h>
@@ -744,6 +745,12 @@ static inline void stm32_1wire_sem_init(FAR struct stm32_1wire_priv_s *priv)
{
sem_init(&priv->sem_excl, 0, 1);
sem_init(&priv->sem_isr, 0, 0);
/* The sem_isr semaphore is used for signaling and, hence, should not have
* priority inheritance enabled.
*/
sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE);
}
/****************************************************************************
+7 -2
View File
@@ -49,8 +49,9 @@
#include <semaphore.h>
#include <nuttx/irq.h>
#include <nuttx/video/fb.h>
#include <nuttx/kmalloc.h>
#include <nuttx/semaphore.h>
#include <nuttx/video/fb.h>
#include <arch/chip/dma2d.h>
#include <arch/board/board.h>
@@ -2167,9 +2168,13 @@ int up_dma2dinitialize(void)
sem_init(&g_lock, 0, 1);
/* Initialize the semaphore for interrupt handling */
/* Initialize the semaphore for interrupt handling. This waitsem
* semaphore is used for signaling and, hence, should not have
* priority inheritance enabled.
*/
sem_init(g_interrupt.sem, 0, 0);
sem_setprotocol(g_interrupt.sem, SEM_PRIO_NONE);
#ifdef CONFIG_STM32_DMA2D_L8
/* Enable dma2d transfer and clut loading interrupts only */
+7 -2
View File
@@ -49,8 +49,9 @@
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/video/fb.h>
#include <nuttx/kmalloc.h>
#include <nuttx/semaphore.h>
#include <nuttx/video/fb.h>
#include <arch/chip/ltdc.h>
#include <arch/chip/dma2d.h>
@@ -1287,9 +1288,13 @@ static void stm32_global_configure(void)
sem_init(&g_lock, 0, 1);
/* Initialize the semaphore for interrupt handling */
/* Initialize the semaphore for interrupt handling. This waitsem
* semaphore is used for signaling and, hence, should not have priority
* inheritance enabled.
*/
sem_init(g_interrupt.sem, 0, 0);
sem_setprotocol(g_interrupt.sem, SEM_PRIO_NONE);
/* Attach LTDC interrupt vector */
+6
View File
@@ -47,6 +47,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/semaphore.h>
#include <nuttx/spi/spi.h>
#include <nuttx/irq.h>
@@ -1635,7 +1636,12 @@ FAR struct spi_dev_s *tiva_ssibus_initialize(int port)
/* Initialize the state structure */
#ifndef CONFIG_SSI_POLLWAIT
/* The xfrsem semaphore is used for signaling and, hence, should not have
* priority inheritance enabled.
*/
sem_init(&priv->xfrsem, 0, 0);
sem_setprotocol(&priv->xfrsem, SEM_PRIO_NONE);
#endif
sem_init(&priv->exclsem, 0, 1);
+10
View File
@@ -56,6 +56,7 @@
#include <nuttx/board.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/semaphore.h>
#include <nuttx/fs/fs.h>
#include <nuttx/nx/nx.h>
@@ -657,9 +658,18 @@ int board_tsc_setup(int minor)
/* Initialize the touchscreen device driver instance */
memset(priv, 0, sizeof(struct up_dev_s));
/* Initialize semaphores */
sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */
sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */
/* The waitsem semaphore is used for signaling and, hence, should not have
* priority inheritance enabled.
*/
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
priv->minor = minor;
/* Register the device as an input device */
+7
View File
@@ -39,6 +39,8 @@
#include <semaphore.h>
#include <nuttx/sermaphore.h>
#include "up_internal.h"
/****************************************************************************
@@ -57,7 +59,12 @@ static sem_t g_uartavail;
void simuart_initialize(void)
{
/* The g_uartavail semaphore is used for signaling and, hence, should not
* have priority inheritance enabled.
*/
sem_init(&g_uartavail, 0, 0);
sem_setprotocol(&g_uartavail, SEM_PRIO_NONE);
}
/****************************************************************************
+7
View File
@@ -46,6 +46,7 @@
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include <nuttx/semaphore.h>
#include "sched/sched.h"
#include "xtensa.h"
@@ -259,7 +260,13 @@ int up_cpu_start(int cpu)
/* Start CPU1 */
sinfo("Starting CPU%d\n", cpu);
/* The waitsem semaphore is used for signaling and, hence, should not
* have priority inheritance enabled.
*/
sem_init(&g_appcpu_interlock, 0, 0);
sem_setprotocol(&g_appcpu_interlock, SEM_PRIO_NONE);
regval = getreg32(DPORT_APPCPU_CTRL_B_REG);
regval |= DPORT_APPCPU_CLKGATE_EN;