mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 06:53:35 +08:00
Manually fixup merge botches via direct comparison with NuttX r5447.
This commit is contained in:
@@ -46,4 +46,13 @@
|
||||
// Namespace
|
||||
//***************************************************************************
|
||||
|
||||
//***************************************************************************
|
||||
// Namespace
|
||||
//***************************************************************************
|
||||
|
||||
namespace std
|
||||
{
|
||||
using ::_Bool8;
|
||||
}
|
||||
|
||||
#endif // __INCLUDE_CXX_CSTDBOOL
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace std
|
||||
using ::FILE;
|
||||
using ::fpos_t;
|
||||
using ::size_t;
|
||||
|
||||
using ::clearerr;
|
||||
using ::fclose;
|
||||
using ::fflush;
|
||||
using ::feof;
|
||||
@@ -69,16 +71,24 @@ namespace std
|
||||
using ::ftell;
|
||||
using ::fwrite;
|
||||
using ::gets;
|
||||
using ::ungetc;
|
||||
|
||||
using ::printf;
|
||||
using ::puts;
|
||||
using ::rename;
|
||||
using ::sprintf;
|
||||
using ::asprintf;
|
||||
using ::snprintf;
|
||||
using ::ungetc;
|
||||
using ::sscanf;
|
||||
using ::perror;
|
||||
|
||||
using ::vprintf;
|
||||
using ::vfprintf;
|
||||
using ::vsprintf;
|
||||
using ::avsprintf;
|
||||
using ::vsnprintf;
|
||||
using ::vsscanf;
|
||||
|
||||
using ::fdopen;
|
||||
using ::statfs;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
/****************************************************************************
|
||||
* include/elf32.h
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Reference: System V Application Binary Interface, Edition 4.1, March 18,
|
||||
* 1997, The Santa Cruz Operation, Inc.
|
||||
*
|
||||
* 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_ELF32_H
|
||||
#define __INCLUDE_ELF32_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Values for Elf32_Ehdr::e_type */
|
||||
|
||||
#define ET_NONE 0 /* No file type */
|
||||
#define ET_REL 1 /* Relocatable file */
|
||||
#define ET_EXEC 2 /* Executable file */
|
||||
#define ET_DYN 3 /* Shared object file */
|
||||
#define ET_CORE 4 /* Core file */
|
||||
#define ET_LOPROC 0xff00 /* Processor-specific */
|
||||
#define ET_HIPROC 0xffff /* Processor-specific */
|
||||
|
||||
/* Values for Elf32_Ehdr::e_machine (most of this were not included in the
|
||||
* original SCO document but have been gleaned from elsewhere).
|
||||
*/
|
||||
|
||||
#define EM_NONE 0 /* No machine */
|
||||
#define EM_M32 1 /* AT&T WE 32100 */
|
||||
#define EM_SPARC 2 /* SPARC */
|
||||
#define EM_386 3 /* Intel 80386 */
|
||||
#define EM_68K 4 /* Motorola 68000 */
|
||||
#define EM_88K 5 /* Motorola 88000 */
|
||||
#define EM_486 6 /* Intel 486+ */
|
||||
#define EM_860 7 /* Intel 80860 */
|
||||
#define EM_MIPS 8 /* MIPS R3000 Big-Endian */
|
||||
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
|
||||
#define EM_PARISC 15 /* HPPA */
|
||||
#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
|
||||
#define EM_PPC 20 /* PowerPC */
|
||||
#define EM_PPC64 21 /* PowerPC64 */
|
||||
#define EM_ARM 40 /* ARM */
|
||||
#define EM_SH 42 /* SuperH */
|
||||
#define EM_SPARCV9 43 /* SPARC v9 64-bit */
|
||||
#define EM_IA_64 50 /* HP/Intel IA-64 */
|
||||
#define EM_X86_64 62 /* AMD x86-64 */
|
||||
#define EM_S390 22 /* IBM S/390 */
|
||||
#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
|
||||
#define EM_V850 87 /* NEC v850 */
|
||||
#define EM_M32R 88 /* Renesas M32R */
|
||||
#define EM_H8_300 46
|
||||
#define EM_ALPHA 0x9026
|
||||
#define EM_CYGNUS_V850 0x9080
|
||||
#define EM_CYGNUS_M32R 0x9041
|
||||
#define EM_S390_OLD 0xa390
|
||||
#define EM_FRV 0x5441
|
||||
|
||||
/* Values for Elf32_Ehdr::e_version */
|
||||
|
||||
#define EV_NONE 0 /* Invalid version */
|
||||
#define EV_CURRENT 1 /* The current version */
|
||||
|
||||
/* Ehe ELF identifier */
|
||||
|
||||
#define EI_MAG0 0 /* File identification */
|
||||
#define EI_MAG1 1 /* " " " " */
|
||||
#define EI_MAG2 2 /* " " " " */
|
||||
#define EI_MAG3 3 /* " " " " */
|
||||
#define EI_CLASS 4 /* File class */
|
||||
#define EI_DATA 5 /* Data encoding */
|
||||
#define EI_VERSION 6 /* File version */
|
||||
#define EI_PAD 7 /* Start of padding bytes */
|
||||
#define EI_NIDENT 16 /* Size of eident[] */
|
||||
|
||||
#define EI_MAGIC_SIZE 4
|
||||
#define EI_MAGIC {0x7f, 'E', 'L', 'F'}
|
||||
|
||||
/* Values for EI_CLASS */
|
||||
|
||||
#define ELFCLASSNONE 0 /* Invalid class */
|
||||
#define ELFCLASS32 1 /* 32-bit objects */
|
||||
#define ELFCLASS64 2 /* 64-bit objects */
|
||||
|
||||
/* Values for EI_DATA */
|
||||
|
||||
#define ELFDATANONE 0 /* Invalid data encoding */
|
||||
#define ELFDATA2LSB 1 /* Least significant byte occupying the lowest address */
|
||||
#define ELFDATA2MSB 2 /* Most significant byte occupying the lowest address */
|
||||
|
||||
/* Figure 4-7: Special Section Indexes */
|
||||
|
||||
#define SHN_UNDEF 0
|
||||
#define SHN_LORESERVE 0xff00
|
||||
#define SHN_LOPROC 0xff00
|
||||
#define SHN_HIPROC 0xff1f
|
||||
#define SHN_ABS 0xfff1
|
||||
#define SHN_COMMON 0xfff2
|
||||
#define SHN_HIRESERVE 0xffff
|
||||
|
||||
/* Figure 4-9: Section Types, sh_type */
|
||||
|
||||
#define SHT_NULL 0
|
||||
#define SHT_PROGBITS 1
|
||||
#define SHT_SYMTAB 2
|
||||
#define SHT_STRTAB 3
|
||||
#define SHT_RELA 4
|
||||
#define SHT_HASH 5
|
||||
#define SHT_DYNAMIC 6
|
||||
#define SHT_NOTE 7
|
||||
#define SHT_NOBITS 8
|
||||
#define SHT_REL 9
|
||||
#define SHT_SHLIB 10
|
||||
#define SHT_DYNSYM 11
|
||||
#define SHT_LOPROC 0x70000000
|
||||
#define SHT_HIPROC 0x7fffffff
|
||||
#define SHT_LOUSER 0x80000000
|
||||
#define SHT_HIUSER 0xffffffff
|
||||
|
||||
/* Figure 4-11: Section Attribute Flags, sh_flags */
|
||||
|
||||
#define SHF_WRITE 1
|
||||
#define SHF_ALLOC 2
|
||||
#define SHF_EXECINSTR 4
|
||||
#define SHF_MASKPROC 0xf0000000
|
||||
|
||||
/* Definitions for Elf32_Sym::st_info */
|
||||
|
||||
#define ELF32_ST_BIND(i) ((i) >> 4)
|
||||
#define ELF32_ST_TYPE(i) ((i) & 0xf)
|
||||
#define ELF32_ST_INFO(b,t) (((b) << 4) | ((t) & 0xf))
|
||||
|
||||
/* Figure 4-16: Symbol Binding, ELF32_ST_BIND */
|
||||
|
||||
#define STB_LOCAL 0
|
||||
#define STB_GLOBAL 1
|
||||
#define STB_WEAK 2
|
||||
#define STB_LOPROC 13
|
||||
#define STB_HIPROC 15
|
||||
|
||||
/* Figure 4-17: Symbol Types, ELF32_ST_TYPE */
|
||||
|
||||
#define STT_NOTYPE 0
|
||||
#define STT_OBJECT 1
|
||||
#define STT_FUNC 2
|
||||
#define STT_SECTION 3
|
||||
#define STT_FILE 4
|
||||
#define STT_LOPROC 13
|
||||
#define STT_HIPROC 15
|
||||
|
||||
/* Definitions for Elf32_Rel*::r_info */
|
||||
|
||||
#define ELF32_R_SYM(i) ((i) >> 8)
|
||||
#define ELF32_R_TYPE(i) ((i) & 0xff)
|
||||
#define ELF32_R_INFO(s,t) (((s)<< 8) | ((t) & 0xff))
|
||||
|
||||
/* Figure 5-2: Segment Types, p_type */
|
||||
|
||||
#define PT_NULL 0
|
||||
#define PT_LOAD 1
|
||||
#define PT_DYNAMIC 2
|
||||
#define PT_INTERP 3
|
||||
#define PT_NOTE 4
|
||||
#define PT_SHLIB 5
|
||||
#define PT_PHDR 6
|
||||
#define PT_LOPROC 0x70000000
|
||||
#define PT_HIPROC 0x7fffffff
|
||||
|
||||
/* Figure 5-3: Segment Flag Bits, p_flags */
|
||||
|
||||
#define PF_X 1 /* Execute */
|
||||
#define PF_W 2 /* Write */
|
||||
#define PF_R 4 /* Read */
|
||||
#define PF_MASKPROC 0xf0000000 /* Unspecified */
|
||||
|
||||
/* Figure 5-10: Dynamic Array Tags, d_tag */
|
||||
|
||||
#define DT_NULL 0 /* d_un=ignored */
|
||||
#define DT_NEEDED 1 /* d_un=d_val */
|
||||
#define DT_PLTRELSZ 2 /* d_un=d_val */
|
||||
#define DT_PLTGOT 3 /* d_un=d_ptr */
|
||||
#define DT_HASH 4 /* d_un=d_ptr */
|
||||
#define DT_STRTAB 5 /* d_un=d_ptr */
|
||||
#define DT_SYMTAB 6 /* d_un=d_ptr */
|
||||
#define DT_RELA 7 /* d_un=d_ptr */
|
||||
#define DT_RELASZ 8 /* d_un=d_val */
|
||||
#define DT_RELAENT 9 /* d_un=d_val */
|
||||
#define DT_STRSZ 10 /* d_un=d_val */
|
||||
#define DT_SYMENT 11 /* d_un=d_val */
|
||||
#define DT_INIT 12 /* d_un=d_ptr */
|
||||
#define DT_FINI 13 /* d_un=d_ptr */
|
||||
#define DT_SONAME 14 /* d_un=d_val */
|
||||
#define DT_RPATH 15 /* d_un=d_val */
|
||||
#define DT_SYMBOLIC 16 /* d_un=ignored */
|
||||
#define DT_REL 17 /* d_un=d_ptr */
|
||||
#define DT_RELSZ 18 /* d_un=d_val */
|
||||
#define DT_RELENT 19 /* d_un=d_val */
|
||||
#define DT_PLTREL 20 /* d_un=d_val */
|
||||
#define DT_DEBUG 21 /* d_un=d_ptr */
|
||||
#define DT_TEXTREL 22 /* d_un=ignored */
|
||||
#define DT_JMPREL 23 /* d_un=d_ptr */
|
||||
#define DT_BINDNOW 24 /* d_un=ignored */
|
||||
#define DT_LOPROC 0x70000000 /* d_un=unspecified */
|
||||
#define DT_HIPROC 0x7fffffff /* d_un= unspecified */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Figure 4.2: 32-Bit Data Types */
|
||||
|
||||
typedef uint32_t Elf32_Addr; /* Unsigned program address */
|
||||
typedef uint16_t Elf32_Half; /* Unsigned medium integer */
|
||||
typedef uint32_t Elf32_Off; /* Unsigned file offset */
|
||||
typedef int32_t Elf32_Sword; /* Signed large integer */
|
||||
typedef uint32_t Elf32_Word; /* Unsigned large integer */
|
||||
|
||||
/* Figure 4-3: ELF Header */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char e_ident[EI_NIDENT];
|
||||
Elf32_Half e_type;
|
||||
Elf32_Half e_machine;
|
||||
Elf32_Word e_version;
|
||||
Elf32_Addr e_entry;
|
||||
Elf32_Off e_phoff;
|
||||
Elf32_Off e_shoff;
|
||||
Elf32_Word e_flags;
|
||||
Elf32_Half e_ehsize;
|
||||
Elf32_Half e_phentsize;
|
||||
Elf32_Half e_phnum;
|
||||
Elf32_Half e_shentsize;
|
||||
Elf32_Half e_shnum;
|
||||
Elf32_Half e_shstrndx;
|
||||
} Elf32_Ehdr;
|
||||
|
||||
/* Figure 4-8: Section Header */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word sh_name;
|
||||
Elf32_Word sh_type;
|
||||
Elf32_Word sh_flags;
|
||||
Elf32_Addr sh_addr;
|
||||
Elf32_Off sh_offset;
|
||||
Elf32_Word sh_size;
|
||||
Elf32_Word sh_link;
|
||||
Elf32_Word sh_info;
|
||||
Elf32_Word sh_addralign;
|
||||
Elf32_Word sh_entsize;
|
||||
} Elf32_Shdr;
|
||||
|
||||
/* Figure 4-15: Symbol Table Entry */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word st_name;
|
||||
Elf32_Addr st_value;
|
||||
Elf32_Word st_size;
|
||||
unsigned char st_info;
|
||||
unsigned char st_other;
|
||||
Elf32_Half st_shndx;
|
||||
} Elf32_Sym;
|
||||
|
||||
/* Figure 4-19: Relocation Entries */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Addr r_offset;
|
||||
Elf32_Word r_info;
|
||||
} Elf32_Rel;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Addr r_offset;
|
||||
Elf32_Word r_info;
|
||||
Elf32_Sword r_addend;
|
||||
} Elf32_Rela;
|
||||
|
||||
/* Figure 5-1: Program Header */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word p_type;
|
||||
Elf32_Off p_offset;
|
||||
Elf32_Addr p_vaddr;
|
||||
Elf32_Addr p_paddr;
|
||||
Elf32_Word p_filesz;
|
||||
Elf32_Word p_memsz;
|
||||
Elf32_Word p_flags;
|
||||
Elf32_Word p_align;
|
||||
} Elf32_Phdr;
|
||||
|
||||
/* Figure 5-9: Dynamic Structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Sword d_tag;
|
||||
union
|
||||
{
|
||||
Elf32_Word d_val;
|
||||
Elf32_Addr d_ptr;
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
//extern Elf32_Dyn _DYNAMIC[] ;
|
||||
|
||||
#endif /* __INCLUDE_ELF32_H */
|
||||
@@ -52,6 +52,10 @@
|
||||
#define IF_NAMESIZE 6 /* Newer naming standard */
|
||||
#define IFHWADDRLEN 6
|
||||
|
||||
#define IFF_RUNNING (1 << 0)
|
||||
#define IF_FLAG_IFUP (1 << 0)
|
||||
#define IF_FLAG_IFDOWN (2 << 0)
|
||||
|
||||
/*******************************************************************************************
|
||||
* Public Type Definitions
|
||||
*******************************************************************************************/
|
||||
@@ -72,6 +76,7 @@ struct lifreq
|
||||
struct sockaddr lifru_hwaddr; /* MAC address */
|
||||
int lifru_count; /* Number of devices */
|
||||
int lifru_mtu; /* MTU size */
|
||||
uint8_t lifru_flags; /* Interface flags */
|
||||
} lifr_ifru;
|
||||
};
|
||||
|
||||
@@ -82,6 +87,7 @@ struct lifreq
|
||||
#define lifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */
|
||||
#define lifr_mtu lifr_ifru.lifru_mtu /* MTU */
|
||||
#define lifr_count lifr_ifru.lifru_count /* Number of devices */
|
||||
#define lifr_flags lifr_ifru.lifru_flags /* interface flags */
|
||||
|
||||
/* This is the older I/F request that should only be used with IPv4. However, since
|
||||
* NuttX only supports IPv4 or 6 (not both), we can force the older structure to
|
||||
@@ -101,6 +107,7 @@ struct ifreq
|
||||
struct sockaddr ifru_hwaddr; /* MAC address */
|
||||
int ifru_count; /* Number of devices */
|
||||
int ifru_mtu; /* MTU size */
|
||||
uint8_t ifru_flags; /* Interface flags */
|
||||
} ifr_ifru;
|
||||
};
|
||||
|
||||
@@ -111,6 +118,7 @@ struct ifreq
|
||||
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* MTU */
|
||||
#define ifr_count ifr_ifru.ifru_count /* Number of devices */
|
||||
#define ifr_flags ifr_ifru.ifru_flags /* interface flags */
|
||||
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
|
||||
@@ -123,6 +131,7 @@ struct ifreq
|
||||
#define ifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */
|
||||
#define ifr_mtu lifr_ifru.lifru_mtu /* MTU */
|
||||
#define ifr_count lifr_ifru.lifru_count /* Number of devices */
|
||||
#define ifr_flags lifr_ifru.lifru_flags /* interface flags */
|
||||
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/binfmt.h
|
||||
*
|
||||
* Copyright (C) 2009 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_BINFMT_H
|
||||
#define __INCLUDE_NUTTX_BINFMT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nxflat.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* This describes the file to be loaded */
|
||||
|
||||
struct symtab_s;
|
||||
struct binary_s
|
||||
{
|
||||
/* Information provided to the loader to load and bind a module */
|
||||
|
||||
FAR const char *filename; /* Full path to the binary to be loaded */
|
||||
FAR const char **argv; /* Argument list */
|
||||
FAR const struct symtab_s *exports; /* Table of exported symbols */
|
||||
int nexports; /* The number of symbols in exports[] */
|
||||
|
||||
/* Information provided from the loader (if successful) describing the
|
||||
* resources used by the loaded module.
|
||||
*/
|
||||
|
||||
main_t entrypt; /* Entry point into a program module */
|
||||
FAR void *ispace; /* Memory-mapped, I-space (.text) address */
|
||||
FAR struct dspace_s *dspace; /* Address of the allocated .data/.bss space */
|
||||
size_t isize; /* Size of the I-space region (needed for munmap) */
|
||||
size_t stacksize; /* Size of the stack in bytes (unallocated) */
|
||||
};
|
||||
|
||||
/* This describes one binary format handler */
|
||||
|
||||
struct binfmt_s
|
||||
{
|
||||
FAR struct binfmt_s *next; /* Supports a singly-linked list */
|
||||
int (*load)(FAR struct binary_s *bin); /* Verify and load binary into memory */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: register_binfmt
|
||||
*
|
||||
* Description:
|
||||
* Register a loader for a binary format
|
||||
*
|
||||
* Returned Value:
|
||||
* This is a NuttX internal function so it follows the convention that
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int register_binfmt(FAR struct binfmt_s *binfmt);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: unregister_binfmt
|
||||
*
|
||||
* Description:
|
||||
* Register a loader for a binary format
|
||||
*
|
||||
* Returned Value:
|
||||
* This is a NuttX internal function so it follows the convention that
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int unregister_binfmt(FAR struct binfmt_s *binfmt);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: load_module
|
||||
*
|
||||
* Description:
|
||||
* Load a module into memory, bind it to an exported symbol take, and
|
||||
* prep the module for execution.
|
||||
*
|
||||
* Returned Value:
|
||||
* This is an end-user function, so it follows the normal convention:
|
||||
* Returns 0 (OK) on success. On failure, it returns -1 (ERROR) with
|
||||
* errno set appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int load_module(FAR struct binary_s *bin);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: unload_module
|
||||
*
|
||||
* Description:
|
||||
* Unload a (non-executing) module from memory. If the module has
|
||||
* been started (via exec_module), calling this will be fatal.
|
||||
*
|
||||
* Returned Value:
|
||||
* This is a NuttX internal function so it follows the convention that
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int unload_module(FAR const struct binary_s *bin);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: exec_module
|
||||
*
|
||||
* Description:
|
||||
* Execute a module that has been loaded into memory by load_module().
|
||||
*
|
||||
* Returned Value:
|
||||
* This is an end-user function, so it follows the normal convention:
|
||||
* Returns the PID of the exec'ed module. On failure, it.returns
|
||||
* -1 (ERROR) and sets errno appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int exec_module(FAR const struct binary_s *bin, int priority);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: exec
|
||||
*
|
||||
* Description:
|
||||
* This is a convenience function that wraps load_ and exec_module into
|
||||
* one call.
|
||||
*
|
||||
* Input Parameter:
|
||||
* filename - Fulll path to the binary to be loaded
|
||||
* argv - Argument list
|
||||
* exports - Table of exported symbols
|
||||
* nexports - The number of symbols in exports
|
||||
*
|
||||
* Returned Value:
|
||||
* This is an end-user function, so it follows the normal convention:
|
||||
* Returns the PID of the exec'ed module. On failure, it.returns
|
||||
* -1 (ERROR) and sets errno appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int exec(FAR const char *filename, FAR const char **argv,
|
||||
FAR const struct symtab_s *exports, int nexports);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_BINFMT_H */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/symtab.h
|
||||
* include/nuttx/binfmt/symtab.h
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_SYMTAB_H
|
||||
#define __INCLUDE_NUTTX_SYMTAB_H
|
||||
#ifndef __INCLUDE_NUTTX_BINFMT_SYMTAB_H
|
||||
#define __INCLUDE_NUTTX_BINFMT_SYMTAB_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@@ -54,7 +54,7 @@
|
||||
* is a fixed size array of struct symtab_s. The information is intentionally
|
||||
* minimal and supports only:
|
||||
*
|
||||
* 1. Function points as sym_values. Of other kinds of values need to be
|
||||
* 1. Function pointers as sym_values. Of other kinds of values need to be
|
||||
* supported, then typing information would also need to be included in
|
||||
* the structure.
|
||||
*
|
||||
@@ -159,5 +159,5 @@ symtab_findorderedbyvalue(FAR const struct symtab_s *symtab,
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_SYMTAB_H */
|
||||
#endif /* __INCLUDE_NUTTX_BINFMT_SYMTAB_H */
|
||||
|
||||
@@ -87,11 +87,16 @@
|
||||
|
||||
# define packed_struct __attribute__ ((packed))
|
||||
|
||||
/* GCC does not support the reentrant or naked attributes */
|
||||
/* GCC does not support the reentrant attribute */
|
||||
|
||||
# define reentrant_function
|
||||
# define naked_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.
|
||||
@@ -191,8 +196,10 @@
|
||||
|
||||
/* GCC supports both types double and long long */
|
||||
|
||||
# define CONFIG_HAVE_DOUBLE 1
|
||||
# define CONFIG_HAVE_LONG_LONG 1
|
||||
# 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 */
|
||||
|
||||
@@ -295,7 +302,9 @@
|
||||
/* SDCC does not support type long long or type double */
|
||||
|
||||
# undef CONFIG_HAVE_LONG_LONG
|
||||
# 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.
|
||||
@@ -398,8 +407,10 @@
|
||||
* simply do not support long long or double.
|
||||
*/
|
||||
|
||||
# undef CONFIG_HAVE_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 */
|
||||
|
||||
@@ -433,9 +444,11 @@
|
||||
# undef CONFIG_LONG_IS_NOT_INT
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
# define inline
|
||||
# define inline 1
|
||||
# undef CONFIG_HAVE_LONG_LONG
|
||||
# define CONFIG_HAVE_FLOAT 1
|
||||
# undef CONFIG_HAVE_DOUBLE
|
||||
# undef CONFIG_HAVE_LONG_DOUBLE
|
||||
# undef CONFIG_CAN_PASS_STRUCTS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/float.h
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Reference: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/float.h.html
|
||||
*
|
||||
* 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_FLOAT_H
|
||||
#define __INCLUDE_NUTTX_FLOAT_H
|
||||
|
||||
/* TODO: These values could vary with architectures toolchains. This
|
||||
* logic should be move at least to the include/arch directory.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Radix of exponent representation, b. */
|
||||
|
||||
#define FLT_RADIX 2
|
||||
|
||||
/* Number of base-FLT_RADIX digits in the floating-point significand, p. */
|
||||
|
||||
#define FLT_MANT_DIG 24
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_MANT_DIG 53
|
||||
#else
|
||||
# define DBL_MANT_DIG FLT_MANT_DIG
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_MANT_DIG DBL_MANT_DIG /* FIX ME */
|
||||
#else
|
||||
# define LDBL_MANT_DIG DBL_MANT_DIG
|
||||
#endif
|
||||
|
||||
/* Number of decimal digits, n, such that any floating-point number in the
|
||||
* widest supported floating type with pmax radix b digits can be rounded
|
||||
* to a floating-point number with n decimal digits and back again without
|
||||
* change to the value.
|
||||
*/
|
||||
|
||||
#define DECIMAL_DIG 10
|
||||
|
||||
/* Number of decimal digits, q, such that any floating-point number with q
|
||||
* decimal digits can be rounded into a floating-point number with p radix
|
||||
* b digits and back again without change to the q decimal digits.
|
||||
*/
|
||||
|
||||
#define FLT_DIG 6
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_DIG 15 /* 10 */
|
||||
#else
|
||||
# define DBL_DIG FLT_DIG
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_DIG DBL_DIG /* FIX ME */
|
||||
#else
|
||||
# define LDBL_DIG DBL_DIG
|
||||
#endif
|
||||
|
||||
/* Minimum negative integer such that FLT_RADIX raised to that power minus
|
||||
* 1 is a normalized floating-point number, emin.
|
||||
*/
|
||||
|
||||
#define FLT_MIN_EXP (-125)
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_MIN_EXP (-1021)
|
||||
#else
|
||||
# define DBL_MIN_EXP FLT_MIN_EXP
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_MIN_EXP DBL_MIN_EXP /* FIX ME */
|
||||
#else
|
||||
# define LDBL_MIN_EXP DBL_MIN_EXP
|
||||
#endif
|
||||
|
||||
/* inimum negative integer such that 10 raised to that power is in the range
|
||||
* of normalized floating-point numbers.
|
||||
*/
|
||||
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_MIN_10_EXP (-307) /* -37 */
|
||||
#else
|
||||
# define DBL_MIN_10_EXP FLT_MIN_10_EXP
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_MIN_10_EXP DBL_MIN_10_EXP /* FIX ME */
|
||||
#else
|
||||
# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
|
||||
#endif
|
||||
|
||||
/* Maximum integer such that FLT_RADIX raised to that power minus 1 is a
|
||||
* representable finite floating-point number, emax.
|
||||
*/
|
||||
|
||||
#define FLT_MAX_EXP 128
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_MAX_EXP 1024
|
||||
#else
|
||||
# define DBL_MAX_EXP FLT_MAX_EXP
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_MAX_EXP DBL_MAX_EXP /* FIX ME */
|
||||
#else
|
||||
# define LDBL_MAX_EXP DBL_MAX_EXP
|
||||
#endif
|
||||
|
||||
/* Maximum integer such that 10 raised to that power is in the range of
|
||||
* representable finite floating-point numbers.
|
||||
*/
|
||||
|
||||
#define FLT_MAX_10_EXP 38 /* 37 */
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_MAX_10_EXP 308 /* 37 */
|
||||
#else
|
||||
# define DBL_MAX_10_EXP FLT_MAX_10_EXP
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_MAX_10_EXP DBL_MAX_10_EXP /* FIX ME */
|
||||
#else
|
||||
# define LDBL_MAX_10_EXP DBL_MAX_10_EXP
|
||||
#endif
|
||||
|
||||
/* Maximum representable finite floating-point number. */
|
||||
|
||||
#define FLT_MAX 3.40282347e+38F /* 1E+37 */
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_MAX 1.7976931348623157e+308 /* 1E+37 */
|
||||
#else
|
||||
# define DBL_MAX FLT_MAX
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_MAX DBL_MAX /* FIX ME */
|
||||
#else
|
||||
# define LDBL_MAX DBL_MAX
|
||||
#endif
|
||||
|
||||
/* The difference between 1 and the least value greater than 1 that is
|
||||
* representable in the given floating-point type, b1-p.
|
||||
*/
|
||||
|
||||
#define FLT_EPSILON 1.1920929e-07F /* 1E-5 */
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
# define DBL_EPSILON 2.2204460492503131e-16 /* 1E-9 */
|
||||
#else
|
||||
# define DBL_EPSILON FLT_EPSILON
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_EPSILON DBL_EPSILON /* FIX ME */
|
||||
#else
|
||||
# define LDBL_EPSILON DBL_EPSILON
|
||||
#endif
|
||||
|
||||
/* Minimum normalized positive floating-point number, bemin -1. */
|
||||
|
||||
#define FLT_MIN 1.17549435e-38F /* 1E-37 */
|
||||
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
#define DBL_MIN 2.2250738585072014e-308 /* 1E-37 */
|
||||
#else
|
||||
# define DBL_MIN FLT_MIN
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
# define LDBL_MIN DBL_MIN /* FIX ME */
|
||||
#else
|
||||
# define LDBL_MIN DBL_MIN
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_FLOAT_H */
|
||||
@@ -51,6 +51,10 @@
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
/* Stream flags for the fs_flags field of in struct file_struct */
|
||||
|
||||
#define __FS_FLAG_EOF (1 << 0) /* EOF detected by a read operation */
|
||||
#define __FS_FLAG_ERROR (1 << 1) /* Error detected by any operation */
|
||||
|
||||
/****************************************************************************
|
||||
* Type Definitions
|
||||
@@ -270,11 +274,6 @@ struct filelist
|
||||
struct file_struct
|
||||
{
|
||||
int fs_filedes; /* File descriptor associated with stream */
|
||||
uint16_t fs_oflags; /* Open mode flags */
|
||||
#if CONFIG_NUNGET_CHARS > 0
|
||||
uint8_t fs_nungotten; /* The number of characters buffered for ungetc */
|
||||
unsigned char fs_ungotten[CONFIG_NUNGET_CHARS];
|
||||
#endif
|
||||
#if CONFIG_STDIO_BUFFER_SIZE > 0
|
||||
sem_t fs_sem; /* For thread safety */
|
||||
pid_t fs_holder; /* Holder of sem */
|
||||
@@ -283,6 +282,12 @@ struct file_struct
|
||||
FAR unsigned char *fs_bufend; /* Pointer to 1 past end of buffer */
|
||||
FAR unsigned char *fs_bufpos; /* Current position in buffer */
|
||||
FAR unsigned char *fs_bufread; /* Pointer to 1 past last buffered read char. */
|
||||
#endif
|
||||
uint16_t fs_oflags; /* Open mode flags */
|
||||
uint8_t fs_flags; /* Stream flags */
|
||||
#if CONFIG_NUNGET_CHARS > 0
|
||||
uint8_t fs_nungotten; /* The number of characters buffered for ungetc */
|
||||
unsigned char fs_ungotten[CONFIG_NUNGET_CHARS];
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+18
-13
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/i2c.h
|
||||
*
|
||||
* Copyright(C) 2009-2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright(C) 2009-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -47,6 +47,16 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* If a dynamic timeout is selected, then a non-negative, non-zero micro-
|
||||
* seconds per byte vale must be provided as well.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_STM32_I2C_DYNTIMEO
|
||||
# if CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE < 1
|
||||
# warning "Ignoring CONFIG_STM32_I2C_DYNTIMEO because of CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE"
|
||||
# undef CONFIG_STM32_I2C_DYNTIMEO
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* I2C address calculation. Convert 7- and 10-bit address to 8-bit and
|
||||
* 16-bit read/write address
|
||||
@@ -323,24 +333,19 @@ EXTERN FAR struct i2c_dev_s *up_i2cinitialize(int port);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int up_i2cuninitialize(FAR struct i2c_dev_s * dev);
|
||||
EXTERN int up_i2cuninitialize(FAR struct i2c_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
/************************************************************************************
|
||||
* Name: up_i2creset
|
||||
*
|
||||
* Description:
|
||||
* Reset the port and the associated I2C bus. Useful when the bus or an
|
||||
* attached slave has become wedged or unresponsive.
|
||||
* Reset an I2C bus
|
||||
*
|
||||
* Input Parameter:
|
||||
* Device structure as returned by the up_i2cinitalize()
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success, ERROR if the bus cannot be unwedged.
|
||||
*
|
||||
****************************************************************************/
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN int up_i2creset(FAR struct i2c_dev_s * dev);
|
||||
#ifdef CONFIG_I2C_RESET
|
||||
EXTERN int up_i2creset(FAR struct i2c_dev_s *dev);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/input/max11802.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Petteri Aimonen <jpa@nx.mail.kapsi.fi>
|
||||
*
|
||||
* References:
|
||||
* "Low-Power, Ultra-Small Resistive Touch-Screen Controllers
|
||||
* with I2C/SPI Interface" Maxim IC, Rev 3, 10/2010
|
||||
*
|
||||
* 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_INPUT_MAX11802_H
|
||||
#define __INCLUDE_NUTTX_INPUT_MAX11802_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/spi.h>
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_MAX11802)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
/* SPI Frequency. Default: 100KHz */
|
||||
|
||||
#ifndef CONFIG_MAX11802_FREQUENCY
|
||||
# define CONFIG_MAX11802_FREQUENCY 100000
|
||||
#endif
|
||||
|
||||
/* Maximum number of threads than can be waiting for POLL events */
|
||||
|
||||
#ifndef CONFIG_MAX11802_NPOLLWAITERS
|
||||
# define CONFIG_MAX11802_NPOLLWAITERS 2
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MAX11802_SPIMODE
|
||||
# define CONFIG_MAX11802_SPIMODE SPIDEV_MODE0
|
||||
#endif
|
||||
|
||||
/* Thresholds */
|
||||
|
||||
#ifndef CONFIG_MAX11802_THRESHX
|
||||
# define CONFIG_MAX11802_THRESHX 12
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MAX11802_THRESHY
|
||||
# define CONFIG_MAX11802_THRESHY 12
|
||||
#endif
|
||||
|
||||
/* Check for some required settings. This can save the user a lot of time
|
||||
* in getting the right configuration.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DISABLE_SIGNALS
|
||||
# error "Signals are required. CONFIG_DISABLE_SIGNALS must not be selected."
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SCHED_WORKQUEUE
|
||||
# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected."
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* A reference to a structure of this type must be passed to the MAX11802
|
||||
* driver. This structure provides information about the configuration
|
||||
* of the MAX11802 and provides some board-specific hooks.
|
||||
*
|
||||
* Memory for this structure is provided by the caller. It is not copied
|
||||
* by the driver and is presumed to persist while the driver is active. The
|
||||
* memory must be writable because, under certain circumstances, the driver
|
||||
* may modify frequency or X plate resistance values.
|
||||
*/
|
||||
|
||||
struct max11802_config_s
|
||||
{
|
||||
/* Device characterization */
|
||||
|
||||
uint32_t frequency; /* SPI frequency */
|
||||
|
||||
/* IRQ/GPIO access callbacks. These operations all hidden behind
|
||||
* callbacks to isolate the MAX11802 driver from differences in GPIO
|
||||
* interrupt handling by varying boards and MCUs. If possible,
|
||||
* interrupts should be configured on both rising and falling edges
|
||||
* so that contact and loss-of-contact events can be detected.
|
||||
*
|
||||
* attach - Attach the MAX11802 interrupt handler to the GPIO interrupt
|
||||
* enable - Enable or disable the GPIO interrupt
|
||||
* clear - Acknowledge/clear any pending GPIO interrupt
|
||||
* pendown - Return the state of the pen down GPIO input
|
||||
*/
|
||||
|
||||
int (*attach)(FAR struct max11802_config_s *state, xcpt_t isr);
|
||||
void (*enable)(FAR struct max11802_config_s *state, bool enable);
|
||||
void (*clear)(FAR struct max11802_config_s *state);
|
||||
bool (*pendown)(FAR struct max11802_config_s *state);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: max11802_register
|
||||
*
|
||||
* Description:
|
||||
* Configure the MAX11802 to use the provided SPI device instance. This
|
||||
* will register the driver as /dev/inputN where N is the minor device
|
||||
* number
|
||||
*
|
||||
* Input Parameters:
|
||||
* spi - An SPI driver instance
|
||||
* config - Persistent board configuration data
|
||||
* minor - The input device minor number
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero is returned on success. Otherwise, a negated errno value is
|
||||
* returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int max11802_register(FAR struct spi_dev_s *spi,
|
||||
FAR struct max11802_config_s *config,
|
||||
int minor);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_INPUT && CONFIG_INPUT_MAX11802 */
|
||||
#endif /* __INCLUDE_NUTTX_INPUT_MAX11802_H */
|
||||
@@ -0,0 +1,245 @@
|
||||
/**************************************************************************************
|
||||
* include/nuttx/lcd/ug-2864ambag01.h
|
||||
* Driver for Univision UG-2864AMBAG01 OLED display (wih SH1101A controller) in SPI
|
||||
* mode
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* References:
|
||||
* 1. Product Specification (Preliminary), Part Name: OEL Display Module, Part ID:
|
||||
* UG-2864AMBAG01, Doc No: SASI-9015-A, Univision Technology Inc.
|
||||
* 2. SH1101A, 132 X 64 Dot Matrix OLED/PLED, Preliminary Segment/Common Driver with
|
||||
* Controller, Sino Wealth
|
||||
*
|
||||
* 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_UG_8264AMBAG01_H
|
||||
#define __INCLUDE_NUTTX_UG_8264AMBAG01_H
|
||||
|
||||
/**************************************************************************************
|
||||
* Included Files
|
||||
**************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#ifdef CONFIG_LCD_UG2864AMBAG01
|
||||
|
||||
/**************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
**************************************************************************************/
|
||||
/* Configuration **********************************************************************/
|
||||
/* UG-2864AMBAG01 Configuration Settings:
|
||||
*
|
||||
* CONFIG_UG2864AMBAG01_SPIMODE - Controls the SPI mode
|
||||
* CONFIG_UG2864AMBAG01_FREQUENCY - Define to use a different bus frequency
|
||||
* CONFIG_UG2864AMBAG01_NINTERFACES - Specifies the number of physical UG-2864AMBAG01
|
||||
* devices that will be supported.
|
||||
*
|
||||
* Required LCD driver settings:
|
||||
*
|
||||
* CONFIG_LCD_UG28AMBAG01 - Enable UG-2864AMBAG01 support
|
||||
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
|
||||
* CONFIG_LCD_MAXPOWER must be 1
|
||||
*
|
||||
* Option LCD driver settings:
|
||||
* CONFIG_LCD_LANDSCAPE, CONFIG_LCD_PORTRAIT, CONFIG_LCD_RLANDSCAPE, and
|
||||
* CONFIG_LCD_RPORTRAIT - Display orientation.
|
||||
*
|
||||
* Required SPI driver settings:
|
||||
* CONFIG_SPI_CMDDATA - Include support for cmd/data selection.
|
||||
*/
|
||||
|
||||
/* SPI Interface
|
||||
*
|
||||
* "The serial interface consists of serial clock SCL, serial data SI, A0 and
|
||||
* CS . SI is shifted into an 8-bit shift register on every rising edge of
|
||||
* SCL in the order of D7, D6, … and D0. A0 is sampled on every eighth clock
|
||||
* and the data byte in the shift register is written to the display data RAM
|
||||
* or command register in the same clock."
|
||||
*
|
||||
* MODE 3:
|
||||
* Clock polarity: High (CPOL=1)
|
||||
* Clock phase: Sample on trailing (rising edge) (CPHA 1)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_UG2864AMBAG01_SPIMODE
|
||||
# define CONFIG_UG2864AMBAG01_SPIMODE SPIDEV_MODE3
|
||||
#endif
|
||||
|
||||
/* "This module determines whether the input data is interpreted as data or
|
||||
* command. When A0 = “H”, the inputs at D7 - D0 are interpreted as data and be
|
||||
* written to display RAM. When A0 = “L”, the inputs at D7 - D0 are interpreted
|
||||
* as command, they will be decoded and be written to the corresponding command
|
||||
* registers.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_SPI_CMDDATA
|
||||
# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration"
|
||||
#endif
|
||||
|
||||
/* CONFIG_UG2864AMBAG01_NINTERFACES determines the number of physical interfaces
|
||||
* that will be supported.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_UG2864AMBAG01_NINTERFACES
|
||||
# define CONFIG_UG2864AMBAG01_NINTERFACES 1
|
||||
#endif
|
||||
|
||||
/* Check contrast selection */
|
||||
|
||||
#if !defined(CONFIG_LCD_MAXCONTRAST)
|
||||
# define CONFIG_LCD_MAXCONTRAST 255
|
||||
#endif
|
||||
|
||||
#if CONFIG_LCD_MAXCONTRAST <= 0|| CONFIG_LCD_MAXCONTRAST > 255
|
||||
# error "CONFIG_LCD_MAXCONTRAST exceeds supported maximum"
|
||||
#endif
|
||||
|
||||
#if CONFIG_LCD_MAXCONTRAST < 255
|
||||
# warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255"
|
||||
#endif
|
||||
|
||||
/* Check power setting */
|
||||
|
||||
#if !defined(CONFIG_LCD_MAXPOWER)
|
||||
# define CONFIG_LCD_MAXPOWER 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_LCD_MAXPOWER != 1
|
||||
# warning "CONFIG_LCD_MAXPOWER exceeds supported maximum"
|
||||
# undef CONFIG_LCD_MAXPOWER
|
||||
# define CONFIG_LCD_MAXPOWER 1
|
||||
#endif
|
||||
|
||||
/* Color is 1bpp monochrome with leftmost column contained in bits 0 */
|
||||
|
||||
#ifdef CONFIG_NX_DISABLE_1BPP
|
||||
# warning "1 bit-per-pixel support needed"
|
||||
#endif
|
||||
|
||||
/* Orientation */
|
||||
|
||||
#if defined(CONFIG_LCD_LANDSCAPE)
|
||||
# undef CONFIG_LCD_PORTRAIT
|
||||
# undef CONFIG_LCD_RLANDSCAPE
|
||||
# undef CONFIG_LCD_RPORTRAIT
|
||||
#elif defined(CONFIG_LCD_PORTRAIT)
|
||||
# undef CONFIG_LCD_LANDSCAPE
|
||||
# undef CONFIG_LCD_RLANDSCAPE
|
||||
# undef CONFIG_LCD_RPORTRAIT
|
||||
#elif defined(CONFIG_LCD_RLANDSCAPE)
|
||||
# undef CONFIG_LCD_LANDSCAPE
|
||||
# undef CONFIG_LCD_PORTRAIT
|
||||
# undef CONFIG_LCD_RPORTRAIT
|
||||
#elif defined(CONFIG_LCD_RPORTRAIT)
|
||||
# undef CONFIG_LCD_LANDSCAPE
|
||||
# undef CONFIG_LCD_PORTRAIT
|
||||
# undef CONFIG_LCD_RLANDSCAPE
|
||||
#else
|
||||
# define CONFIG_LCD_LANDSCAPE 1
|
||||
# warning "Assuming landscape orientation"
|
||||
#endif
|
||||
|
||||
/* Some important "colors" */
|
||||
|
||||
#define UG_Y1_BLACK 0
|
||||
#define UG_Y1_WHITE 1
|
||||
|
||||
/**************************************************************************************
|
||||
* Public Types
|
||||
**************************************************************************************/
|
||||
|
||||
/**************************************************************************************
|
||||
* Public Data
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Public Function Prototypes
|
||||
**************************************************************************************/
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: ug2864ambag01_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the UG-2864AMBAG01 video hardware. The initial state of the
|
||||
* OLED is fully initialized, display memory cleared, and the OLED ready
|
||||
* to use, but with the power setting at 0 (full off == sleep mode).
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* spi - A reference to the SPI driver instance.
|
||||
* devno - A value in the range of 0 through CONFIG_UG2864AMBAG01_NINTERFACES-1.
|
||||
* This allows support for multiple OLED devices.
|
||||
*
|
||||
* Returned Value:
|
||||
*
|
||||
* On success, this function returns a reference to the LCD object for
|
||||
* the specified OLED. NULL is returned on any failure.
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
struct lcd_dev_s; /* See include/nuttx/lcd/lcd.h */
|
||||
struct spi_dev_s; /* See include/nuttx/spi.h */
|
||||
FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi,
|
||||
unsigned int devno);
|
||||
|
||||
/************************************************************************************************
|
||||
* Name: ug2864ambag01_fill
|
||||
*
|
||||
* Description:
|
||||
* This non-standard method can be used to clear the entire display by writing one
|
||||
* color to the display. This is much faster than writing a series of runs.
|
||||
*
|
||||
* Input Parameters:
|
||||
* priv - Reference to private driver structure
|
||||
*
|
||||
* Assumptions:
|
||||
* Caller has selected the OLED section.
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_LCD_UG2864AMBAG01 */
|
||||
#endif /* __INCLUDE_NUTTX_UG_8264AMBAG01_H */
|
||||
@@ -3,7 +3,7 @@
|
||||
* Driver for the Univision UG-9664HSWAG01 Display with the Solomon Systech
|
||||
* SSD1305 LCD controller.
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -58,8 +58,6 @@
|
||||
* CONFIG_UG9664HSWAG01_POWER
|
||||
* If the hardware supports a controllable OLED a power supply, this
|
||||
* configuration shold be defined. (See ug_power() below).
|
||||
* CONFIG_LCD_UGDEBUG - Enable detailed UG-9664HSWAG01 debug output
|
||||
* (CONFIG_DEBUG and CONFIG_VERBOSE must also be enabled).
|
||||
*
|
||||
* Required LCD driver settings:
|
||||
* CONFIG_LCD_UG9664HSWAG01 - Enable UG-9664HSWAG01 support
|
||||
@@ -90,10 +88,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -123,7 +119,7 @@ extern "C" {
|
||||
|
||||
struct lcd_dev_s; /* see nuttx/lcd.h */
|
||||
struct spi_dev_s; /* see nuttx/spi.h */
|
||||
EXTERN FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devno);
|
||||
FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devno);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ug_power
|
||||
@@ -145,12 +141,11 @@ EXTERN FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned i
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_UG9664HSWAG01_POWER
|
||||
EXTERN void ug_power(unsigned int devno, bool on);
|
||||
void ug_power(unsigned int devno, bool on);
|
||||
#else
|
||||
# define ug_power(a,b)
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -146,9 +146,15 @@
|
||||
|
||||
#define SIOCSIWPMKSA _SIOC(0x0036) /* PMKSA cache operation */
|
||||
|
||||
/* Interface flags */
|
||||
|
||||
#define SIOCSIFFLAGS _SIOC(0x0037) /* Sets the interface flags */
|
||||
#define SIOCGIFFLAGS _SIOC(0x0038) /* Gets the interface flags */
|
||||
|
||||
/****************************************************************************
|
||||
* Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* See include/net/if.h */
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -90,6 +90,10 @@ struct uip_driver_s
|
||||
char d_ifname[IFNAMSIZ];
|
||||
#endif
|
||||
|
||||
/* Drivers interface flags. See IFF_* definitions in include/net/if.h */
|
||||
|
||||
uint8_t d_flags;
|
||||
|
||||
/* Ethernet device identity */
|
||||
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/nxflat.h
|
||||
*
|
||||
* Copyright (C) 2009 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_NXFLAT_H
|
||||
#define __INCLUDE_NUTTX_NXFLAT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nxflat.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* This struct provides a desciption of the currently loaded instantiation
|
||||
* of an nxflat binary.
|
||||
*/
|
||||
|
||||
struct nxflat_loadinfo_s
|
||||
{
|
||||
/* Instruction Space (ISpace): This region contains the nxflat file header
|
||||
* plus everything from the text section. Ideally, will have only one mmap'ed
|
||||
* text section instance in the system for each module.
|
||||
*/
|
||||
|
||||
uint32_t ispace; /* Address where hdr/text is loaded */
|
||||
uint32_t entryoffs; /* Offset from ispace to entry point */
|
||||
uint32_t isize; /* Size of ispace. */
|
||||
|
||||
/* Data Space (DSpace): This region contains all information that in referenced
|
||||
* as data (other than the stack which is separately allocated). There will be
|
||||
* a unique instance of DSpace (and stack) for each instance of a process.
|
||||
*/
|
||||
|
||||
struct dspace_s *dspace; /* Allocated D-Space (data/bss/etc) */
|
||||
uint32_t datasize; /* Size of data segment in dspace */
|
||||
uint32_t bsssize; /* Size of bss segment in dspace */
|
||||
uint32_t stacksize; /* Size of stack (not allocated) */
|
||||
uint32_t dsize; /* Size of dspace (may be large than parts) */
|
||||
|
||||
/* This is temporary memory where relocation records will be loaded. */
|
||||
|
||||
uint32_t relocstart; /* Start of array of struct flat_reloc */
|
||||
uint16_t reloccount; /* Number of elements in reloc array */
|
||||
|
||||
/* File descriptors */
|
||||
|
||||
int filfd; /* Descriptor for the file being loaded */
|
||||
|
||||
/* This is a copy of the NXFLAT header (still in network order) */
|
||||
|
||||
struct nxflat_hdr_s header;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* These are APIs exported by libnxflat (and may be used outside of NuttX):
|
||||
****************************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
* Name: nxflat_verifyheader
|
||||
*
|
||||
* Description:
|
||||
* Given the header from a possible NXFLAT executable, verify that it
|
||||
* is an NXFLAT executable.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
EXTERN int nxflat_verifyheader(const struct nxflat_hdr_s *header);
|
||||
|
||||
/***********************************************************************
|
||||
* Name: nxflat_init
|
||||
*
|
||||
* Description:
|
||||
* This function is called to configure the library to process an NXFLAT
|
||||
* program binary.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
EXTERN int nxflat_init(const char *filename,
|
||||
struct nxflat_loadinfo_s *loadinfo);
|
||||
|
||||
/***********************************************************************
|
||||
* Name: nxflat_uninit
|
||||
*
|
||||
* Description:
|
||||
* Releases any resources committed by nxflat_init(). This essentially
|
||||
* undoes the actions of nxflat_init.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
EXTERN int nxflat_uninit(struct nxflat_loadinfo_s *loadinfo);
|
||||
|
||||
/***********************************************************************
|
||||
* Name: nxflat_load
|
||||
*
|
||||
* Description:
|
||||
* Loads the binary specified by nxflat_init into memory, mapping
|
||||
* the I-space executable regions, allocating the D-Space region,
|
||||
* and inializing the data segment (relocation information is
|
||||
* temporarily loaded into the BSS region. BSS will be cleared
|
||||
* by nxflat_bind() after the relocation data has been processed).
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
EXTERN int nxflat_load(struct nxflat_loadinfo_s *loadinfo);
|
||||
|
||||
/***********************************************************************
|
||||
* Name: nxflat_read
|
||||
*
|
||||
* Description:
|
||||
* Read 'readsize' bytes from the object file at 'offset'
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
EXTERN int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer,
|
||||
int readsize, int offset);
|
||||
|
||||
/***********************************************************************
|
||||
* Name: nxflat_bind
|
||||
*
|
||||
* Description:
|
||||
* Bind the imported symbol names in the loaded module described by
|
||||
* 'loadinfo' using the exported symbol values provided by 'symtab'
|
||||
* After binding the module, clear the BSS region (which held the relocation
|
||||
* data) in preparation for execution.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
struct symtab_s;
|
||||
EXTERN int nxflat_bind(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
FAR const struct symtab_s *exports, int nexports);
|
||||
|
||||
/***********************************************************************
|
||||
* Name: nxflat_unload
|
||||
*
|
||||
* Description:
|
||||
* This function unloads the object from memory. This essentially
|
||||
* undoes the actions of nxflat_load.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
EXTERN int nxflat_unload(struct nxflat_loadinfo_s *loadinfo);
|
||||
|
||||
/****************************************************************************
|
||||
* These are APIs used internally only by NuttX:
|
||||
****************************************************************************/
|
||||
/***********************************************************************
|
||||
* Name: nxflat_initialize
|
||||
*
|
||||
* Description:
|
||||
* NXFLAT support is built unconditionally. However, it order to
|
||||
* use this binary format, this function must be called during system
|
||||
* format in order to register the NXFLAT binary format.
|
||||
*
|
||||
* Returned Value:
|
||||
* This is a NuttX internal function so it follows the convention that
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
* failure.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
EXTERN int nxflat_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxflat_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Unregister the NXFLAT binary loader
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void nxflat_uninitialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_NXFLAT_H */
|
||||
@@ -163,7 +163,7 @@
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_IDLEENTER_THRESH >= CONFIG_PM_IDLEEXIT_THRESH
|
||||
# error "Must have CONFIG_PM_IDLEENTER_THRESH < CONFIG_PM_IDLEEXIT_THRESH
|
||||
# error "Must have CONFIG_PM_IDLEENTER_THRESH < CONFIG_PM_IDLEEXIT_THRESH"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_PM_IDLEENTER_COUNT
|
||||
@@ -181,7 +181,7 @@
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_STANDBYENTER_THRESH >= CONFIG_PM_STANDBYEXIT_THRESH
|
||||
# error "Must have CONFIG_PM_STANDBYENTER_THRESH < CONFIG_PM_STANDBYEXIT_THRESH
|
||||
# error "Must have CONFIG_PM_STANDBYENTER_THRESH < CONFIG_PM_STANDBYEXIT_THRESH"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_PM_STANDBYENTER_COUNT
|
||||
@@ -199,7 +199,7 @@
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_SLEEPENTER_THRESH >= CONFIG_PM_SLEEPEXIT_THRESH
|
||||
# error "Must have CONFIG_PM_SLEEPENTER_THRESH < CONFIG_PM_SLEEPEXIT_THRESH
|
||||
# error "Must have CONFIG_PM_SLEEPENTER_THRESH < CONFIG_PM_SLEEPEXIT_THRESH"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_PM_SLEEPENTER_COUNT
|
||||
|
||||
@@ -138,11 +138,11 @@ typedef union entry_u entry_t;
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SCHED_ATEXIT
|
||||
typedef void (*atexitfunc_t)(void);
|
||||
typedef CODE void (*atexitfunc_t)(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCHED_ONEXIT
|
||||
typedef void (*onexitfunc_t)(int exitcode, FAR void *arg);
|
||||
typedef CODE void (*onexitfunc_t)(int exitcode, FAR void *arg);
|
||||
#endif
|
||||
|
||||
/* POSIX Message queue */
|
||||
@@ -205,7 +205,7 @@ struct _TCB
|
||||
start_t start; /* Thread start function */
|
||||
entry_t entry; /* Entry Point into the thread */
|
||||
|
||||
#ifdef CONFIG_SCHED_ATEXIT
|
||||
#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT)
|
||||
# if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
|
||||
atexitfunc_t atexitfunc[CONFIG_SCHED_ATEXIT_MAX];
|
||||
# else
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
/* USB Controller */
|
||||
|
||||
#ifndef CONFIG_USBDEV_SELFPOWERED
|
||||
# define SELFPOWERED USB_CONFIG_ATT_SELFPOWER
|
||||
# define SELFPOWERED USB_CONFIG_ATTR_SELFPOWER
|
||||
#else
|
||||
# define SELFPOWERED (0)
|
||||
#endif
|
||||
|
||||
@@ -238,10 +238,6 @@
|
||||
#define USBCOMPOSITE_TRACEERR_ALLOCDEVSTRUCT 0x000a
|
||||
#define USBCOMPOSITE_TRACEERR_CLASSOBJECT 0x000b
|
||||
#define USBCOMPOSITE_TRACEERR_DEVREGISTER 0x000c
|
||||
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x000d
|
||||
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x000f
|
||||
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x0010
|
||||
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x0011
|
||||
|
||||
/* USB Storage driver class events ******************************************/
|
||||
|
||||
|
||||
@@ -109,17 +109,35 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Work queue IDs (indices). These are both zero if there is only one work
|
||||
* queue.
|
||||
/* Work queue IDs (indices):
|
||||
*
|
||||
* Kernel Work Queues:
|
||||
* HPWORK: This ID of the high priority work queue that should only be used for
|
||||
* hi-priority, time-critical, driver bottom-half functions.
|
||||
*
|
||||
* LPWORK: This is the ID of the low priority work queue that can be used for any
|
||||
* purpose. if CONFIG_SCHED_LPWORK is not defined, then there is only one kernel
|
||||
* work queue and LPWORK == HPWORK.
|
||||
*
|
||||
* User Work Queue:
|
||||
* USRWORK: CONFIG_NUTTX_KERNEL and CONFIG_SCHED_USRWORK are defined, then NuttX
|
||||
* will also support a user-accessible work queue. Otherwise, USRWORK == LPWORK.
|
||||
*/
|
||||
|
||||
#define HPWORK 0
|
||||
#ifdef CONFIG_SCHED_LPWORK
|
||||
# define LPWORK 1
|
||||
# define LPWORK (HPWORK+1)
|
||||
#else
|
||||
# define LPWORK HPWORK
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_SCHED_USRWORK)
|
||||
# warning "Feature not implemented"
|
||||
# define USRWORK (LPWORK+1)
|
||||
#else
|
||||
# define USRWORK LPWORK
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
@@ -102,6 +102,9 @@ extern "C" {
|
||||
|
||||
/* ANSI-like File System Interfaces */
|
||||
|
||||
/* Operations on streams (FILE) */
|
||||
|
||||
EXTERN void clearerr(register FILE *stream);
|
||||
EXTERN int fclose(FAR FILE *stream);
|
||||
EXTERN int fflush(FAR FILE *stream);
|
||||
EXTERN int feof(FAR FILE *stream);
|
||||
@@ -120,6 +123,9 @@ EXTERN int fsetpos(FAR FILE *stream, FAR fpos_t *pos);
|
||||
EXTERN long ftell(FAR FILE *stream);
|
||||
EXTERN size_t fwrite(FAR const void *ptr, size_t size, size_t n_items, FAR FILE *stream);
|
||||
EXTERN FAR char *gets(FAR char *s);
|
||||
EXTERN int ungetc(int c, FAR FILE *stream);
|
||||
|
||||
/* Operations on the stdout stream, buffers, paths, and the whole printf-family */
|
||||
|
||||
EXTERN int printf(const char *format, ...);
|
||||
EXTERN int puts(FAR const char *s);
|
||||
@@ -130,7 +136,6 @@ EXTERN int snprintf(FAR char *buf, size_t size, const char *format, ...);
|
||||
EXTERN int sscanf(const char *buf, const char *fmt, ...);
|
||||
EXTERN void perror(FAR const char *s);
|
||||
|
||||
EXTERN int ungetc(int c, FAR FILE *stream);
|
||||
EXTERN int vprintf(FAR const char *format, va_list ap);
|
||||
EXTERN int vfprintf(FAR FILE *stream, const char *format, va_list ap);
|
||||
EXTERN int vdprintf(FAR int fd, const char *format, va_list ap);
|
||||
|
||||
@@ -232,7 +232,7 @@ struct termios
|
||||
* cf[set|get][o|i]speed() POSIX interfaces.
|
||||
*/
|
||||
|
||||
speed_t c_speed; /* Input/output speed (non-POSIX)*/
|
||||
speed_t c_speed; /* Input/output speed (non-POSIX)*/
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -133,6 +133,7 @@ EXTERN pid_t getpid(void);
|
||||
EXTERN void _exit(int status) noreturn_function;
|
||||
EXTERN unsigned int sleep(unsigned int seconds);
|
||||
EXTERN int usleep(useconds_t usec);
|
||||
EXTERN int pause(void);
|
||||
|
||||
/* File descriptor operations */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user