mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
Z16F integration changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@595 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -76,7 +76,7 @@
|
|||||||
#ifdef CONFIG_ARCH_STACKDUMP
|
#ifdef CONFIG_ARCH_STACKDUMP
|
||||||
static void up_registerdump(void)
|
static void up_registerdump(void)
|
||||||
{
|
{
|
||||||
uint32 *regs32 = (uint32*)current_regs;
|
FAR uint32 *regs32 = (FAR uint32*)current_regs;
|
||||||
lldbg("R0 :%08x R1 :%08x R2 :%08x R3 :%08x "
|
lldbg("R0 :%08x R1 :%08x R2 :%08x R3 :%08x "
|
||||||
"R4 :%08x R5 :%08x R6 :%08x R7 :%08x\n"
|
"R4 :%08x R5 :%08x R6 :%08x R7 :%08x\n"
|
||||||
regs32[REG_R0/2], regs32[REG_R1/2], regs32[REG_R2/2], regs32[REG_R3/2],
|
regs32[REG_R0/2], regs32[REG_R1/2], regs32[REG_R2/2], regs32[REG_R3/2],
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
|
|||||||
{
|
{
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (chipreg_t)sigdeliver);
|
dbg("tcb=0x%p sigdeliver=0x%06x\n", tcb, (uint32)sigdeliver);
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->xcp.sigdeliver)
|
||||||
{
|
{
|
||||||
@@ -141,7 +141,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32 *current_pc = (uint32*)¤t_regs[REG_PC];
|
FAR uint32 *current_pc = (FAR uint32*)¤t_regs[REG_PC];
|
||||||
|
|
||||||
/* Save the return address and interrupt state.
|
/* Save the return address and interrupt state.
|
||||||
* These will be restored by the signal trampoline after
|
* These will be restored by the signal trampoline after
|
||||||
|
|||||||
@@ -82,9 +82,9 @@
|
|||||||
void up_sigdeliver(void)
|
void up_sigdeliver(void)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||||
chipreg_t regs[XCPTCONTEXT_REGS];
|
chipreg_t regs[XCPTCONTEXT_REGS];
|
||||||
uint32 *regs32 = (uint32*)regs;
|
FAR uint32 *regs32 = (FAR uint32*)regs;
|
||||||
sig_deliver_t sigdeliver;
|
sig_deliver_t sigdeliver;
|
||||||
|
|
||||||
/* Save the errno. This must be preserved throughout the signal handling
|
/* Save the errno. This must be preserved throughout the signal handling
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ CONFIG_DEBUG_VERBOSE=n
|
|||||||
CONFIG_MM_REGIONS=1
|
CONFIG_MM_REGIONS=1
|
||||||
CONFIG_ARCH_LOWPUTC=n
|
CONFIG_ARCH_LOWPUTC=n
|
||||||
CONFIG_ARCH_LOWGETC=n
|
CONFIG_ARCH_LOWGETC=n
|
||||||
CONFIG_RR_INTERVAL=0
|
CONFIG_RR_INTERVAL=200
|
||||||
CONFIG_SCHED_INSTRUMENTATION=n
|
CONFIG_SCHED_INSTRUMENTATION=n
|
||||||
CONFIG_TASK_NAME_SIZE=0
|
CONFIG_TASK_NAME_SIZE=0
|
||||||
CONFIG_START_YEAR=2008
|
CONFIG_START_YEAR=2008
|
||||||
@@ -172,7 +172,7 @@ CONFIG_DEV_LOWCONSOLE=y
|
|||||||
CONFIG_DISABLE_CLOCK=n
|
CONFIG_DISABLE_CLOCK=n
|
||||||
CONFIG_DISABLE_POSIX_TIMERS=n
|
CONFIG_DISABLE_POSIX_TIMERS=n
|
||||||
CONFIG_DISABLE_PTHREAD=n
|
CONFIG_DISABLE_PTHREAD=n
|
||||||
CONFIG_DISABLE_SIGNALS=y
|
CONFIG_DISABLE_SIGNALS=n
|
||||||
CONFIG_DISABLE_MQUEUE=n
|
CONFIG_DISABLE_MQUEUE=n
|
||||||
CONFIG_DISABLE_MOUNTPOINT=n
|
CONFIG_DISABLE_MOUNTPOINT=n
|
||||||
CONFIG_DISABLE_ENVIRON=n
|
CONFIG_DISABLE_ENVIRON=n
|
||||||
@@ -331,8 +331,8 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
|
|||||||
#
|
#
|
||||||
CONFIG_BOOT_FROM_FLASH=n
|
CONFIG_BOOT_FROM_FLASH=n
|
||||||
CONFIG_CUSTOM_STACK=n
|
CONFIG_CUSTOM_STACK=n
|
||||||
CONFIG_PROC_STACK_SIZE=1024
|
CONFIG_PROC_STACK_SIZE=4096
|
||||||
CONFIG_PTHREAD_STACK_MIN=256
|
CONFIG_PTHREAD_STACK_MIN=256
|
||||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
CONFIG_PTHREAD_STACK_DEFAULT=4096
|
||||||
CONFIG_HEAP_SIZE=
|
CONFIG_HEAP_SIZE=
|
||||||
CONFIG_HEAP_BASE=
|
CONFIG_HEAP_BASE=
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* roundrobin.c
|
* examples/ostest/roundrobin.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name Gregory NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -134,6 +134,7 @@ static void *sieve1(void *parameter)
|
|||||||
printf("sieve1 finished\n");
|
printf("sieve1 finished\n");
|
||||||
|
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
|
return NULL; /* To keep some compilers happy */
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
@@ -154,6 +155,7 @@ static void *sieve2(void *parameter)
|
|||||||
printf("sieve2 finished\n");
|
printf("sieve2 finished\n");
|
||||||
|
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
|
return NULL; /* To keep some compilers happy */
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
|
|||||||
@@ -263,7 +263,7 @@
|
|||||||
# define FAR _Far
|
# define FAR _Far
|
||||||
# define NEAR _Near
|
# define NEAR _Near
|
||||||
# define DSEG _Far
|
# define DSEG _Far
|
||||||
# define CODE _Near
|
# define CODE _Far
|
||||||
|
|
||||||
/* Select the large, 32-bit addressing model */
|
/* Select the large, 32-bit addressing model */
|
||||||
|
|
||||||
|
|||||||
@@ -75,16 +75,14 @@
|
|||||||
|
|
||||||
/* General Task Management Types ************************************************/
|
/* General Task Management Types ************************************************/
|
||||||
|
|
||||||
/* This is the type of the task_state field of the TCB.
|
/* This is the type of the task_state field of the TCB. NOTE: the order and
|
||||||
* NOTE: the order and content of this enumeration is
|
* content of this enumeration is critical since there are some OS tables indexed
|
||||||
* critical since there are some OS tables indexed by these
|
* by these values. The range of values is assumed to fit into a ubyte in _TCB.
|
||||||
* values.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum tstate_e
|
enum tstate_e
|
||||||
{
|
{
|
||||||
TSTATE_TASK_INVALID = 0, /* INVALID - The TCB is is not in a valid state
|
TSTATE_TASK_INVALID = 0, /* INVALID - The TCB is uninitialized */
|
||||||
* (Uninitialized or between context switches) */
|
|
||||||
TSTATE_TASK_PENDING = 1, /* READY_TO_RUN - Pending preemption unlock */
|
TSTATE_TASK_PENDING = 1, /* READY_TO_RUN - Pending preemption unlock */
|
||||||
TSTATE_TASK_READYTORUN = 2, /* READY-TO-RUN - But not running */
|
TSTATE_TASK_READYTORUN = 2, /* READY-TO-RUN - But not running */
|
||||||
TSTATE_TASK_RUNNING = 3, /* READY_TO_RUN - And running */
|
TSTATE_TASK_RUNNING = 3, /* READY_TO_RUN - And running */
|
||||||
@@ -179,7 +177,7 @@ struct _TCB
|
|||||||
entry_t entry; /* Entry Point into the thread */
|
entry_t entry; /* Entry Point into the thread */
|
||||||
exitfunc_t exitfunc; /* Called if exit is called. */
|
exitfunc_t exitfunc; /* Called if exit is called. */
|
||||||
ubyte sched_priority; /* Current priority of the thread */
|
ubyte sched_priority; /* Current priority of the thread */
|
||||||
tstate_t task_state; /* Current state of the thread */
|
ubyte task_state; /* Current state of the thread */
|
||||||
uint16 flags; /* Misc. general status flags */
|
uint16 flags; /* Misc. general status flags */
|
||||||
sint16 lockcount; /* 0=preemptable (not-locked) */
|
sint16 lockcount; /* 0=preemptable (not-locked) */
|
||||||
#ifndef CONFIG_DISABLE_PTHREAD
|
#ifndef CONFIG_DISABLE_PTHREAD
|
||||||
|
|||||||
+23
-24
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* semaphore.h
|
* include/semaphore.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,14 +31,14 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __SEMAPHORE_H
|
#ifndef __SEMAPHORE_H
|
||||||
#define __SEMAPHORE_H
|
#define __SEMAPHORE_H
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@@ -50,13 +50,13 @@ extern "C" {
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Type Declarations
|
* Public Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* This is the generic semaphore structure. */
|
/* This is the generic semaphore structure. */
|
||||||
|
|
||||||
@@ -67,25 +67,25 @@ struct sem_s
|
|||||||
};
|
};
|
||||||
typedef struct sem_s sem_t;
|
typedef struct sem_s sem_t;
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Variables
|
* Public Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Counting Semaphore Interfaces (based on POSIX APIs) */
|
/* Counting Semaphore Interfaces (based on POSIX APIs) */
|
||||||
|
|
||||||
EXTERN int sem_init(sem_t *sem, int pshared, unsigned int value);
|
EXTERN int sem_init(FAR sem_t *sem, int pshared, unsigned int value);
|
||||||
EXTERN int sem_destroy(sem_t *sem);
|
EXTERN int sem_destroy(FAR sem_t *sem);
|
||||||
EXTERN FAR sem_t *sem_open(const char *name, int oflag, ...);
|
EXTERN FAR sem_t *sem_open(FAR const char *name, int oflag, ...);
|
||||||
EXTERN int sem_close(FAR sem_t *sem);
|
EXTERN int sem_close(FAR sem_t *sem);
|
||||||
EXTERN int sem_unlink(const char *name);
|
EXTERN int sem_unlink(FAR const char *name);
|
||||||
EXTERN int sem_wait(sem_t *sem);
|
EXTERN int sem_wait(FAR sem_t *sem);
|
||||||
EXTERN int sem_trywait(sem_t *sem);
|
EXTERN int sem_trywait(FAR sem_t *sem);
|
||||||
EXTERN int sem_post(sem_t *sem);
|
EXTERN int sem_post(FAR sem_t *sem);
|
||||||
EXTERN int sem_getvalue(sem_t *sem, int *sval);
|
EXTERN int sem_getvalue(FAR sem_t *sem, FAR int *sval);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -93,4 +93,3 @@ EXTERN int sem_getvalue(sem_t *sem, int *sval);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __SEMAPHORE_H */
|
#endif /* __SEMAPHORE_H */
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -177,18 +177,18 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN int kill(pid_t, int);
|
EXTERN int kill(pid_t, int);
|
||||||
EXTERN int sigemptyset(sigset_t *set);
|
EXTERN int sigemptyset(FAR sigset_t *set);
|
||||||
EXTERN int sigfillset(sigset_t *set);
|
EXTERN int sigfillset(FAR sigset_t *set);
|
||||||
EXTERN int sigaddset(sigset_t *set, int signo);
|
EXTERN int sigaddset(FAR sigset_t *set, int signo);
|
||||||
EXTERN int sigdelset(sigset_t *set, int signo);
|
EXTERN int sigdelset(FAR sigset_t *set, int signo);
|
||||||
EXTERN int sigismember(const sigset_t *set, int signo);
|
EXTERN int sigismember(FAR const sigset_t *set, int signo);
|
||||||
EXTERN int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
|
EXTERN int sigaction(int sig, FAR const struct sigaction *act, FAR struct sigaction *oact);
|
||||||
EXTERN int sigprocmask(int how, const sigset_t *set, sigset_t *oset);
|
EXTERN int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
|
||||||
EXTERN int sigpending(sigset_t *set);
|
EXTERN int sigpending(FAR sigset_t *set);
|
||||||
EXTERN int sigsuspend(const sigset_t *sigmask);
|
EXTERN int sigsuspend(FAR const sigset_t *sigmask);
|
||||||
EXTERN int sigwaitinfo(const sigset_t *set, struct siginfo *value);
|
EXTERN int sigwaitinfo(FAR const sigset_t *set, FAR struct siginfo *value);
|
||||||
EXTERN int sigtimedwait(const sigset_t *set, struct siginfo *value,
|
EXTERN int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *value,
|
||||||
const struct timespec *timeout);
|
FAR const struct timespec *timeout);
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||||
EXTERN int sigqueue(int pid, int signo, union sigval value);
|
EXTERN int sigqueue(int pid, int signo, union sigval value);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+15
-15
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* unistd.h
|
* unistd.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,21 +31,21 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __UNISTD_H
|
#ifndef __UNISTD_H
|
||||||
#define __UNISTD_H
|
#define __UNISTD_H
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The number of functions that may be registerd to be called
|
/* The number of functions that may be registerd to be called
|
||||||
* at program exit.
|
* at program exit.
|
||||||
@@ -96,9 +96,9 @@
|
|||||||
|
|
||||||
#define fdatasync(f) fsync(f)
|
#define fdatasync(f) fsync(f)
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
@@ -110,13 +110,13 @@ extern "C" {
|
|||||||
|
|
||||||
/* Used by getopt (obviously NOT thread safe!) */
|
/* Used by getopt (obviously NOT thread safe!) */
|
||||||
|
|
||||||
EXTERN char *optarg; /* Optional argument following option */
|
EXTERN FAR char *optarg; /* Optional argument following option */
|
||||||
EXTERN int optind; /* Index into argv */
|
EXTERN int optind; /* Index into argv */
|
||||||
EXTERN int optopt; /* unrecognized option character */
|
EXTERN int optopt; /* unrecognized option character */
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Function Prototypes
|
* Global Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Task Control Interfaces */
|
/* Task Control Interfaces */
|
||||||
|
|
||||||
|
|||||||
+19
-20
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* wdog.h
|
* wdog.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,29 +31,29 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __WDOG_H
|
#ifndef __WDOG_H
|
||||||
#define __WDOG_H
|
#define __WDOG_H
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilations Switches
|
* Compilations Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Type Declarations
|
* Global Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The arguments are passed as uint32 values. For systems
|
/* The arguments are passed as uint32 values. For systems
|
||||||
* where the sizeof(pointer) < sizeof(uint32), the following
|
* where the sizeof(pointer) < sizeof(uint32), the following
|
||||||
@@ -67,8 +67,8 @@
|
|||||||
|
|
||||||
union wdparm_u
|
union wdparm_u
|
||||||
{
|
{
|
||||||
void *pvarg;
|
FAR void *pvarg;
|
||||||
uint32 *dwarg;
|
FAR uint32 *dwarg;
|
||||||
};
|
};
|
||||||
typedef union wdparm_u wdparm_t;
|
typedef union wdparm_u wdparm_t;
|
||||||
|
|
||||||
@@ -76,19 +76,19 @@ typedef union wdparm_u wdparm_t;
|
|||||||
* watchdog function expires. Up to four parameters may be passed.
|
* watchdog function expires. Up to four parameters may be passed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef void (*wdentry_t)(int argc, uint32 arg1, ...);
|
typedef CODE void (*wdentry_t)(int argc, uint32 arg1, ...);
|
||||||
|
|
||||||
/* Watchdog 'handle' */
|
/* Watchdog 'handle' */
|
||||||
|
|
||||||
typedef FAR struct wdog_s *WDOG_ID;
|
typedef FAR struct wdog_s *WDOG_ID;
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Function Prototypes
|
* Global Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define EXTERN extern "C"
|
#define EXTERN extern "C"
|
||||||
@@ -110,4 +110,3 @@ EXTERN int wd_gettime(WDOG_ID wdog);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _WDOG_H_ */
|
#endif /* _WDOG_H_ */
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ ssize_t mq_receive(mqd_t mqdes, void *msg, size_t msglen, int *prio)
|
|||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
ssize_t ret = ERROR;
|
ssize_t ret = ERROR;
|
||||||
|
|
||||||
DEBUGASSERT(!up_interrupt_context());
|
DEBUGASSERT(up_interrupt_context() == FALSE);
|
||||||
|
|
||||||
/* Verify the input parameters and, in case of an error, set
|
/* Verify the input parameters and, in case of an error, set
|
||||||
* errno appropriately.
|
* errno appropriately.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* mq_timedreceive.c
|
* sched/mq_timedreceive.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void mq_rcvtimeout(int argc, uint32 pid, ...)
|
static void mq_rcvtimeout(int argc, uint32 pid)
|
||||||
{
|
{
|
||||||
FAR _TCB *wtcb;
|
FAR _TCB *wtcb;
|
||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
@@ -192,7 +192,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, void *msg, size_t msglen,
|
|||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
DEBUGASSERT(!up_interrupt_context());
|
DEBUGASSERT(up_interrupt_context() == FALSE);
|
||||||
|
|
||||||
/* Verify the input parameters and, in case of an error, set
|
/* Verify the input parameters and, in case of an error, set
|
||||||
* errno appropriately.
|
* errno appropriately.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* mq_timedsend.c
|
* sched/mq_timedsend.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void mq_sndtimeout(int argc, uint32 pid, ...)
|
static void mq_sndtimeout(int argc, uint32 pid)
|
||||||
{
|
{
|
||||||
FAR _TCB *wtcb;
|
FAR _TCB *wtcb;
|
||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
@@ -189,7 +189,7 @@ int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
|
|||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
DEBUGASSERT(!up_interrupt_context());
|
DEBUGASSERT(up_interrupt_context() == FALSE);
|
||||||
|
|
||||||
/* Verify the input parameters -- setting errno appropriately
|
/* Verify the input parameters -- setting errno appropriately
|
||||||
* on any failures to verify.
|
* on any failures to verify.
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void pthread_condtimedout(int argc, uint32 pid, uint32 signo, ...)
|
static void pthread_condtimedout(int argc, uint32 pid, uint32 signo)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||||
union sigval value;
|
union sigval value;
|
||||||
|
|||||||
+32
-36
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_close.c
|
* sched/sem_close.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -44,48 +44,46 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_close
|
* Function: sem_close
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is called to indicate that the calling\
|
* This function is called to indicate that the calling task is finished
|
||||||
* task is finished with the specified named semaphore,
|
* with the specified named semaphore, 'sem'. The sem_close() deallocates
|
||||||
* sem. The sem_close() deallocates any system resources
|
* any system resources allocated by the system for this named semaphore.
|
||||||
* allocated by the system for this named semaphore.
|
|
||||||
*
|
*
|
||||||
* If the semaphore has not been removed with a call to
|
* If the semaphore has not been removed with a call to sem_unlink(), then
|
||||||
* sem_unlink(), then sem_close() has no effect on the
|
* sem_close() has no effect on the named semaphore. However, when the
|
||||||
* named semaphore. However, when the named semaphore has
|
* named semaphore has been fully unlinked, the semaphore will vanish when
|
||||||
* been fully unlinked, the semaphore will vanish when the
|
* the last task closes it.
|
||||||
* last task closes it.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* sem - semaphore descriptor
|
* sem - semaphore descriptor
|
||||||
@@ -94,12 +92,11 @@
|
|||||||
* 0 (OK), or -1 (ERROR) if unsuccessful.
|
* 0 (OK), or -1 (ERROR) if unsuccessful.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* - Care must be taken to avoid risking the deletion of
|
* - Care must be taken to avoid risking the deletion of a semaphore that
|
||||||
* a semaphore that another calling task has already
|
* another calling task has already locked.
|
||||||
* locked.
|
|
||||||
* - sem_close must not be called for an un-named semaphore
|
* - sem_close must not be called for an un-named semaphore
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_close(FAR sem_t *sem)
|
int sem_close(FAR sem_t *sem)
|
||||||
{
|
{
|
||||||
@@ -142,4 +139,3 @@ int sem_close(FAR sem_t *sem)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+32
-33
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_destroy.c
|
* sched/sem_destroy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,58 +31,57 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_destroy
|
* Function: sem_destroy
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is used to destroy the un-named semaphore
|
* This function is used to destroy the un-named semaphore indicated by
|
||||||
* indicated by sem. Only a semaphore that was created
|
* 'sem'. Only a semaphore that was created using sem_init() may be
|
||||||
* using sem_init() may be destroyed using sem_destroy();
|
* destroyed using sem_destroy(); the effect of calling sem_destroy() with
|
||||||
* the effect of calling sem_destroy() with a name semaphore
|
* a named semaphore is undefined. The effect of subsequent use of the
|
||||||
* is undefined. The effect of subsequent use of the
|
* semaphore sem is undefined until sem is re-initialized by another call
|
||||||
* semaphore sem is undefined until sem is re-initialized
|
* to sem_init().
|
||||||
* by another call to sem_init().
|
|
||||||
*
|
*
|
||||||
* The effect of destroying a semaphore upon which other
|
* The effect of destroying a semaphore upon which other processes are
|
||||||
* processes are currently blocked is undefined.
|
* currently blocked is undefined.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* sem - Semaphore to be destroyed.
|
* sem - Semaphore to be destroyed.
|
||||||
@@ -92,9 +91,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_destroy (sem_t *sem)
|
int sem_destroy (FAR sem_t *sem)
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
|
|||||||
+33
-36
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_getvalue.c
|
* sched/sem_getvalue.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,60 +31,58 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_getvalue
|
* Function: sem_getvalue
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function updates the location referenced by sval
|
* This function updates the location referenced by 'sval' argument to
|
||||||
* argument to have the value of the semaphore referenced
|
* have the value of the semaphore referenced by 'sem' without effecting
|
||||||
* by sem without effecting the state of the semaphore.
|
* the state of the semaphore. The updated value represents the actual
|
||||||
* The updated value represents the actual semaphore value
|
* semaphore value that occurred at some unspecified time during the call,
|
||||||
* that occurred at some unspecified time during the call,
|
* but may not reflect the actual value of the semaphore when it is
|
||||||
* but may not reflect the actual value of the semaphore
|
* returned to the calling task.
|
||||||
* when it is returned to the calling task.
|
|
||||||
*
|
*
|
||||||
* If sem is locked, the value return by sem_getvalue()
|
* If 'sem' is locked, the value return by sem_getvalue() will either be
|
||||||
* will either be zero or a negative number whose absolute
|
* zero or a negative number whose absolute value represents the number
|
||||||
* value represents the number of tasks waiting for the
|
* of tasks waiting for the semaphore.
|
||||||
* semaphore.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* sem - Semaphore descriptor
|
* sem - Semaphore descriptor
|
||||||
@@ -95,9 +93,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_getvalue(sem_t *sem, int *sval)
|
int sem_getvalue(FAR sem_t *sem, FAR int *sval)
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
@@ -109,4 +107,3 @@ int sem_getvalue(sem_t *sem, int *sval)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+31
-33
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_init.c
|
* sched/sem_init.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,59 +31,57 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_init
|
* Function: sem_init
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function initializes the UNAMED semaphore sem.
|
* This function initializes the UNAMED semaphore sem. Following a
|
||||||
* Following a successful call to sem_init(), the
|
* successful call to sem_init(), the semaophore may be used in subsequent
|
||||||
* semaophore may be used in subsequent calls to
|
* calls to sem_wait(), sem_post(), and sem_trywait(). The semaphore
|
||||||
* sem_wait(), sem_post(), and sem_trywait(). The
|
* remains usable until it is destroyed.
|
||||||
* semaphore remains usable until it is destroyed.
|
|
||||||
*
|
*
|
||||||
* Only sem itself may be used for performing
|
* Only sem itself may be used for performing synchronization. The result
|
||||||
* synchronization. The result of referring to copies of
|
* of referring to copies of sem in calls to sem_wait(), sem_trywait(),
|
||||||
* sem in calls to sem_wait(), sem_trywait(), sem_post(),
|
* sem_post(), and sem_destroy() is undefined.
|
||||||
* and sem_destroy() is undefined.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* sem - Semaphore to be initialized
|
* sem - Semaphore to be initialized
|
||||||
@@ -95,9 +93,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_init (sem_t *sem, int pshared, unsigned int value)
|
int sem_init (FAR sem_t *sem, int pshared, unsigned int value)
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
|
|||||||
+43
-46
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_open.c
|
* sched/sem_open.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -47,76 +47,73 @@
|
|||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_open
|
* Function: sem_open
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function establishes a connection between named
|
* This function establishes a connection between named semaphores and a
|
||||||
* semaphores and a task. Following a call to sem_open()
|
* task. Following a call to sem_open() with the semaphore name, the task
|
||||||
* with the semaphore name, the task may reference the
|
* may reference the semaphore associated with name using the address
|
||||||
* semaphore associated with name using the address
|
* returned by this call. The semaphore may be used in subsequent calls
|
||||||
* returned by this call. The semaphore may be used in
|
* to sem_wait(), sem_trywait(), and sem_post(). The semaphore remains
|
||||||
* subsequent calls to sem_wait(), sem_trywait(), and
|
* usable until the semaphore is closed by a successful call to sem_close().
|
||||||
* sem_post(). The semaphore remains usable until the
|
|
||||||
* semaphore is closed by a successful call to sem_close().
|
|
||||||
*
|
*
|
||||||
* If a task makes multiple calls to sem_open() with the
|
* If a task makes multiple calls to sem_open() with the same name, then
|
||||||
* same name, then the same semaphore address is returned
|
* the same semaphore address is returned (provided there have been no
|
||||||
* (provided there have been no calls to sem_unlink()).
|
* calls to sem_unlink()).
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* name - Semaphore name
|
* name - Semaphore name
|
||||||
* oflag - Semaphore creation options. This may either
|
* oflag - Semaphore creation options. This may either or both of the
|
||||||
* or both of the following bit settings.
|
* following bit settings.
|
||||||
* oflag = 0: Connect to the semaphore only if it
|
* oflag = 0: Connect to the semaphore only if it already exists.
|
||||||
* already exists.
|
* oflag = O_CREAT: Connect to the semaphore if it exists, otherwise
|
||||||
* oflag = O_CREAT: Connect to the semaphore if it
|
* create the semaphore.
|
||||||
* exists, otherwise create the semaphore.
|
|
||||||
* oflag = O_CREAT|O_EXCL: Create a new semaphore
|
* oflag = O_CREAT|O_EXCL: Create a new semaphore
|
||||||
* unless one of this name already exists.
|
* unless one of this name already exists.
|
||||||
* Optional parameters. When the O_CREAT flag is specified,
|
* Optional parameters. When the O_CREAT flag is specified, two optional
|
||||||
* two optional parameters are expected:
|
* parameters are expected:
|
||||||
* 1. mode_t mode (ignored), and
|
* 1. mode_t mode (ignored), and
|
||||||
* 2. unsigned int value. This initial value of the semaphore.
|
* 2. unsigned int value. This initial value of the semaphore. Valid
|
||||||
* valid initial values of the semaphore must be less than
|
* initial values of the semaphore must be less than or equal to
|
||||||
* or equal to SEM_VALUE_MAX.
|
* SEM_VALUE_MAX.
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* A pointer to sem_t or -1 (ERROR) if unsuccessful.
|
* A pointer to sem_t or -1 (ERROR) if unsuccessful.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR sem_t *sem_open (const char *name, int oflag, ...)
|
FAR sem_t *sem_open (FAR const char *name, int oflag, ...)
|
||||||
{
|
{
|
||||||
int namelen;
|
int namelen;
|
||||||
FAR nsem_t *psem;
|
FAR nsem_t *psem;
|
||||||
|
|||||||
+33
-37
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_post.c
|
* sched/sem_post.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@@ -45,52 +45,49 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_post
|
* Function: sem_post
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* When a task has finished with a semaphore, it will call
|
* When a task has finished with a semaphore, it will call sem_post().
|
||||||
* sem_post(). This function unlocks the semaphore
|
* This function unlocks the semaphore referenced by sem by performing the
|
||||||
* referenced by sem by performing the semaphore unlock
|
* semaphore unlock operation on that semaphore.
|
||||||
* operation on that semaphore.
|
|
||||||
*
|
*
|
||||||
* If the semaphore value resulting from this operation
|
* If the semaphore value resulting from this operation is positive, then
|
||||||
* is positive, then no tasks were blocked waiting for the
|
* no tasks were blocked waiting for the semaphore to become unlocked; the
|
||||||
* semaphore to become unlocked; the semaphore is simply
|
* semaphore is simply incremented.
|
||||||
* incremented.
|
|
||||||
*
|
*
|
||||||
* If the value of the semaphore resulting from this
|
* If the value of the semaphore resulting from this operation is zero,
|
||||||
* operation is zero, then one of the tasks blocked
|
* then one of the tasks blocked waiting for the semaphore shall be
|
||||||
* waiting for the semaphore shall be allowed to return
|
* allowed to return successfully from its call to sem_wait().
|
||||||
* successfully from its call to sem_wait().
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* sem - Semaphore descriptor
|
* sem - Semaphore descriptor
|
||||||
@@ -103,9 +100,9 @@
|
|||||||
* It assumes the currently executing task is the one that
|
* It assumes the currently executing task is the one that
|
||||||
* is performing the unlock.
|
* is performing the unlock.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_post(sem_t *sem)
|
int sem_post(FAR sem_t *sem)
|
||||||
{
|
{
|
||||||
FAR _TCB *stcb;
|
FAR _TCB *stcb;
|
||||||
STATUS ret = ERROR;
|
STATUS ret = ERROR;
|
||||||
@@ -163,4 +160,3 @@ int sem_post(sem_t *sem)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+26
-26
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_trywait.c
|
* sched/sem_trywait.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
@@ -45,35 +45,35 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_trywait
|
* Function: sem_trywait
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -94,17 +94,17 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_trywait(sem_t *sem)
|
int sem_trywait(FAR sem_t *sem)
|
||||||
{
|
{
|
||||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
/* This API should not be called from interrupt handlers */
|
/* This API should not be called from interrupt handlers */
|
||||||
|
|
||||||
DEBUGASSERT(!up_interrupt_context())
|
DEBUGASSERT(up_interrupt_context() == FALSE)
|
||||||
|
|
||||||
/* Assume any errors reported are due to invalid arguments. */
|
/* Assume any errors reported are due to invalid arguments. */
|
||||||
|
|
||||||
|
|||||||
+30
-33
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_unlink.c
|
* sched/sem_unlink.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
@@ -44,46 +44,44 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_unlink
|
* Function: sem_unlink
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function removes the semaphore named by the input
|
* This function removes the semaphore named by the input parameter 'name.'
|
||||||
* parameter "name." If the semaphore named by "name" is
|
* If the semaphore named by 'name' is currently referenced by other task,
|
||||||
* currently referenced by other processes, the sem_unlink()
|
* the sem_unlink() will have no effect on the state of the semaphore. If
|
||||||
* will have no effect on the state of the semaphore. If
|
* one or more processes have the semaphore open when sem_unlink() is
|
||||||
* one or more processes have the semaphore open when
|
* called, destruction of the semaphore will be postponed until all
|
||||||
* sem_unlink() is called, destruction of the semaphore
|
* references to the semaphore have been destroyed by calls of sem_close().
|
||||||
* will be postponed until all references to the semaphore
|
|
||||||
* have been destroyed by calls of sem_close().
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* name - Semaphore name
|
* name - Semaphore name
|
||||||
@@ -93,9 +91,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_unlink(const char *name)
|
int sem_unlink(FAR const char *name)
|
||||||
{
|
{
|
||||||
FAR nsem_t *psem;
|
FAR nsem_t *psem;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
@@ -139,4 +137,3 @@ int sem_unlink(const char *name)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+31
-34
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sem_wait.c
|
* sched/sem_wait.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
@@ -45,59 +45,57 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sem_internal.h"
|
#include "sem_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Compilation Switches
|
* Compilation Switches
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sem_wait
|
* Function: sem_wait
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function attempts to lock the semaphore referenced
|
* This function attempts to lock the semaphore referenced by 'sem'. If
|
||||||
* by sem. If the semaphore value is (<=) zero, then the
|
* the semaphore value is (<=) zero, then the calling task will not return
|
||||||
* calling task will not return until it successfully
|
* until it successfully acquires the lock.
|
||||||
* acquires the lock.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* sem - Semaphore descriptor.
|
* sem - Semaphore descriptor.
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* 0 (OK), or -1 (ERROR) is unsuccessful
|
* 0 (OK), or -1 (ERROR) is unsuccessful
|
||||||
* If this function returns -1 (ERROR), then the cause
|
* If this function returns -1 (ERROR), then the cause of the failure will
|
||||||
* of the failure will be reported in "errno" as:
|
* be reported in 'errno' as:
|
||||||
* - EINVAL: Invalid attempt to get the semaphore
|
* - EINVAL: Invalid attempt to get the semaphore
|
||||||
* - EINTR: The wait was interrupted by the receipt of
|
* - EINTR: The wait was interrupted by the receipt of a signal.
|
||||||
* a signal.
|
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_wait(sem_t *sem)
|
int sem_wait(FAR sem_t *sem)
|
||||||
{
|
{
|
||||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
@@ -105,7 +103,7 @@ int sem_wait(sem_t *sem)
|
|||||||
|
|
||||||
/* This API should not be called from interrupt handlers */
|
/* This API should not be called from interrupt handlers */
|
||||||
|
|
||||||
DEBUGASSERT(!up_interrupt_context())
|
DEBUGASSERT(up_interrupt_context() == FALSE)
|
||||||
|
|
||||||
/* Assume any errors reported are due to invalid arguments. */
|
/* Assume any errors reported are due to invalid arguments. */
|
||||||
|
|
||||||
@@ -182,4 +180,3 @@ int sem_wait(sem_t *sem)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+51
-60
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_action.c
|
* sched/sig_action.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -44,38 +44,38 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sig_internal.h"
|
#include "sig_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define COPY_SIGACTION(t,f) \
|
#define COPY_SIGACTION(t,f) \
|
||||||
{ (t)->sa_sigaction = (f)->sa_sigaction; \
|
{ (t)->sa_sigaction = (f)->sa_sigaction; \
|
||||||
(t)->sa_mask = (f)->sa_mask; \
|
(t)->sa_mask = (f)->sa_mask; \
|
||||||
(t)->sa_flags = (f)->sa_flags; }
|
(t)->sa_flags = (f)->sa_flags; }
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sig_allocateaction
|
* Function: sig_allocateaction
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a new element for a sigaction queue
|
* Allocate a new element for a sigaction queue
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static FAR sigactq_t *sig_allocateaction(void)
|
static FAR sigactq_t *sig_allocateaction(void)
|
||||||
{
|
{
|
||||||
@@ -105,49 +105,41 @@ static FAR sigactq_t *sig_allocateaction(void)
|
|||||||
return sigact;
|
return sigact;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigaction
|
* Function: sigaction
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function allows the calling process to examine
|
* This function allows the calling process to examine and/or specify the
|
||||||
* and/or specify the action to be associated with a
|
* action to be associated with a specific signal.
|
||||||
* specific signal.
|
|
||||||
*
|
*
|
||||||
* The structure sigaction, used to describe an action to
|
* The structure sigaction, used to describe an action to be taken, is
|
||||||
* be taken, is defined to include the following members:
|
* defined to include the following members:
|
||||||
*
|
*
|
||||||
* - sa_u.sa_handler: Pointer to a signal-catching
|
* - sa_u.sa_handler: Pointer to a signal-catching function
|
||||||
* function
|
* - sa_u.sa_sigaction: Alternative form of the signal-catching function
|
||||||
* - sa_u.sa_sigaction: Alternative form of the
|
* - sa_mask: An additional set of signals to be blocked during execution
|
||||||
* signal-catching function
|
* of a signal catching function
|
||||||
* - sa_mask: An additional set of signals to be blocked
|
* - sa_flags. Special flags to affect the behavior of a signal.
|
||||||
* during execution of a signal catching function
|
|
||||||
* - sa_flags. Special flags to affect the behavior of a
|
|
||||||
* signal.
|
|
||||||
*
|
*
|
||||||
* If the argument 'act' is not NULL, it points to a
|
* If the argument 'act' is not NULL, it points to a structure specifying
|
||||||
* structure specifying the action to be associated with
|
* the action to be associated with the specified signal. If the argument
|
||||||
* the specified signal. If the argument 'oact' is not
|
* 'oact' is not NULL, the action previously associated with the signal
|
||||||
* NULL, the action previously associated with the signal
|
* is stored in the location pointed to by the argument 'oact.'
|
||||||
* is stored in the location pointed to by the argument
|
|
||||||
* 'oact.'
|
|
||||||
*
|
*
|
||||||
* When a signal is caught by a signal-catching function
|
* When a signal is caught by a signal-catching function installed by
|
||||||
* installed by sigaction() function, a new signal mask is
|
* sigaction() function, a new signal mask is calculated and installed for
|
||||||
* calculated and installed for the duration of the
|
* the duration of the signal-catching function. This mask is formed by
|
||||||
* signal-catching function. This mask is formed by taking
|
* taking the union of the current signal mask and the value of the
|
||||||
* the union of the current signal mask and the value of the
|
* sa_mask for the signal being delivered and then including the signal
|
||||||
* sa_mask for the signal being delivered and then including
|
* being delivered. If and when the user's signal handler returns, the
|
||||||
* the signal being delivered. If and when the user's signal
|
* original signal mask is restored.
|
||||||
* handler returns, the original signal mask is restored.
|
|
||||||
*
|
*
|
||||||
* Once an action is installed for a specific signal, it
|
* Once an action is installed for a specific signal, it remains installed
|
||||||
* remains installed until another action is explicitly
|
* until another action is explicitly requested by another call to sigaction().
|
||||||
* requested by another call to sigaction().
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* sig - Signal of interest
|
* sig - Signal of interest
|
||||||
@@ -166,18 +158,17 @@ static FAR sigactq_t *sig_allocateaction(void)
|
|||||||
* - All sa_flags in struct sigaction of act input are
|
* - All sa_flags in struct sigaction of act input are
|
||||||
* ignored (all treated like SA_SIGINFO).
|
* ignored (all treated like SA_SIGINFO).
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigaction(int signo, const struct sigaction *act,
|
int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *oact)
|
||||||
struct sigaction *oact)
|
|
||||||
{
|
{
|
||||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||||
FAR sigactq_t *sigact;
|
FAR sigactq_t *sigact;
|
||||||
int ret = ERROR; /* Assume failure */
|
int ret = ERROR; /* Assume failure */
|
||||||
|
|
||||||
/* Since sigactions can only be installed from the running
|
/* Since sigactions can only be installed from the running thread of
|
||||||
* thread of execution, no special precautions should be
|
* execution, no special precautions should be necessary.
|
||||||
* necessary. */
|
*/
|
||||||
|
|
||||||
/* Verify the signal */
|
/* Verify the signal */
|
||||||
|
|
||||||
@@ -262,13 +253,13 @@ int sigaction(int signo, const struct sigaction *act,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sig_releaseaction
|
* Function: sig_releaseaction
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Deallocate a sigaction Q entry
|
* Deallocate a sigaction Q entry
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void sig_releaseaction(FAR sigactq_t *sigact)
|
void sig_releaseaction(FAR sigactq_t *sigact)
|
||||||
{
|
{
|
||||||
|
|||||||
+27
-27
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_addset.c
|
* sched/sig_addset.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,44 +31,44 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigaddset
|
* Function: sigaddset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function adds the signal specified by signo to the
|
* This function adds the signal specified by signo to the signal set
|
||||||
* signal set specified by set.
|
* specified by set.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - Signal set to add signal to
|
* set - Signal set to add signal to
|
||||||
@@ -79,9 +79,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigaddset(sigset_t *set, int signo)
|
int sigaddset(FAR sigset_t *set, int signo)
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
@@ -89,10 +89,10 @@ int sigaddset(sigset_t *set, int signo)
|
|||||||
|
|
||||||
if (GOOD_SIGNO(signo))
|
if (GOOD_SIGNO(signo))
|
||||||
{
|
{
|
||||||
/* Add the signal to the set */
|
/* Add the signal to the set */
|
||||||
|
|
||||||
*set |= SIGNO2SET(signo);
|
*set |= SIGNO2SET(signo);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
+27
-27
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_delset.c
|
* sched/sig_delset.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,44 +31,44 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigdelset
|
* Function: sigdelset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function deletes the signal specified by signo from
|
* This function deletes the signal specified by signo from the signal
|
||||||
* the signal set specified by set.
|
* set specified by the 'set' argument.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - Signal set to delete the signal from
|
* set - Signal set to delete the signal from
|
||||||
@@ -79,9 +79,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigdelset(sigset_t *set, int signo)
|
int sigdelset(FAR sigset_t *set, int signo)
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
@@ -89,10 +89,10 @@ int sigdelset(sigset_t *set, int signo)
|
|||||||
|
|
||||||
if (GOOD_SIGNO(signo))
|
if (GOOD_SIGNO(signo))
|
||||||
{
|
{
|
||||||
/* Delete the signal to the set */
|
/* Delete the signal to the set */
|
||||||
|
|
||||||
*set &= ~SIGNO2SET(signo);
|
*set &= ~SIGNO2SET(signo);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
+25
-26
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_emptyset.c
|
* sched/sig_emptyset.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,57 +31,56 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigemptyset
|
* Function: sigemptyset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function initializes the signal set specified by
|
* This function initializes the signal set specified by set such that all
|
||||||
* set such that all signals are excluded.
|
* signals are excluded.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - Signal set to initalize
|
* set - Signal set to initalize
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* 0 (OK), or -1 (ERROR) if the signal set cannot be
|
* 0 (OK), or -1 (ERROR) if the signal set cannot be initialized.
|
||||||
* initialized.
|
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigemptyset(sigset_t *set)
|
int sigemptyset(FAR sigset_t *set)
|
||||||
{
|
{
|
||||||
*set = NULL_SIGNAL_SET;
|
*set = NULL_SIGNAL_SET;
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
+25
-26
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_fillset.c
|
* sched/sig_fillset.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,57 +31,56 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Publics Functioins
|
* Publics Functioins
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigfillset
|
* Function: sigfillset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function initializes the signal set specified by
|
* This function initializes the signal set specified by set such that all
|
||||||
* set such that all signals are included.
|
* signals are included.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - Signal set to initalize
|
* set - Signal set to initalize
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* 0 (OK), or -1 (ERROR) if the signal set cannot be
|
* 0 (OK), or -1 (ERROR) if the signal set cannot be initialized.
|
||||||
* initialized.
|
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigfillset(sigset_t *set)
|
int sigfillset(FAR sigset_t *set)
|
||||||
{
|
{
|
||||||
*set = ALL_SIGNAL_SET;
|
*set = ALL_SIGNAL_SET;
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
+25
-24
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_ismember.c
|
* sched/sig_ismember.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,44 +31,44 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigismember
|
* Function: sigismember
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function tests whether the signal specified by signo
|
* This function tests whether the signal specified by signo is a member
|
||||||
* is a member of the set specified by set.
|
* of the set specified by set.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - Signal set to test
|
* set - Signal set to test
|
||||||
@@ -81,9 +81,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigismember(const sigset_t *set, int signo)
|
int sigismember(FAR const sigset_t *set, int signo)
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
@@ -92,6 +92,7 @@ int sigismember(const sigset_t *set, int signo)
|
|||||||
if (GOOD_SIGNO(signo))
|
if (GOOD_SIGNO(signo))
|
||||||
{
|
{
|
||||||
/* Check if the signal is in the set */
|
/* Check if the signal is in the set */
|
||||||
|
|
||||||
ret = ((*set & SIGNO2SET(signo)) != 0);
|
ret = ((*set & SIGNO2SET(signo)) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+28
-29
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_pending.c
|
* sched/sig_pending.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -43,37 +43,37 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sig_internal.h"
|
#include "sig_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigpending
|
* Function: sigpending
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function stores the returns the set of signals that
|
* This function stores the returns the set of signals that are blocked
|
||||||
* are blocked for delivery and that are pending for the
|
* for delivery and that are pending for the calling process in the space
|
||||||
* calling process in the space pointed to by set.
|
* pointed to by set.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - The location to return the pending signal set.
|
* set - The location to return the pending signal set.
|
||||||
@@ -83,9 +83,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigpending(sigset_t *set)
|
int sigpending(FAR sigset_t *set)
|
||||||
{
|
{
|
||||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
@@ -99,12 +99,13 @@ int sigpending(sigset_t *set)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sig_pendingset
|
* Function: sig_pendingset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Convert the list of pending signals into a signal set
|
* Convert the list of pending signals into a signal set
|
||||||
************************************************************/
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
sigset_t sig_pendingset(FAR _TCB *stcb)
|
sigset_t sig_pendingset(FAR _TCB *stcb)
|
||||||
{
|
{
|
||||||
@@ -124,5 +125,3 @@ sigset_t sig_pendingset(FAR _TCB *stcb)
|
|||||||
|
|
||||||
return sigpendset;
|
return sigpendset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+38
-41
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_procmask.c
|
* sched/sig_procmask.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -50,58 +50,55 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sig_internal.h"
|
#include "sig_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigprocmask
|
* Function: sigprocmask
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function allows the calling process to examine
|
* This function allows the calling process to examine and/or change its
|
||||||
* and/or change its signal mask. If the set is not NULL,
|
* signal mask. If the 'set' is not NULL, then it points to a set of
|
||||||
* then it points to a set of signals to be used to change
|
* signals to be used to change the currently blocked set. The value of
|
||||||
* the currently blocked set. The value of how indicates
|
* 'how' indicates the manner in which the set is changed.
|
||||||
* the manner in which the set is changed.
|
|
||||||
*
|
*
|
||||||
* If there any pending unblocked signals after the call
|
* If there any pending unblocked signals after the call to sigprocmask(),
|
||||||
* to sigprocmask(), those signals will be delivered
|
* those signals will be delivered before sigprocmask() returns.
|
||||||
* before sigprocmask() returns.
|
|
||||||
*
|
*
|
||||||
* If sigprocmask() fails, the signal mask of the process
|
* If sigprocmask() fails, the signal mask of the process is not changed
|
||||||
* is not changed by this function call.
|
* by this function call.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* how - How the signal mast will be changed:
|
* how - How the signal mast will be changed:
|
||||||
* SIG_BLOCK - The resulting set is the union of
|
* SIG_BLOCK - The resulting set is the union of the current set
|
||||||
* the current set and the signal set
|
* and the signal set pointed to by 'set'.
|
||||||
* pointed to by set.
|
* SIG_UNBLOCK - The resulting set is the intersection of the current
|
||||||
* SIG_UNBLOCK - The resulting set is the intersection
|
* set and the complement of the signal set pointed to
|
||||||
* of the current set and the complement
|
* by 'set'.
|
||||||
* of the signal set pointed to by _set.
|
* SIG_SETMASK - The resulting set is the signal set pointed to by
|
||||||
* SIG_SETMASK - The resulting set is the signal set
|
* 'set'.
|
||||||
* pointed to by set.
|
* set - Location of the new signal mask
|
||||||
* set - Location of the new signal mask
|
|
||||||
* oset - Location to store the old signal mask
|
* oset - Location to store the old signal mask
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
@@ -109,9 +106,9 @@
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigprocmask(int how, const sigset_t *set, sigset_t *oset)
|
int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
|
||||||
{
|
{
|
||||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||||
sigset_t oldsigprocmask;
|
sigset_t oldsigprocmask;
|
||||||
|
|||||||
+33
-37
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_suspend.c
|
* sig_suspend.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -46,48 +46,46 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "sig_internal.h"
|
#include "sig_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigsuspend
|
* Function: sigsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
*
|
*
|
||||||
* The sigsuspend() function replaces the signal mask of the
|
* The sigsuspend() function replaces the signal mask of the task with the
|
||||||
* process with the set of signals pointed to by the argument
|
* set of signals pointed to by the argument 'set' and then suspends the
|
||||||
* set and then suspends the process until delivery of a
|
* process until delivery of a signal to the task.
|
||||||
* signal to the process.
|
|
||||||
*
|
*
|
||||||
* If the effect of the set argument is to unblock a
|
* If the effect of the set argument is to unblock a pending signal, then
|
||||||
* pending signal, then no wait is performed.
|
* no wait is performed.
|
||||||
*
|
*
|
||||||
* The original signal mask is restored when this function
|
* The original signal mask is restored when this function returns.
|
||||||
* returns.
|
|
||||||
*
|
*
|
||||||
* Waiting for an empty signal set stops a task without
|
* Waiting for an empty signal set stops a task without freeing any
|
||||||
* freeing any resources.
|
* resources.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - signal mask to use while suspended.
|
* set - signal mask to use while suspended.
|
||||||
@@ -100,16 +98,14 @@
|
|||||||
* POSIX Compatibility:
|
* POSIX Compatibility:
|
||||||
* int sigsuspend(const sigset_t *set);
|
* int sigsuspend(const sigset_t *set);
|
||||||
*
|
*
|
||||||
* POSIX states that sigsuspend() "suspends the process
|
* POSIX states that sigsuspend() "suspends the process until delivery of
|
||||||
* until delivery of a signal whose action is either to
|
* a signal whose action is either to execute a signal-catching function
|
||||||
* execute a signal-catching function or to terminate the
|
* or to terminate the process." Only the deliver of a signal is required
|
||||||
* process." Only the deliver of a signal is required in
|
* in the present implementation (even if the signal is ignored).
|
||||||
* the present implementation (even if the signal is
|
|
||||||
* ignored).
|
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigsuspend(const sigset_t *set)
|
int sigsuspend(FAR const sigset_t *set)
|
||||||
{
|
{
|
||||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||||
sigset_t intersection;
|
sigset_t intersection;
|
||||||
|
|||||||
+49
-54
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_timedwait.c
|
* sched/sig_timedwait.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -50,40 +50,40 @@
|
|||||||
#include "sig_internal.h"
|
#include "sig_internal.h"
|
||||||
#include "clock_internal.h"
|
#include "clock_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functionss
|
* Private Functionss
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sig_timeout
|
* Function: sig_timeout
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* A timeout elapsed while waiting for signals to be queued.
|
* A timeout elapsed while waiting for signals to be queued.
|
||||||
************************************************************/
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
static void sig_timeout(int argc, uint32 itcb, ...)
|
static void sig_timeout(int argc, uint32 itcb)
|
||||||
{
|
{
|
||||||
/* On many small machines, pointers are encoded and cannot
|
/* On many small machines, pointers are encoded and cannot be simply cast
|
||||||
* be simply cast from uint32 to _TCB*. The following
|
* from uint32 to _TCB*. The following union works around this
|
||||||
* union works around this (see wdogparm_t). This odd
|
* (see wdogparm_t). This odd logic could be conditioned on
|
||||||
* logic could be conditioned on CONFIG_CAN_CAST_POINTERS,
|
* CONFIG_CAN_CAST_POINTERS, but it is not too bad in any case.
|
||||||
* but it is not too bad in any case.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
union
|
union
|
||||||
@@ -105,37 +105,34 @@ static void sig_timeout(int argc, uint32 itcb, ...)
|
|||||||
|
|
||||||
if (u.wtcb->task_state == TSTATE_WAIT_SIG)
|
if (u.wtcb->task_state == TSTATE_WAIT_SIG)
|
||||||
{
|
{
|
||||||
u.wtcb->sigunbinfo.si_signo = ERROR;
|
u.wtcb->sigunbinfo.si_signo = ERROR;
|
||||||
u.wtcb->sigunbinfo.si_code = SI_TIMER;
|
u.wtcb->sigunbinfo.si_code = SI_TIMER;
|
||||||
u.wtcb->sigunbinfo.si_value.sival_int = 0;
|
u.wtcb->sigunbinfo.si_value.sival_int = 0;
|
||||||
up_unblock_task(u.wtcb);
|
up_unblock_task(u.wtcb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigtimedwait
|
* Function: sigtimedwait
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function selects the pending signal set specified
|
* This function selects the pending signal set specified by the argument
|
||||||
* by the argument set. If multiple signals are pending
|
* set. If multiple signals are pending in set, it will remove and return
|
||||||
* in set, it will remove and return the lowest numbered
|
* the lowest numbered one. If no signals in set are pending at the time
|
||||||
* one. If no signals in set are pending at the time of
|
* of the call, the calling process will be suspended until one of the
|
||||||
* the call, the calling process will be suspended until
|
* signals in set becomes pending, OR until the process is interrupted by
|
||||||
* one of the signals in set becomes pending, OR until
|
* an unblocked signal, OR until the time interval specified by timeout
|
||||||
* the process is interrupted by an unblocked signal, OR
|
* (if any), has expired. If timeout is NULL, then the timeout interval
|
||||||
* until the time interval specified by timeout (if any),
|
* is forever.
|
||||||
* has expired. If timeout is NULL, then the timeout
|
|
||||||
* interval is forever.
|
|
||||||
*
|
*
|
||||||
* If the info argument is non-NULL, the selected signal
|
* If the info argument is non-NULL, the selected signal number is stored
|
||||||
* number is stored in the si_signo member and the cause
|
* in the si_signo member and the cause of the signal is store in the
|
||||||
* of the signal is store in the si_code emember. The
|
* si_code emember. The content of si_value is only meaningful if the
|
||||||
* content of si_value is only meaningful if the signal was
|
* signal was generated by sigqueue().
|
||||||
* generated by sigqueue().
|
|
||||||
*
|
*
|
||||||
* The following values for si_code are defined in signal.h:
|
* The following values for si_code are defined in signal.h:
|
||||||
* SI_USER - Signal sent from kill, raise, or abort
|
* SI_USER - Signal sent from kill, raise, or abort
|
||||||
@@ -151,15 +148,15 @@ static void sig_timeout(int argc, uint32 itcb, ...)
|
|||||||
* timeout - The amount of time to wait
|
* timeout - The amount of time to wait
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Signal number that cause the wait to be terminated, otherwise
|
* Signal number that cause the wait to be terminated, otherwise -1 (ERROR)
|
||||||
* -1 (ERROR) is returned.
|
* is returned.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigtimedwait(const sigset_t *set, struct siginfo *info,
|
int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
||||||
const struct timespec *timeout)
|
FAR const struct timespec *timeout)
|
||||||
{
|
{
|
||||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||||
sigset_t intersection;
|
sigset_t intersection;
|
||||||
@@ -242,12 +239,11 @@ int sigtimedwait(const sigset_t *set, struct siginfo *info,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
wdparm_t wdparm;
|
wdparm_t wdparm;
|
||||||
wdparm.pvarg = (void*)rtcb;
|
wdparm.pvarg = (FAR void*)rtcb;
|
||||||
|
|
||||||
/* Start the watchdog */
|
/* Start the watchdog */
|
||||||
|
|
||||||
wd_start(wdog, waitticks, (wdentry_t)sig_timeout,
|
wd_start(wdog, waitticks, (wdentry_t)sig_timeout, 1, wdparm.dwarg);
|
||||||
1, wdparm.dwarg);
|
|
||||||
|
|
||||||
/* Now wait for either the signal or the watchdog */
|
/* Now wait for either the signal or the watchdog */
|
||||||
|
|
||||||
@@ -290,4 +286,3 @@ int sigtimedwait(const sigset_t *set, struct siginfo *info,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+26
-26
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* sig_waitinfo.c
|
* sched/sig_waitinfo.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,59 +31,59 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: sigwaitinfo
|
* Function: sigwaitinfo
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is equivalent to sigtimedwait with a NULL
|
* This function is equivalent to sigtimedwait with a NULL timeout
|
||||||
* timeout parameter. (see above).
|
* parameter.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* set - The pending signal set
|
* set - The pending signal set
|
||||||
* info - The returned value
|
* info - The returned value
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Signal number that cause the wait to be terminated, otherwise
|
* Signal number that cause the wait to be terminated, otherwise -1 (ERROR)
|
||||||
* -1 (ERROR) is returned.
|
* is returned.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sigwaitinfo(const sigset_t *set, struct siginfo *info)
|
int sigwaitinfo(FAR const sigset_t *set, FAR struct siginfo *info)
|
||||||
{
|
{
|
||||||
return sigtimedwait(set, info, NULL);
|
return sigtimedwait(set, info, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* timer_settime.c
|
* sched/timer_settime.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -140,7 +140,7 @@ static void inline timer_restart(FAR struct posix_timer_s *timer, uint32 itimer)
|
|||||||
if (timer->pt_delay)
|
if (timer->pt_delay)
|
||||||
{
|
{
|
||||||
timer->pt_last = timer->pt_delay;
|
timer->pt_last = timer->pt_delay;
|
||||||
(void)wd_start(timer->pt_wdog, timer->pt_delay, timer_timeout, 1, itimer);
|
(void)wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, 1, itimer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ static void inline timer_restart(FAR struct posix_timer_s *timer, uint32 itimer)
|
|||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
static void timer_timeout(int argc, uint32 itimer, ...)
|
static void timer_timeout(int argc, uint32 itimer)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_CAN_PASS_STRUCTS
|
#ifndef CONFIG_CAN_PASS_STRUCTS
|
||||||
/* On many small machines, pointers are encoded and cannot be simply cast from
|
/* On many small machines, pointers are encoded and cannot be simply cast from
|
||||||
@@ -355,7 +355,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
|
|||||||
if (delay > 0)
|
if (delay > 0)
|
||||||
{
|
{
|
||||||
timer->pt_last = delay;
|
timer->pt_last = delay;
|
||||||
ret = wd_start(timer->pt_wdog, timer->pt_delay, timer_timeout, 1, (uint32)timer);
|
ret = wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, 1, (uint32)timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore(state);
|
irqrestore(state);
|
||||||
|
|||||||
+27
-27
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* wd_create.c
|
* sched/wd_create.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <wdog.h>
|
#include <wdog.h>
|
||||||
@@ -43,55 +43,55 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include "wd_internal.h"
|
#include "wd_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: wd_create
|
* Function: wd_create
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The wd_create function will create a watchdog by
|
* The wd_create function will create a watchdog by allocating it from the
|
||||||
* allocating it from the free list.
|
* list of free watchdogs.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Pointer to watchdog (i.e., the watchdog ID), or NULL
|
* Pointer to watchdog (i.e., the watchdog ID), or NULL if insufficient
|
||||||
* if insufficient watchdogs are available.
|
* watchdogs are available.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
WDOG_ID wd_create (void)
|
WDOG_ID wd_create (void)
|
||||||
{
|
{
|
||||||
wdog_t *wdog;
|
FAR wdog_t *wdog;
|
||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
|
|
||||||
saved_state = irqsave();
|
saved_state = irqsave();
|
||||||
wdog = (wdog_t*)sq_remfirst(&g_wdfreelist);
|
wdog = (FAR wdog_t*)sq_remfirst(&g_wdfreelist);
|
||||||
irqrestore(saved_state);
|
irqrestore(saved_state);
|
||||||
|
|
||||||
/* Indicate that the watchdog is not actively timing */
|
/* Indicate that the watchdog is not actively timing */
|
||||||
|
|||||||
+43
-45
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/****************************************************************************
|
||||||
* wd_start.c
|
* sched/wd_start.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -46,13 +46,13 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "wd_internal.h"
|
#include "wd_internal.h"
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Type Declarations
|
* Private Type Declarations
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
typedef void (*wdentry0_t)(int argc);
|
typedef void (*wdentry0_t)(int argc);
|
||||||
#if CONFIG_MAX_WDOGPARMS > 0
|
#if CONFIG_MAX_WDOGPARMS > 0
|
||||||
@@ -70,23 +70,23 @@ typedef void (*wdentry4_t)(int argc, uint32 arg1, uint32 arg2,
|
|||||||
uint32 arg3, uint32 arg4);
|
uint32 arg3, uint32 arg4);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Global Variables
|
* Global Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Variables
|
* Private Variables
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: wd_start
|
* Function: wd_start
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -107,9 +107,9 @@ typedef void (*wdentry4_t)(int argc, uint32 arg1, uint32 arg2,
|
|||||||
* any effect.
|
* any effect.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* wdog = watchdog ID
|
* wdog = watchdog ID
|
||||||
* delay = Delay count in clock ticks
|
* delay = Delay count in clock ticks
|
||||||
* wdentry = function to call on timeout
|
* wdentry = function to call on timeout
|
||||||
* parm1..4 = parameters to pass to wdentry
|
* parm1..4 = parameters to pass to wdentry
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
@@ -119,15 +119,14 @@ typedef void (*wdentry4_t)(int argc, uint32 arg1, uint32 arg2,
|
|||||||
* The watchdog routine runs in the context of the timer interrupt
|
* The watchdog routine runs in the context of the timer interrupt
|
||||||
* handler and is subject to all ISR restrictions.
|
* handler and is subject to all ISR restrictions.
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
|
STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...)
|
||||||
int argc, ...)
|
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
wdog_t *curr;
|
FAR wdog_t *curr;
|
||||||
wdog_t *prev;
|
FAR wdog_t *prev;
|
||||||
wdog_t *next;
|
FAR wdog_t *next;
|
||||||
sint32 now;
|
sint32 now;
|
||||||
irqstate_t saved_state;
|
irqstate_t saved_state;
|
||||||
int i;
|
int i;
|
||||||
@@ -154,8 +153,8 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
|
|||||||
|
|
||||||
/* Save the data in the watchdog structure */
|
/* Save the data in the watchdog structure */
|
||||||
|
|
||||||
wdog->func = wdentry; /* Function to execute when delay expires */
|
wdog->func = wdentry; /* Function to execute when delay expires */
|
||||||
wdog->argc = argc;
|
wdog->argc = argc;
|
||||||
|
|
||||||
va_start(ap, argc);
|
va_start(ap, argc);
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
@@ -226,7 +225,7 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
|
|||||||
|
|
||||||
/* Insert the new watchdog in the list */
|
/* Insert the new watchdog in the list */
|
||||||
|
|
||||||
if (curr == (wdog_t*)g_wdactivelist.head)
|
if (curr == (FAR wdog_t*)g_wdactivelist.head)
|
||||||
{
|
{
|
||||||
sq_addfirst((FAR sq_entry_t*)wdog, &g_wdactivelist);
|
sq_addfirst((FAR sq_entry_t*)wdog, &g_wdactivelist);
|
||||||
}
|
}
|
||||||
@@ -268,14 +267,13 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/****************************************************************************
|
||||||
* Function: wd_timer
|
* Function: wd_timer
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is called from the timer interrupt
|
* This function is called from the timer interrupt handler to determine
|
||||||
* handler to determine if it is time to execute a watchdog
|
* if it is time to execute a watchdog function. If so, the watchdog
|
||||||
* function. If so, the watchdog function will be executed
|
* function will be executed in the context of the timer interrupt handler.
|
||||||
* in the context of the timer interrupt handler.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* None
|
* None
|
||||||
@@ -285,12 +283,12 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void wd_timer(void)
|
void wd_timer(void)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
wdog_t *wdog;
|
FAR wdog_t *wdog;
|
||||||
|
|
||||||
/* Check if there are any active watchdogs to process */
|
/* Check if there are any active watchdogs to process */
|
||||||
|
|
||||||
@@ -298,22 +296,22 @@ void wd_timer(void)
|
|||||||
{
|
{
|
||||||
/* There are. Decrement the lag counter */
|
/* There are. Decrement the lag counter */
|
||||||
|
|
||||||
--(((wdog_t*)g_wdactivelist.head)->lag);
|
--(((FAR wdog_t*)g_wdactivelist.head)->lag);
|
||||||
|
|
||||||
/* Check if the watchdog at the head of the list is ready to run */
|
/* Check if the watchdog at the head of the list is ready to run */
|
||||||
|
|
||||||
if (((wdog_t*)g_wdactivelist.head)->lag <= 0)
|
if (((FAR wdog_t*)g_wdactivelist.head)->lag <= 0)
|
||||||
{
|
{
|
||||||
/* Process the watchdog at the head of the list as well as any
|
/* Process the watchdog at the head of the list as well as any
|
||||||
* other watchdogs that became ready to run at this time
|
* other watchdogs that became ready to run at this time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (g_wdactivelist.head &&
|
while (g_wdactivelist.head &&
|
||||||
((wdog_t*)g_wdactivelist.head)->lag <= 0)
|
((FAR wdog_t*)g_wdactivelist.head)->lag <= 0)
|
||||||
{
|
{
|
||||||
/* Remove the watchdog from the head of the list */
|
/* Remove the watchdog from the head of the list */
|
||||||
|
|
||||||
wdog = (wdog_t*)sq_remfirst(&g_wdactivelist);
|
wdog = (FAR wdog_t*)sq_remfirst(&g_wdactivelist);
|
||||||
|
|
||||||
/* If there is another watchdog behind this one, update its
|
/* If there is another watchdog behind this one, update its
|
||||||
* its lag (this shouldn't be necessary).
|
* its lag (this shouldn't be necessary).
|
||||||
@@ -321,7 +319,7 @@ void wd_timer(void)
|
|||||||
|
|
||||||
if (g_wdactivelist.head)
|
if (g_wdactivelist.head)
|
||||||
{
|
{
|
||||||
((wdog_t*)g_wdactivelist.head)->lag += wdog->lag;
|
((FAR wdog_t*)g_wdactivelist.head)->lag += wdog->lag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indicate that the watchdog is no longer activer. */
|
/* Indicate that the watchdog is no longer activer. */
|
||||||
|
|||||||
Reference in New Issue
Block a user