diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index e609b5287b..90dfcec54f 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -16,7 +16,7 @@
by
Gregory Nutt
-Last Update: March 22, 2007
+Last Update: March 26, 2007
- See also arch/README.txt.
+ See also arch/README.txt
and configs/README.txt
.
General Philosophy. @@ -96,53 +104,66 @@
The general directly layout for NuttX is very similar to the directory structure -of the Linux kernel -- at least at the most superficial layers. -At the top level is the main makefile and a series of sub-directories identified -below and discussed in the following paragraphs:
- ++ Directory Structure. + The general directly layout for NuttX is very similar to the directory structure + of the Linux kernel -- at least at the most superficial layers. + At the top level is the main makefile and a series of sub-directories identified + below and discussed in the following paragraphs: +
. -|-- Makefile +|-- Makefile |-- Documentation -| `-- (documentation files) -|-- arch -| |-- <arch-name> -| | |-- include -| | `-- src -| `-- <:;other-architectures> -|-- configs -| |-- <board-name> -| | |-- Make.defs -| | |-- defconfig -| | `-- setenv.sh -| `-- <:;other-architectures> +| `-- (documentation files)/ +|-- arch/ +| |-- <arch-name>/ +| | |-- include/ +| | | |--<chip-name>/ +| | | | `-- (chip-specific header files) +| | | |--<other-chips>/ +| | | `-- (architecture-specific header files) +| | `-- src/ +| | |--<chip-name>/ +| | | `-- (chip-specific source files) +| | |--<other-chips>/ +| | `-- (architecture-specific source files) +| `-- <other-architectures>/ +|-- configs/ +| |-- <board-name>/ +| | |-- include/ +| | | `-- (board-specific header files) +| | |-- src/ +| | | |-- Makefile +| | | `-- (board-specific source files) +| | `-- (board-specific configuration files) +| `-- <other-boards>/ |-- drivers -| |-- Makefile -| `-- (driver source files) -|-- examples -| `-- (example) +| |-- Makefile/ +| `-- (common driver source files) +|-- examples/ +| `-- (example)/ | |-- Makefile | `-- (example source files) -|-- fs +|-- fs/ | |-- Makefile | `-- (fs source files) -|-- include +|-- include/ | |-- (standard header files) -| |-- nuttx +| |-- nuttx/ | | `-- (nuttx specific header files) -| `- sys +| `- sys/ | | `-- (more standard header files) -|-- lib +|-- lib/ | |-- Makefile | `-- (lib source files) -|-- mm +|-- mm/ | |-- Makefile | `-- (mm source files) -|-- sched +|-- sched/ | |-- Makefile | `-- (sched source files) -`-- tools +`-- tools/ |-- Makefile.mkconfig |-- configure.sh |-- mkconfig.c @@ -150,6 +171,40 @@ below and discussed in the following paragraphs: `-- zipme+
+ Configuration Files. + The NuttX configuration consists of: +
+arch/
<arch-name>/
directory
+ and are discussed in a paragraph below.
+
+ These chip-specific files are contained within chip-specific sub-directories in the
+ arch/
<arch-name>/
directory and are selected via
+ the CONFIG_ARCH_name
selection.
+
+ These board-specific configuration files can be found in the
+ configs/
<board-name>/
sub-directories and are discussed
+ in a a paragraph below.
+
@@ -168,23 +223,33 @@ below and discussed in the following paragraphs:
The complete board port in is defined by the architecture-specific code in this directory (plus the board-specific configurations in theconfig/
subdirectory).
- Each architecture must provide a subdirectory, <arch-name>
+ Each architecture must provide a subdirectory, <arch-name>
under arch/
with the following characteristics:
- <arch-name> + <arch-name>/ |-- include/ + | |--<chip-name>/ + | | `-- (chip-specific header files) + | |--<other-chips>/ | |-- arch.h | |-- irq.h | |-- types.h | `-- limits.h `-- src/ + |--<chip-name>/ + | `-- (chip-specific source files) + |--<other-chips>/ |-- Makefile `-- (architecture-specific source files)
include/
<chip-name>/
+ This sub-directory contains chip-specific header files.
+ include/arch.h
:
This is a hook for any architecture specific definitions that may
@@ -239,6 +304,10 @@ below and discussed in the following paragraphs:
by the board.
src/
<chip-name>/
+ This sub-directory contains chip-specific source files.
+ src/Makefile
:
This makefile will be executed to build the targets src/libup.a
and
@@ -251,7 +320,7 @@ below and discussed in the following paragraphs:
(architecture-specific source files).
The file include/nuttx/arch.h
identifies all of the APIs that must
be provided by the architecture specific logic. (It also includes
- arch/<arch-name>/arch.h
as described above).
+ arch/
<arch-name>/arch.h
as described above).
configs/
with the following characteristics:
- <board-name> + <board-name> |-- include/ + | `-- (board-specific header files) |-- src/ - | `-- Makefile + | |-- Makefile + | `-- (board-specific source files) |-- Make.defs |-- defconfig `-- setenv.sh-
include/
:
This directory contains board specific header files.
This directory will be linked as include/arch/board
at configuration time
and can be included via #include <arch/board/header.h>
.
- These header file can only be included by files in arch/<arch-name>/include/
- and arch/<arch-name>/src/
.
+ These header file can only be included by files in arch/
<arch-name>/include/
+ and arch/
<arch-name>/src/
.
src/
:
This directory contains board specific drivers.
- This directory will be linked as /src/board
libext$(LIBEXT)
, clean
, and distclean
.
+ The configs/
<board-name>/
sub-directory holds all of the
+ files that are necessary to configure Nuttx for the particular board.
+ The procedure for configuring NuttX is described below,
+ This paragraph will describe the contents of these configuration files.
+
Make.defs
: This makefile fragment provides architecture and
tool-specific build options. It will be included by all other
@@ -362,7 +443,12 @@ below and discussed in the following paragraphs:
+ All of the specific boards supported by NuttX are identified below. + These the the specific <board-name>'s that may be used to configure NuttX + as described below. +
configs/sim
:
A user-mode port of NuttX to the x86 Linux platform is available.
@@ -399,24 +485,6 @@ below and discussed in the following paragraphs:
is available to build these toolchains.
-- Configuring NuttX requires only copying: -
-configs/<board-name>/Make.def
to ${TOPDIR}/Make.defs
,
- configs/<board-name>/setenv.sh
to ${TOPDIR}/setenv.sh
, and
- configs/<board-name>/defconfig
to ${TOPDIR}/.config
-- There is a script that automates these steps. The following steps will - accomplish the same configuration: -
-- cd tools - ./configure.sh <board-name> -
@@ -453,33 +521,112 @@ below and discussed in the following paragraphs:
This directory holds a collection of standard libc-like functions with custom interfaces into Nuttx.
This is the NuttX memory manager.
The files forming core of the NuttX RTOS reside here.
This directory holds a collection of tools and scripts to simplify configuring and building NuttX.
+
+ The top-level Makefile
in the ${TOPDIR}
directory contains all of the top-level control
+ logic to build NuttX.
+ Use of this Makefile
to build NuttX is described below.
+
+ Manual Configuration.
+ Configuring NuttX requires only copying the
+ board-specific configuration files into the top level directory which appears in the make files as the make variable, ${TOPDIR}
.
+ This could be done manually as follows:
+
configs/
<board-name>/Make.def to ${TOPDIR}/Make.defs
,configs/
<board-name>/setenv.sh to ${TOPDIR}/setenv.sh
, andconfigs/
<board-name>/defconfig to ${TOPDIR}/.config
+ Where <board-name> is the name of one of the sub-directories of the
+ NuttX configs/
directory.
+ This sub-directory name corresponds to one of the supported boards
+ identified above.
+
+ Automated Configuration. + There is a script that automates these steps. The following steps will + accomplish the same configuration: +
++ cd tools + ./configure.sh <board-name> ++ +
+ Additional Configuration Steps.
+ The remainder of configuration steps will be performed by ${TOPDIR}/Makefile
+ the first time the system is built as described below.
+
+ Building NuttX. + Once NuttX has been configured as described above, it may be built as follows: +
++cd ${TOPDIR} +source ./setenv.sh +make ++
+ The ${TOPDIR}
directory holds:
+
Makefile
that controls the NuttX build.
++ That directory also holds: +
+.config
that describes the current configuration.Make.defs
that provides customized build targers, andsetenv.sh
that sets up the configuration environment for the build.
+The setenv.sh
contains Linux environmental settings that are needed for the build.
+The specific environmental definitions are unique for each board but should include, as a minimum, updates to the PATH
variable to include the full path to the architecture-specific toolchain identified in Make.defs
.
+The setenv.sh
only needs to be source'ed at the beginning of a session.
+The system can be re-made subsequently by just typing make
.
+
+ First Time Make. + Additional configuration actions will be taken the first time that system is built. + These additional steps include: +
+include/nuttx/config.
using the ${TOPDIR}/.config
file.
+ ${TOPDIR}/arch/
<arch-name>/include
at ${TOPDIR}/include/arch
.
+ ${TOPDIR}/configs/
<board-name>/include
at ${TOPDIR}/include/arch/board
.
+ ${TOPDIR}/configs/
<board-name>/src
at ${TOPDIR}/arch/
<arch-name>/src/board
+ +
User's Manual -
+ +
by -
+
Gregory Nutt -
-Last Update: March 21, 2007 +
+Last Update: March 26, 2007
-This user's manual is divided into three sections plus a index: -
+ This manual provides general usage information for the NuttX RTOS from the + perspective of the firmware developer. + +
+ This user's manual is divided into three sections plus a index: +
++ The intended audience for this document are firmware developers who are implementing applications on NuttX. + Specifically, this documented is limited to addressing only NuttX RTOS APIs that are available to the application developer. + As such, this document does not focus on any technical details of the organization or implementation of NuttX. + Those technical details are provided in the NuttX Porting Guide. +
++ Information about configuring and building NuttX is also needed by the application developer. + That information can also be found in the NuttX Porting Guide. +
--This section describes each C-callable interface to the NuttX -Operating System. The description of each interface is presented -in the following format: -
-Function Prototype: The C prototype of the interface function +
+ This section describes each C-callable interface to the NuttX + Operating System. The description of each interface is presented + in the following format: +
+Function Prototype: The C prototype of the interface function is provided. -
-Description: The operation performed by the interface function +
+Description: The operation performed by the interface function is discussed. -
-Input Parameters: All input parameters are listed along +
+Input Parameters: All input parameters are listed along with brief descriptions of each input parameter. -
-Returned Values: All possible values returned by the interface +
+Returned Values: All possible values returned by the interface function are listed. Values returned as side-effects (through pointer input parameters or through global variables) will be addressed in the description of the interface function. -
-Assumptions/Limitations: Any unusual assumptions made by +
+Assumptions/Limitations: Any unusual assumptions made by the interface function or any non-obvious limitations to the use of the interface function will be indicated here. -
-POSIX Compatibility: Any significant differences between the +
+POSIX Compatibility: Any significant differences between the NuttX interface and its corresponding POSIX interface will be noted here. -
+
NOTE: In order to achieve an independent name space for the NuttX interface functions, differences in function names and types are to be expected and will not be identified as differences in these paragraphs. -
Tasks. @@ -139,20 +164,20 @@ paragraphs.
-Function Prototype: +
+Function Prototype:
#include <sched.h> int task_create(char *name, int priority, int stack_size, main_t entry, const char *argv[]);-
-Description: +
+Description: This function creates and activates a new task with a specified priority and returns its system-assigned ID.
-The entry address entry is the address of the "main" +
The entry address entry is the address of the "main" function of the task. This function will be called once the C environment has been set up. The specified function will be called with four arguments. @@ -180,34 +205,34 @@ paragraphs. descriptors (corresponding to stdin, stdout, and stderr) and redirection of standard I/O is supported.
--Input Parameters: -
+Input Parameters: +
CONFIG_MAX_TASK_ARG
parameters may be provided.
If fewer than CONFIG_MAX_TASK_ARG
parameters are
passed, the list should be terminated with a NULL argv[] value.
If no parameters are required, argv may be NULL.
- - Returned Values: +
+ Returned Values:
--Assumptions/Limitations: -
-POSIX Compatibility: This is a NON-POSIX interface. +
+Assumptions/Limitations: +
+POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following similar interface:
int taskSpawn(char *name, int priority, int options, int stackSize, FUNCPTR entryPt, @@ -215,71 +240,71 @@ VxWorks provides the following similar interface: int arg6, int arg7, int arg8, int arg9, int arg10);-
+
The NuttX task_create() differs from VxWorks' taskSpawn() in the following ways:
--Function Prototype: +
+Function Prototype:
#include <sched.h> STATUS task_init(_TCB *tcb, char *name, int priority, uint32 *stack, uint32 stack_size, maint_t entry, const char *argv[]);-
-Description: -
+
+Description: +
This function initializes a Task Control Block (TCB)
in preparation for starting a new thread. It performs a subset
of the functionality of task_create()
(see above).
+
Unlike task_create(), task_init() does not activate the task. This must be done by calling task_activate().
--Input Parameters: -
+Input Parameters: +
CONFIG_MAX_TASK_ARG
parameters may be provided.
If fewer than CONFIG_MAX_TASK_ARG
parameters are
passed, the list should be terminated with a NULL argv[] value.
If no parameters are required, argv may be NULL.
- -Returned Values: +
+Returned Values:
-OK, or ERROR if the task cannot be initialized.
-This function can only failure is it is unable to assign +
OK, or ERROR if the task cannot be initialized.
+This function can only failure is it is unable to assign a new, unique task ID to the TCB (errno is not set).
--Assumptions/Limitations: -
+Assumptions/Limitations: +
-POSIX Compatibility: This is a NON-POSIX interface. +
+POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following similar interface:
STATUS taskInit(WIND_TCB *pTcb, char *name, int priority, int options, uint32 *pStackBase, int stackSize, @@ -287,121 +312,121 @@ VxWorks provides the following similar interface: int arg6, int arg7, int arg8, int arg9, int arg10);-
+
The NuttX task_init() differs from VxWorks' taskInit() in the following ways:
--Function Prototype: +
+Function Prototype:
#include <sched.h> STATUS task_activate( _TCB *tcb );-
-Description: This function activates tasks created by task_init(). +
+Description: This function activates tasks created by task_init(). Without activation, a task is ineligible for execution by the scheduler. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
+Assumptions/Limitations: +
-POSIX Compatibility: This is a NON-POSIX interface. +
+POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following similar interface:
STATUS taskActivate( int tid );-
+
The NuttX task_activate() differs from VxWorks' taskActivate() in the following ways:
--Function Prototype: +
+Function Prototype:
#include <sched.h> STATUS task_delete( pid_t pid );-
-Description: This function causes a specified task to cease +
+Description: This function causes a specified task to cease to exist -- its stack and TCB will be deallocated. This function is the companion to task_create(). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
+
+Assumptions/Limitations: +
task_delete() must be used with caution: If the task holds resources (for example, allocated memory or semaphores needed by other tasks), then task_delete() can strand those resources. -
-POSIX Compatibility: This is a NON-POSIX interface. +
+POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following similar interface:
STATUS taskDelete( int tid );-
+
The NuttX task_delete() differs from VxWorks' taskDelete() in the following ways:
--Function Prototype: +
+Function Prototype:
#include <sched.h> void exit( int code ); @@ -410,25 +435,25 @@ VxWorks provides the following similar interface: void _exit( int code );-
-Description: This function causes the calling task to cease +
+Description: This function causes the calling task to cease to exist -- its stack and TCB will be deallocated. exit differs from _exit in that it flushs streams, closes file descriptors and will execute any function registered with atexit(). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: None. +
+Returned Values: None. -
-Assumptions/Limitations: +
+Assumptions/Limitations: -
-POSIX Compatibility: This is equivalent to the ANSI interface: +
+POSIX Compatibility: This is equivalent to the ANSI interface:
void exit( int code );@@ -437,92 +462,92 @@ And the unix interface: void _exit( int code ); -
+
The NuttX exit() differs from ANSI exit() in the following ways:
--Function Prototype: +
+Function Prototype:
#include <sched.h> STATUS task_restart( pid_t pid );-
-Description: This function "restarts" a task. +
+Description: This function "restarts" a task. The task is first terminated and then reinitialized with same ID, priority, original entry point, stack size, and parameters it had when it was first started. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
-POSIX Compatibility: This is a NON-POSIX interface. +
+Assumptions/Limitations: +
+POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following similar interface:
STATUS taskRestart (int tid);-
+
The NuttX task_restart() differs from VxWorks' taskRestart() in the following ways:
--Function Prototype: +
+Function Prototype:
#include <unistd.h> pid_t getpid( void );-
-Description: This function returns the task ID of the +
+Description: This function returns the task ID of the calling task. The task ID will be invalid if called at the interrupt level. -
-Input Parameters: None. -
-Returned Values: -
+Input Parameters: None. +
+Returned Values: +
-Assumptions/Limitations: -
-POSIX Compatibility: +
+Assumptions/Limitations: +
+POSIX Compatibility: Compatible with the POSIX interface of the same name. -
By default, NuttX performs strict priority scheduling: Tasks of higher @@ -560,7 +585,7 @@ Compatible with the POSIX interface of the same name. int sched_setparam(pid_t pid, const struct sched_param *param);
- Description: + Description: This function sets the priority of the task specified by pid input parameter.
@@ -607,7 +632,7 @@ Compatible with the POSIX interface of the same name. Assumptions/Limitations:
- POSIX Compatibility: + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include:
@@ -617,66 +642,75 @@ Compatible with the POSIX interface of the same name.-Function Prototype: +
+Function Prototype:
#include <sched.h> int sched_getparam (pid_t pid, struct sched_param *param);-
-Description: This function gets the scheduling priority +
+Description: This function gets the scheduling priority of the task specified by pid. -
-Input Parameters: -
param.
+Input Parameters: +
pid
. The task ID of the task.
+ If pid is zero, the priority of the calling task is returned.
+param
.
+ A structure whose member sched_priority
is the integer priority.
+ The task's priority is copied to the sched_priority
element of this structure.
+-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <sched.h> int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);-
- Description: +
+ Description: sched_setscheduler() sets both the scheduling policy and the priority for the task identified by pid. If pid equals zero, the scheduler of the calling thread will be set. The parameter 'param' holds the priority of the thread under the new policy.
--Input Parameters: -
+Input Parameters: +
param.
param. A structure whose member sched_priority is the
integer priority. The range of valid priority numbers is from
SCHED_PRIORITY_MIN through SCHED_PRIORITY_MAX.
-
- Returned Values: + + +
+ Returned Values: On success, sched_setscheduler() returns OK (zero). On error, ERROR (-1) is returned, and errno is set appropriately:
@@ -684,23 +718,23 @@ interface of the same name.-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <sched.h> int sched_getscheduler (pid_t pid);-
- Description: +
+ Description: sched_getscheduler() returns the scheduling policy currently applied to the task identified by pid. If pid equals zero, the policy of the calling process will @@ -712,18 +746,18 @@ interface of the same name. This function returns the current scheduling policy. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX + +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <sched.h> int sched_yield( void );-
-Description: This function forces the calling task to give +
+Description: This function forces the calling task to give up the CPU (only to other tasks at the same priority). -
-Input Parameters: None. -
-Returned Values: -
+Input Parameters: None. +
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <sched.h> int sched_get_priority_max (int policy)-
-Description: This function returns the value of the highest +
+Description: This function returns the value of the highest possible task priority for a specified scheduling policy. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <sched.h> int sched_get_priority_min (int policy);-
-Description: This function returns the value of the lowest +
+Description: This function returns the value of the lowest possible task priority for a specified scheduling policy. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <sched.h> int sched_get_rr_interval (pid_t pid, struct timespec *interval);-
- Description: +
+ Description: sched_rr_get_interval() writes the timeslice interval for task identified by pid into the timespec structure pointed to by interval. If pid is zero, the timeslice @@ -846,35 +880,35 @@ interface of the same name. identified process should be running under the SCHED_RR scheduling policy.'
-- Input Parameters: +
+ Input Parameters:
-- Returned Values: +
+ Returned Values: On success, sched_rr_get_interval() returns OK (0). On error, ERROR (-1) is returned, and errno is set to:
-- Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+ Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
--Function Prototype: +
+Function Prototype:
#include <sched.h> STATUS sched_lock( void );-
-Description: This function disables context switching by +
+Description: This function disables context switching by Disabling addition of new tasks to the ready-to-run task list. The task that calls this function will be the only task that is allowed to run until it either calls sched_unlock (the appropriate number of times) or until it blocks itself. -
-Input Parameters: None. -
-Returned Values: -
+Input Parameters: None. +
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: This is a NON-POSIX interface. +
+Assumptions/Limitations: +
+ POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the comparable interface:
STATUS taskLock( void ); @@ -916,32 +950,32 @@ VxWorks provides the comparable interface:2.3.2 sched_unlock
--Function Prototype: +
+Function Prototype:
#include <sched.h> STATUS sched_unlock( void );--Description: This function decrements the preemption lock +
+Description: This function decrements the preemption lock count. Typically this is paired with sched_lock() and concludes a critical section of code. Preemption will not be unlocked until sched_unlock() has been called as many times as sched_lock(). When the lockCount is decremented to zero, any tasks that were eligible to preempt the current task will execute. -
-Input Parameters: None. -
-Returned Values: -
+Input Parameters: None. +
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: This is a NON-POSIX interface. +
+Assumptions/Limitations: +
+ POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the comparable interface:
STATUS taskUnlock( void ); @@ -949,33 +983,33 @@ VxWorks provides the comparable interface:2.3.3 sched_lockcount
--Function Prototype: +
+Function Prototype:
#include <sched.h> sint32 sched_lockcount( void )--Description: This function returns the current value of +
+Description: This function returns the current value of the lockCount. If zero, preemption is enabled; if non-zero, this value indicates the number of times that sched_lock() has been called on this thread of execution. -
-Input Parameters: None. -
-Returned Values: -
+Input Parameters: None. +
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: None. -
+Assumptions/Limitations: +
+ POSIX Compatibility: None. +
NuttX supports POSIX named message queues for intertask communication. @@ -995,43 +1029,43 @@ on this thread of execution.
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> mqd_t mq_open( const char *mqName, int oflags, ... );-
-Description: This function establish a connection between +
+Description: This function establish a connection between a named message queue and the calling task. After a successful call of mq_open(), the task can reference the message queue using the address returned by the call. The message queue remains usable until it is closed by a successful call to mq_close(). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX interface +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> int mq_close( mqd_t mqdes );-
-Description: This function is used to indicate that the +
+Description: This function is used to indicate that the calling task is finished with the specified message queued mqdes. The mq_close() deallocates any system resources allocated by the system for use by this task for its message queue. -
+
If the calling task has attached a notification request to the message queue via this mqdes (see mq_notify()), this attachment will be removed and the message queue is available for another task to attach for notification. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
-
+Assumptions/Limitations: +
+
- POSIX Compatibility: Comparable to the POSIX interface +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> int mq_unlink( const char *mqName );-
-Description: This function removes the message queue named +
+Description: This function removes the message queue named by "mqName." If one or more tasks have the message queue open when mq_unlink() is called, removal of the message queue is postponed until all references to the message queue have been closed. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: None. -
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Returned Values: None. +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> int mq_send( mqd_t mqdes, const void *msg, size_t msgLen, int msgPrio );-
-Description: This function adds the specified message (msg) +
+Description: This function adds the specified message (msg) to the message queue (mqdes). The "msgLen" parameter specifies the length of the message in bytes pointed to by "msg." This length must not exceed the maximum message length from the mq_getattr(). -
+
If the message queue is not full, mq_send() will in the message in the message queue at the position indicated by the "msgPrio" argument. Messages with higher priority will be inserted before lower priority messages. The value of "msgPrio" must not exceed MQ_PRIO_MAX. -
+
If the specified message queue is full and O_NONBLOCK is not set in the message queue, then mq_send() will block until space becomes available to the queue the message. -
+
If the message queue is full and osNON_BLOCK is set, the message is not queued and ERROR is returned. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: None. -
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Returned Values: None. +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> int mq_receive( mqd_t mqdes, void *msg, size_t msgLen, int *msgPrio );-
-Description: This function receives the oldest of the highest +
+Description: This function receives the oldest of the highest priority messages from the message queue specified by "mqdes." If the size of the buffer in bytes (msgLen) is less than the "mq_msgsize" attribute of the message queue, mq_receive will return an error. Otherwise, the select message is removed from the queue and copied to "msg." -
+
If the message queue is empty and O_NONBLOCK was not set, mq_receive() will block until a message is added to the message queue. If more than one task is waiting to receive a message, only the task with the highest priority that has waited the longest will be unblocked. -
+
If the queue is empty and O_NONBLOCK is set, ERROR will be returned. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> int mq_notify( mqd_t mqdes, const struct sigevent *notification );-
-Description: If the "notification" input parameter +
+Description: If the "notification" input parameter is not NULL, this function connects the task with the message queue such that the specified signal will be sent to the task whenever the message changes from empty to non-empty. One notification can be attached to a message queue. -
+
If "notification" is NULL, the attached notification is detached (if it was held by the calling task) and the queue is available to attach another notification. -
+
When the notification is sent to the registered task, its registration will be removed. The message queue will then be available for registration. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: None. -
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX interface +
+Returned Values: None. +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> int mq_setattr( mqd_t mqdes, const struct mq_attr *mqStat, struct mq_attr *oldMqStat);-
-Description: This function sets the attributes associated +
+Description: This function sets the attributes associated with the specified message queue "mqdes." Only the "O_NONBLOCK" bit of the "mq_flags" can be changed. -
+
If "oldMqStat" is non-null, mq_setattr() will store the previous message queue attributes at that location (just as would have been returned by mq_getattr()). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <mqueue.h> int mq_getattr( mqd_t mqdes, struct mq_attr *mqStat);-
-Description: This functions gets status information and +
+Description: This functions gets status information and attributes associated with the specified message queue. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Semaphores. Semaphores are the basis for @@ -1385,16 +1419,16 @@ interface of the same name. and, as a result, can adversely affect system response times.
- Priority Inversion. Proper use of semaphores avoids the issues of + Priority Inversion. Proper use of semaphores avoids the issues of sched_lock(). However, consider the following example:
@@ -1413,13 +1447,13 @@ interface of the same name. provide implementations that will not suffer from priority inversion. The designer may, as examples:
-POSIX semaphore interfaces:
@@ -1437,413 +1471,413 @@ interface of the same name.-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_init ( sem_t *sem, int pshared, unsigned int value );-
-Description: This function initializes the UN-NAMED semaphore +
+Description: This function initializes the UN-NAMED semaphore sem. Following a successful call to sem_init(), the semaphore may be used in subsequent calls to sem_wait(), sem_post(), and sem_trywait(). The semaphore remains usable until it is destroyed. -
+
Only sem itself may be used for performing synchronization. The result of referring to copies of sem in calls to sem_wait(), sem_trywait(), sem_post(), and sem_destroy(), is not defined. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_destroy ( sem_t *sem );-
-Description: This function is used to destroy the un-named semaphore +
+Description: This function is used to destroy the un-named semaphore indicated by sem. Only a semaphore that was created using sem_init() may be destroyed using sem_destroy(). The effect of calling sem_destroy() with a named semaphore is undefined. The effect of subsequent use of the semaphore sem is undefined until sem is re-initialized by another call to sem_init(). -
+
The effect of destroying a semaphore upon which other tasks are currently blocked is undefined. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> sem_t *sem_open ( const char *name, int oflag, ...);-
-Description: This function establishes a connection between +
+Description: This function establishes a connection between named semaphores and a task. Following a call to sem_open() with the semaphore name, the task may reference the semaphore associated with name using the address returned by this call. The semaphore may be used in subsequent calls to sem_wait(), sem_trywait(), and 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 same name, then the same semaphore address is returned (provided there have been no calls to sem_unlink()). -
-Input Parameters: -
+Input Parameters: +
include/limits.h
).
--Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_close ( sem_t *sem );-
-Description: This function is called to indicate that the +
+Description: This function is called to indicate that the calling task is finished with the specified named semaphore, sem. The sem_close() deallocates any system resources allocated by the system for this named semaphore. -
+
If the semaphore has not been removed with a call to sem_unlink(), then sem_close() has no effect on the named semaphore. However, when the named semaphore has been fully unlinked, the semaphore will vanish when the last task closes it. -
+
Care must be taken to avoid risking the deletion of a semaphore that another calling task has already locked. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
+Assumptions/Limitations: +
- POSIX Compatibility: Comparable to the POSIX +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_unlink ( const char *name );-
-Description: This function will remove the semaphore named by the +
+Description: This function will remove the semaphore named by the input name parameter. If one or more tasks have the semaphore named by name oepn when sem_unlink() is called, destruction of the semaphore will be postponed until all references have been destroyed by calls to sem_close(). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
+Assumptions/Limitations: +
- POSIX Compatibility: Comparable to the POSIX +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_wait ( sem_t *sem );-
-Description: This function attempts to lock the semaphore +
+Description: This function attempts to lock the semaphore referenced by sem. If the semaphore as already locked by another task, the calling task will not return until it either successfully acquires the lock or the call is interrupted by a signal. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+
+Returned Values: +
If sem_wait returns -1 (ERROR) then the cause of the failure will be indicated by the thread-specific errno value (a pointer to this value can be obtained using get_errno_ptr()). The following lists the possible values for errno: -
-
+
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_trywait ( sem_t *sem );-
-Description: This function locks the specified semaphore +
+Description: This function locks the specified semaphore only if the semaphore is currently not locked. In any event, the call returns without blocking. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-
+
+
-
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_post ( sem_t *sem );-
-Description: When a task has finished with a semaphore, +
+Description: When a task has finished with a semaphore, it will call sem_post(). This function unlocks the semaphore referenced by sem by performing the semaphore unlock operation. -
+
If the semaphore value resulting from this operation is positive, then no tasks were blocked waiting for the semaphore to become unlocked; The semaphore value is simply incremented. -
+
If the value of the semaphore resulting from this operation is zero, then on of the tasks blocked waiting for the semaphore will be allowed to return successfully from its call to sem_wait(). -
-NOTE: sem_post() may be called from an interrupt handler. -
-Input Parameters: -
+NOTE: sem_post() may be called from an interrupt handler. +
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: This function cannot be called +
+Assumptions/Limitations: This function cannot be called from an interrupt handler. It assumes the currently executing task is the one that is performing the unlock. -
- POSIX Compatibility: Comparable to the POSIX +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <semaphore.h> int sem_getvalue ( sem_t *sem, int *sval );-
-Description: This function updates the location referenced +
+Description: This function updates the location referenced by sval argument to have the value of the semaphore referenced by sem without effecting the state of the semaphore. The updated value represents the actual semaphore value that occurred at some unspecified time during the call, but may not reflect the actual value of the semaphore when it is returned to the calling task. -
+
If sem is locked, the value return by sem_getvalue() will either be zero or a negative number whose absolute value represents the number of tasks waiting for the semaphore. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. -
+
NuttX provides a general watchdog timer facility. This facility allows the NuttX user to specify a watchdog timer function that will run after a specified delay. @@ -1861,174 +1895,174 @@ interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <wdog.h> WDOG_ID wd_create (void);-
-Description: The wd_create function will create a watchdog +
+Description: The wd_create function will create a watchdog by allocating the appropriate resources for the watchdog. -
-Input Parameters: None. -
-Returned Values: -
+Input Parameters: None. +
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: This is a NON-POSIX interface. +
+Assumptions/Limitations: +
+ POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:
WDOG_ID wdCreate (void);-
+
Differences from the VxWorks interface include: -
-Function Prototype: +
+Function Prototype:
#include <wdog.h> STATUS wd_delete (WDOG_ID wdog);-
-Description: The wd_delete function will deallocate a +
+Description: The wd_delete function will deallocate a watchdog. The watchdog will be removed from the timer queue if has been started. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: It is the responsibility of the +
+Assumptions/Limitations: It is the responsibility of the caller to assure that the watchdog is inactive before deleting it. -
- POSIX Compatibility: This is a NON-POSIX interface. +
+ POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:
STATUS wdDelete (WDOG_ID wdog);-
+
Differences from the VxWorks interface include: -
-Function Prototype: +
+Function Prototype:
#include <wdog.h> STATUS wd_start( WDOG_ID wdog, int delay, wdentry_t wdentry, intt argc, ....);-
-Description: This function adds a watchdog to the timer +
+Description: This function adds a watchdog to the timer queue. The specified watchdog function will be called from the interrupt level after the specified number of ticks has elapsed. Watchdog timers may be started from the interrupt level. -
+
Watchdog times execute in the context of the timer interrupt handler, but with the PIC/PID address environment that was in place when wd_start() was called. -
+
Watchdog timers execute only once. -
+
To replace either the timeout delay or the function to be executed, call wd_start again with the same wdog; only the most recent wd_start() on a given watchdog ID has any effect. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: The watchdog routine runs in the +
+Assumptions/Limitations: The watchdog routine runs in the context of the timer interrupt handler and is subject to all ISR restrictions. -
- POSIX Compatibility: This is a NON-POSIX interface. +
+ POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:
STATUS wdStart (WDOG_ID wdog, int delay, FUNCPTR wdentry, int parameter);-
+
Differences from the VxWorks interface include: -
-Function Prototype: +
+Function Prototype:
#include <wdog.h> STATUS wd_cancel (WDOG_ID wdog);-
-Description: This function cancels a currently running +
+Description: This function cancels a currently running watchdog timer. Watchdog timers may be canceled from the interrupt level. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: This is a NON-POSIX interface. +
+Assumptions/Limitations: +
+ POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:
STATUS wdCancel (WDOG_ID wdog); @@ -2058,9 +2092,9 @@ VxWorks provides the following comparable interface: means either that wdog is not valid or that the wdog has already expired. -
+
-2.7 Clocks and Timers
+2.7 Clocks and Timers
Function Prototype:
@@ -2100,10 +2134,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:Exxx
.To be provided
.Function Prototype:
@@ -2128,10 +2162,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:Exxx
.To be provided
.Function Prototype:
@@ -2156,10 +2190,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:Exxx
.To be provided
.Function Prototype:
@@ -2184,10 +2218,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:Exxx
.To be provided
.Function Prototype:
@@ -2212,16 +2246,16 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:Exxx
.To be provided
.#include <time.h> #define localtime_r(c,r) gmtime_r(c,r)-
Function Prototype:
@@ -2291,7 +2325,7 @@ VxWorks provides the following comparable interface:CLOCK_REALTIME
is supported for the clockid
argument.Function Prototype:
@@ -2329,7 +2363,7 @@ VxWorks provides the following comparable interface: Comparable to the POSIX interface of the same name. -Function Prototype:
@@ -2411,7 +2445,7 @@ VxWorks provides the following comparable interface:ovalue
argument is ignored.Function Prototype:
@@ -2458,7 +2492,7 @@ VxWorks provides the following comparable interface: Comparable to the POSIX interface of the same name. -Function Prototype:
@@ -2513,14 +2547,14 @@ VxWorks provides the following comparable interface:-POSIX Compatibility: Comparable to the POSIX +Assumptions/Limitations: +
+POSIX Compatibility: Comparable to the POSIX interface of the same name. -
NuttX provides signal interfaces for tasks. Signals are used to @@ -2563,412 +2597,412 @@ interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigemptyset(sigset_t *set);-
-Description: This function initializes the signal set specified +
+Description: This function initializes the signal set specified by set such that all signals are excluded. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigfillset(sigset_t *set);-
-Description: This function initializes the signal set specified +
+Description: This function initializes the signal set specified by set such that all signals are included. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigaddset(sigset_t *set, int signo);-
-Description: This function adds the signal specified by +
+Description: This function adds the signal specified by signo to the signal set specified by set. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigdelset(sigset_t *set, int signo);-
-Description: This function deletes the signal specified +
+Description: This function deletes the signal specified by signo from the signal set specified by set. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigismember(const sigset_t *set, int signo);-
-Description: This function tests whether the signal specified +
+Description: This function tests whether the signal specified by signo is a member of the set specified by set. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigaction( int signo, const struct sigaction *act, struct sigaction *oact );-
-Description: This function allows the calling task to +
+Description: This function allows the calling task to examine and/or specify the action to be associated with a specific signal. -
+
The structure sigaction, used to describe an action to be taken, is defined to include the following members: -
+
If the argument act is not NULL, it points to a structure specifying the action to be associated with the specified signal. If the argument oact is not NULL, the action previously associated with the signal is stored in the location pointed to by the argument oact. If the argument act is NULL, signal handling is unchanged by this function call; thus, the call can be used to enquire about the current handling of a given signal. -
+
When a signal is caught by a signal-catching function installed by the sigaction() function, a new signal mask is calculated and installed for the duration of the signal-catching function. This mask is formed by taking the union of the current signal mask and the value of the sa_mask for the signal being delivered, and then including the signal being delivered. If and when the signal handler returns, the original signal mask is restored. -
+
Signal catching functions execute in the same address environment as the task that called sigaction() to install the signal-catching function. -
+
Once an action is installed for a specific signal, it remains installed until another action is explicitly requested by another call to sigaction(). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX implementation include: -
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigprocmask(int how, const sigset_t *set, sigset_t *oset);-
-Description: This function allows the calling task to +
+Description: This function allows the calling task to examine and/or change its signal mask. If the set is not NULL, then it points to a set of signals to be used to change the currently blocked set. The value of how indicates the manner in which the set is changed. -
+
If there are any pending unblocked signals after the call to sigprocmask(), those signals will be delivered before sigprocmask() returns. -
+
If sigprocmask() fails, the signal mask of the task is not changed. -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigpending( sigset_t *set );-
-Description: This function stores the returns the set of +
+Description: This function stores the returns the set of signals that are blocked for delivery and that are pending for the calling task in the space pointed to by set. -
+
If the task receiving a signal has the signal blocked via its sigprocmask, the signal will pend until it is unmasked. Only one pending signal (for a given signo) is retained by the system. This is consistent with POSIX which states: "If a subsequent occurrence of a pending signal is generated, it is implementation defined as to whether the signal is delivered more than once." -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigsuspend( const sigset_t *set );-
-Description: The sigsuspend() function replaces the signal mask +
+Description: The sigsuspend() function replaces the signal mask with the set of signals pointed to by the argument set and then suspends the task until delivery of a signal to the task. -
+
If the effect of the set argument is to unblock a pending signal, then no wait is performed. -
+
The original signal mask is restored when sigsuspend() returns. -
+
Waiting for an empty signal set stops a task without freeing any resources (a very bad idea). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX specification include: -
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigwaitinfo(const sigset_t *set, struct siginfo *info);-
-Description: This function is equivalent to sigtimedwait() +
+Description: This function is equivalent to sigtimedwait() with a NULL timeout parameter. (see below). -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigtimedwait( const sigset_t *set, struct siginfo *info, const struct timespec *timeout );-
-Description: This function selects the pending signal set +
+Description: This function selects the pending signal set specified by the argument set. If multiple signals are pending in set, it will remove and return the lowest numbered one. If no signals in set are pending at the time of the call, the calling task will be suspended @@ -2976,85 +3010,85 @@ until one of the signals in set becomes pending OR until the task interrupted by an unblocked signal OR until the time interval specified by timeout (if any), has expired. If timeout is NULL, then the timeout interval is forever. -
+
If the info argument is non-NULL, the selected signal number is stored in the si_signo member and the cause of the signal is store in the si_code member. The content of si_value is only meaningful if the signal was generated by sigqueue(). The following values for si_code are defined in signal.h: -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX interface include: -
-Function Prototype: +
+Function Prototype:
#include <signal.h> int sigqueue (int tid, int signo, const union sigval value);-
-Description: This function sends the signal specified by +
+Description: This function sends the signal specified by signo with the signal parameter value to the task specified by tid. -
+
If the receiving task has the signal blocked via its sigprocmask, the signal will pend until it is unmasked. Only one pending signal (for a given signo) is retained by the system. This is consistent with POSIX which states: "If a subsequent occurrence of a pending signal is generated, it is implementation defined as to whether the signal is delivered more than once." -
-Input Parameters: -
+Input Parameters: +
-Returned Values: -
+Returned Values: +
EPERM
. The task does not have permission to send the signal to the receiving process.ESRCH
. No process has a PID matching pid.-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+ POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX interface include: -
-Function Prototype: +
+Function Prototype:
#include <sys/types.h> #include <signal.h> int kill(pid_t pid, int sig);-
-Description: +
+Description: The kill() system call can be used to send any signal to any task.
@@ -3111,19 +3145,19 @@ be sent. information as zero and negative pid values. Only positive, non-zero values of pid are supported by this implementation. ID of the task to receive signal -- Returned Values: -
- Assumptions/Limitations: + Assumptions/Limitations:
POSIX Compatibility: @@ -3136,7 +3170,7 @@ be sent.
NuttX does not support processes in the way that, say, Linux does. NuttX only supports simple threads or tasks running within the same address space. @@ -3260,437 +3294,437 @@ be sent.
pthread_testcancel
. set cancelability state.-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_init(pthread_attr_t *attr);-
-Description: +
+Description: Initializes a thread attributes object (attr) with default values for all of the individual attributes used by the implementation. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-
-Function Prototype: -
+
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_destroy(pthread_attr_t *attr);-
-Description: +
+Description: An attributes object can be deleted when it is no longer needed. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-
-Function Prototype: -
+
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_setschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_getschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_getschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_getschedparam(pthread_attr_t *attr, struct sched_param *param);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_getschedparam() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_setinheritsched() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-
-Function Prototype: -
+
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_getinheritsched() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_setstacksize(pthread_attr_t *attr, long stacksize);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_setstacksize() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_attr_getstacksize(pthread_attr_t *attr, long *stackaddr);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_attr_getstacksize() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_create(pthread_t *thread, pthread_attr_t *attr, pthread_startroutine_t startRoutine, pthread_addr_t arg);-
-Description: +
+Description: To create a thread object and runnable thread, a routine must be specified as the new thread's start routine. An argument may be passed to this routine, as an untyped address; an untyped address may also be returned as the routine's value. An attributes object may be used to specify details about the kind of thread being created. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_create() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_detach(pthread_t thread);-
-Description: +
+Description: A thread object may be "detached" to specify that the return value and completion status will not be requested. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_detach() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> void pthread_exit(pthread_addr_t pvValue);-
-Description: +
+Description: A thread may terminate it's own execution. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_exit() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_cancel(pthread_t thread);-
-Description: +
+Description:
The pthread_cancel() function shall request that thread be canceled. The target thread's cancelability state determines @@ -3706,48 +3740,48 @@ calls pthread_testcancel().
Cancelability is asynchronous; all cancels are acted upon immediately (when enable), interrupting the thread with its processing.
--Input Parameters: -
-
+Input Parameters: +
+
-Returned Values: -
+
+Returned Values: +
If successful, the ptnread_cancel() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
+
-POSIX Compatibility: Comparable to the POSIX +
+POSIX Compatibility: Comparable to the POSIX interface of the same name. Except:
--Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_setcancelstate(int state, int *oldstate);-
-Description: -
The pthread_setcancelstate() function atomically +
+Description: +
The pthread_setcancelstate() function atomically sets both the calling thread's cancelability state to the indicated state and returns the previous cancelability state at the location referenced by oldstate. @@ -3756,159 +3790,159 @@ Legal values for state are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DISABLE.<.li
Any pending thread cancelation may occur at the time that the cancelation state is set to PTHREAD_CANCEL_ENABLE.
-Input Parameters: --
+
-Returned Values: -
+
+Returned Values: +
If successful, the pthread_setcancelstate() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
+
-POSIX Compatibility: Comparable to the POSIX +
+POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_setcancelstate(void);-
-Description: -
NOT SUPPORTED -Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
NOT SUPPORTED +Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_setcancelstate() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_join(pthread_t thread, pthread_addr_t *ppvValue);-
-Description: +
+Description: A thread can await termination of another thread and retrieve the return value of the thread. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_join() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> void pthread_yield(void);-
-Description: +
+Description: A thread may tell the scheduler that its processor can be made available. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_yield() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> pthread_t pthread_self(void);-
-Description: +
+Description: A thread may obtain a copy of its own thread handle. -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_self() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3974,7 +4008,7 @@ interface of the same name. Comparable to the POSIX interface of the same name. -Function Prototype:
@@ -4066,72 +4100,72 @@ interface of the same name. Comparable to the POSIX interface of the same name. --Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_key_create( pthread_key_t *key, void (*destructor)(void*) )-
-Description: -
+
+Description: +
This function creates a thread-specific data key visible to all threads in the system. Although the same key value may be used by different threads, the values bound to the key by pthread_setspecific() are maintained on a per-thread basis and persist for the life of the calling thread. -
+
Upon key creation, the value NULL will be associated with the the new key in all active threads. Upon thread creation, the value NULL will be associated with all defined keys in the new thread. -
-Input Parameters: -
-
+Input Parameters: +
+
-Returned Values: -
+
+Returned Values: +
If successful, the pthread_key_create() function will store the newly created key value at *key and return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
+
-POSIX Compatibility: Comparable to the POSIX +
+POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_setspecific( pthread_key_t key, void *value )-
-Description: -
+
+Description: +
The pthread_setspecific() function associates a thread- specific value with a key obtained via a previous call to pthread_key_create(). Different threads may bind @@ -4139,611 +4173,611 @@ different values to the same key. These values are typically pointers to blocks of dynamically allocated memory that have been reserved for use by the calling thread. -
+
The effect of calling pthread_setspecific() with a key value not obtained from pthread_key_create() or after a key has been deleted with pthread_key_delete() is undefined. -
-Input Parameters: -
-
-Returned Values: -
+
+Input Parameters: +
+
+Returned Values: +
If successful, pthread_setspecific() will return zero (OK). Otherwise, an error number will be returned: -
-
+
-Assumptions/Limitations: -
-POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> void *pthread_getspecific( pthread_key_t key )-
-Description: -
+
+Description: +
The pthread_getspecific() function returns the value currently bound to the specified key on behalf of the calling thread. -
+
The effect of calling pthread_getspecific() with a key value not obtained from pthread_key_create() or after a key has been deleted with pthread_key_delete() is undefined. -
-Input Parameters: -
-
-Returned Values: -
+
+Input Parameters: +
+
+Returned Values: +
The function pthread_getspecific() returns the thread- specific data associated with the given key. If no thread specific data is associated with the key, then the value NULL is returned. -
-Assumptions/Limitations: -
-POSIX Compatibility: Comparable to the POSIX +
+Assumptions/Limitations: +
+POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_key_delete( pthread_key_t key )-
-Description: -
+
+Description: +
This POSIX function should delete a thread-specific data key previously returned by pthread_key_create(). However, this function does nothing in the present implementation. -
-Input Parameters: -
-
-Returned Values: -
-
-Assumptions/Limitations: -
-POSIX Compatibility: Comparable to the POSIX +
+Input Parameters: +
+
+Returned Values: +
+
+Assumptions/Limitations: +
+POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutexattr_init(pthread_mutexattr_t *attr);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutexattr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Protoype: -
+
+Function Protoype: +
#include <pthread.h> int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutexattr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutexattr_getpshared() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutexattr_setpshared() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutex_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutex_destroy(pthread_mutex_t *mutex);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutex_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutex_lock(pthread_mutex_t *mutex);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutex_lock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutex_trylock(pthread_mutex_t *mutex);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_mutex_trylock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_mutex_unlock(pthread_mutex_t *mutex);-
-Description: -
-Input Parameters: -
-
+Description: +
+Input Parameters: +
+
param.
-Returned Values: -
+
+Returned Values: +
If successful, the pthread_mutex_unlock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_condattr_init(pthread_condattr_t *attr);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_condattr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_condattr_destroy(pthread_condattr_t *attr);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_condattr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_cond_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_cond_destroy(pthread_cond_t *cond);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_cond_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_cond_broadcast(pthread_cond_t *cond);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_cond_broadcast() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_cond_signal(pthread_cond_t *dond);-
-Description: -
-Input Parameters: -
-
param.
-Returned Values: -
+
+Description: +
+Input Parameters: +
+
To be provided
.+Returned Values: +
If successful, the pthread_cond_signal() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
-Function Prototype: -
+
+Function Prototype: +
#include <pthread.h> int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);-
-Description: -
-Input Parameters: -
-
param.
+
+Description: +
+Input Parameters: +
+
To be provided
.Returned Values: -
+
If successful, the pthread_cond_wait() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -
-
Exxx
. -POSIX Compatibility: Comparable to the POSIX +
+
To be provided
. +POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -4760,7 +4794,7 @@ interface of the same name.
parm
.To be provided
.Returned Values: @@ -4771,7 +4805,7 @@ interface of the same name. returned to indicate the error:
Exxx
. To be provided
. Assumptions/Limitations: @@ -5251,71 +5285,71 @@ interface of the same name. POSIX Compatibility: Comparable to the POSIX interface of the same name.
-+
Many of the types used to communicate with NuttX are simple scalar types. These types are used to provide architecture independence of the OS from the application. The scalar types used at the NuttX interface include: -
+
Several of the types used to interface with NuttX are structures that are intended to be hidden from the application. From the standpoint of the application, these structures (and structure pointers) should be treated as simple handles to reference OS resources. These hidden structures include: -
+
In order to maintain portability, applications should not reference specific elements within these hidden structures. These hidden structures will not be described further in this user's manual. -
+
+
A pointer to the thread-specific errno. value is available through a function call: -
-Function Prototype: -
+
+Function Prototype: +
int *get_errno_ptr( void )-
-Description: osGetErrnorPtr() returns a pointer to +
+Description: osGetErrnorPtr() returns a pointer to the thread-specific errno value. -
+
This differs somewhat from the use for errno in a multi-threaded process environment: Each pthread will have its own private copy of errno and the errno will not be shared between pthreads. -
-Input Parameters: None -
-Returned Values: -
-
+
+Input Parameters: None +
+Returned Values: +
+
+
+
main_t defines the type of a task entry point. main_t is declared in sys/types.h as:
@@ -5324,7 +5358,7 @@ in sys/types.h as:3.4.2 struct sched_param
-+
This structure is used to pass scheduling priorities to and from NuttX;
@@ -5336,7 +5370,7 @@ NuttX;3.4.3 struct timespec
-+
This structure is used to pass timing information between the NuttX and a user application:
@@ -5349,7 +5383,7 @@ NuttX and a user application:3.4.4 struct mq_attr
-+
This structure is used to communicate message queue attributes between NuttX and a MoBY application:
@@ -5363,7 +5397,7 @@ between NuttX and a MoBY application:3.4.5 struct sigaction
-+
The following structure defines the action to take for given signal:
struct sigaction @@ -5382,7 +5416,7 @@ The following structure defines the action to take for given signal:3.4.6 struct siginfo/siginfo_t
-+
The following types is used to pass parameters to/from signal handlers:
@@ -5396,7 +5430,7 @@ handlers:3.4.7 union sigval
-+
This defines the type of the struct siginfo si_value field and is used to pass parameters with signals.
@@ -5409,7 +5443,7 @@ is used to pass parameters with signals.3.4.8 struct sigevent
-+
The following is used to attach a signal to a message queue to notify a task when a message is available on a queue.
diff --git a/TODO b/TODO index c15c8d23b6..6e9bcea8e9 100644 --- a/TODO +++ b/TODO @@ -44,8 +44,8 @@ o File system o Console Output o Documentation -- Document fs & driver logic -- Document filesystem, library +- Document fs/ & driver/ logic +- Document C-library APIs o Build system - Names under arch are incorrect. These should hold processor architectures. diff --git a/arch/README.txt b/arch/README.txt index 3dfaa66e82..b8b1802072 100644 --- a/arch/README.txt +++ b/arch/README.txt @@ -11,8 +11,33 @@ Table of Contents Architecture-Specific Code ^^^^^^^^^^^^^^^^^^^^^^^^^^ -The file include/nuttx/arch.h identifies all of the APIs that must -be provided by the architecture specific logic. (It also includes +The NuttX configuration consists of: + +o Processor architecture specific files. These are the files contained + in the arch// directory discussed in this README. + +o Chip/SoC specific files. Each processor processor architecture + is embedded in chip or System-on-a-Chip (SoC) architecture. The + full chip architecture includes the processor architecture plus + chip-specific interrupt logic, general purpose I/O (GIO) logic, and + specialized, internal peripherals (such as UARTs, USB, etc.). + + These chip-specific files are contained within chip-specific + sub-directories in the arch/ / directory and are selected + via the CONFIG_ARCH_name selection + +o Board specific files. In order to be usable, the chip must be + contained in a board environment. The board configuration defines + additional properties of the board including such things as + peripheral LEDs, external peripherals (such as network, USB, etc.). + + These board-specific configuration files can be found in the + configs/ / sub-directories. + +This README will address the processor architecture specific files +that are contained in the arch/ / directory. The file +include/nuttx/arch.h identifies all of the APIs that must +be provided by this architecture specific logic. (It also includes arch/ /arch.h as described below). Directory Structure @@ -25,18 +50,27 @@ subdirectory). Each architecture must provide a subdirectory under arch/ with the following characteristics: - - |-- include + / + |-- include/ + | |-- / + | | `-- (chip-specific header files) + | |-- / | |-- arch.h | |-- irq.h | `-- types.h - `-- src + `-- src/ + |-- / + | `-- (chip-specific source files) + |-- / |-- Makefile `-- (architecture-specific source files) Summary of Files ^^^^^^^^^^^^^^^^ +include/ / + This sub-directory contains chip-specific header files. + include/arch.h This is a hook for any architecture specific definitions that may be needed by the system. It is included by include/nuttx/arch.h @@ -76,6 +110,9 @@ include/irq.h This file must also define NR_IRQS, the total number of IRQs supported by the board. +src/ / + This sub-directory contains chip-specific source files. + src/Makefile This makefile will be executed to build the targets src/libup.a and src/up_head.o. The up_head.o file holds the entry point into the system diff --git a/configs/README.txt b/configs/README.txt index e15c57c36f..f09046dff3 100644 --- a/configs/README.txt +++ b/configs/README.txt @@ -11,9 +11,33 @@ Table of Contents Board-Specific Configurations ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The NuttX configuration consists of: + +o Processor architecture specific files. These are the files contained + in the arch/ / directory. + +o Chip/SoC specific files. Each processor processor architecture + is embedded in chip or System-on-a-Chip (SoC) architecture. The + full chip architecture includes the processor architecture plus + chip-specific interrupt logic, general purpose I/O (GIO) logic, and + specialized, internal peripherals (such as UARTs, USB, etc.). + + These chip-specific files are contained within chip-specific + sub-directories in the arch/ / directory and are selected + via the CONFIG_ARCH_name selection + +o Board specific files. In order to be usable, the chip must be + contained in a board environment. The board configuration defines + additional properties of the board including such things as + peripheral LEDs, external peripherals (such as network, USB, etc.). + + These board-specific configuration files can be found in the + configs/ / sub-directories and are discussed in this + README. + The configs/ subdirectory contains configuration data for each board. These board-specific configurations plus the architecture-specific configurations in -the arch/ subdirectory complete define a customized port of NuttX. +the arch/ subdirectory completely define a customized port of NuttX. Directory Structure ^^^^^^^^^^^^^^^^^^^ @@ -25,8 +49,10 @@ following characteristics: |-- include/ + | `-- (board-specific header files) |-- src/ - | `-- Makefile + | |-- Makefile + | `-- (board-specific source files) |-- Make.defs |-- defconfig `-- setenv.sh