mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
@@ -29,7 +29,6 @@
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/queue.h>
|
||||
#include <nuttx/mutex.h>
|
||||
#include <semaphore.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/irq.h>
|
||||
@@ -286,7 +285,7 @@ typedef struct alt_evtbuf_inst_s
|
||||
uint16_t altcid;
|
||||
FAR void **outparam;
|
||||
size_t outparamlen;
|
||||
mutex_t stat_lock;
|
||||
sem_t stat_lock;
|
||||
alt_evtbuf_state_t stat;
|
||||
} alt_evtbuf_inst_t;
|
||||
|
||||
@@ -324,25 +323,25 @@ typedef struct altcom_fd_set_s altcom_fd_set;
|
||||
struct alt_queue_s
|
||||
{
|
||||
sq_queue_t queue;
|
||||
mutex_t lock;
|
||||
sem_t lock;
|
||||
};
|
||||
|
||||
struct alt1250_dev_s
|
||||
{
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR const struct alt1250_lower_s *lower;
|
||||
mutex_t refslock;
|
||||
sem_t refslock;
|
||||
uint8_t crefs;
|
||||
struct alt_queue_s waitlist;
|
||||
struct alt_queue_s replylist;
|
||||
uint64_t evtbitmap;
|
||||
mutex_t evtmaplock;
|
||||
mutex_t pfdlock;
|
||||
sem_t evtmaplock;
|
||||
sem_t pfdlock;
|
||||
FAR struct pollfd *pfd;
|
||||
pthread_t recvthread;
|
||||
FAR struct alt_evtbuffer_s *evtbuff;
|
||||
uint32_t discardcnt;
|
||||
mutex_t senddisablelock;
|
||||
sem_t senddisablelock;
|
||||
bool senddisable;
|
||||
FAR alt_container_t *select_container;
|
||||
struct alt_evtbuf_inst_s select_inst;
|
||||
|
||||
+95
-312
File diff suppressed because it is too large
Load Diff
@@ -35,7 +35,6 @@
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <nuttx/queue.h>
|
||||
#include <nuttx/mutex.h>
|
||||
#ifdef CONFIG_MM_IOB
|
||||
# include <nuttx/mm/iob.h>
|
||||
#endif
|
||||
@@ -393,30 +392,6 @@ void net_unlock(void);
|
||||
|
||||
int net_sem_timedwait(sem_t *sem, unsigned int timeout);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_mutex_timedlock
|
||||
*
|
||||
* Description:
|
||||
* Atomically wait for mutex (or a timeout) while temporarily releasing
|
||||
* the lock on the network.
|
||||
*
|
||||
* Caution should be utilized. Because the network lock is relinquished
|
||||
* during the wait, there could be changes in the network state that occur
|
||||
* before the lock is recovered. Your design should account for this
|
||||
* possibility.
|
||||
*
|
||||
* Input Parameters:
|
||||
* mutex - A reference to the mutex to be taken.
|
||||
* timeout - The relative time to wait until a timeout is declared.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int net_mutex_timedlock(mutex_t *mutex, unsigned int timeout);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_sem_wait
|
||||
*
|
||||
@@ -439,28 +414,6 @@ int net_mutex_timedlock(mutex_t *mutex, unsigned int timeout);
|
||||
|
||||
int net_sem_wait(sem_t *sem);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_mutex_lock
|
||||
*
|
||||
* Description:
|
||||
* Atomically wait for mutex while temporarily releasing the network lock.
|
||||
*
|
||||
* Caution should be utilized. Because the network lock is relinquished
|
||||
* during the wait, there could be changes in the network state that occur
|
||||
* before the lock is recovered. Your design should account for this
|
||||
* possibility.
|
||||
*
|
||||
* Input Parameters:
|
||||
* mutex - A reference to the mutex to be taken.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int net_mutex_lock(mutex_t *mutex);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_sem_timedwait_uninterruptible
|
||||
*
|
||||
|
||||
@@ -40,21 +40,21 @@
|
||||
|
||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||
/* semcount, flags, waitlist, hhead */
|
||||
/* semcount, waitlist, flags, hhead */
|
||||
|
||||
# define NXSEM_INITIALIZER(c, f) \
|
||||
{(c), (f), SEM_WAITLIST_INITIALIZER, NULL}
|
||||
{(c), SEM_WAITLIST_INITIALIZER, (f), NULL}
|
||||
# else
|
||||
/* semcount, flags, waitlist, holder[2] */
|
||||
/* semcount, waitlist, flags, holder[2] */
|
||||
|
||||
# define NXSEM_INITIALIZER(c, f) \
|
||||
{(c), (f), SEM_WAITLIST_INITIALIZER, {SEMHOLDER_INITIALIZER, SEMHOLDER_INITIALIZER}}
|
||||
{(c), SEM_WAITLIST_INITIALIZER, (f), {SEMHOLDER_INITIALIZER, SEMHOLDER_INITIALIZER}}
|
||||
# endif
|
||||
#else /* CONFIG_PRIORITY_INHERITANCE */
|
||||
/* semcount, flags, waitlist */
|
||||
/* semcount, waitlist */
|
||||
|
||||
# define NXSEM_INITIALIZER(c, f) \
|
||||
{(c), (f), SEM_WAITLIST_INITIALIZER}
|
||||
{(c), SEM_WAITLIST_INITIALIZER}
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE */
|
||||
|
||||
/* Most internal nxsem_* interfaces are not available in the user space in
|
||||
|
||||
+9
-11
@@ -42,7 +42,6 @@
|
||||
#define SEM_PRIO_INHERIT 1
|
||||
#define SEM_PRIO_PROTECT 2
|
||||
#define SEM_PRIO_MASK 3
|
||||
#define SEM_PRIO_MUTEX 4
|
||||
|
||||
/* Value returned by sem_open() in the event of a failure. */
|
||||
|
||||
@@ -100,15 +99,14 @@ struct sem_s
|
||||
volatile int16_t semcount; /* >0 -> Num counts available */
|
||||
/* <0 -> Num tasks waiting for semaphore */
|
||||
|
||||
dq_queue_t waitlist;
|
||||
|
||||
/* If priority inheritance is enabled, then we have to keep track of which
|
||||
* tasks hold references to the semaphore.
|
||||
*/
|
||||
|
||||
uint8_t flags; /* See SEM_PRIO_* definitions */
|
||||
|
||||
dq_queue_t waitlist;
|
||||
|
||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||
uint8_t flags; /* See PRIOINHERIT_FLAGS_* definitions */
|
||||
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||
FAR struct semholder_s *hhead; /* List of holders of semaphore counts */
|
||||
# else
|
||||
@@ -123,21 +121,21 @@ typedef struct sem_s sem_t;
|
||||
|
||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||
/* semcount, flags, waitlist, hhead */
|
||||
/* semcount, waitlist, flags, hhead */
|
||||
|
||||
# define SEM_INITIALIZER(c) \
|
||||
{(c), 0, SEM_WAITLIST_INITIALIZER, NULL}
|
||||
{(c), SEM_WAITLIST_INITIALIZER, 0, NULL}
|
||||
# else
|
||||
/* semcount, flags, waitlist, holder[2] */
|
||||
/* semcount, waitlist, flags, holder[2] */
|
||||
|
||||
# define SEM_INITIALIZER(c) \
|
||||
{(c), 0, SEM_WAITLIST_INITIALIZER, {SEMHOLDER_INITIALIZER, SEMHOLDER_INITIALIZER}}
|
||||
{(c), SEM_WAITLIST_INITIALIZER, 0, {SEMHOLDER_INITIALIZER, SEMHOLDER_INITIALIZER}}
|
||||
# endif
|
||||
#else
|
||||
/* semcount, flags, waitlist */
|
||||
/* semcount, waitlist */
|
||||
|
||||
# define SEM_INITIALIZER(c) \
|
||||
{(c), 0, SEM_WAITLIST_INITIALIZER}
|
||||
{(c), SEM_WAITLIST_INITIALIZER}
|
||||
#endif
|
||||
|
||||
# define SEM_WAITLIST(sem) (&((sem)->waitlist))
|
||||
|
||||
Reference in New Issue
Block a user