mirror of
https://github.com/openharmony/third_party_NuttX.git
synced 2026-07-01 08:17:34 -04:00
add OpenHarmony 1.0 baseline
This commit is contained in:
Executable
+179
@@ -0,0 +1,179 @@
|
||||
/****************************************************************************
|
||||
* include/debug.h
|
||||
*
|
||||
* Copyright (C) 2007-2011, 2014, 2016 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_DEBUG_H
|
||||
#define __INCLUDE_DEBUG_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "vfs_config.h"
|
||||
#include "compiler.h"
|
||||
#include "syslog.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug macros to runtime filter the debug messages sent to the console. In
|
||||
* general, there are four forms of the debug macros:
|
||||
*
|
||||
* [a-z]dbg() -- Outputs messages to the console similar to printf() except
|
||||
* that the output is not buffered. The first character indicates the
|
||||
* system system (e.g., n=network, f=filesystm, etc.). If the first
|
||||
* character is missing (i.e., dbg()), then it is common. The common
|
||||
* dbg() macro is enabled by CONFIG_DEBUG. Subsystem debug requires an
|
||||
* additional configuration setting to enable it (e.g., CONFIG_DEBUG_NET
|
||||
* for the network, CONFIG_DEBUG_FS for the file system, etc).
|
||||
*
|
||||
* In general, error messages and output of importance use [a-z]dbg().
|
||||
* [a-z]dbg() is implementation dependent but usually uses file descriptors.
|
||||
* (that is a problem only because the interrupt task may have re-
|
||||
* directed stdout). Therefore [a-z]dbg() should not be used in interrupt
|
||||
* handlers.
|
||||
*
|
||||
* [a-z]vdbg() -- Identical to [a-z]dbg() except that it also requires that
|
||||
* CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug
|
||||
* output that you would normally want to suppress.
|
||||
*
|
||||
* [a-z]lldbg() -- Identical to [a-z]dbg() except this is uses special
|
||||
* interfaces provided by architecture-specific logic to talk directly
|
||||
* to the underlying console hardware. If the architecture provides such
|
||||
* logic, it should define CONFIG_ARCH_LOWPUTC.
|
||||
*
|
||||
* [a-z]lldbg() should not be used in normal code because the implementation
|
||||
* probably disables interrupts and does things that are not consistent with
|
||||
* good real-time performance. However, [a-z]lldbg() is particularly useful
|
||||
* in low-level code where it is inappropriate to use file descriptors. For
|
||||
* example, only [a-z]lldbg() should be used in interrupt handlers.
|
||||
*
|
||||
* [a-z]llvdbg() -- Identical to [a-z]lldbg() except that it also requires that
|
||||
* CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug
|
||||
* output that you would normally want to suppress.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_HAVE_FUNCTIONNAME
|
||||
# define EXTRA_FMT "%s: "
|
||||
# define EXTRA_ARG ,__FUNCTION__
|
||||
#else
|
||||
# define EXTRA_FMT
|
||||
# define EXTRA_ARG
|
||||
#endif
|
||||
|
||||
/* Debug macros will differ depending upon if the toolchain supports
|
||||
* macros with a variable number of arguments or not.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
|
||||
/* C-99 style variadic macros are supported */
|
||||
|
||||
/* The actual logger function may be overridden in arch/debug.h if needed.
|
||||
* (Currently only if the pre-processor supports variadic macros)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
# define dbg(format, ...) \
|
||||
syslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define lldbg(format, ...) \
|
||||
lowsyslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
# else
|
||||
# define lldbg(x...)
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define vdbg(format, ...) \
|
||||
syslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define llvdbg(format, ...) \
|
||||
lowsyslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
# else
|
||||
# define llvdbg(x...)
|
||||
# endif
|
||||
|
||||
# else
|
||||
# define vdbg(x...)
|
||||
# define llvdbg(x...)
|
||||
# endif
|
||||
|
||||
#else /* CONFIG_DEBUG */
|
||||
|
||||
# define dbg(x...)
|
||||
# define lldbg(x...)
|
||||
# define vdbg(x...)
|
||||
# define llvdbg(x...)
|
||||
|
||||
#endif /* CONFIG_DEBUG */
|
||||
|
||||
/* Subsystem specific debug */
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
# define fdbg(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define flldbg(format, ...) lldbg(format, ##__VA_ARGS__)
|
||||
# define fvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
|
||||
# define fllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
|
||||
# define finfo(format, ...) vdbg(format, ##__VA_ARGS__)
|
||||
# define ferr(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define fwarn(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define fdbg(x...)
|
||||
# define flldbg(x...)
|
||||
# define fvdbg(x...)
|
||||
# define fllvdbg(x...)
|
||||
# define finfo(x...)
|
||||
# define ferr(x...)
|
||||
# define fwarn(x...)
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_CPP_HAVE_VARARGS */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __INCLUDE_DEBUG_H */
|
||||
Executable
+696
@@ -0,0 +1,696 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/compiler.h
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012-2013, 2015-2017 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_COMPILER_H
|
||||
#define __INCLUDE_NUTTX_COMPILER_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* GCC-specific definitions *************************************************/
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* Pre-processor */
|
||||
|
||||
# define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */
|
||||
# define CONFIG_CPP_HAVE_WARNING 1 /* Supports #warning */
|
||||
|
||||
/* Intriniscs. GCC supports __func__ but provides __FUNCTION__ for backward
|
||||
* compatibility with older versions of GCC.
|
||||
*/
|
||||
|
||||
# define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */
|
||||
# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */
|
||||
|
||||
/* Indicate that a local variable is not used */
|
||||
|
||||
# define UNUSED(a) ((void)(a))
|
||||
|
||||
/* Built-in functions */
|
||||
|
||||
/* GCC 4.x have __builtin_ctz(|l|ll) and __builtin_clz(|l|ll). These count
|
||||
* trailing/leading zeros of input number and typically will generate few
|
||||
* fast bit-counting instructions. Inputting zero to these functions is
|
||||
* undefined and needs to be taken care of by the caller. */
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
# define CONFIG_HAVE_BUILTIN_CTZ 1
|
||||
# define CONFIG_HAVE_BUILTIN_CLZ 1
|
||||
#endif
|
||||
|
||||
/* C++ support */
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201402L
|
||||
# define CONFIG_HAVE_CXX14 1
|
||||
#else
|
||||
# undef CONFIG_HAVE_CXX14
|
||||
#endif
|
||||
|
||||
/* Attributes
|
||||
*
|
||||
* GCC supports weak symbols which can be used to reduce code size because
|
||||
* unnecessary "weak" functions can be excluded from the link.
|
||||
*/
|
||||
|
||||
# if !defined(__CYGWIN__) && !defined(CONFIG_ARCH_GNU_NO_WEAKFUNCTIONS)
|
||||
# define CONFIG_HAVE_WEAKFUNCTIONS 1
|
||||
# ifndef weak_alias
|
||||
# define weak_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
|
||||
# endif
|
||||
# define weak_function __attribute__ ((weak))
|
||||
# define weak_const_function __attribute__ ((weak, __const__))
|
||||
# else
|
||||
# undef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
# define weak_alias(name, aliasname)
|
||||
# define weak_function
|
||||
# define weak_const_function
|
||||
# endif
|
||||
|
||||
/* The noreturn attribute informs GCC that the function will not return.
|
||||
* C11 adds _Noreturn keyword (see stdnoreturn.h)
|
||||
*/
|
||||
|
||||
# define noreturn_function __attribute__ ((noreturn))
|
||||
|
||||
/* The farcall_function attribute informs GCC that is should use long calls
|
||||
* (even though -mlong-calls does not appear in the compilation options)
|
||||
*/
|
||||
|
||||
# define farcall_function __attribute__ ((long_call))
|
||||
|
||||
/* Data alignment */
|
||||
|
||||
# define aligned_data(n) __attribute__ ((aligned(n)))
|
||||
|
||||
/* The packed attribute informs GCC that the structure elements are packed,
|
||||
* ignoring other alignment rules.
|
||||
*/
|
||||
|
||||
# define begin_packed_struct
|
||||
# define end_packed_struct __attribute__ ((packed))
|
||||
|
||||
/* GCC does not support the reentrant attribute */
|
||||
|
||||
# define reentrant_function
|
||||
|
||||
/* The naked attribute informs GCC that the programmer will take care of
|
||||
* the function prolog and epilog.
|
||||
*/
|
||||
|
||||
# define naked_function __attribute__ ((naked,no_instrument_function))
|
||||
|
||||
/* The inline_function attribute informs GCC that the function should always
|
||||
* be inlined, regardless of the level of optimization. The noinline_function
|
||||
* indicates that the function should never be inlined.
|
||||
*/
|
||||
|
||||
# define inline_function __attribute__ ((always_inline,no_instrument_function))
|
||||
# define noinline_function __attribute__ ((noinline))
|
||||
|
||||
/* GCC does not use storage classes to qualify addressing */
|
||||
|
||||
# define FAR
|
||||
# define NEAR
|
||||
# define DSEG
|
||||
# define CODE
|
||||
|
||||
/* Handle cases where sizeof(int) is 16-bits, sizeof(long) is 32-bits, and
|
||||
* pointers are 16-bits.
|
||||
*/
|
||||
|
||||
#if defined(__m32c__)
|
||||
/* No I-space access qualifiers */
|
||||
|
||||
# define IOBJ
|
||||
# define IPTR
|
||||
|
||||
/* Select the small, 16-bit addressing model */
|
||||
|
||||
# define CONFIG_SMALL_MEMORY 1
|
||||
|
||||
/* Long and int are not the same size */
|
||||
|
||||
# define CONFIG_LONG_IS_NOT_INT 1
|
||||
|
||||
/* Pointers and int are the same size */
|
||||
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
|
||||
#elif defined(__AVR__)
|
||||
# if defined(CONFIG_AVR_HAS_MEMX_PTR)
|
||||
/* I-space access qualifiers needed by Harvard architecture */
|
||||
|
||||
# define IOBJ __flash
|
||||
# define IPTR __memx
|
||||
|
||||
# else
|
||||
/* No I-space access qualifiers */
|
||||
|
||||
# define IOBJ
|
||||
# define IPTR
|
||||
# endif
|
||||
|
||||
/* Select the small, 16-bit addressing model (for D-Space) */
|
||||
|
||||
# define CONFIG_SMALL_MEMORY 1
|
||||
|
||||
/* Long and int are not the same size */
|
||||
|
||||
# define CONFIG_LONG_IS_NOT_INT 1
|
||||
|
||||
/* Pointers and int are the same size */
|
||||
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
|
||||
/* Uses a 32-bit FAR pointer only from accessing data outside of the 16-bit
|
||||
* data space.
|
||||
*/
|
||||
|
||||
# define CONFIG_HAVE_FARPOINTER 1
|
||||
|
||||
#elif defined(__mc68hc1x__)
|
||||
|
||||
/* No I-space access qualifiers */
|
||||
|
||||
# define IOBJ
|
||||
# define IPTR
|
||||
|
||||
/* Select the small, 16-bit addressing model */
|
||||
|
||||
# define CONFIG_SMALL_MEMORY 1
|
||||
|
||||
/* Normally, mc68hc1x code is compiled with the -mshort option
|
||||
* which results in a 16-bit integer. If -mnoshort is defined
|
||||
* then an integer is 32-bits. GCC will defined __INT__ accordingly:
|
||||
*/
|
||||
|
||||
# if __INT__ == 16
|
||||
/* int is 16-bits, long is 32-bits */
|
||||
|
||||
# define CONFIG_LONG_IS_NOT_INT 1
|
||||
|
||||
/* Pointers and int are the same size (16-bits) */
|
||||
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
# else
|
||||
/* int and long are both 32-bits */
|
||||
|
||||
# undef CONFIG_LONG_IS_NOT_INT
|
||||
|
||||
/* Pointers and int are NOT the same size */
|
||||
|
||||
# define CONFIG_PTR_IS_NOT_INT 1
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/* No I-space access qualifiers */
|
||||
|
||||
# define IOBJ
|
||||
# define IPTR
|
||||
|
||||
/* Select the large, 32-bit addressing model */
|
||||
|
||||
# undef CONFIG_SMALL_MEMORY
|
||||
|
||||
/* Long and int are (probably) the same size (32-bits) */
|
||||
|
||||
# undef CONFIG_LONG_IS_NOT_INT
|
||||
|
||||
/* Pointers and int are the same size (32-bits) */
|
||||
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
#endif
|
||||
|
||||
/* GCC supports inlined functions for C++ and for C version C99 and above */
|
||||
|
||||
# if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ >= 199901L
|
||||
# define CONFIG_HAVE_INLINE 1
|
||||
# else
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
# define inline
|
||||
# endif
|
||||
|
||||
/* ISO C11 supports anonymous (unnamed) structures and unions, added in
|
||||
* GCC 4.6 (but might be suppressed with -std= option). ISO C++11 also
|
||||
* adds un-named unions, but NOT unnamed structures (although compilers
|
||||
* may support them).
|
||||
*
|
||||
* CAREFUL: This can cause issues for shared data structures shared between
|
||||
* C and C++ if the two versions do not support the same features. Structures
|
||||
* and unions can lose binary compatibility!
|
||||
*
|
||||
* NOTE: The NuttX coding standard forbids the use of unnamed structures and
|
||||
* unions within the OS.
|
||||
*/
|
||||
|
||||
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
|
||||
# undef CONFIG_HAVE_ANONYMOUS_UNION
|
||||
|
||||
# if (defined(__cplusplus) && __cplusplus >= 201103L) || \
|
||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
|
||||
# define CONFIG_HAVE_ANONYMOUS_STRUCT 1
|
||||
# define CONFIG_HAVE_ANONYMOUS_UNION 1
|
||||
# endif
|
||||
|
||||
/* GCC supports both types double and long long */
|
||||
|
||||
# ifndef __clang__
|
||||
# define CONFIG_HAVE_LONG_LONG 1
|
||||
# endif
|
||||
# define CONFIG_HAVE_FLOAT 1
|
||||
# define CONFIG_HAVE_DOUBLE 1
|
||||
# define CONFIG_HAVE_LONG_DOUBLE 1
|
||||
|
||||
/* Structures and unions can be assigned and passed as values */
|
||||
|
||||
# define CONFIG_CAN_PASS_STRUCTS 1
|
||||
|
||||
/* Indicate that a local variable is not used */
|
||||
|
||||
# define UNUSED(a) ((void)(a))
|
||||
|
||||
/* SDCC-specific definitions ************************************************/
|
||||
|
||||
#elif defined(SDCC) || defined(__SDCC)
|
||||
|
||||
/* No I-space access qualifiers */
|
||||
|
||||
# define IOBJ
|
||||
# define IPTR
|
||||
|
||||
/* Pre-processor */
|
||||
|
||||
# define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */
|
||||
# define CONFIG_CPP_HAVE_WARNING 1 /* Supports #warning */
|
||||
|
||||
/* Intriniscs */
|
||||
|
||||
# define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */
|
||||
# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */
|
||||
# define __FUNCTION__ __func__ /* SDCC supports on __func__ */
|
||||
|
||||
/* Pragmas
|
||||
*
|
||||
* Disable warnings for unused function arguments */
|
||||
|
||||
# pragma disable_warning 85
|
||||
|
||||
/* C++ support */
|
||||
|
||||
# undef CONFIG_HAVE_CXX14
|
||||
|
||||
/* Attributes
|
||||
*
|
||||
* SDCC does not support weak symbols */
|
||||
|
||||
# undef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
# ifndef weak_alias
|
||||
# define weak_alias(name, aliasname)
|
||||
# endif
|
||||
# define weak_function
|
||||
# define weak_const_function
|
||||
# define restrict /* REVISIT */
|
||||
|
||||
/* SDCC does not support the noreturn or packed attributes */
|
||||
/* Current SDCC supports noreturn via C11 _Noreturn keyword (see
|
||||
* stdnoreturn.h).
|
||||
*/
|
||||
|
||||
# define noreturn_function
|
||||
# define aligned_data(n)
|
||||
# define begin_packed_struct
|
||||
# define end_packed_struct
|
||||
|
||||
/* REVISIT: */
|
||||
|
||||
# define farcall_function
|
||||
|
||||
/* SDCC does support "naked" functions */
|
||||
|
||||
# define naked_function __naked
|
||||
|
||||
/* SDCC does not support forced inlining. */
|
||||
|
||||
# define inline_function
|
||||
# define noinline_function
|
||||
|
||||
/* The reentrant attribute informs SDCC that the function
|
||||
* must be reentrant. In this case, SDCC will store input
|
||||
* arguments on the stack to support reentrancy.
|
||||
*
|
||||
* SDCC functions are always reentrant (except for the mcs51,
|
||||
* ds390, hc08 and s08 backends)
|
||||
*/
|
||||
|
||||
# define reentrant_function __reentrant
|
||||
|
||||
/* ISO C11 supports anonymous (unnamed) structures and unions. Does SDCC? */
|
||||
|
||||
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
|
||||
# undef CONFIG_HAVE_ANONYMOUS_UNION
|
||||
|
||||
/* Indicate that a local variable is not used */
|
||||
|
||||
# define UNUSED(a) ((void)(a))
|
||||
|
||||
/* It is assumed that the system is build using the small
|
||||
* data model with storage defaulting to internal RAM.
|
||||
* The NEAR storage class can also be used to address data
|
||||
* in internal RAM; FAR can be used to address data in
|
||||
* external RAM.
|
||||
*/
|
||||
|
||||
#if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_gbz80)
|
||||
# define FAR
|
||||
# define NEAR
|
||||
# define CODE
|
||||
# define DSEG
|
||||
#else
|
||||
# define FAR __xdata
|
||||
# define NEAR __data
|
||||
# define CODE __code
|
||||
# if defined(SDCC_MODEL_SMALL)
|
||||
# define DSEG __data
|
||||
# else
|
||||
# define DSEG __xdata
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Select small, 16-bit address model */
|
||||
|
||||
# define CONFIG_SMALL_MEMORY 1
|
||||
|
||||
/* Long and int are not the same size */
|
||||
|
||||
# define CONFIG_LONG_IS_NOT_INT 1
|
||||
|
||||
/* The generic pointer and int are not the same size (for some SDCC
|
||||
* architectures). REVISIT: SDCC now has more backends where pointers are
|
||||
* the same size as int than just z80 and z180.
|
||||
*/
|
||||
|
||||
#if !defined(__z80) && !defined(__gbz80)
|
||||
# define CONFIG_PTR_IS_NOT_INT 1
|
||||
#endif
|
||||
|
||||
/* New versions of SDCC supports inline function */
|
||||
|
||||
# define CONFIG_HAVE_INLINE 1
|
||||
|
||||
/* SDCC does types long long and float, but not types double and long
|
||||
* double.
|
||||
*/
|
||||
|
||||
# define CONFIG_HAVE_LONG_LONG 1
|
||||
# define CONFIG_HAVE_FLOAT 1
|
||||
# undef CONFIG_HAVE_DOUBLE
|
||||
# undef CONFIG_HAVE_LONG_DOUBLE
|
||||
|
||||
/* Structures and unions cannot be passed as values or used
|
||||
* in assignments.
|
||||
*/
|
||||
|
||||
# undef CONFIG_CAN_PASS_STRUCTS
|
||||
|
||||
/* Indicate that a local variable is not used */
|
||||
|
||||
# define UNUSED(a) ((void)(a))
|
||||
|
||||
/* Zilog-specific definitions ***********************************************/
|
||||
|
||||
#elif defined(__ZILOG__)
|
||||
|
||||
/* At present, only the following Zilog compilers are recognized */
|
||||
|
||||
# if !defined(__ZNEO__) && !defined(__EZ8__) && !defined(__EZ80__)
|
||||
# warning "Unrecognized Zilog compiler"
|
||||
# endif
|
||||
|
||||
/* Pre-processor */
|
||||
|
||||
# undef CONFIG_CPP_HAVE_VARARGS /* No variable argument macros */
|
||||
# undef CONFIG_CPP_HAVE_WARNING /* Does not support #warning */
|
||||
|
||||
/* Intrinsics */
|
||||
|
||||
# define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */
|
||||
# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */
|
||||
|
||||
/* No I-space access qualifiers */
|
||||
|
||||
# define IOBJ
|
||||
# define IPTR
|
||||
|
||||
/* C++ support */
|
||||
|
||||
# undef CONFIG_HAVE_CXX14
|
||||
|
||||
/* Attributes
|
||||
*
|
||||
* The Zilog compiler does not support weak symbols
|
||||
*/
|
||||
|
||||
# undef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
# ifndef weak_alias
|
||||
# define weak_alias(name, aliasname)
|
||||
# endif
|
||||
# define weak_function
|
||||
# define weak_const_function
|
||||
# define restrict
|
||||
|
||||
/* The Zilog compiler does not support the noreturn, packed, naked
|
||||
* attributes.
|
||||
*/
|
||||
|
||||
# define noreturn_function
|
||||
# define aligned_data(n)
|
||||
# define begin_packed_struct
|
||||
# define end_packed_struct
|
||||
# define naked_function
|
||||
# define inline_function
|
||||
# define noinline_function
|
||||
|
||||
/* REVISIT: */
|
||||
|
||||
# define farcall_function
|
||||
|
||||
/* The Zilog compiler does not support the reentrant attribute */
|
||||
|
||||
# define reentrant_function
|
||||
|
||||
/* Addressing.
|
||||
*
|
||||
* Z16F ZNEO: Far is 24-bits; near is 16-bits of address.
|
||||
* The supported model is (1) all code on ROM, and (2) all data
|
||||
* and stacks in external (far) RAM.
|
||||
* Z8Encore!: Far is 16-bits; near is 8-bits of address.
|
||||
* The supported model is (1) all code on ROM, and (2) all data
|
||||
* and stacks in internal (far) RAM.
|
||||
* Z8Acclaim: In Z80 mode, all pointers are 16-bits. In ADL mode, all pointers
|
||||
* are 24 bits.
|
||||
*/
|
||||
|
||||
# if defined(__ZNEO__)
|
||||
# define FAR _Far
|
||||
# define NEAR _Near
|
||||
# define DSEG _Far
|
||||
# define CODE _Erom
|
||||
# undef CONFIG_SMALL_MEMORY /* Select the large, 32-bit addressing model */
|
||||
# undef CONFIG_LONG_IS_NOT_INT /* Long and int are the same size */
|
||||
# undef CONFIG_PTR_IS_NOT_INT /* FAR pointers and int are the same size */
|
||||
# elif defined(__EZ8__)
|
||||
# define FAR far
|
||||
# define NEAR near
|
||||
# define DSEG far
|
||||
# define CODE rom
|
||||
# define CONFIG_SMALL_MEMORY 1 /* Select small, 16-bit address model */
|
||||
# define CONFIG_LONG_IS_NOT_INT 1 /* Long and int are not the same size */
|
||||
# undef CONFIG_PTR_IS_NOT_INT /* FAR pointers and int are the same size */
|
||||
# elif defined(__EZ80__)
|
||||
# define FAR
|
||||
# define NEAR
|
||||
# define DSEG
|
||||
# define CODE
|
||||
# undef CONFIG_SMALL_MEMORY /* Select the large, 32-bit addressing model */
|
||||
# define CONFIG_LONG_IS_NOT_INT 1 /* Long and int are not the same size */
|
||||
# ifdef CONFIG_EZ80_Z80MODE
|
||||
# define CONFIG_PTR_IS_NOT_INT 1 /* Pointers and int are not the same size */
|
||||
# else
|
||||
# undef CONFIG_PTR_IS_NOT_INT /* Pointers and int are the same size */
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* The Zilog compiler does not support inline functions */
|
||||
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
# define inline
|
||||
|
||||
/* ISO C11 supports anonymous (unnamed) structures and unions. Zilog does
|
||||
* not support C11
|
||||
*/
|
||||
|
||||
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
|
||||
# undef CONFIG_HAVE_ANONYMOUS_UNION
|
||||
|
||||
/* Older Zilog compilers support both types double and long long, but the size
|
||||
* is 32-bits (same as long and single precision) so it is safer to say that
|
||||
* they are not supported. Later versions are more ANSII compliant and
|
||||
* simply do not support long long or double.
|
||||
*/
|
||||
|
||||
# undef CONFIG_HAVE_LONG_LONG
|
||||
# define CONFIG_HAVE_FLOAT 1
|
||||
# undef CONFIG_HAVE_DOUBLE
|
||||
# undef CONFIG_HAVE_LONG_DOUBLE
|
||||
|
||||
/* Structures and unions can be assigned and passed as values */
|
||||
|
||||
# define CONFIG_CAN_PASS_STRUCTS 1
|
||||
|
||||
/* Indicate that a local variable is not used */
|
||||
|
||||
# define UNUSED(a) ((void)(a))
|
||||
|
||||
/* ICCARM-specific definitions ***********************************************/
|
||||
|
||||
#elif defined(__ICCARM__)
|
||||
|
||||
# define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */
|
||||
# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */
|
||||
# define CONFIG_HAVE_FLOAT 1
|
||||
|
||||
/* Indicate that a local variable is not used */
|
||||
|
||||
# define UNUSED(a) ((void)(a))
|
||||
|
||||
# ifndef weak_alias
|
||||
# define weak_alias(name, aliasname)
|
||||
# endif
|
||||
# define weak_function __weak
|
||||
# define weak_const_function
|
||||
# define noreturn_function
|
||||
# define farcall_function
|
||||
# define aligned_data(n)
|
||||
# define begin_packed_struct __packed
|
||||
# define end_packed_struct
|
||||
# define reentrant_function
|
||||
# define naked_function
|
||||
# define inline_function
|
||||
# define noinline_function
|
||||
|
||||
# define FAR
|
||||
# define NEAR
|
||||
# define DSEG
|
||||
# define CODE
|
||||
# define IOBJ
|
||||
# define IPTR
|
||||
|
||||
# define __asm__ asm
|
||||
# define __volatile__ volatile
|
||||
|
||||
/* For operatots __sfb() and __sfe() */
|
||||
|
||||
# pragma section = ".bss"
|
||||
# pragma section = ".data"
|
||||
# pragma section = ".data_init"
|
||||
# pragma section = ".text"
|
||||
|
||||
/* C++ support */
|
||||
|
||||
# undef CONFIG_HAVE_CXX14
|
||||
|
||||
/* ISO C11 supports anonymous (unnamed) structures and unions. Does ICCARM? */
|
||||
|
||||
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
|
||||
# undef CONFIG_HAVE_ANONYMOUS_UNION
|
||||
|
||||
/* Unknown compiler *********************************************************/
|
||||
|
||||
#else
|
||||
|
||||
# undef CONFIG_CPP_HAVE_VARARGS
|
||||
# undef CONFIG_CPP_HAVE_WARNING
|
||||
# undef CONFIG_HAVE_FUNCTIONNAME
|
||||
# undef CONFIG_HAVE_FILENAME
|
||||
# undef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
# undef CONFIG_HAVE_CXX14
|
||||
# ifndef weak_alias
|
||||
# define weak_alias(name, aliasname)
|
||||
# endif
|
||||
# define weak_function
|
||||
# define weak_const_function
|
||||
# define restrict
|
||||
# define noreturn_function
|
||||
# define farcall_function
|
||||
# define aligned_data(n)
|
||||
# define begin_packed_struct
|
||||
# define end_packed_struct
|
||||
# define reentrant_function
|
||||
# define naked_function
|
||||
# define inline_function
|
||||
# define noinline_function
|
||||
|
||||
# define FAR
|
||||
# define NEAR
|
||||
# define DSEG
|
||||
# define CODE
|
||||
|
||||
# undef CONFIG_SMALL_MEMORY
|
||||
# undef CONFIG_LONG_IS_NOT_INT
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
# define inline
|
||||
# undef CONFIG_HAVE_LONG_LONG
|
||||
# define CONFIG_HAVE_FLOAT 1
|
||||
# undef CONFIG_HAVE_DOUBLE
|
||||
# undef CONFIG_HAVE_LONG_DOUBLE
|
||||
# undef CONFIG_CAN_PASS_STRUCTS
|
||||
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
|
||||
# undef CONFIG_HAVE_ANONYMOUS_UNION
|
||||
|
||||
# define UNUSED(a) ((void)(a))
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_COMPILER_H */
|
||||
Executable
+200
@@ -0,0 +1,200 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/audio/automount.h
|
||||
*
|
||||
* Copyright (C) 2014 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_AUDIO_AUTOMOUNT_H
|
||||
#define __INCLUDE_NUTTX_AUDIO_AUTOMOUNT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************
|
||||
* Automounter configuration
|
||||
* CONFIG_FS_AUTOMOUNTER - Enables automount support
|
||||
*
|
||||
* Prequisites:
|
||||
* CONFIG_SCHED_WORKQUEUE - Work queue support is required
|
||||
* And others that would only matter if you are working in a very minimal
|
||||
* configuration.
|
||||
*/
|
||||
|
||||
/* Helper macros ************************************************************/
|
||||
|
||||
#define AUTOMOUNT_ATTACH(s,isr,arg) ((s)->attach(s,isr,arg))
|
||||
#define AUTOMOUNT_DETACH(s) ((s)->attach(s,NULL,NULL))
|
||||
#define AUTOMOUNT_ENABLE(s) ((s)->enable(s,true))
|
||||
#define AUTOMOUNT_DISABLE(s) ((s)->enable(s,false))
|
||||
#define AUTOMOUNT_INSERTED(s) ((s)->inserted(s))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
/* This is the type of the automount media change handler. The lower level
|
||||
* code will intercept the interrupt and provide the upper level with the
|
||||
* private data that was provided when the interrupt was attached and will
|
||||
* also provide an indication if the media was inserted or removed.
|
||||
*/
|
||||
|
||||
struct automount_lower_s; /* Forward reference. Defined below */
|
||||
|
||||
typedef CODE int
|
||||
(*automount_handler_t)(FAR const struct automount_lower_s *lower,
|
||||
FAR void *arg, bool inserted);
|
||||
|
||||
/* A reference to a structure of this type must be passed to the FS
|
||||
* automounter. This structure provides information about the volume to be
|
||||
* mounted and provides board-specific hooks.
|
||||
*
|
||||
* Memory for this structure is provided by the caller. It is not copied
|
||||
* by the automounter and is presumed to persist while the automounter
|
||||
* is active.
|
||||
*/
|
||||
|
||||
struct automount_lower_s
|
||||
{
|
||||
/* Volume characterization */
|
||||
|
||||
FAR const char *fstype; /* Type of file system */
|
||||
FAR const char *blockdev; /* Path to the block device */
|
||||
FAR const char *mountpoint; /* Location to mount the volume */
|
||||
|
||||
/* Debounce delay in system clock ticks. Automount operation will not
|
||||
* be performed until the insertion/removal state has been unchanges
|
||||
* for this duration.
|
||||
*/
|
||||
|
||||
uint32_t ddelay;
|
||||
|
||||
/* Unmount delay time in system clock ticks. If a volume has open
|
||||
* references at the time that the media is removed, then we will be
|
||||
* unable to unmount it. In that case, hopefully, the clients of the
|
||||
* mount will eventually fail with file access errors and eventually close
|
||||
* their references. So, at some time later, it should be possible to
|
||||
* unmount the volume. This delay specifies the time between umount
|
||||
* retries.
|
||||
*/
|
||||
|
||||
uint32_t udelay;
|
||||
|
||||
/* Interrupt related operations all hidden behind callbacks to isolate the
|
||||
* automounter from differences in interrupt handling by varying boards
|
||||
* and MCUs. Board interrupts should be configured both insertion and
|
||||
* removal of the media can be detected.
|
||||
*
|
||||
* attach - Attach or detach the media change interrupt handler to the
|
||||
* board level interrupt
|
||||
* enable - Enable or disable the media change interrupt
|
||||
*/
|
||||
|
||||
CODE int (*attach)(FAR const struct automount_lower_s *lower,
|
||||
automount_handler_t isr, FAR void *arg);
|
||||
CODE void (*enable)(FAR const struct automount_lower_s *lower,
|
||||
bool enable);
|
||||
CODE bool (*inserted)(FAR const struct automount_lower_s *lower);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: automount_initialize
|
||||
*
|
||||
* Description:
|
||||
* Configure the automounter.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - Persistent board configuration data
|
||||
*
|
||||
* Returned Value:
|
||||
* A void* handle. The only use for this handle is with automount_uninitialize().
|
||||
* NULL is returned on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *automount_initialize(FAR const struct automount_lower_s *lower);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: automount_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Stop the automounter and free resources that it used. NOTE that the
|
||||
* mount is left in its last state mounted/unmounted state.
|
||||
*
|
||||
* Input Parameters:
|
||||
* handle - The value previously returned by automount_initialize();
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void automount_uninitialize(FAR void *handle);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_AUDIO_AUTOMOUNT_H */
|
||||
Executable
+331
@@ -0,0 +1,331 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/fs/dirent_fs.h
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011-2013, 2015, 2018 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_FS_DIRENT_FS_H
|
||||
#define __INCLUDE_NUTTX_FS_DIRENT_FS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "vfs_config.h"
|
||||
|
||||
#include "sys/types.h"
|
||||
#include "stdint.h"
|
||||
#include "dirent.h"
|
||||
|
||||
#include "fs/fs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define kmm_malloc(s) malloc(s)
|
||||
#define kmm_free(mem) free(mem)
|
||||
#define kmm_zalloc(s) zalloc(s)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NFS
|
||||
# define DIRENT_NFS_MAXHANDLE 64 /* Maximum length of an NFSv3 file handle */
|
||||
# define DIRENT_NFS_VERFLEN 8 /* Length of the copy verifier */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* The internal representation of type DIR is just a container for an inode
|
||||
* reference, a position, a dirent structure, and file-system-specific
|
||||
* information.
|
||||
*
|
||||
* For the root pseudo-file system, we need retain only the 'next' inode
|
||||
* need for the next readdir() operation. We hold a reference on this
|
||||
* inode so we know that it will persist until closedir is called.
|
||||
*/
|
||||
|
||||
struct fs_pseudodir_s
|
||||
{
|
||||
struct inode *fd_next; /* The inode for the next call to readdir() */
|
||||
};
|
||||
|
||||
typedef void *fs_dir_s;
|
||||
|
||||
#define DIRENT_MAGIC 0x11CBA828 /* Magic number to express the status of a dirent */
|
||||
|
||||
#ifdef CONFIG_FS_FAT
|
||||
/* For fat, we need to return the start cluster, current cluster, current
|
||||
* sector and current directory index.
|
||||
*/
|
||||
|
||||
struct fs_fatdir_s
|
||||
{
|
||||
off_t fd_startcluster; /* Start cluster number of the directory */
|
||||
off_t fd_currcluster; /* Current cluster number being read */
|
||||
off_t fd_currsector; /* Current sector being read */
|
||||
unsigned int fd_index; /* Current index of the directory entry to read */
|
||||
};
|
||||
#endif /* CONFIG_FS_FAT */
|
||||
|
||||
#ifdef CONFIG_FS_ROMFS
|
||||
/* For ROMFS, we need to return the offset to the current and start positions
|
||||
* of the directory entry being read
|
||||
*/
|
||||
|
||||
struct fs_romfsdir_s
|
||||
{
|
||||
off_t fr_firstoffset; /* Offset to the first entry in the directory */
|
||||
off_t fr_curroffset; /* Current offset into the directory contents */
|
||||
};
|
||||
#endif /* CONFIG_FS_ROMFS */
|
||||
|
||||
#ifdef CONFIG_FS_CROMFS
|
||||
/* For CROMFS, we need to return the next compressed node to be examined. */
|
||||
|
||||
struct fs_cromfsdir_s
|
||||
{
|
||||
uint32_t cr_firstoffset; /* Offset to the first entry in the directory */
|
||||
uint32_t cr_curroffset; /* Current offset into the directory contents */
|
||||
};
|
||||
#endif /* CONFIG_FS_CROMFS */
|
||||
/* For TMPFS, we need the directory object and an index into the directory
|
||||
* entries.
|
||||
*/
|
||||
|
||||
struct tmpfs_directory_s; /* Forward reference */
|
||||
struct fs_tmpfsdir_s
|
||||
{
|
||||
FAR struct tmpfs_directory_s *tf_tdo; /* Directory being enumerated */
|
||||
unsigned int tf_index; /* Directory index */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FS_BINFS
|
||||
/* The apps/ pseudo bin/ directory. The state value is simply an index */
|
||||
|
||||
struct fs_binfsdir_s
|
||||
{
|
||||
unsigned int fb_index; /* Index to the next named entry point */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_NXFFS
|
||||
/* NXFFS is the tiny NuttX wear-leveling FLASH file system. The state value is
|
||||
* the offset in FLASH memory to the next inode entry.
|
||||
*/
|
||||
|
||||
struct fs_nxffsdir_s
|
||||
{
|
||||
off_t nx_offset; /* Offset to the next inode */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NFS
|
||||
/* The NFS client file system */
|
||||
|
||||
struct nfsdir_s
|
||||
{
|
||||
uint8_t nfs_fhsize; /* Length of the file handle */
|
||||
uint8_t nfs_fhandle[DIRENT_NFS_MAXHANDLE]; /* File handle (max size allocated) */
|
||||
uint8_t nfs_verifier[DIRENT_NFS_VERFLEN]; /* Cookie verifier */
|
||||
uint32_t nfs_cookie[2]; /* Cookie */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_SMARTFS
|
||||
/* SMARTFS is the Sector Mapped Allocation for Really Tiny FLASH filesystem.
|
||||
* it is designed to use small sectors on small serial FLASH devices, using
|
||||
* minimal RAM footprint.
|
||||
*/
|
||||
|
||||
struct fs_smartfsdir_s
|
||||
{
|
||||
uint16_t fs_firstsector; /* First sector of directory list */
|
||||
uint16_t fs_currsector; /* Current sector of directory list */
|
||||
uint16_t fs_curroffset; /* Current offset within current sector */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_SPIFFS
|
||||
/* SPIFFS is an SPI-oriented FLASH file system originally by Peter Andersson */
|
||||
|
||||
struct fs_spiffsdir_s
|
||||
{
|
||||
int16_t block; /* Current block */
|
||||
int entry; /* Current entry */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_UNIONFS
|
||||
/* The Union File System can be used to merge to different mountpoints so
|
||||
* that they appear as a single merged directory.
|
||||
*/
|
||||
|
||||
struct fs_dirent_s; /* Forward reference */
|
||||
struct fs_unionfsdir_s
|
||||
{
|
||||
uint8_t fu_ndx; /* Index of file system being enumerated */
|
||||
bool fu_eod; /* True: At end of directory */
|
||||
bool fu_prefix[2]; /* True: Fake directory in prefix */
|
||||
FAR char *fu_relpath; /* Path being enumerated */
|
||||
FAR struct fs_dirent_s *fu_lower[2]; /* dirent struct used by contained file system */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_USERFS
|
||||
/* The UserFS uses an opaque representation since the actual userspace representation
|
||||
* of the directory state structure is unknowable.
|
||||
*/
|
||||
|
||||
struct fs_userfsdir_s
|
||||
{
|
||||
FAR void *fs_dir; /* Opaque pointer to UserFS DIR */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_HOSTFS
|
||||
/* HOSTFS provides mapping to directories on the host machine in the
|
||||
* sim environment.
|
||||
*/
|
||||
|
||||
struct fs_hostfsdir_s
|
||||
{
|
||||
FAR void *fs_dir; /* Opaque pointer to host DIR */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct fs_dirent_s
|
||||
{
|
||||
/* This is the node that was opened by opendir. The type of the inode
|
||||
* determines the way that the readdir() operations are performed. For the
|
||||
* pseudo root pseudo-file system, it is also used to support rewind.
|
||||
*
|
||||
* We hold a reference on this inode so we know that it will persist until
|
||||
* closedir() is called (although inodes linked to this inode may change).
|
||||
*/
|
||||
|
||||
struct inode *fd_root;
|
||||
|
||||
/* At present, only mountpoints require special handling flags */
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
unsigned int fd_flags;
|
||||
#endif
|
||||
|
||||
/* This keeps track of the current directory position for telldir */
|
||||
|
||||
off_t fd_position;
|
||||
|
||||
/* Retained control information depends on the type of file system that
|
||||
* provides is provides the mountpoint. Ideally this information should
|
||||
* be hidden behind an opaque, file-system-dependent void *, but we put
|
||||
* the private definitions in line here for now to reduce allocations.
|
||||
*/
|
||||
|
||||
struct
|
||||
{
|
||||
/* Private data used by the built-in pseudo-file system */
|
||||
|
||||
struct fs_pseudodir_s pseudo;
|
||||
|
||||
/* Private data used by other file systems */
|
||||
fs_dir_s fs_dir;
|
||||
#ifdef CONFIG_FS_FAT
|
||||
struct fs_fatdir_s fat;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_ROMFS
|
||||
struct fs_romfsdir_s romfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_CROMFS
|
||||
struct fs_cromfsdir_s cromfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_TMPFS
|
||||
struct fs_tmpfsdir_s tmpfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_BINFS
|
||||
struct fs_binfsdir_s binfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
FAR void *procfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_NXFFS
|
||||
struct fs_nxffsdir_s nxffs;
|
||||
#endif
|
||||
#ifdef CONFIG_NFS
|
||||
struct nfsdir_s nfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_SMARTFS
|
||||
struct fs_smartfsdir_s smartfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_SPIFFS
|
||||
struct fs_spiffsdir_s spiffs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_LITTLEFS
|
||||
FAR void *littlefs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_UNIONFS
|
||||
struct fs_unionfsdir_s unionfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_USERFS
|
||||
struct fs_userfsdir_s userfs;
|
||||
#endif
|
||||
#ifdef CONFIG_FS_HOSTFS
|
||||
struct fs_hostfsdir_s hostfs;
|
||||
#endif
|
||||
} u;
|
||||
|
||||
/* In any event, this the actual struct dirent that is returned by readdir */
|
||||
|
||||
struct dirent fd_dir; /* Populated when readdir is called */
|
||||
int fd_status; /* Express the dirent is been opened or no */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __INCLUDE_NUTTX_FS_DIRENT_FS_H */
|
||||
Executable
+179
@@ -0,0 +1,179 @@
|
||||
/****************************************************************************
|
||||
* include/fs/file.h
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2013, 2015-2018 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_FS_FILE_H
|
||||
#define __INCLUDE_FS_FILE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "vfs_config.h"
|
||||
#include "compiler.h"
|
||||
|
||||
#include "sys/types.h"
|
||||
#include "stdarg.h"
|
||||
#include "stdint.h"
|
||||
#include "fs/fs.h"
|
||||
|
||||
#include "semaphore.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************
|
||||
* Global Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* Callback used by foreach_mountpoints to traverse all mountpoints in the
|
||||
* pseudo-file system.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
struct statfs; /* Forward reference */
|
||||
typedef int (*foreach_mountpoint_t)(FAR const char *mountpoint,
|
||||
FAR struct statfs *statbuf,
|
||||
FAR void *arg);
|
||||
#endif
|
||||
|
||||
struct filelist *sched_getfiles(void);
|
||||
|
||||
/* fs/fs_sendfile.c *************************************************/
|
||||
/****************************************************************************
|
||||
* Name: sendfile
|
||||
*
|
||||
* Description:
|
||||
* Copy data between one file descriptor and another.
|
||||
*
|
||||
****************************************************************************/
|
||||
ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count);
|
||||
|
||||
/**
|
||||
* @ingroup fs
|
||||
* @brief get the path by a given file fd.
|
||||
*
|
||||
* @par Description:
|
||||
* The function is used for getting the path by a given file fd.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>Only support file fd, not any dir fd.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param fd [IN] Type #int file fd.
|
||||
* @param path [IN] Type #char ** address of the location to return the path reference.
|
||||
*
|
||||
* @retval #0 get path success
|
||||
* @retval #~0 get path failed
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>fs.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*
|
||||
* @since 2020-1-8
|
||||
*/
|
||||
|
||||
extern int get_path_from_fd(int fd, char **path);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: foreach_mountpoint
|
||||
*
|
||||
* Description:
|
||||
* Visit each mountpoint in the pseudo-file system. The traversal is
|
||||
* terminated when the callback 'handler' returns a non-zero value, or when
|
||||
* all of the mountpoints have been visited.
|
||||
*
|
||||
* This is just a front end "filter" to foreach_inode() that forwards only
|
||||
* mountpoint inodes. It is intended to support the mount() command to
|
||||
* when the mount command is used to enumerate mounts.
|
||||
*
|
||||
* NOTE 1: Use with caution... The pseudo-file system is locked throughout
|
||||
* the traversal.
|
||||
* NOTE 2: The search algorithm is recursive and could, in principle, use
|
||||
* an indeterminant amount of stack space. This will not usually be a
|
||||
* real work issue.
|
||||
*
|
||||
* Input Parameters:
|
||||
* handler - Operation function when find a mount point.
|
||||
* arg - Private data.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
int foreach_mountpoint(foreach_mountpoint_t handler, FAR void *arg);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: find_blockdriver
|
||||
*
|
||||
* Description:
|
||||
* Return the inode of the block driver specified by 'pathname'
|
||||
*
|
||||
* Input Parameters:
|
||||
* pathname - The full path to the block driver to be located
|
||||
* mountflags - If MS_RDONLY is not set, then driver must support write
|
||||
* operations (see include/sys/mount.h)
|
||||
* ppinode - Address of the location to return the inode reference
|
||||
*
|
||||
* Returned Value:
|
||||
* Returns zero on success or a negated errno on failure:
|
||||
*
|
||||
* EINVAL - Pathname or pinode is NULL.
|
||||
* ENOENT - No block driver of this name is registered
|
||||
* ENOTBLK - The inode associated with the pathname is not a block driver
|
||||
* EACCESS - The MS_RDONLY option was not set but this driver does not
|
||||
* support write access
|
||||
*
|
||||
* Attention:
|
||||
* The parameter pathname is a full path, which begin with '/'.
|
||||
* The parameter ppinode must point a valid memory, which size must be enough for storing struct inode.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
int find_blockdriver(FAR const char *pathname, int mountflags,
|
||||
FAR struct inode **ppinode);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __INCLUDE_FS_FILE_H */
|
||||
Executable
+1058
File diff suppressed because it is too large
Load Diff
Executable
+1504
File diff suppressed because it is too large
Load Diff
Executable
+1051
File diff suppressed because it is too large
Load Diff
Executable
+132
@@ -0,0 +1,132 @@
|
||||
/************************************************************************************
|
||||
* include/nuttx/usb/storage.h
|
||||
*
|
||||
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* References:
|
||||
* "Universal Serial Bus Mass Storage Class, Specification Overview,"
|
||||
* Revision 1.2, USB Implementer's Forum, June 23, 2003.
|
||||
*
|
||||
* "Universal Serial Bus Mass Storage Class, Bulk-Only Transport,"
|
||||
* Revision 1.0, USB Implementer's Forum, September 31, 1999.
|
||||
*
|
||||
* 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_USB_STORAGE_H
|
||||
#define __INCLUDE_NUTTX_USB_STORAGE_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Mass storage requests */
|
||||
|
||||
#define USBMSC_TYPE_SETUPIN (USB_DIR_IN|UT_CLASS|UT_INTERFACE)
|
||||
#define USBMSC_TYPE_SETUPOUT (USB_DIR_OUT|UT_CLASS|UT_INTERFACE)
|
||||
|
||||
#define USBMSC_REQ_MSRESET (0xff) /* Reset mass storage device and interface */
|
||||
#define USBMSC_REQ_GETMAXLUN (0xfe) /* Return number LUNs supported */
|
||||
|
||||
/* Mass storage subclass codes */
|
||||
|
||||
#define USBMSC_SUBCLASS_RBC (0x01) /* Reduced block commands (e.g., flash devices) */
|
||||
#define USBMSC_SUBCLASS_SFF1 (0x02) /* SFF-8020i/MMC-2 (ATAPI) (e.g., C/DVD) */
|
||||
#define USBMSC_SUBCLASS_QIC (0x03) /* QIC-157 (e.g., tape device) */
|
||||
#define USBMSC_SUBCLASS_UFI (0x04) /* e.g. floppy device */
|
||||
#define USBMSC_SUBCLASS_SFF2 (0x05) /* SFF-8070i (e.g. floppy disk) */
|
||||
#define USBMSC_SUBCLASS_SCSI (0x06) /* SCSI transparent */
|
||||
|
||||
#define UMASS_ATTACH_PRENAME "/dev/sd"
|
||||
#define MASS_NAME 10
|
||||
#define MAX_DEVICE 5
|
||||
|
||||
/* Mass storage transport protocols */
|
||||
|
||||
#define USBMSC_PROTO_CBI0 (0x00) /* CBI transport with command completion interrupt */
|
||||
#define USBMSC_PROTO_CBI1 (0x01) /* CBI transport without command completion interrupt */
|
||||
#define USBMSC_PROTO_BULKONLY (0x50) /* Bulk only transport */
|
||||
|
||||
/* Common Block Wrapper (CBW) */
|
||||
|
||||
#define USBMSC_CBW_SIZEOF (31)
|
||||
#define USBMSC_CBW_SIGNATURE (0x43425355) /* Little endian USBC */
|
||||
#define USBMSC_CBWFLAG_IN (0x80) /* Bit 7=1: Direction = IN */
|
||||
|
||||
#define USBMSC_MAXCDBLEN (16) /* Max length of SCSI Command Data Block */
|
||||
|
||||
/* Command Status Wrapper (CSW) */
|
||||
|
||||
#define USBMSC_CSW_SIZEOF (13)
|
||||
#define USBMSC_CSW_SIGNATURE (0x53425355) /* Little endian 'USBS' */
|
||||
#define USBMSC_CSWSTATUS_PASS (0)
|
||||
#define USBMSC_CSWSTATUS_FAIL (1)
|
||||
#define USBMSC_CSWSTATUS_PHASEERROR (2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/* Command Block Wrapper (CBW) */
|
||||
|
||||
struct usbmsc_cbw_s
|
||||
{
|
||||
uint8_t signature[4]; /* 'USBC' = 0x43425355 */
|
||||
uint8_t tag[4]; /* Depends on command id */
|
||||
uint8_t datlen[4]; /* Number of bytes that host expects to transfer */
|
||||
uint8_t flags; /* Bit 7: Direction=IN (other obsolete or reserved) */
|
||||
uint8_t lun; /* LUN (normally 0) */
|
||||
uint8_t cdblen; /* len of cdb[] */
|
||||
uint8_t cdb[USBMSC_MAXCDBLEN]; /* Command Data Block */
|
||||
};
|
||||
|
||||
/* Command Status Wrapper (CSW) */
|
||||
|
||||
struct usbmsc_csw_s
|
||||
{
|
||||
uint8_t signature[4]; /* 'USBS' = 0x53425355 */
|
||||
uint8_t tag[4]; /* Same tag as original command */
|
||||
uint8_t residue[4]; /* Amount not transferred */
|
||||
uint8_t status; /* Status of transfer */
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_USB_STORAGE_H */
|
||||
Executable
+709
@@ -0,0 +1,709 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/video/fb.h
|
||||
*
|
||||
* Copyright (C) 2008-2011, 2013, 2016-2018 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_VIDEO_FB_H
|
||||
#define __INCLUDE_NUTTX_VIDEO_FB_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "los_config.h"
|
||||
#include "compiler.h"
|
||||
#include "los_vm_map.h"
|
||||
|
||||
#define CONFIG_FB_CMAP
|
||||
#define CONFIG_FB_OVERLAY_BLIT
|
||||
#define CONFIG_FB_OVERLAY
|
||||
#define CONFIG_FB_TRANSPARENCY
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Color format definitions. The pretty much define the color pixel processing
|
||||
* organization of the video controller.
|
||||
*/
|
||||
|
||||
/* Monochrome Formats *******************************************************/
|
||||
|
||||
#define FB_FMT_Y1 0 /* BPP=1, monochrome */
|
||||
#define FB_FMT_Y2 1 /* BPP=2, 2-bit uncompressed greyscale */
|
||||
#define FB_FMT_Y4 2 /* BPP=4, 4-bit uncompressed greyscale */
|
||||
#define FB_FMT_Y8 3 /* BPP=8, 8-bit uncompressed greyscale */
|
||||
#define FB_FMT_Y16 4 /* BPP=16, 16-bit uncompressed greyscale */
|
||||
#define FB_FMT_GREY FB_FMT_Y8 /* BPP=8 */
|
||||
#define FB_FMT_Y800 FB_FMT_Y8 /* BPP=8 */
|
||||
|
||||
#define FB_ISMONO(f) ((f) >= FB_FMT_Y4) && (f) <= FB_FMT_Y16)
|
||||
|
||||
/* RGB video formats ********************************************************/
|
||||
|
||||
/* Standard RGB */
|
||||
|
||||
#define FB_FMT_RGB1 FB_FMT_Y1 /* BPP=1 */
|
||||
#define FB_FMT_RGB4 5 /* BPP=4 */
|
||||
#define FB_FMT_RGB8 6 /* BPP=8 RGB palette index */
|
||||
#define FB_FMT_RGB8_222 7 /* BPP=8 R=2, G=2, B=2 */
|
||||
#define FB_FMT_RGB8_332 8 /* BPP=8 R=3, G=3, B=2 */
|
||||
#define FB_FMT_RGB12_444 9 /* BPP=12 R=4, G=4, B=4 */
|
||||
#define FB_FMT_RGB16_555 10 /* BPP=16 R=5, G=5, B=5 (1 unused bit) */
|
||||
#define FB_FMT_RGB16_565 11 /* BPP=16 R=6, G=6, B=5 */
|
||||
#define FB_FMT_RGB24 12 /* BPP=24 */
|
||||
#define FB_FMT_RGB32 13 /* BPP=32 */
|
||||
|
||||
/* Run length encoded RGB */
|
||||
|
||||
#define FB_FMT_RGBRLE4 14 /* BPP=4 */
|
||||
#define FB_FMT_RGBRLE8 15 /* BPP=8 */
|
||||
|
||||
/* Raw RGB */
|
||||
|
||||
#define FB_FMT_RGBRAW 16 /* BPP=? */
|
||||
|
||||
/* Raw RGB with arbitrary sample packing within a pixel. Packing and precision
|
||||
* of R, G and B components is determined by bit masks for each.
|
||||
*/
|
||||
|
||||
#define FB_FMT_RGBBTFLD16 17 /* BPP=16 */
|
||||
#define FB_FMT_RGBBTFLD24 18 /* BPP=24 */
|
||||
#define FB_FMT_RGBBTFLD32 19 /* BPP=32 */
|
||||
#define FB_FMT_RGBA16 20 /* BPP=16 Raw RGB with alpha */
|
||||
#define FB_FMT_RGBA32 21 /* BPP=32 Raw RGB with alpha */
|
||||
|
||||
/* Raw RGB with a transparency field. Layout is as for standard RGB at 16 and
|
||||
* 32 bits per pixel but the msb in each pixel indicates whether the pixel is
|
||||
* transparent or not.
|
||||
*/
|
||||
|
||||
#define FB_FMT_RGBT16 22 /* BPP=16 */
|
||||
#define FB_FMT_RGBT32 23 /* BPP=32 */
|
||||
|
||||
#define FB_ISRGB(f) ((f) >= FB_FMT_RGB1) && (f) <= FB_FMT_RGBT32)
|
||||
|
||||
/* Packed YUV Formats *******************************************************/
|
||||
|
||||
#define FB_FMT_AYUV 24 /* BPP=32 Combined YUV and alpha */
|
||||
#define FB_FMT_CLJR 25 /* BPP=8 4 pixels packed into a uint32_t.
|
||||
* YUV 4:1:1 with l< 8 bits
|
||||
* per YUV sample */
|
||||
#define FB_FMT_CYUV 26 /* BPP=16 UYVY except that height is
|
||||
* reversed */
|
||||
#define FB_FMT_IRAW 27 /* BPP=? Intel uncompressed YUV */
|
||||
#define FB_FMT_IUYV 28 /* BPP=16 Interlaced UYVY (line order
|
||||
* 0,2,4,.., 1,3,5...) */
|
||||
#define FB_FMT_IY41 29 /* BPP=12 Interlaced Y41P (line order
|
||||
* 0,2,4,.., 1,3,5...) */
|
||||
#define FB_FMT_IYU2 30 /* BPP=24 */
|
||||
#define FB_FMT_HDYC 31 /* BPP=16 UYVY except uses the BT709
|
||||
* color space */
|
||||
#define FB_FMT_UYVP 32 /* BPP=24? YCbCr 4:2:2, 10-bits per
|
||||
* component in U0Y0V0Y1 order */
|
||||
#define FB_FMT_UYVY 33 /* BPP=16 YUV 4:2:2 */
|
||||
#define FB_FMT_UYNV FB_FMT_UYVY /* BPP=16 */
|
||||
#define FB_FMT_Y422 FB_FMT_UYVY /* BPP=16 */
|
||||
#define FB_FMT_V210 34 /* BPP=32 10-bit 4:2:2 YCrCb */
|
||||
#define FB_FMT_V422 35 /* BPP=16 Upside down version of UYVY */
|
||||
#define FB_FMT_V655 36 /* BPP=16? 16-bit YUV 4:2:2 */
|
||||
#define FB_FMT_VYUY 37 /* BPP=? ATI Packed YUV Data */
|
||||
#define FB_FMT_YUYV 38 /* BPP=16 YUV 4:2:2 */
|
||||
#define FB_FMT_YUY2 FB_FMT_YUYV /* BPP=16 YUV 4:2:2 */
|
||||
#define FB_FMT_YUNV FB_FMT_YUYV /* BPP=16 YUV 4:2:2 */
|
||||
#define FB_FMT_YVYU 39 /* BPP=16 YUV 4:2:2 */
|
||||
#define FB_FMT_Y41P 40 /* BPP=12 YUV 4:1:1 */
|
||||
#define FB_FMT_Y411 41 /* BPP=12 YUV 4:1:1 */
|
||||
#define FB_FMT_Y211 42 /* BPP=8 */
|
||||
#define FB_FMT_Y41T 43 /* BPP=12 Y41P LSB for transparency */
|
||||
#define FB_FMT_Y42T 44 /* BPP=16 UYVY LSB for transparency */
|
||||
#define FB_FMT_YUVP 45 /* BPP=24? YCbCr 4:2:2 Y0U0Y1V0 order */
|
||||
|
||||
#define FB_ISYUVPACKED(f) ((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP)
|
||||
|
||||
/* Packed Planar YUV Formats ************************************************/
|
||||
|
||||
#define FB_FMT_YVU9 46 /* BPP=9 8-bit Y followed by 8-bit
|
||||
* 4x4 VU */
|
||||
#define FB_FMT_YUV9 47 /* BPP=9? */
|
||||
#define FB_FMT_IF09 48 /* BPP=9.5 YVU9 + 4x4 plane of delta
|
||||
* relative to tframe. */
|
||||
#define FB_FMT_YV16 49 /* BPP=16 8-bit Y followed by 8-bit
|
||||
* 2x1 VU */
|
||||
#define FB_FMT_YV12 50 /* BPP=12 8-bit Y followed by 8-bit
|
||||
* 2x2 VU */
|
||||
#define FB_FMT_I420 51 /* BPP=12 8-bit Y followed by 8-bit
|
||||
* 2x2 UV */
|
||||
#define FB_FMT_IYUV FB_FMT_I420 /* BPP=12 */
|
||||
#define FB_FMT_NV12 52 /* BPP=12 8-bit Y followed by an
|
||||
* interleaved 2x2 UV */
|
||||
#define FB_FMT_NV21 53 /* BPP=12 NV12 with UV reversed */
|
||||
#define FB_FMT_IMC1 54 /* BPP=12 YV12 except UV planes same
|
||||
* stride as Y */
|
||||
#define FB_FMT_IMC2 55 /* BPP=12 IMC1 except UV lines
|
||||
* interleaved at half stride
|
||||
* boundaries */
|
||||
#define FB_FMT_IMC3 56 /* BPP=12 As IMC1 except that UV
|
||||
* swapped */
|
||||
#define FB_FMT_IMC4 57 /* BPP=12 As IMC2 except that UV
|
||||
* swapped */
|
||||
#define FB_FMT_CLPL 58 /* BPP=12 YV12 but including a level
|
||||
* of indirection. */
|
||||
#define FB_FMT_Y41B 59 /* BPP=12? 4:1:1 planar. */
|
||||
#define FB_FMT_Y42B 60 /* BPP=16? YUV 4:2:2 planar. */
|
||||
#define FB_FMT_CXY1 61 /* BPP=12 */
|
||||
#define FB_FMT_CXY2 62 /* BPP=16 */
|
||||
|
||||
#define FB_ISYUVPLANAR(f) (((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP)
|
||||
#define FB_ISYUV(f) (FB_ISYUVPACKED(f) || FB_ISYUVPLANAR(f))
|
||||
|
||||
/* Hardware cursor control **************************************************/
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
# define FB_CUR_ENABLE 0x01 /* Enable the cursor */
|
||||
# define FB_CUR_SETIMAGE 0x02 /* Set the cursor image */
|
||||
# define FB_CUR_SETPOSITION 0x04 /* Set the position of the cursor */
|
||||
# define FB_CUR_SETSIZE 0x08 /* Set the size of the cursor */
|
||||
# define FB_CUR_XOR 0x10 /* Use XOR vs COPY ROP on image */
|
||||
#endif
|
||||
|
||||
/* Hardware overlay acceleration *******************************************/
|
||||
|
||||
#ifdef CONFIG_FB_OVERLAY
|
||||
# define FB_ACCL_TRANSP 0x01 /* Hardware tranparency support */
|
||||
# define FB_ACCL_CHROMA 0x02 /* Hardware chromakey support */
|
||||
# define FB_ACCL_COLOR 0x04 /* Hardware color support */
|
||||
# define FB_ACCL_AREA 0x08 /* Hardware support area selection */
|
||||
|
||||
#ifdef CONFIG_FB_OVERLAY_BLIT
|
||||
# define FB_ACCL_BLIT 0x10 /* Hardware blit support */
|
||||
# define FB_ACCL_BLEND 0x20 /* Hardware blend support */
|
||||
#endif
|
||||
|
||||
/* Overlay transparency mode ************************************************/
|
||||
|
||||
# define FB_CONST_ALPHA 0x00 /* Transparency by alpha value */
|
||||
# define FB_PIXEL_ALPHA 0x01 /* Transparency by pixel alpha value */
|
||||
|
||||
#endif /* CONFIG_FB_OVERLAY */
|
||||
|
||||
/* FB character driver IOCTL commands ***************************************/
|
||||
#define _FBIOCBASE (0x2800) /* Frame buffer character driver ioctl commands */
|
||||
#define _IOC_X(type,nr) ((type)|(nr))
|
||||
#define _FBIOC(nr) _IOC_X(_FBIOCBASE,nr)
|
||||
|
||||
/* ioctls */
|
||||
|
||||
#define FBIOGET_VIDEOINFO _FBIOC(0x0001) /* Get color plane info */
|
||||
/* Argument: writable struct
|
||||
* fb_videoinfo_s */
|
||||
#define FBIOGET_PLANEINFO _FBIOC(0x0002) /* Get video plane info */
|
||||
/* Argument: writable struct
|
||||
* fb_planeinfo_s */
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
# define FBIOGET_CMAP _FBIOC(0x0003) /* Get RGB color mapping */
|
||||
/* Argument: writable struct
|
||||
* fb_cmap_s */
|
||||
# define FBIOPUT_CMAP _FBIOC(0x0004) /* Put RGB color mapping */
|
||||
/* Argument: read-only struct
|
||||
* fb_cmap_s */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
# define FBIOGET_CURSOR _FBIOC(0x0005) /* Get cursor attributes */
|
||||
/* Argument: writable struct
|
||||
* fb_cursorattrib_s */
|
||||
# define FBIOPUT_CURSOR _FBIOC(0x0006) /* Set cursor attributes */
|
||||
/* Argument: read-only struct
|
||||
* fb_setcursor_s */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
# define FBIO_UPDATE _FBIOC(0x0007) /* Update a rectangular region in
|
||||
* the framebuffer
|
||||
* Argument: read-only struct
|
||||
* nxgl_rect_s */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FB_SYNC
|
||||
# define FBIO_WAITFORVSYNC _FBIOC(0x0008) /* Wait for vertical sync */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FB_OVERLAY
|
||||
# define FBIOGET_OVERLAYINFO _FBIOC(0x0009) /* Get video overlay info */
|
||||
/* Argument: writable struct
|
||||
* fb_overlayinfo_s */
|
||||
# define FBIO_SELECT_OVERLAY _FBIOC(0x000a) /* Select overlay */
|
||||
/* Argument: read-only
|
||||
* unsigned long */
|
||||
# define FBIOSET_TRANSP _FBIOC(0x000b) /* Set opacity or transparency
|
||||
* Argument: read-only struct
|
||||
* fb_overlayinfo_s */
|
||||
# define FBIOSET_CHROMAKEY _FBIOC(0x000c) /* Set chroma key
|
||||
* Argument: read-only struct
|
||||
* fb_overlayinfo_s */
|
||||
# define FBIOSET_COLOR _FBIOC(0x000d) /* Set color
|
||||
* Argument: read-only struct
|
||||
* fb_overlayinfo_s */
|
||||
# define FBIOSET_BLANK _FBIOC(0x000e) /* Blank or unblank
|
||||
* Argument: read-only struct
|
||||
* fb_overlayinfo_s */
|
||||
# define FBIOSET_AREA _FBIOC(0x000f) /* Set active overlay area
|
||||
* Argument: read-only struct
|
||||
* fb_overlayinfo_s */
|
||||
#ifdef CONFIG_FB_OVERLAY_BLIT
|
||||
# define FBIOSET_BLIT _FBIOC(0x0010) /* Blit area between overlays
|
||||
* Argument: read-only struct
|
||||
* fb_overlayblit_s */
|
||||
# define FBIOSET_BLEND _FBIOC(0x0011) /* Blend area between overlays
|
||||
* Argument: read-only struct
|
||||
* fb_overlayblend_s */
|
||||
#endif
|
||||
#endif /* CONFIG_FB_OVERLAY */
|
||||
|
||||
#define FIOC_MMAP _FBIOC(0x0012)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* If any dimension of the display exceeds 65,536 pixels, then the following
|
||||
* type will need to change:
|
||||
*/
|
||||
|
||||
typedef uint16_t fb_coord_t;
|
||||
|
||||
/* This structure describes the overall video controller */
|
||||
|
||||
struct fb_videoinfo_s
|
||||
{
|
||||
uint8_t fmt; /* see FB_FMT_* */
|
||||
fb_coord_t xres; /* Horizontal resolution in pixel columns */
|
||||
fb_coord_t yres; /* Vertical resolution in pixel rows */
|
||||
uint8_t nplanes; /* Number of color planes supported */
|
||||
#ifdef CONFIG_FB_OVERLAY
|
||||
uint8_t noverlays; /* Number of overlays supported */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* This structure describes one color plane. Some YUV formats may support
|
||||
* up to 4 planes
|
||||
*/
|
||||
|
||||
struct fb_planeinfo_s
|
||||
{
|
||||
FAR void *fbmem; /* Start of frame buffer memory */
|
||||
size_t fblen; /* Length of frame buffer memory in bytes */
|
||||
fb_coord_t stride; /* Length of a line in bytes */
|
||||
uint8_t display; /* Display number */
|
||||
uint8_t bpp; /* Bits per pixel */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FB_OVERLAY
|
||||
/* This structure describes the transparency. */
|
||||
|
||||
struct fb_transp_s
|
||||
{
|
||||
uint8_t transp; /* Transparency */
|
||||
uint8_t transp_mode; /* Transparency mode */
|
||||
};
|
||||
|
||||
/* This structure describes an area. */
|
||||
|
||||
struct fb_area_s
|
||||
{
|
||||
fb_coord_t x; /* x-offset of the area */
|
||||
fb_coord_t y; /* y-offset of the area */
|
||||
fb_coord_t w; /* Width of the area */
|
||||
fb_coord_t h; /* Height of the area */
|
||||
};
|
||||
|
||||
/* This structure describes one overlay. */
|
||||
|
||||
struct fb_overlayinfo_s
|
||||
{
|
||||
FAR void *fbmem; /* Start of frame buffer virtual memory */
|
||||
FAR void *memphys; /* Start of frame buffer physical memory */
|
||||
size_t fblen; /* Length of frame buffer memory in bytes */
|
||||
fb_coord_t stride; /* Length of a line in bytes */
|
||||
uint8_t overlay; /* Overlay number */
|
||||
uint8_t bpp; /* Bits per pixel */
|
||||
uint8_t blank; /* Blank or unblank */
|
||||
uint32_t chromakey; /* Chroma key argb8888 formatted */
|
||||
uint32_t color; /* Color argb8888 formatted */
|
||||
struct fb_transp_s transp; /* Transparency */
|
||||
struct fb_area_s sarea; /* Selected area within the overlay */
|
||||
uint32_t accl; /* Supported hardware acceleration */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FB_OVERLAY_BLIT
|
||||
/* This structure describes an overlay area within a whole overlay */
|
||||
|
||||
struct fb_overlayarea_s
|
||||
{
|
||||
uint8_t overlay; /* Number overlay */
|
||||
struct fb_area_s area; /* Overlay area */
|
||||
};
|
||||
|
||||
/* This structure describes blit operation */
|
||||
|
||||
struct fb_overlayblit_s
|
||||
{
|
||||
struct fb_overlayarea_s dest; /* The destination overlay area */
|
||||
struct fb_overlayarea_s src; /* The source overlay area */
|
||||
};
|
||||
|
||||
/* This structure describes blend operation */
|
||||
|
||||
struct fb_overlayblend_s
|
||||
{
|
||||
struct fb_overlayarea_s dest; /* The destination overlay area */
|
||||
struct fb_overlayarea_s foreground; /* The foreground overlay area */
|
||||
struct fb_overlayarea_s background; /* The background overlay area */
|
||||
};
|
||||
#endif
|
||||
#endif /* CONFIG_FB_OVERLAY */
|
||||
|
||||
/* On video controllers that support mapping of a pixel palette value
|
||||
* to an RGB encoding, the following structure may be used to define
|
||||
* that mapping.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
struct fb_cmap_s
|
||||
{
|
||||
uint16_t first; /* Offset offset first color entry in tables */
|
||||
uint16_t len; /* Number of color entries in tables */
|
||||
|
||||
/* Tables of color component. Any may be NULL if not used */
|
||||
|
||||
uint8_t *red; /* Table of 8-bit red values */
|
||||
uint8_t *green; /* Table of 8-bit green values */
|
||||
uint8_t *blue; /* Table of 8-bit blue values */
|
||||
#ifdef CONFIG_FB_TRANSPARENCY
|
||||
uint8_t *transp; /* Table of 8-bit transparency */
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||
/* If the video controller hardware supports a hardware cursor and
|
||||
* that hardware cursor supports user-provided images, then the
|
||||
* following structure may be used to provide the cursor image
|
||||
*/
|
||||
|
||||
struct fb_cursorimage_s
|
||||
{
|
||||
fb_coord_t width; /* Width of the cursor image in pixels */
|
||||
fb_coord_t height /* Height of the cursor image in pixels */
|
||||
const uint8_t *image; /* Pointer to image data */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The following structure defines the cursor position/size */
|
||||
|
||||
struct fb_cursorpos_s
|
||||
{
|
||||
fb_coord_t x; /* X position in pixels */
|
||||
fb_coord_t y; /* Y position in rows */
|
||||
};
|
||||
|
||||
/* If the hardware supports setting the cursor size, then this structure
|
||||
* is used to provide the size.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
struct fb_cursorsize_s
|
||||
{
|
||||
fb_coord_t h; /* Height in rows */
|
||||
fb_coord_t w; /* Width in pixels */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The following is used to get the cursor attributes */
|
||||
|
||||
struct fb_cursorattrib_s
|
||||
{
|
||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||
uint8_t fmt; /* Video format of cursor */
|
||||
#endif
|
||||
struct fb_cursorpos_s pos; /* Current cursor position */
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
struct fb_cursorsize_s mxsize; /* Maximum cursor size */
|
||||
struct fb_cursorsize_s size; /* Current size */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct fb_setcursor_s
|
||||
{
|
||||
uint8_t flags; /* See FB_CUR_* definitions */
|
||||
struct fb_cursorpos_s pos; /* Cursor position */
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
struct fb_cursorsize_s size; /* Cursor size */
|
||||
#endif
|
||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||
struct fb_cursorimage_s img; /* Cursor image */
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The framebuffer "object" is accessed through within the OS via
|
||||
* the following vtable:
|
||||
*/
|
||||
|
||||
struct fb_vtable_s
|
||||
{
|
||||
/* Get information about the video controller configuration and the
|
||||
* configuration of each color plane.
|
||||
*/
|
||||
|
||||
int (*getvideoinfo)(FAR struct fb_vtable_s *vtable,
|
||||
FAR struct fb_videoinfo_s *vinfo);
|
||||
int (*getplaneinfo)(FAR struct fb_vtable_s *vtable, int planeno,
|
||||
FAR struct fb_planeinfo_s *pinfo);
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
/* The following are provided only if the video hardware supports RGB
|
||||
* color mapping
|
||||
*/
|
||||
|
||||
int (*getcmap)(FAR struct fb_vtable_s *vtable,
|
||||
FAR struct fb_cmap_s *cmap);
|
||||
int (*putcmap)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_cmap_s *cmap);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
/* The following are provided only if the video hardware supports a
|
||||
* hardware cursor.
|
||||
*/
|
||||
|
||||
int (*getcursor)(FAR struct fb_vtable_s *vtable,
|
||||
FAR struct fb_cursorattrib_s *attrib);
|
||||
int (*setcursor)(FAR struct fb_vtable_s *vtable,
|
||||
FAR struct fb_setcursor_s *settings);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FB_SYNC
|
||||
/* The following are provided only if the video hardware signals
|
||||
* vertical snyc.
|
||||
*/
|
||||
|
||||
int (*waitforvsync)(FAR struct fb_vtable_s *vtable);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FB_OVERLAY
|
||||
/* Get information about the video controller configuration and the
|
||||
* configuration of each overlay.
|
||||
*/
|
||||
|
||||
int (*getoverlayinfo)(FAR struct fb_vtable_s *vtable, int overlayno,
|
||||
FAR struct fb_overlayinfo_s *oinfo);
|
||||
|
||||
/* The following are provided only if the video hardware supports
|
||||
* transparency
|
||||
*/
|
||||
|
||||
int (*settransp)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_overlayinfo_s *oinfo);
|
||||
|
||||
/* The following are provided only if the video hardware supports
|
||||
* chromakey
|
||||
*/
|
||||
|
||||
int (*setchromakey)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_overlayinfo_s *oinfo);
|
||||
|
||||
/* The following are provided only if the video hardware supports
|
||||
* filling the overlay with a color.
|
||||
*/
|
||||
|
||||
int (*setcolor)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_overlayinfo_s *oinfo);
|
||||
|
||||
/* The following allows to switch the overlay on or off */
|
||||
|
||||
int (*setblank)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_overlayinfo_s *oinfo);
|
||||
|
||||
/* The following allows to set the active area for subsequently overlay
|
||||
* operations.
|
||||
*/
|
||||
|
||||
int (*setarea)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_overlayinfo_s *oinfo);
|
||||
|
||||
# ifdef CONFIG_FB_OVERLAY_BLIT
|
||||
/* The following are provided only if the video hardware supports
|
||||
* blit operation between overlays.
|
||||
*/
|
||||
|
||||
int (*blit)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_overlayblit_s *blit);
|
||||
|
||||
/* The following are provided only if the video hardware supports
|
||||
* blend operation between overlays.
|
||||
*/
|
||||
|
||||
int (*blend)(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_overlayblend_s *blend);
|
||||
# endif
|
||||
#endif
|
||||
int (*fb_open)(struct fb_vtable_s *vtable);
|
||||
int (*fb_release)(struct fb_vtable_s *vtable);
|
||||
#ifdef CONFIG_FB_OVERLAY
|
||||
int (*fb_pan_display)(struct fb_vtable_s *vtable, struct fb_overlayinfo_s *oinfo);
|
||||
#endif
|
||||
int (*fb_ioctl)(struct fb_vtable_s *vtable, int cmd, unsigned long arg);
|
||||
int (*fb_check_var)(struct fb_vtable_s *vtable, unsigned long arg);
|
||||
int (*fb_set_par)(struct fb_vtable_s *vtable);
|
||||
ssize_t (*fb_mmap)(FAR struct fb_vtable_s *vtable, FAR LosVmMapRegion *region);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* If an architecture supports a framebuffer, then it must provide the
|
||||
* following APIs to access the framebuffer.
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the framebuffer video hardware associated with the display.
|
||||
*
|
||||
* There are multiple logic paths that may call up_fbinitialize() so any
|
||||
* implementation of up_fbinitialize() should be tolerant of being called
|
||||
* multiple times.
|
||||
*
|
||||
* Input Parameters:
|
||||
* display - In the case of hardware with multiple displays, this
|
||||
* specifies the display. Normally this is zero.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero is returned on success; a negated errno value is returned on any
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_fbinitialize(int display);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbgetvplane
|
||||
*
|
||||
* Description:
|
||||
* Return a a reference to the framebuffer object for the specified video
|
||||
* plane of the specified plane. Many OSDs support multiple planes of video.
|
||||
*
|
||||
* Input Parameters:
|
||||
* display - In the case of hardware with multiple displays, this
|
||||
* specifies the display. Normally this is zero.
|
||||
* vplane - Identifies the plane being queried.
|
||||
*
|
||||
* Returned Value:
|
||||
* A non-NULL pointer to the frame buffer access structure is returned on
|
||||
* success; NULL is returned on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbuninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize the framebuffer support for the specified display.
|
||||
*
|
||||
* Input Parameters:
|
||||
* display - In the case of hardware with multiple displays, this
|
||||
* specifies the display. Normally this is zero.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_fbuninitialize(int display);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fb_register
|
||||
*
|
||||
* Description:
|
||||
* Register the framebuffer character device at /dev/fbN where N is the
|
||||
* display number if the devices supports only a single plane. If the
|
||||
* hardware supports multiple color planes, then the device will be
|
||||
* registered at /dev/fbN.M where N is the again display number but M
|
||||
* is the display plane.
|
||||
*
|
||||
* Input Parameters:
|
||||
* display - The display number for the case of boards supporting multiple
|
||||
* displays or for hardware that supports multiple
|
||||
* layers (each layer is consider a display). Typically zero.
|
||||
* plane - Identifies the color plane on hardware that supports separate
|
||||
* framebuffer "planes" for each color component.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned success; a negated errno value is returned on any
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fb_register(int display, int plane);
|
||||
|
||||
int fb_unregister(int display);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_VIDEO_FB_H */
|
||||
Executable
+301
@@ -0,0 +1,301 @@
|
||||
/****************************************************************************
|
||||
* include/syslog.h
|
||||
*
|
||||
* Copyright (C) 2013-2014, 2018 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_SYSLOG_H
|
||||
#define __INCLUDE_SYSLOG_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "vfs_config.h"
|
||||
|
||||
#include "stdint.h"
|
||||
#include "stdarg.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* The option argument to openlog() is an OR of any of these:
|
||||
*
|
||||
* LOG_CONS - Write directly to system console if there is an error
|
||||
* while sending to system logger.
|
||||
* LOG_NDELAY - Open the connection immediately (normally, the connection
|
||||
* is opened when the first message is logged).
|
||||
* LOG_NOWAIT - Don't wait for child processes that may have been created
|
||||
* while logging the message.
|
||||
* LOG_ODELAY - The converse of LOG_NDELAY; opening of the connection is
|
||||
* delayed until syslog() is called. (This is the default,
|
||||
* and need not be specified.)
|
||||
* LOG_PERROR - (Not in POSIX.1-2001 or POSIX.1-2008.) Print to stderr
|
||||
* as well (Linux).
|
||||
* LOG_PID - Include PID with each message.
|
||||
*/
|
||||
|
||||
/* Note: openlog() is not currently supported */
|
||||
|
||||
/* The facility argument is used to specify what type of program is logging
|
||||
* the message. This lets the configuration file specify that messages from
|
||||
* different facilities will be handled differently.
|
||||
*
|
||||
* LOG_AUTH - Security/authorization messages
|
||||
* LOG_AUTHPRIV - Security/authorization messages (private)
|
||||
* LOG_CRON - Clock daemon (cron and at)
|
||||
* LOG_DAEMON - System daemons without separate facility value
|
||||
* LOG_FTP - Ftp daemon
|
||||
* LOG_KERN - Lernel messages (these can't be generated from user
|
||||
* processes)
|
||||
* LOG_LOCAL0 through LOG_LOCAL7 - Reserved for local use
|
||||
* LOG_LPR - Line printer subsystem
|
||||
* LOG_MAIL - Mail subsystem
|
||||
* LOG_NEWS - USENET news subsystem
|
||||
* LOG_SYSLOG - Messages generated internally by syslogd(8)
|
||||
* LOG_USER - Generic user-level messages (default)
|
||||
* LOG_UUCP - UUCP subsystem
|
||||
*/
|
||||
|
||||
#define LOG_AUTH 0
|
||||
#define LOG_AUTHPRIV 0
|
||||
#define LOG_CRON 0
|
||||
#define LOG_DAEMON 0
|
||||
#define LOG_FTP 0
|
||||
#define LOG_KERN 0
|
||||
#define LOG_LOCAL0 0
|
||||
#define LOG_LOCAL1 0
|
||||
#define LOG_LOCAL2 0
|
||||
#define LOG_LOCAL3 0
|
||||
#define LOG_LOCAL4 0
|
||||
#define LOG_LOCAL5 0
|
||||
#define LOG_LOCAL6 0
|
||||
#define LOG_LOCAL7 0
|
||||
#define LOG_LPR 0
|
||||
#define LOG_MAIL 0
|
||||
#define LOG_NEWS 0
|
||||
#define LOG_SYSLOG 0
|
||||
#define LOG_USER 0
|
||||
#define LOG_UUCP 0
|
||||
|
||||
/* This determines the importance of the message. The levels are, in order
|
||||
* of decreasing importance:
|
||||
*/
|
||||
|
||||
#define LOG_EMERG 0 /* System is unusable */
|
||||
#define LOG_ALERT 1 /* Action must be taken immediately */
|
||||
#define LOG_CRIT 2 /* Critical conditions */
|
||||
#define LOG_ERR 3 /* Error conditions */
|
||||
#define LOG_WARNING 4 /* Warning conditions */
|
||||
#define LOG_NOTICE 5 /* Normal, but significant, condition */
|
||||
#define LOG_INFO 6 /* Informational message */
|
||||
#define LOG_DEBUG 7 /* Debug-level message */
|
||||
|
||||
/* Used with setlogmask() */
|
||||
|
||||
#define LOG_MASK(p) (1 << (p))
|
||||
#define LOG_UPTO(p) ((1 << (p)) - 1)
|
||||
#define LOG_ALL 0xff
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SYSLOG_CHAR) && !defined(CONFIG_SYSLOG_DEVPATH)
|
||||
# define CONFIG_SYSLOG_DEVPATH "/dev/ttyS1"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: openlog
|
||||
*
|
||||
* Description:
|
||||
* The openlog() function sets process attributes that affect subsequent
|
||||
* calls to syslog(). The ident argument is a string that is prepended to
|
||||
* every message. The logopt argument indicates logging options. Values
|
||||
* for logopt are constructed by a bitwise-inclusive OR of zero or more of
|
||||
* the following:
|
||||
*
|
||||
* LOG_PID - Log the process ID with each message. This is useful for
|
||||
* identifying specific processes.
|
||||
*
|
||||
* LOG_CONS - Write messages to the system console if they cannot be
|
||||
* sent to the logging facility. The syslog() function ensures that
|
||||
* the process does not acquire the console as a controlling terminal
|
||||
* in the process of writing the message.
|
||||
*
|
||||
* LOG_NDELAY - Open the connection to the logging facility immediately.
|
||||
* Normally the open is delayed until the first message is logged.
|
||||
* This is useful for programs that need to manage the order in which
|
||||
* file descriptors are allocated.
|
||||
*
|
||||
* LOG_ODELAY - Delay open until syslog() is called.
|
||||
*
|
||||
* LOG_NOWAIT - Do not wait for child processes that may have been
|
||||
* created during the course of logging the message. This option
|
||||
* should be used by processes that enable notification of child
|
||||
* termination using SIGCHLD, since syslog() may otherwise block
|
||||
* waiting for a child whose exit status has already been collected.
|
||||
*
|
||||
* The facility argument encodes a default facility to be assigned to all
|
||||
* messages that do not have an explicit facility already encoded. The
|
||||
* initial default facility is LOG_USER.
|
||||
*
|
||||
* It is not necessary to call openlog() prior to calling syslog().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if 0 /* Not supported */
|
||||
void openlog(FAR const char *ident, int option, int facility);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: closelog
|
||||
*
|
||||
* Description:
|
||||
* The openlog() and syslog() functions may allocate a file descriptor.
|
||||
* The closelog() function will close any open file descriptors allocated
|
||||
* by previous calls to openlog() or syslog().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if 0 /* Not supported */
|
||||
void closelog(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: syslog and vsyslog
|
||||
*
|
||||
* Description:
|
||||
* syslog() generates a log message. The priority argument is formed by
|
||||
* ORing the facility and the level values (see include/syslog.h). The
|
||||
* remaining arguments are a format, as in printf and any arguments to the
|
||||
* format.
|
||||
*
|
||||
* The NuttX implementation does not support any special formatting
|
||||
* characters beyond those supported by printf.
|
||||
*
|
||||
* The function vsyslog() performs the same task as syslog() with the
|
||||
* difference that it takes a set of arguments which have been obtained
|
||||
* using the stdarg variable argument list macros.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int syslog(int priority, const char *format, ...);
|
||||
int vsyslog(int priority, const char *src, va_list ap);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lowsyslog and lowvsyslog
|
||||
*
|
||||
* Description:
|
||||
* syslog() generates a log message. The priority argument is formed by
|
||||
* ORing the facility and the level values (see include/syslog.h). The
|
||||
* remaining arguments are a format, as in printf and any arguments to the
|
||||
* format.
|
||||
*
|
||||
* This is a non-standard, low-level system logging interface. The
|
||||
* difference between syslog() and lowsyslog() is that the syslog()
|
||||
* interface writes to the syslog device (usually fd=1, stdout) whereas
|
||||
* lowsyslog() uses a lower level interface that works even from interrupt
|
||||
* handlers.
|
||||
*
|
||||
* If the platform cannot support lowsyslog, then we will substitute the
|
||||
* standard syslogging functions. These will, however, probably cause
|
||||
* problems if called from interrupt handlers, depending upon the nature of
|
||||
* the underlying syslog device.
|
||||
*
|
||||
* The function lowvsyslog() performs the same task as lowsyslog() with
|
||||
* the difference that it takes a set of arguments which have been
|
||||
* obtained using the stdarg variable argument list macros.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_LOWPUTC
|
||||
|
||||
int lowsyslog(int priority, FAR const char *format, ...);
|
||||
int lowvsyslog(int priority, FAR const char *format, va_list ap);
|
||||
|
||||
#else
|
||||
|
||||
# ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# define lowsyslog(p,f,...) syslog(p,f,##__VA_ARGS__)
|
||||
# else
|
||||
# define lowsyslog (void)
|
||||
# endif
|
||||
# define lowvsyslog(p,f,a) vsyslog(p,f,a)
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: setlogmask
|
||||
*
|
||||
* Description:
|
||||
* The setlogmask() function sets the logmask and returns the previous
|
||||
* mask. If the mask argument is 0, the current logmask is not modified.
|
||||
*
|
||||
* The SYSLOG priorities are: LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
|
||||
* LOG_WARNING, LOG_NOTICE, LOG_INFO, and LOG_DEBUG. The bit corresponding
|
||||
* to a priority p is LOG_MASK(p); LOG_UPTO(p) provides the mask of all
|
||||
* priorities in the above list up to and including p.
|
||||
*
|
||||
* Per OpenGroup.org "If the maskpri argument is 0, the current log mask
|
||||
* is not modified." In this implementation, the value zero is permitted
|
||||
* in order to disable all syslog levels.
|
||||
*
|
||||
* REVISIT: Per POSIX the syslog mask should be a per-process value but in
|
||||
* NuttX, the scope of the mask is dependent on the nature of the build:
|
||||
*
|
||||
* Flat Build: There is one, global SYSLOG mask that controls all output.
|
||||
* Protected Build: There are two SYSLOG masks. One within the kernel
|
||||
* that controls only kernel output. And one in user-space that controls
|
||||
* only user SYSLOG output.
|
||||
* Kernel Build: The kernel build is compliant with the POSIX requirement:
|
||||
* There will be one mask for for each user process, controlling the
|
||||
* SYSLOG output only form that process. There will be a separate mask
|
||||
* accessable only in the kernel code to control kernel SYSLOG output.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int setlogmask(int mask);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCLUDE_SYSLOG_H */
|
||||
Reference in New Issue
Block a user