mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
drivers: Disable priority inheritance on all semaphores used for signaling
This commit is contained in:
parent
bdde5720ca
commit
4fcbe8e410
20 changed files with 184 additions and 19 deletions
|
@ -58,6 +58,7 @@
|
|||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/analog/adc.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
@ -441,9 +442,17 @@ int adc_register(FAR const char *path, FAR struct adc_dev_s *dev)
|
|||
|
||||
dev->ad_ocount = 0;
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&dev->ad_recv.af_sem, 0, 0);
|
||||
sem_init(&dev->ad_closesem, 0, 1);
|
||||
|
||||
/* The receive semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&dev->ad_recv.af_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Reset the ADC hardware */
|
||||
|
||||
DEBUGASSERT(dev->ad_ops->ao_reset != NULL);
|
||||
|
|
|
@ -55,8 +55,9 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/analog/dac.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
@ -515,9 +516,17 @@ int dac_register(FAR const char *path, FAR struct dac_dev_s *dev)
|
|||
|
||||
dev->ad_ocount = 0;
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&dev->ad_xmit.af_sem, 0, 0);
|
||||
sem_init(&dev->ad_closesem, 0, 1);
|
||||
|
||||
/* The transmit semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&dev->ad_xmit.af_sem, SEM_PRIO_NONE);
|
||||
|
||||
dev->ad_ops->ao_reset(dev);
|
||||
|
||||
return register_driver(path, &dac_fops, 0555, dev);
|
||||
|
|
|
@ -54,8 +54,9 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/can.h>
|
||||
|
||||
#ifdef CONFIG_CAN_TXREADY
|
||||
|
@ -1166,6 +1167,8 @@ int can_register(FAR const char *path, FAR struct can_dev_s *dev)
|
|||
dev->cd_error = 0;
|
||||
#endif
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&dev->cd_xmit.tx_sem, 0, 1);
|
||||
sem_init(&dev->cd_recv.rx_sem, 0, 1);
|
||||
sem_init(&dev->cd_closesem, 0, 1);
|
||||
|
@ -1175,7 +1178,12 @@ int can_register(FAR const char *path, FAR struct can_dev_s *dev)
|
|||
|
||||
for (i = 0; i < CONFIG_CAN_NPENDINGRTR; i++)
|
||||
{
|
||||
/* Initialize wait semahores. These semaphores are used for signaling
|
||||
* and should not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&dev->cd_rtr[i].cr_sem, 0, 0);
|
||||
sem_setprotocol(&dev->cd_rtr[i].cr_sem, SEM_PRIO_NONE);
|
||||
dev->cd_rtr[i].cr_msg = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
#include <nuttx/input/ads7843e.h>
|
||||
|
||||
|
@ -1184,9 +1185,17 @@ int ads7843e_register(FAR struct spi_dev_s *spi,
|
|||
priv->threshx = INVALID_THRESHOLD; /* Initialize thresholding logic */
|
||||
priv->threshy = INVALID_THRESHOLD; /* Initialize thresholding logic */
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */
|
||||
sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */
|
||||
|
||||
/* The pen event semaphore is used for signaling and, hence, should not
|
||||
* have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
|
||||
config->clear(config);
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
#include <nuttx/input/max11802.h>
|
||||
|
||||
|
@ -1187,9 +1188,17 @@ int max11802_register(FAR struct spi_dev_s *spi,
|
|||
priv->threshx = INVALID_THRESHOLD; /* Initialize thresholding logic */
|
||||
priv->threshy = INVALID_THRESHOLD; /* Initialize thresholding logic */
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */
|
||||
sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */
|
||||
|
||||
/* The pen event semaphore is used for signaling and, hence, should not
|
||||
* have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
|
||||
config->clear(config);
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
#include <nuttx/input/mxt.h>
|
||||
|
||||
|
@ -1884,9 +1885,17 @@ int mxt_register(FAR struct i2c_master_s *i2c,
|
|||
priv->i2c = i2c; /* Save the SPI device handle */
|
||||
priv->lower = lower; /* Save the board configuration */
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&priv->devsem, 0, 1); /* Initialize device semaphore */
|
||||
sem_init(&priv->waitsem, 0, 0); /* Initialize event wait semaphore */
|
||||
|
||||
/* The event wait semaphore is used for signaling and, hence, should not
|
||||
* have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
|
||||
MXT_CLEAR(lower);
|
||||
|
|
|
@ -55,8 +55,9 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
#include <nuttx/net/slip.h>
|
||||
|
@ -965,6 +966,7 @@ int slip_initialize(int intf, FAR const char *devname)
|
|||
/* Initialize the wait semaphore */
|
||||
|
||||
sem_init(&priv->waitsem, 0, 0);
|
||||
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Put the interface in the down state. This usually amounts to resetting
|
||||
* the device and/or calling slip_ifdown().
|
||||
|
|
|
@ -884,11 +884,17 @@ static int tun_dev_init(FAR struct tun_device_s *priv, FAR struct file *filep,
|
|||
#endif
|
||||
priv->dev.d_private = (FAR void *)priv; /* Used to recover private state from dev */
|
||||
|
||||
/* Initialize the wait semaphore */
|
||||
/* Initialize the mutual exlcusion and wait semaphore */
|
||||
|
||||
sem_init(&priv->waitsem, 0, 1);
|
||||
sem_init(&priv->read_wait_sem, 0, 0);
|
||||
|
||||
/* The wait semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->read_wait_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||
|
||||
priv->txpoll = wd_create(); /* Create periodic poll timer */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* drivers/pipes/pipe_common.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -53,12 +53,13 @@
|
|||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#ifdef CONFIG_DEBUG_FEATURES
|
||||
# include <nuttx/arch.h>
|
||||
#endif
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
#include "pipe_common.h"
|
||||
|
||||
|
@ -172,6 +173,13 @@ FAR struct pipe_dev_s *pipecommon_allocdev(size_t bufsize)
|
|||
sem_init(&dev->d_rdsem, 0, 0);
|
||||
sem_init(&dev->d_wrsem, 0, 0);
|
||||
|
||||
/* The read/write wait semaphores are used for signaling and, hence,
|
||||
* should not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&dev->d_rdsem, SEM_PRIO_NONE);
|
||||
sem_setprotocol(&dev->d_wrsem, SEM_PRIO_NONE);
|
||||
|
||||
dev->d_bufsize = bufsize;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* drivers/pwm.c
|
||||
*
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -55,9 +55,10 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/pwm.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
@ -601,7 +602,14 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev)
|
|||
sem_init(&upper->exclsem, 0, 1);
|
||||
#ifdef CONFIG_PWM_PULSECOUNT
|
||||
sem_init(&upper->waitsem, 0, 0);
|
||||
|
||||
/* The wait semaphore is used for signaling and, hence, should not have priority
|
||||
* inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&upper->waitsem, SEM_PRIO_NONE);
|
||||
#endif
|
||||
|
||||
upper->dev = dev;
|
||||
|
||||
/* Register the PWM device */
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "uart.h"
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/sercomm/sercomm.h>
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -187,6 +188,9 @@ int sercomm_register(FAR const char *path, FAR uart_dev_t *dev)
|
|||
sem_init(&dev->pollsem, 0, 1);
|
||||
#endif
|
||||
|
||||
sem_setprotocol(&dev->xmitsem, SEM_PRIO_NONE);
|
||||
sem_setprotocol(&dev->recvsem, SEM_PRIO_NONE);
|
||||
|
||||
_info("Registering %s\n", path);
|
||||
return register_driver(path, &g_sercom_console_ops, 0666, NULL);
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/drivers.h>
|
||||
#include <nuttx/serial/pty.h>
|
||||
|
@ -1016,8 +1017,17 @@ int pty_register(int minor)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&devpair->pp_slavesem, 0, 0);
|
||||
sem_init(&devpair->pp_exclsem, 0, 1);
|
||||
|
||||
/* The pp_slavesem semaphore is used for signaling and, hence, should not
|
||||
* have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&devpair->pp_slavesem, SEM_PRIO_NONE);
|
||||
|
||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||
devpair->pp_minor = minor;
|
||||
#endif
|
||||
|
|
|
@ -1413,7 +1413,7 @@ int uart_register(FAR const char *path, FAR uart_dev_t *dev)
|
|||
#endif
|
||||
|
||||
/* The recvsem and xmitsem are used for signaling and, hence, should not have
|
||||
* priroity inheritance enabled.
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&dev->xmitsem, SEM_PRIO_NONE);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* drivers/syslog/ramlog.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
|
||||
|
@ -53,10 +53,10 @@
|
|||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
@ -694,7 +694,14 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
|
|||
sem_init(&priv->rl_exclsem, 0, 1);
|
||||
#ifndef CONFIG_RAMLOG_NONBLOCKING
|
||||
sem_init(&priv->rl_waitsem, 0, 0);
|
||||
|
||||
/* The rl_waitsem semaphore is used for signaling and, hence, should
|
||||
* not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->rl_waitsem, SEM_PRIO_NONE);
|
||||
#endif
|
||||
|
||||
priv->rl_bufsize = buflen;
|
||||
priv->rl_buffer = buffer;
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/storage.h>
|
||||
|
@ -1339,11 +1340,20 @@ int usbmsc_configure(unsigned int nluns, void **handle)
|
|||
priv = &alloc->dev;
|
||||
memset(priv, 0, sizeof(struct usbmsc_dev_s));
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&priv->thsynch, 0, 0);
|
||||
sem_init(&priv->thlock, 0, 1);
|
||||
sem_init(&priv->thwaitsem, 0, 0);
|
||||
sq_init(&priv->wrreqlist);
|
||||
|
||||
/* The thsynch and thwaitsem semaphores are used for signaling and, hence,
|
||||
* should not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->thsynch, SEM_PRIO_NONE);
|
||||
sem_setprotocol(&priv->thwaitsem, SEM_PRIO_NONE);
|
||||
|
||||
sq_init(&priv->wrreqlist);
|
||||
priv->nluns = nluns;
|
||||
|
||||
/* Allocate the LUN table */
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
|
||||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
@ -1864,6 +1865,12 @@ static FAR struct usbhost_class_s *
|
|||
sem_init(&priv->exclsem, 0, 1);
|
||||
sem_init(&priv->waitsem, 0, 0);
|
||||
|
||||
/* The waitsem semaphore is used for signaling and, hence, should
|
||||
* not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Return the instance of the USB keyboard class driver */
|
||||
|
||||
return &priv->usbclass;
|
||||
|
@ -2423,6 +2430,12 @@ int usbhost_kbdinit(void)
|
|||
sem_init(&g_exclsem, 0, 1);
|
||||
sem_init(&g_syncsem, 0, 0);
|
||||
|
||||
/* The g_syncsem semaphore is used for signaling and, hence, should not
|
||||
* have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&g_syncsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Advertise our availability to support (certain) devices */
|
||||
|
||||
return usbhost_registerclass(&g_hidkbd);
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
|
||||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
@ -1934,6 +1935,12 @@ static FAR struct usbhost_class_s *
|
|||
sem_init(&priv->exclsem, 0, 1);
|
||||
sem_init(&priv->waitsem, 0, 0);
|
||||
|
||||
/* The waitsem semaphore is used for signaling and, hence, should
|
||||
* not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Return the instance of the USB mouse class driver */
|
||||
|
||||
return &priv->usbclass;
|
||||
|
@ -2553,6 +2560,12 @@ int usbhost_mouse_init(void)
|
|||
sem_init(&g_exclsem, 0, 1);
|
||||
sem_init(&g_syncsem, 0, 0);
|
||||
|
||||
/* The g_syncsem semaphore is used for signaling and, hence, should not
|
||||
* have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&g_syncsem, SEM_PRIO_NONE);
|
||||
|
||||
/* Advertise our availability to support (certain) mouse devices */
|
||||
|
||||
return usbhost_registerclass(&g_hidmouse);
|
||||
|
|
|
@ -63,13 +63,15 @@
|
|||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <nuttx/wireless/wireless.h>
|
||||
#include <nuttx/wireless/cc3000.h>
|
||||
|
@ -822,19 +824,33 @@ static int cc3000_open(FAR struct file *filep)
|
|||
|
||||
if (tmp == 1)
|
||||
{
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&priv->waitsem, 0, 0); /* Initialize event wait semaphore */
|
||||
sem_init(&priv->irqsem, 0, 0); /* Initialize IRQ Ready semaphore */
|
||||
sem_init(&priv->readysem, 0, 0); /* Initialize Device Ready semaphore */
|
||||
|
||||
/* These semaphores are all used for signaling and, hence, should
|
||||
* not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
|
||||
sem_setprotocol(&priv->irqsem, SEM_PRIO_NONE);
|
||||
sem_setprotocol(&priv->readysem, SEM_PRIO_NONE);
|
||||
|
||||
#ifdef CONFIG_CC3000_MT
|
||||
priv->accepting_socket.acc.sd = FREE_SLOT;
|
||||
sem_init(&priv->accepting_socket.acc.semwait, 0, 0);
|
||||
sem_setprotocol(&priv->accepting_socket.acc.semwait, SEM_PRIO_NONE);
|
||||
|
||||
for (s = 0; s < CONFIG_WL_MAX_SOCKETS; s++)
|
||||
{
|
||||
priv->sockets[s].sd = FREE_SLOT;
|
||||
priv->sockets[s].received_closed_event = false;
|
||||
priv->sockets[s].emptied_and_remotely_closed = false;
|
||||
|
||||
sem_init(&priv->sockets[s].semwait, 0, 0);
|
||||
sem_setprotocol(&priv->sockets[s].semwait, SEM_PRIO_NONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -884,6 +900,8 @@ static int cc3000_open(FAR struct file *filep)
|
|||
pthread_attr_setschedparam(&tattr, ¶m);
|
||||
|
||||
sem_init(&priv->selectsem, 0, 0);
|
||||
sem_setprotocol(&priv->selectsem, SEM_PRIO_NONE);
|
||||
|
||||
ret = pthread_create(&priv->selecttid, &tattr, select_thread_func,
|
||||
(pthread_addr_t)priv);
|
||||
if (ret != 0)
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
|
@ -1370,9 +1371,19 @@ FAR struct ieee802154_dev_s *mrf24j40_init(FAR struct spi_dev_s *spi,
|
|||
}
|
||||
|
||||
dev->ieee.ops = &mrf24j40_devops;
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&dev->ieee.rxsem, 0, 0);
|
||||
sem_init(&dev->ieee.txsem, 0, 0);
|
||||
|
||||
/* These semaphores are all used for signaling and, hence, should
|
||||
* not have priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&dev->ieee.rxsem, SEM_PRIO_NONE);
|
||||
sem_setprotocol(&dev->ieee.txsem, SEM_PRIO_NONE);
|
||||
|
||||
dev->lower = lower;
|
||||
dev->spi = spi;
|
||||
|
||||
|
|
|
@ -1224,7 +1224,8 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c
|
|||
dev->pfd = NULL;
|
||||
#endif
|
||||
|
||||
sem_init(&(dev->sem_tx), 0, 0);
|
||||
sem_init(&dev->sem_tx, 0, 0);
|
||||
sem_setprotocol(&dev->sem_tx, SEM_PRIO_NONE);
|
||||
|
||||
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT
|
||||
if ((rx_fifo = kmm_malloc(CONFIG_WL_NRF24L01_RXFIFO_LEN)) == NULL)
|
||||
|
@ -1240,6 +1241,7 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c
|
|||
|
||||
sem_init(&(dev->sem_fifo), 0, 1);
|
||||
sem_init(&(dev->sem_rx), 0, 0);
|
||||
sem_setprotocol(&dev->sem_rx, SEM_PRIO_NONE);
|
||||
#endif
|
||||
|
||||
/* Set the global reference */
|
||||
|
|
Loading…
Reference in a new issue