mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 01:23:34 +08:00
Merge Nuttx r5554
This commit is contained in:
@@ -82,6 +82,18 @@ typedef FAR void (*binfmt_dtor_t)(void);
|
||||
struct symtab_s;
|
||||
struct binary_s
|
||||
{
|
||||
/* If CONFIG_SCHED_HAVE_PARENT is defined then schedul_unload() will
|
||||
* manage instances of struct binary_s allocated with kmalloc. It
|
||||
* will keep the binary data in a link list and when SIGCHLD is received
|
||||
* (meaning that the task has exit'ed, schedul_unload() will find the
|
||||
* data, unload the module, and free the structure.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
FAR struct binary_s *flink; /* Supports a singly linked list */
|
||||
pid_t pid; /* Task ID of the child task */
|
||||
#endif
|
||||
|
||||
/* Information provided to the loader to load and bind a module */
|
||||
|
||||
FAR const char *filename; /* Full path to the binary to be loaded (See NOTE 1 above) */
|
||||
@@ -222,19 +234,48 @@ int unload_module(FAR const struct binary_s *bin);
|
||||
*
|
||||
* Returned Value:
|
||||
* This is an end-user function, so it follows the normal convention:
|
||||
* Returns the PID of the exec'ed module. On failure, it.returns
|
||||
* Returns the PID of the exec'ed module. On failure, it returns
|
||||
* -1 (ERROR) and sets errno appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int exec_module(FAR const struct binary_s *bin);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: schedule_unload
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_SCHED_HAVE_PARENT is defined, this function may be called by
|
||||
* the parent of the the newly created task to automatically unload the
|
||||
* module when the task exits. This assumes that (1) the caller is the
|
||||
* parent of the created task, (2) that bin was allocated with kmalloc()
|
||||
* or friends. It will also automatically free the structure with kfree()
|
||||
* after unloading the module.
|
||||
*
|
||||
* Input Parameter:
|
||||
* pid - The task ID of the child task
|
||||
* bin - This structure must have been allocated with kmalloc() and must
|
||||
* persist until the task unloads
|
||||
*
|
||||
* Returned Value:
|
||||
* This is an end-user function, so it follows the normal convention:
|
||||
* It returns 0 (OK) if the callback was successfully scheduled. On
|
||||
* failure, it returns -1 (ERROR) and sets errno appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
int schedule_unload(pid_t pid, FAR struct binary_s *bin);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: exec
|
||||
*
|
||||
* Description:
|
||||
* This is a convenience function that wraps load_ and exec_module into
|
||||
* one call.
|
||||
* one call. If CONFIG_SCHED_ONEXIT is also defined, this function will
|
||||
* automatically call schedule_unload() to unload the module when task
|
||||
* exits.
|
||||
*
|
||||
* Input Parameter:
|
||||
* filename - Fulll path to the binary to be loaded
|
||||
@@ -244,7 +285,7 @@ int exec_module(FAR const struct binary_s *bin);
|
||||
*
|
||||
* Returned Value:
|
||||
* This is an end-user function, so it follows the normal convention:
|
||||
* Returns the PID of the exec'ed module. On failure, it.returns
|
||||
* It returns the PID of the exec'ed module. On failure, it returns
|
||||
* -1 (ERROR) and sets errno appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -73,18 +73,40 @@ extern "C" {
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* The g_builtins[] array holds information about each builtin function. If
|
||||
* support for builtin functions is enabled in the NuttX configuration, then
|
||||
* this arrary (along with the number_builtins() function) must be provided
|
||||
* by the application code.
|
||||
*/
|
||||
|
||||
EXTERN const struct builtin_s g_builtins[];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: builtin_initialize
|
||||
*
|
||||
* Description:
|
||||
* Builtin support is built unconditionally. However, it order to
|
||||
* use this binary format, this function must be called during system
|
||||
* format in order to register the builtin binary format.
|
||||
*
|
||||
* Returned Value:
|
||||
* This is a NuttX internal function so it follows the convention that
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int builtin_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: builtin_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Unregister the builtin binary loader
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void builtin_uninitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Utility Functions Provided to Applications by binfmt/libbuiltin
|
||||
****************************************************************************/
|
||||
@@ -128,24 +150,24 @@ FAR const char *builtin_getname(int index);
|
||||
* Data Set Access Functions Provided to Applications by binfmt/libbuiltin
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
* Name: number_builtins
|
||||
* Name: builtin_for_index
|
||||
*
|
||||
* Description:
|
||||
* Returns the number of builtin functions in the g_builtins[] array. If
|
||||
* support for builtin functions is enabled in the NuttX configuration,
|
||||
* then this function (along with g_builtins[]) must be provided by the
|
||||
* application code.
|
||||
* Returns the builtin_s structure for the selected builtin.
|
||||
* If support for builtin functions is enabled in the NuttX configuration,
|
||||
* then this function must be provided by the application code.
|
||||
*
|
||||
* Input Parameter:
|
||||
* None
|
||||
* index, from 0 and on...
|
||||
*
|
||||
* Returned Value:
|
||||
* The number of entries in the g_builtins[] array. This function does
|
||||
* not return failures.
|
||||
* Returns valid pointer pointing to the builtin_s structure if index is
|
||||
* valid.
|
||||
* Otherwise, NULL is returned.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int number_builtins(void);
|
||||
EXTERN FAR const struct builtin_s *builtin_for_index(int index);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/********************************************************************************************
|
||||
* include/nuttx/lcd/hd4478ou.h
|
||||
*
|
||||
* Definitions for the Hitachi HD44780U LCD controller (as used in the
|
||||
* LCD1602).
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_HD4478OU_H
|
||||
#define __INCLUDE_NUTTX_HD4478OU_H
|
||||
|
||||
/********************************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************************/
|
||||
/* Command set:
|
||||
*
|
||||
* RS=0 R/W=0 : Command
|
||||
* RS=0 R/W=1 : Busy/AD, Read CT (see below)
|
||||
* RS=1 R/W=0 : Write data to CGRAM or DDRAM
|
||||
* RS=1 R/W=0 : Read data from CGRAM or DDRAM
|
||||
*/
|
||||
|
||||
#define HD4478OU_CLEAR (0x01) /* Screen Clear, Set AC to 0 */
|
||||
#define HD4478OU_RETURN (0x02) /* DDRAM AD=0, return */
|
||||
#define HD4478OU_INPUT (0x04) /* Set moving direction of cursor */
|
||||
# define HD4478OU_INPUT_SHIFT (1 << 0) /* Shift */
|
||||
# define HD4478OU_INPUT_INCR (1 << 1) /* Increment mode */
|
||||
# define HD4478OU_INPUT_DECR (0x00) /* Decrement mode */
|
||||
#define HD4478OU_DISPLAY (0x08) /* Set display, cursor, blink on/off */
|
||||
# define HD4478OU_DISPLAY_BLINK (1 << 0) /* Blink on/off */
|
||||
# define HD4478OU_DISPLAY_CURSOR (1 << 1) /* Cursor on/off */
|
||||
# define HD4478OU_DISPLAY_ON (1 << 2) /* Display on/off */
|
||||
#define HD4478OU_SHIFT (0x10) /* Remove cursor and whole diplay */
|
||||
# define HD4478OU_SHIFT_RIGHT (1 << 2) /* Shift right */
|
||||
# define HD4478OU_SHIFT_LEFT (0x00) /* Shift right */
|
||||
# define HD4478OU_SHIFT_DISPLAY (1 << 3) /* Display shift */
|
||||
# define HD4478OU_SHIFT_CURSOR (0x00) /* Cursor shift */
|
||||
#define HD4478OU_FUNC (0x20) /* Set DL, display line, font */
|
||||
# define HD4478OU_FUNC_F5x10 (1 << 2) /* 5x10 Style */
|
||||
# define HD4478OU_FUNC_F5x7 (0x00) /* 5x7 Style */
|
||||
# define HD4478OU_FUNC_N1 (1 << 3) /* N=2R */
|
||||
# define HD4478OU_FUNC_N0 (0x00) /* N=1R */
|
||||
# define HD4478OU_FUNC_DL8D (1 << 4) /* DL=8D, 8-bit interface */
|
||||
# define HD4478OU_FUNC_DL4D (0x00) /* DL=4D, 4-bit interface */
|
||||
#define HD4478OU_CGRAM_AD(a) (0x40|(a)) /* Set CGRAM AD, send receive data */
|
||||
#define HD4478OU_DDRAM_AD(a) (0x80|(a)) /* Set DDRAM AD, send receive data */
|
||||
|
||||
/* RS=0 R/W=1 : Execute internal function, read AD of CT */
|
||||
|
||||
#define HD4478OU_BUSY(bf,ac) ((bf) << 7 | (ac))
|
||||
|
||||
/********************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
********************************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Types
|
||||
********************************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Data
|
||||
********************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Name: up_lcd1602_initialize
|
||||
*
|
||||
* Description:
|
||||
* the LCD1602 is an HD4478OU-based LCD from Wave share. This function initializes the
|
||||
* LCD1602 hardware and registers the character driver as /dev/lcd1602.
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
int up_lcd1602_initialize(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_HD4478OU_H */
|
||||
@@ -1,5 +1,6 @@
|
||||
/**************************************************************************************
|
||||
* include/nuttx/lcd/ug-2864ambag01.h
|
||||
*
|
||||
* Driver for Univision UG-2864AMBAG01 OLED display (wih SH1101A controller) in SPI
|
||||
* mode
|
||||
*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/**************************************************************************************
|
||||
* include/nuttx/lcd/ug-2864hsweg01.h
|
||||
*
|
||||
* Driver for Univision UG-2864HSWEG01 OLED display (wih SSD1306 controller) in SPI
|
||||
* mode
|
||||
*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/lcd/ug-9664hswag01.h
|
||||
*
|
||||
* Driver for the Univision UG-9664HSWAG01 Display with the Solomon Systech
|
||||
* SSD1305 LCD controller.
|
||||
*
|
||||
|
||||
+53
-18
@@ -62,21 +62,31 @@
|
||||
|
||||
/* This is the maximum number of times that a lock can be set */
|
||||
|
||||
#define MAX_LOCK_COUNT 127
|
||||
#define MAX_LOCK_COUNT 127
|
||||
|
||||
/* Values for the _TCB flags flag bits */
|
||||
|
||||
#define TCB_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: thread type */
|
||||
#define TCB_FLAG_TTYPE_MASK (3 << TCB_FLAG_TTYPE_SHIFT)
|
||||
# define TCB_FLAG_TTYPE_TASK (0 << TCB_FLAG_TTYPE_SHIFT) /* Normal user task */
|
||||
# define TCB_FLAG_TTYPE_PTHREAD (1 << TCB_FLAG_TTYPE_SHIFT) /* User pthread */
|
||||
# define TCB_FLAG_TTYPE_KERNEL (2 << TCB_FLAG_TTYPE_SHIFT) /* Kernel thread */
|
||||
#define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */
|
||||
#define TCB_FLAG_CANCEL_PENDING (1 << 3) /* Bit 3: Pthread cancel is pending */
|
||||
#define TCB_FLAG_ROUND_ROBIN (1 << 4) /* Bit 4: Round robin sched enabled */
|
||||
#define TCB_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: thread type */
|
||||
#define TCB_FLAG_TTYPE_MASK (3 << TCB_FLAG_TTYPE_SHIFT)
|
||||
# define TCB_FLAG_TTYPE_TASK (0 << TCB_FLAG_TTYPE_SHIFT) /* Normal user task */
|
||||
# define TCB_FLAG_TTYPE_PTHREAD (1 << TCB_FLAG_TTYPE_SHIFT) /* User pthread */
|
||||
# define TCB_FLAG_TTYPE_KERNEL (2 << TCB_FLAG_TTYPE_SHIFT) /* Kernel thread */
|
||||
#define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */
|
||||
#define TCB_FLAG_CANCEL_PENDING (1 << 3) /* Bit 3: Pthread cancel is pending */
|
||||
#define TCB_FLAG_ROUND_ROBIN (1 << 4) /* Bit 4: Round robin sched enabled */
|
||||
#define TCB_FLAG_NOCLDWAIT (1 << 5) /* Bit 5: Do not retain child exit status */
|
||||
|
||||
/* Values for struct child_status_s ch_flags */
|
||||
|
||||
#define CHILD_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: child thread type */
|
||||
#define CHILD_FLAG_TTYPE_MASK (3 << CHILD_FLAG_TTYPE_SHIFT)
|
||||
# define CHILD_FLAG_TTYPE_TASK (0 << CHILD_FLAG_TTYPE_SHIFT) /* Normal user task */
|
||||
# define CHILD_FLAG_TTYPE_PTHREAD (1 << CHILD_FLAG_TTYPE_SHIFT) /* User pthread */
|
||||
# define CHILD_FLAG_TTYPE_KERNEL (2 << CHILD_FLAG_TTYPE_SHIFT) /* Kernel thread */
|
||||
#define CHILD_FLAG_EXITED (1 << 0) /* Bit 2: The child thread has exit'ed */
|
||||
|
||||
/********************************************************************************
|
||||
* Global Type Definitions
|
||||
* Public Type Definitions
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
@@ -163,6 +173,22 @@ typedef struct environ_s environ_t;
|
||||
# define SIZEOF_ENVIRON_T(alloc) (sizeof(environ_t) + alloc - 1)
|
||||
#endif
|
||||
|
||||
/* This structure is used to maintin information about child tasks.
|
||||
* pthreads work differently, they have join information. This is
|
||||
* only for child tasks.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||
struct child_status_s
|
||||
{
|
||||
FAR struct child_status_s *flink;
|
||||
|
||||
uint8_t ch_flags; /* Child status: See CHILD_FLAG_* definitions */
|
||||
pid_t ch_pid; /* Child task ID */
|
||||
int ch_status; /* Child exit status */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This structure describes a reference counted D-Space region. This must be a
|
||||
* separately allocated "break-away" structure that can be owned by a task and
|
||||
* any pthreads created by the task.
|
||||
@@ -202,9 +228,13 @@ struct _TCB
|
||||
/* Task Management Fields *****************************************************/
|
||||
|
||||
pid_t pid; /* This is the ID of the thread */
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT /* Support parent-child relationship */
|
||||
pid_t parent; /* This is the ID of the parent thread */
|
||||
#ifdef CONFIG_SCHED_CHILD_STATUS /* Retain child thread status */
|
||||
FAR struct child_status_s *children; /* Head of a list of child status */
|
||||
#else
|
||||
uint16_t nchildren; /* This is the number active children */
|
||||
#endif
|
||||
#endif
|
||||
start_t start; /* Thread start function */
|
||||
entry_t entry; /* Entry Point into the thread */
|
||||
@@ -357,33 +387,38 @@ typedef void (*sched_foreach_t)(FAR _TCB *tcb, FAR void *arg);
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/********************************************************************************
|
||||
* Global Function Prototypes
|
||||
* Public Data
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/********************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************/
|
||||
|
||||
/* TCB helpers */
|
||||
|
||||
EXTERN FAR _TCB *sched_self(void);
|
||||
FAR _TCB *sched_self(void);
|
||||
|
||||
/* File system helpers */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
EXTERN FAR struct filelist *sched_getfiles(void);
|
||||
FAR struct filelist *sched_getfiles(void);
|
||||
#if CONFIG_NFILE_STREAMS > 0
|
||||
EXTERN FAR struct streamlist *sched_getstreams(void);
|
||||
FAR struct streamlist *sched_getstreams(void);
|
||||
#endif /* CONFIG_NFILE_STREAMS */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
EXTERN FAR struct socketlist *sched_getsockets(void);
|
||||
FAR struct socketlist *sched_getsockets(void);
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
/* Internal vfork support.The overall sequence is:
|
||||
@@ -417,7 +452,7 @@ void task_vforkabort(FAR _TCB *child, int errcode);
|
||||
* will be disabled throughout this enumeration!
|
||||
*/
|
||||
|
||||
EXTERN void sched_foreach(sched_foreach_t handler, FAR void *arg);
|
||||
void sched_foreach(sched_foreach_t handler, FAR void *arg);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/********************************************************************************************
|
||||
* include/nuttx/serial/tioctl.h
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -165,16 +165,23 @@
|
||||
#define TIOCSRS485 _TIOC(0x002a) /* Set RS485 mode, arg: pointer to struct serial_rs485 */
|
||||
#define TIOCGRS485 _TIOC(0x002b) /* Get RS485 mode, arg: pointer to struct serial_rs485 */
|
||||
|
||||
/* Definitions for flags used in struct serial_rs485 (Linux compatible) */
|
||||
|
||||
# define SER_RS485_ENABLED (1 << 0) /* Enable/disble RS-485 support */
|
||||
# define SER_RS485_RTS_ON_SEND (1 << 1) /* Logic level for RTS pin when sending */
|
||||
# define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logic level for RTS pin after sent */
|
||||
# define SER_RS485_RX_DURING_TX (1 << 4)
|
||||
|
||||
/* Single-wire UART support */
|
||||
|
||||
#define TIOCSSINGLEWIRE _TIOC(0x002c) /* Set single-wire mode */
|
||||
#define TIOCGSINGLEWIRE _TIOC(0x002d) /* Get single-wire mode */
|
||||
|
||||
# define SER_SINGLEWIRE_ENABLED (1 << 0) /* Enable/disable single-wire support */
|
||||
|
||||
/* Debugging */
|
||||
|
||||
#define TIOCSERGSTRUCT _TIOC(0x002c) /* Get device TTY structure */
|
||||
|
||||
/* Definitions used in struct serial_rs485 (Linux compatible) */
|
||||
|
||||
#define SER_RS485_ENABLED (1 << 0) /* Enable/disble RS-485 support */
|
||||
#define SER_RS485_RTS_ON_SEND (1 << 1) /* Logic level for RTS pin when sending */
|
||||
#define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logic level for RTS pin after sent */
|
||||
#define SER_RS485_RX_DURING_TX (1 << 4)
|
||||
#define TIOCSERGSTRUCT _TIOC(0x002e) /* Get device TTY structure */
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Type Definitions
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/spawn.h
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_SPAWN_H
|
||||
#define __INCLUDE_NUTTX_SPAWN_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <spawn.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Type Definitions
|
||||
****************************************************************************/
|
||||
/* This enumerator identifies a file action */
|
||||
|
||||
enum spawn_file_actions_e
|
||||
{
|
||||
SPAWN_FILE_ACTION_NONE = 0,
|
||||
SPAWN_FILE_ACTION_CLOSE,
|
||||
SPAWN_FILE_ACTION_DUP2,
|
||||
SPAWN_FILE_ACTION_OPEN
|
||||
};
|
||||
|
||||
/* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(),
|
||||
* and posix_spawn_file_actions_addopen() will allocate memory and append
|
||||
* a new file action to an instance of posix_spawn_file_actions_t. The
|
||||
* internal representation of these structures are defined below:
|
||||
*/
|
||||
|
||||
struct spawn_general_file_action_s
|
||||
{
|
||||
FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
|
||||
enum spawn_file_actions_e action; /* A member of enum spawn_file_actions_e */
|
||||
};
|
||||
|
||||
struct spawn_close_file_action_s
|
||||
{
|
||||
FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
|
||||
enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_CLOSE */
|
||||
int fd; /* The file descriptor to close */
|
||||
};
|
||||
|
||||
struct spawn_dup2_file_action_s
|
||||
{
|
||||
FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
|
||||
enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_DUP2 */
|
||||
int fd1; /* The first file descriptor for dup2() */
|
||||
int fd2; /* The second file descriptor for dup2() */
|
||||
};
|
||||
|
||||
struct spawn_open_file_action_s
|
||||
{
|
||||
FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
|
||||
enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_OPEN */
|
||||
int fd; /* The file descriptor after opening */
|
||||
int oflags; /* Open flags */
|
||||
mode_t mode; /* File creation mode */
|
||||
char path[1]; /* Start of the path to be
|
||||
* opened */
|
||||
};
|
||||
|
||||
#define SIZEOF_OPEN_FILE_ACTION_S(n) \
|
||||
(sizeof(struct spawn_open_file_action_s) + (n))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void add_file_action(FAR posix_spawn_file_actions_t *file_action,
|
||||
FAR struct spawn_general_file_action_s *entry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_SPAWN_H */
|
||||
+35
-30
@@ -79,7 +79,7 @@
|
||||
#endif
|
||||
|
||||
/********************************************************************************
|
||||
* Global Type Definitions
|
||||
* Public Type Definitions
|
||||
********************************************************************************/
|
||||
|
||||
/* This is the POSIX-like scheduling parameter structure */
|
||||
@@ -90,56 +90,61 @@ struct sched_param
|
||||
};
|
||||
|
||||
/********************************************************************************
|
||||
* Global Function Prototypes
|
||||
* Public Data
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/********************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************/
|
||||
|
||||
/* Task Control Interfaces (non-standard) */
|
||||
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
EXTERN int task_init(FAR _TCB *tcb, const char *name, int priority,
|
||||
FAR uint32_t *stack, uint32_t stack_size,
|
||||
main_t entry, const char *argv[]);
|
||||
int task_init(FAR _TCB *tcb, const char *name, int priority,
|
||||
FAR uint32_t *stack, uint32_t stack_size, main_t entry,
|
||||
FAR const char *argv[]);
|
||||
#else
|
||||
EXTERN int task_init(FAR _TCB *tcb, const char *name, int priority,
|
||||
main_t entry, const char *argv[]);
|
||||
int task_init(FAR _TCB *tcb, const char *name, int priority, main_t entry,
|
||||
FAR const char *argv[]);
|
||||
#endif
|
||||
EXTERN int task_activate(FAR _TCB *tcb);
|
||||
int task_activate(FAR _TCB *tcb);
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
EXTERN int task_create(const char *name, int priority, int stack_size,
|
||||
main_t entry, const char *argv[]);
|
||||
int task_create(FAR const char *name, int priority, int stack_size, main_t entry,
|
||||
FAR const char *argv[]);
|
||||
#else
|
||||
EXTERN int task_create(const char *name, int priority,
|
||||
main_t entry, const char *argv[]);
|
||||
int task_create(FAR const char *name, int priority, main_t entry,
|
||||
FAR const char *argv[]);
|
||||
#endif
|
||||
EXTERN int task_delete(pid_t pid);
|
||||
EXTERN int task_restart(pid_t pid);
|
||||
int task_delete(pid_t pid);
|
||||
int task_restart(pid_t pid);
|
||||
|
||||
/* Task Scheduling Interfaces (based on POSIX APIs) */
|
||||
|
||||
EXTERN int sched_setparam(pid_t pid, const struct sched_param *param);
|
||||
EXTERN int sched_getparam(pid_t pid, struct sched_param *param);
|
||||
EXTERN int sched_setscheduler(pid_t pid, int policy,
|
||||
const struct sched_param *param);
|
||||
EXTERN int sched_getscheduler(pid_t pid);
|
||||
EXTERN int sched_yield(void);
|
||||
EXTERN int sched_get_priority_max(int policy);
|
||||
EXTERN int sched_get_priority_min(int policy);
|
||||
EXTERN int sched_rr_get_interval(pid_t pid, struct timespec *interval);
|
||||
int sched_setparam(pid_t pid, const struct sched_param *param);
|
||||
int sched_getparam(pid_t pid, struct sched_param *param);
|
||||
int sched_setscheduler(pid_t pid, int policy,
|
||||
FAR const struct sched_param *param);
|
||||
int sched_getscheduler(pid_t pid);
|
||||
int sched_yield(void);
|
||||
int sched_get_priority_max(int policy);
|
||||
int sched_get_priority_min(int policy);
|
||||
int sched_rr_get_interval(pid_t pid, FAR struct timespec *interval);
|
||||
|
||||
/* Task Switching Interfaces (non-standard) */
|
||||
|
||||
EXTERN int sched_lock(void);
|
||||
EXTERN int sched_unlock(void);
|
||||
EXTERN int sched_lockcount(void);
|
||||
int sched_lock(void);
|
||||
int sched_unlock(void);
|
||||
int sched_lockcount(void);
|
||||
|
||||
/* If instrumentation of the scheduler is enabled, then some outboard logic
|
||||
* must provide the following interfaces.
|
||||
@@ -147,9 +152,9 @@ EXTERN int sched_lockcount(void);
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
|
||||
EXTERN void sched_note_start(FAR _TCB *tcb);
|
||||
EXTERN void sched_note_stop(FAR _TCB *tcb);
|
||||
EXTERN void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb);
|
||||
void sched_note_start(FAR _TCB *tcb);
|
||||
void sched_note_stop(FAR _TCB *tcb);
|
||||
void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb);
|
||||
|
||||
#else
|
||||
# define sched_note_start(t)
|
||||
|
||||
+13
-8
@@ -61,14 +61,17 @@
|
||||
|
||||
/* All signals are "real time" signals */
|
||||
|
||||
#define SIGRTMIN 0 /* First real time signal */
|
||||
#define SIGRTMAX 31 /* Last real time signal */
|
||||
#define SIGRTMIN MIN_SIGNO /* First real time signal */
|
||||
#define SIGRTMAX MAX_SIGNO /* Last real time signal */
|
||||
|
||||
/* A few of the real time signals are used within the OS. They have
|
||||
* default values that can be overridden from the configuration file. The
|
||||
* rest are all user signals.
|
||||
*
|
||||
* These are semi-standard signal definitions:
|
||||
* The signal number zero is wasted for the most part. It is a valid
|
||||
* signal number, but has special meaning at many interfaces (e.g., Kill()).
|
||||
*
|
||||
* These are the semi-standard signal definitions:
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_SIG_SIGUSR1
|
||||
@@ -126,11 +129,13 @@
|
||||
|
||||
/* struct sigaction flag values */
|
||||
|
||||
#define SA_NOCLDSTOP 1 /* Do not generate SIGCHILD when
|
||||
* children stop (ignored) */
|
||||
#define SA_SIGINFO 2 /* Invoke the signal-catching function
|
||||
* with 3 args instead of 1
|
||||
* (always assumed) */
|
||||
#define SA_NOCLDSTOP (1 << 0) /* Do not generate SIGCHILD when
|
||||
* children stop (ignored) */
|
||||
#define SA_SIGINFO (1 << 1) /* Invoke the signal-catching function
|
||||
* with 3 args instead of 1
|
||||
* (always assumed) */
|
||||
#define SA_NOCLDWAIT (1 << 2) /* If signo=SIGCHLD, exit status of child
|
||||
* processes will be discarded */
|
||||
|
||||
/* These are the possible values of the signfo si_code field */
|
||||
|
||||
|
||||
@@ -158,13 +158,13 @@ typedef uint16_t ino_t;
|
||||
* negative PID values are used to represent invalid PIDs.
|
||||
*/
|
||||
|
||||
typedef int pid_t;
|
||||
typedef int16_t pid_t;
|
||||
|
||||
/* id_t is a general identifier that can be used to contain at least a pid_t,
|
||||
* uid_t, or gid_t.
|
||||
*/
|
||||
|
||||
typedef unsigned int id_t;
|
||||
typedef int16_t id_t;
|
||||
|
||||
/* Signed integral type of the result of subtracting two pointers */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user