From a69a97b03b52f369211bde6a473efe6d79068fe8 Mon Sep 17 00:00:00 2001
From: patacongo nuttx/syscall/syscall.csv
that describes the NuttX RTOS interface, and
nuttx/lib/lib/csv
that describes the NuttX C library interface.
+ nuttx/libc/lib.csv
that describes the NuttX C library interface.
@@ -424,7 +424,7 @@ Where:
cd nuttx/tools -cat ../syscall/syscall.csv ../lib/lib.csv | sort >tmp.csv +cat ../syscall/syscall.csv ../libc/lib.csv | sort >tmp.csv ./mksymtab.exe tmp.csv tmp.cdiff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index a2c58b41f..e602d2cd3 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -52,7 +52,7 @@ 2.6 nuttx/fs/
This directory holds a collection of standard libc-like functions with custom interfaces into NuttX.
- Normally the logic in this file builds to a single library (liblib.a
).
+ Normally the logic in this file builds to a single library (libc.a
).
However, if NuttX is built as a separately compiled kernel (with CONFIG_NUTTX_KERNEL=y
), then the contents of this directory are built as two libraries:
- One for use by user programs (libulib.a
) and one for use only within the <kernel> space (libklib.a
).
+ One for use by user programs (libuc.a
) and one for use only within the <kernel> space (libkc.a
).
These user/kernel space libraries (along with the sycalls of nuttx/syscall
) are needed to support the two differing protection domains.
@@ -1177,7 +1177,7 @@ include/
Directory structure:
-lib/ +libc/ |-- libgen/ | `-- (Implementation of functions from libgen.h) |-- math/ diff --git a/nuttx/Documentation/README.html b/nuttx/Documentation/README.html index 61d5c43af..0a4cc93b0 100644 --- a/nuttx/Documentation/README.html +++ b/nuttx/Documentation/README.html @@ -236,8 +236,8 @@ | | `- README.txt | |- graphics/ | | `- README.txt - | |- lib/ - | | `- README.txt + | |- libc/ + | | `- README.txt | |- libxx/ | | `- README.txt | |- mm/ diff --git a/nuttx/Kconfig b/nuttx/Kconfig index 90fe74f25..13e92ebf2 100644 --- a/nuttx/Kconfig +++ b/nuttx/Kconfig @@ -467,7 +467,7 @@ source binfmt/Kconfig endmenu menu "Library Routines" -source lib/Kconfig +source libc/Kconfig source libxx/Kconfig endmenu diff --git a/nuttx/Makefile b/nuttx/Makefile index 8235854fd..c1060c34f 100644 --- a/nuttx/Makefile +++ b/nuttx/Makefile @@ -115,14 +115,14 @@ ifeq ($(CONFIG_NUTTX_KERNEL),y) NONFSDIRS += syscall CONTEXTDIRS += syscall -USERDIRS += syscall lib mm $(USER_ADDONS) +USERDIRS += syscall libc mm $(USER_ADDONS) ifeq ($(CONFIG_HAVE_CXX),y) USERDIRS += libxx endif else -NONFSDIRS += lib mm +NONFSDIRS += libc mm OTHERDIRS += syscall $(USER_ADDONS) ifeq ($(CONFIG_HAVE_CXX),y) NONFSDIRS += libxx @@ -197,10 +197,10 @@ USERLIBS = # is placed in user space (only). ifeq ($(CONFIG_NUTTX_KERNEL),y) -NUTTXLIBS += syscall/libstubs$(LIBEXT) lib/libklib$(LIBEXT) -USERLIBS += syscall/libproxies$(LIBEXT) lib/libulib$(LIBEXT) mm/libmm$(LIBEXT) +NUTTXLIBS += syscall/libstubs$(LIBEXT) libc/libkc$(LIBEXT) +USERLIBS += syscall/libproxies$(LIBEXT) libc/libuc$(LIBEXT) mm/libmm$(LIBEXT) else -NUTTXLIBS += mm/libmm$(LIBEXT) lib/liblib$(LIBEXT) +NUTTXLIBS += mm/libmm$(LIBEXT) libc/libc$(LIBEXT) endif # Add libraries for C++ support. CXX, CXXFLAGS, and COMPILEXX must @@ -208,9 +208,9 @@ endif ifeq ($(CONFIG_HAVE_CXX),y) ifeq ($(CONFIG_NUTTX_KERNEL),y) -USERLIBS += libxx/liblibxx$(LIBEXT) +USERLIBS += libxx/libcxx$(LIBEXT) else -NUTTXLIBS += libxx/liblibxx$(LIBEXT) +NUTTXLIBS += libxx/libcxx$(LIBEXT) endif endif @@ -267,7 +267,7 @@ all: $(BIN) # include/nuttx/math.h will hand the redirection to the architecture- # specific math.h header file. # -# If the CONFIG_LIBM is defined, the Rhombus libm will be built at lib/math. +# If the CONFIG_LIBM is defined, the Rhombus libm will be built at libc/math. # Definitions and prototypes for the Rhombus libm are also contained in # include/nuttx/math.h and so the file must also be copied in that case. # @@ -445,8 +445,8 @@ check_context: # # Possible kernel-mode builds -lib/libklib$(LIBEXT): context - $(Q) $(MAKE) -C lib TOPDIR="$(TOPDIR)" libklib$(LIBEXT) EXTRADEFINES=$(KDEFINE) +libc/libkc$(LIBEXT): context + $(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libkc$(LIBEXT) EXTRADEFINES=$(KDEFINE) sched/libsched$(LIBEXT): context $(Q) $(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) EXTRADEFINES=$(KDEFINE) @@ -474,11 +474,11 @@ syscall/libstubs$(LIBEXT): context # Possible user-mode builds -lib/libulib$(LIBEXT): context - $(Q) $(MAKE) -C lib TOPDIR="$(TOPDIR)" libulib$(LIBEXT) +libc/libuc$(LIBEXT): context + $(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libuc$(LIBEXT) -libxx/liblibxx$(LIBEXT): context - $(Q) $(MAKE) -C libxx TOPDIR="$(TOPDIR)" liblibxx$(LIBEXT) +libxx/libcxx$(LIBEXT): context + $(Q) $(MAKE) -C libxx TOPDIR="$(TOPDIR)" libcxx$(LIBEXT) mm/libmm$(LIBEXT): context $(Q) $(MAKE) -C mm TOPDIR="$(TOPDIR)" libmm$(LIBEXT) EXTRADEFINES=$(KDEFINE) @@ -491,8 +491,8 @@ syscall/libproxies$(LIBEXT): context # Possible non-kernel builds -lib/liblib$(LIBEXT): context - $(Q) $(MAKE) -C lib TOPDIR="$(TOPDIR)" liblib$(LIBEXT) +libc/libc$(LIBEXT): context + $(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libc$(LIBEXT) # pass1 and pass2 # @@ -649,7 +649,7 @@ distclean: clean subdir_distclean clean_context ifeq ($(CONFIG_BUILD_2PASS),y) $(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" distclean endif - $(Q) rm -f Make.defs setenv.sh .config .config.old + $(Q) rm -f Make.defs setenv.sh setenv.bat .config .config.old # Application housekeeping targets. The APPDIR variable refers to the user # application directory. A sample apps/ directory is included with NuttX, diff --git a/nuttx/README.txt b/nuttx/README.txt index 85bb7f381..c6138d1fd 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -842,7 +842,7 @@ nuttx | `- README.txt |- graphics/ | `- README.txt - |- lib/ + |- libc/ | `- README.txt |- libxx/ | `- README.txt diff --git a/nuttx/TODO b/nuttx/TODO index e98aced90..343212a31 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -15,7 +15,7 @@ nuttx/ (6) Binary loaders (binfmt/) (17) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) - (11) Libraries (lib/) + (11) Libraries (libc/, ) (9) File system/Generic drivers (fs/, drivers/) (5) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) @@ -634,8 +634,8 @@ o USB (drivers/usbdev, drivers/usbhost) Status: Open Priority: Low/Unknown. This is a feature enhancement. -o Libraries (lib/) - ^^^^^^^^^^^^^^^^ +o Libraries (libc/) + ^^^^^^^^^^^^^^^^^ Title: ENVIRON Description: The definition of environ in stdlib.h is bogus and will not @@ -648,7 +648,7 @@ o Libraries (lib/) Description: Need some minimal termios support... at a minimum, enough to switch between raw and "normal" modes to support behavior like that needed for readline(). - UPDATE: There is growing functionality in lib/termios/ and in the + UPDATE: There is growing functionality in libc/termios/ and in the ioctl methods of several MCU serial drivers (stm32, lpc43, lpc17, pic32). However, as phrased, this bug cannot yet be closed since this "growing functionality" does not address all termios.h @@ -713,7 +713,7 @@ o Libraries (lib/) Priority: Title: OLD dtoa NEEDS TO BE UPDATED - Description: This implementation of dtoa in lib/stdio is old and will not + Description: This implementation of dtoa in libc/stdio is old and will not work with some newer compilers. See http://patrakov.blogspot.com/2009/03/dont-use-old-dtoac.html Status: Open @@ -721,7 +721,7 @@ o Libraries (lib/) Title: SYSLOG INTEGRATION Description: There are the beginnings of some system logging capabilities (see - drivers/syslog, fs/fs_syslog.c, and lib/stdio/lib_librawprintf.c and + drivers/syslog, fs/fs_syslog.c, and libc/stdio/lib_librawprintf.c and lib_liblowprintf.c. For NuttX, SYSLOG is a concept and includes, extends, and replaces the legacy NuttX debug ouput. Some additional integration is required to formalized this. For example: @@ -958,7 +958,7 @@ o Build system built configuration, only the multiple user mode can be supported with the NX server residing inside of the kernel space. In this case, most of the user end functions in graphics/nxmu - must be moved to lib/nx and those functions must be built into + must be moved to libc/nx and those functions must be built into libuser.a to be linked with the user-space code. A similar issue exists in NSH that uses some internal OS interfaces that would not be available in a kernel build diff --git a/nuttx/configs/stm32f4discovery/ostest/defconfig b/nuttx/configs/stm32f4discovery/ostest/defconfig index a644b42ec..da7c8d200 100644 --- a/nuttx/configs/stm32f4discovery/ostest/defconfig +++ b/nuttx/configs/stm32f4discovery/ostest/defconfig @@ -8,6 +8,15 @@ CONFIG_NUTTX_NEWCONFIG=y # Build Setup # # CONFIG_EXPERIMENTAL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set +# CONFIG_WINDOWS_MKLINK is not set # # Build Configuration @@ -28,6 +37,7 @@ CONFIG_RAW_BINARY=y # # CONFIG_ARCH_STDBOOL_H is not set # CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set # CONFIG_ARCH_STDARG_H is not set # @@ -72,6 +82,8 @@ CONFIG_ARCH_CHIP_STM32=y CONFIG_ARCH_CORTEXM4=y CONFIG_ARCH_FAMILY="armv7-m" CONFIG_ARCH_CHIP="stm32" +CONFIG_ARCH_HAVE_CMNVECTOR=y +# CONFIG_ARMV7M_CMNVECTOR is not set # CONFIG_ARCH_FPU is not set CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARMV7M_MPU is not set @@ -87,8 +99,14 @@ CONFIG_BOARD_LOOPSPERMSEC=16717 # CONFIG_ARCH_CHIP_STM32F100CB is not set # CONFIG_ARCH_CHIP_STM32F100R8 is not set # CONFIG_ARCH_CHIP_STM32F100RB is not set +# CONFIG_ARCH_CHIP_STM32F100RC is not set +# CONFIG_ARCH_CHIP_STM32F100RD is not set +# CONFIG_ARCH_CHIP_STM32F100RE is not set # CONFIG_ARCH_CHIP_STM32F100V8 is not set # CONFIG_ARCH_CHIP_STM32F100VB is not set +# CONFIG_ARCH_CHIP_STM32F100VC is not set +# CONFIG_ARCH_CHIP_STM32F100VD is not set +# CONFIG_ARCH_CHIP_STM32F100VE is not set # CONFIG_ARCH_CHIP_STM32F103RET6 is not set # CONFIG_ARCH_CHIP_STM32F103VCT6 is not set # CONFIG_ARCH_CHIP_STM32F103VET6 is not set @@ -121,14 +139,14 @@ CONFIG_STM32_CODESOURCERYL=y # CONFIG_STM32_ADC1 is not set # CONFIG_STM32_ADC2 is not set # CONFIG_STM32_ADC3 is not set -# CONFIG_STM32_CRC is not set -# CONFIG_STM32_DMA1 is not set -# CONFIG_STM32_DMA2 is not set # CONFIG_STM32_BKPSRAM is not set # CONFIG_STM32_CAN1 is not set # CONFIG_STM32_CAN2 is not set # CONFIG_STM32_CCMDATARAM is not set +# CONFIG_STM32_CRC is not set # CONFIG_STM32_CRYP is not set +# CONFIG_STM32_DMA1 is not set +# CONFIG_STM32_DMA2 is not set # CONFIG_STM32_DAC1 is not set # CONFIG_STM32_DAC2 is not set # CONFIG_STM32_DCMI is not set @@ -387,6 +405,7 @@ CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_STDIO_BUFFER_SIZE=256 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 +# CONFIG_LIBM is not set # CONFIG_NOPRINTF_FIELDWIDTH is not set # CONFIG_LIBC_FLOATINGPOINT is not set # CONFIG_EOL_IS_CR is not set @@ -399,9 +418,11 @@ CONFIG_ARCH_LOWPUTC=y CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_ARCH_ROMGETC is not set # CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Basic CXX Support +# # CONFIG_HAVE_CXX is not set -# CONFIG_HAVE_CXXINITIALIZE is not set -# CONFIG_CXX_NEWLONG is not set # # Application Configuration @@ -415,266 +436,61 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Examples # - -# -# ADC Example -# - -# -# Buttons Example -# # CONFIG_EXAMPLES_BUTTONS is not set - -# -# CAN Example -# # CONFIG_EXAMPLES_CAN is not set - -# -# USB CDC/ACM Class Driver Example -# # CONFIG_EXAMPLES_CDCACM is not set - -# -# USB composite Class Driver Example -# # CONFIG_EXAMPLES_COMPOSITE is not set - -# -# DHCP Server Example -# # CONFIG_EXAMPLES_DHCPD is not set - -# -# ELF Loader Example -# # CONFIG_EXAMPLES_ELF is not set - -# -# FTP Client Example -# # CONFIG_EXAMPLES_FTPC is not set - -# -# FTP Server Example -# # CONFIG_EXAMPLES_FTPD is not set - -# -# "Hello, World!" Example -# # CONFIG_EXAMPLES_HELLO is not set - -# -# "Hello, World!" C++ Example -# # CONFIG_EXAMPLES_HELLOXX is not set - -# -# USB HID Keyboard Example -# +# CONFIG_EXAMPLES_JSON is not set # CONFIG_EXAMPLES_HIDKBD is not set - -# -# IGMP Example -# # CONFIG_EXAMPLES_IGMP is not set - -# -# LCD Read/Write Example -# # CONFIG_EXAMPLES_LCDRW is not set - -# -# Memory Management Example -# # CONFIG_EXAMPLES_MM is not set - -# -# File System Mount Example -# # CONFIG_EXAMPLES_MOUNT is not set - -# -# FreeModBus Example -# # CONFIG_EXAMPLES_MODBUS is not set - -# -# Network Test Example -# # CONFIG_EXAMPLES_NETTEST is not set - -# -# NuttShell (NSH) Example -# # CONFIG_EXAMPLES_NSH is not set - -# -# NULL Example -# # CONFIG_EXAMPLES_NULL is not set - -# -# NX Graphics Example -# # CONFIG_EXAMPLES_NX is not set - -# -# NxConsole Example -# # CONFIG_EXAMPLES_NXCONSOLE is not set - -# -# NXFFS File System Example -# # CONFIG_EXAMPLES_NXFFS is not set - -# -# NXFLAT Example -# # CONFIG_EXAMPLES_NXFLAT is not set - -# -# NX Graphics "Hello, World!" Example -# # CONFIG_EXAMPLES_NXHELLO is not set - -# -# NX Graphics image Example -# # CONFIG_EXAMPLES_NXIMAGE is not set - -# -# NX Graphics lines Example -# # CONFIG_EXAMPLES_NXLINES is not set - -# -# NX Graphics Text Example -# # CONFIG_EXAMPLES_NXTEXT is not set - -# -# OS Test Example -# CONFIG_EXAMPLES_OSTEST=y # CONFIG_EXAMPLES_OSTEST_BUILTIN is not set CONFIG_EXAMPLES_OSTEST_LOOPS=1 CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 - -# -# Pascal "Hello, World!"example -# +CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000 +CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # CONFIG_EXAMPLES_PASHELLO is not set - -# -# Pipe Example -# # CONFIG_EXAMPLES_PIPE is not set - -# -# Poll Example -# # CONFIG_EXAMPLES_POLL is not set - -# -# Pulse Width Modulation (PWM) Example -# - -# -# Quadrature Encoder Example -# # CONFIG_EXAMPLES_QENCODER is not set - -# -# RGMP Example -# # CONFIG_EXAMPLES_RGMP is not set - -# -# ROMFS Example -# # CONFIG_EXAMPLES_ROMFS is not set - -# -# sendmail Example -# # CONFIG_EXAMPLES_SENDMAIL is not set - -# -# Serial Loopback Example -# # CONFIG_EXAMPLES_SERLOOP is not set - -# -# Telnet Daemon Example -# # CONFIG_EXAMPLES_TELNETD is not set - -# -# THTTPD Web Server Example -# # CONFIG_EXAMPLES_THTTPD is not set - -# -# TIFF Generation Example -# # CONFIG_EXAMPLES_TIFF is not set - -# -# Touchscreen Example -# # CONFIG_EXAMPLES_TOUCHSCREEN is not set - -# -# UDP Example -# # CONFIG_EXAMPLES_UDP is not set - -# -# UDP Discovery Daemon Example -# - -# -# uIP Web Server Example -# # CONFIG_EXAMPLES_UIP is not set - -# -# USB Serial Test Example -# # CONFIG_EXAMPLES_USBSERIAL is not set - -# -# USB Mass Storage Class Example -# # CONFIG_EXAMPLES_USBMSC is not set - -# -# USB Serial Terminal Example -# # CONFIG_EXAMPLES_USBTERM is not set - -# -# Watchdog timer Example -# # CONFIG_EXAMPLES_WATCHDOG is not set - -# -# wget Example -# - -# -# WLAN Example -# # CONFIG_EXAMPLES_WLAN is not set -# -# XML RPC Example -# - # # Interpreters # @@ -692,74 +508,20 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Networking Utilities # - -# -# DHCP client -# +# CONFIG_NETUTILS_CODECS is not set # CONFIG_NETUTILS_DHCPC is not set - -# -# DHCP server -# # CONFIG_NETUTILS_DHCPD is not set - -# -# FTP client -# # CONFIG_NETUTILS_FTPC is not set - -# -# FTP server -# # CONFIG_NETUTILS_FTPD is not set - -# -# Name resolution -# +# CONFIG_NETUTILS_JSON is not set # CONFIG_NETUTILS_RESOLV is not set - -# -# SMTP -# # CONFIG_NETUTILS_SMTP is not set - -# -# TFTP client -# # CONFIG_NETUTILS_TELNETD is not set - -# -# TFTP client -# # CONFIG_NETUTILS_TFTPC is not set - -# -# THTTPD web server -# # CONFIG_NETUTILS_THTTPD is not set - -# -# uIP support library -# # CONFIG_NETUTILS_UIPLIB is not set - -# -# uIP web client -# # CONFIG_NETUTILS_WEBCLIENT is not set -# -# uIP web server -# - -# -# UDP Discovery Utility -# - -# -# XML-RPC library -# - # # ModBus # diff --git a/nuttx/lib/Kconfig b/nuttx/lib/Kconfig deleted file mode 100644 index 1c93bb047..000000000 --- a/nuttx/lib/Kconfig +++ /dev/null @@ -1,275 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config STDIO_BUFFER_SIZE - int "C STDIO buffer size" - default 64 - ---help--- - Size of buffers using within the C buffered I/O interfaces. - (printf, putchar, fwrite, etc.). - -config STDIO_LINEBUFFER - bool "STDIO line buffering" - default y - ---help--- - Flush buffer I/O whenever a newline character is found in - the output data stream. - -config NUNGET_CHARS - int "Number unget() characters" - default 2 - ---help--- - Number of characters that can be buffered by ungetc() (Only if NFILE_STREAMS > 0) - -config LIB_HOMEDIR - string "Home directory" - default "/" - depends on !DISABLE_ENVIRON - ---help--- - The home directory to use with operations like such as 'cd ~' - -source lib/math/Kconfig - -config NOPRINTF_FIELDWIDTH - bool "Disable sprintf support fieldwidth" - default n - ---help--- - sprintf-related logic is a - little smaller if we do not support fieldwidthes - -config LIBC_FLOATINGPOINT - bool "Enable floating point in printf" - default n - ---help--- - By default, floating point - support in printf, sscanf, etc. is disabled. - -choice - prompt "Newline Options" - default EOL_IS_EITHER_CRLF - ---help--- - This selection determines the line terminating character that is used. - Some environments may return CR as end-of-line, others LF, and others - both. If not specified, the default is either CR or LF (but not both) - as the line terminating charactor. - -config EOL_IS_CR - bool "EOL is CR" - -config EOL_IS_LF - bool "EOL is LF" - -config EOL_IS_BOTH_CRLF - bool "EOL is CR and LF" - -config EOL_IS_EITHER_CRLF - bool "EOL is CR or LF" - -endchoice - -config LIBC_STRERROR - bool "Enable strerror" - default n - ---help--- - strerror() is useful because it decodes 'errno' values into a human readable - strings. But it can also require a lot of memory. If this option is selected, - strerror() will still exist in the build but it will not decode error values. - This option should be used by other logic to decide if it should use strerror() - or not. For example, the NSH application will not use strerror() if this - option is not selected; perror() will not use strerror() is this option is not - selected (see also NSH_STRERROR). - -config LIBC_STRERROR_SHORT - bool "Use short error descriptions in strerror()" - default n - depends on LIBC_STRERROR - ---help--- - If this option is selected, then strerror() will use a shortened string when - it decodes the error. Specifically, strerror() is simply use the string that - is the common name for the error. For example, the 'errno' value of 2 will - produce the string "No such file or directory" is LIBC_STRERROR_SHORT - is not defined but the string "ENOENT" is LIBC_STRERROR_SHORT is defined. - -config LIBC_PERROR_STDOUT - bool "perror() to stdout" - default n - ---help--- - POSIX requires that perror() provide its output on stderr. This option may - be defined, however, to provide perror() output that is serialized with - other stdout messages. - -config ARCH_LOWPUTC - bool "Low-level console output" - default "y" - ---help--- - architecture supports low-level, boot time console output - -config LIB_SENDFILE_BUFSIZE - int "sendfile() buffer size" - default 512 - ---help--- - Size of the I/O buffer to allocate in sendfile(). Default: 512b - -config ARCH_ROMGETC - bool "Support for ROM string access" - default n - ---help--- - In Harvard architectures, data accesses and instruction accesses - occur on different busses, perhaps concurrently. All data accesses - are performed on the data bus unless special machine instructions - are used to read data from the instruction address space. Also, in - the typical MCU, the available SRAM data memory is much smaller that - the non-volatile FLASH instruction memory. So if the application - requires many constant strings, the only practical solution may be - to store those constant strings in FLASH memory where they can only - be accessed using architecture-specific machine instructions. - - If ARCH_ROMGETC is defined, then the architecture logic must export - the function up_romgetc(). up_romgetc() will simply read one byte - of data from the instruction space. - - If ARCH_ROMGETC, certain C stdio functions are effected: (1) All - format strings in printf, fprintf, sprintf, etc. are assumed to lie - in FLASH (string arguments for %s are still assumed to reside in SRAM). - And (2), the string argument to puts and fputs is assumed to reside - in FLASH. Clearly, these assumptions may have to modified for the - particular needs of your environment. There is no "one-size-fits-all" - solution for this problem. - -config ARCH_OPTIMIZED_FUNCTIONS - bool "Enable arch optimized functions" - default n - ---help--- - Allow for architecture optimized implementations of certain library - functions. Architecture-specific implementations can improve overall - system performance. - -if ARCH_OPTIMIZED_FUNCTIONS -config ARCH_MEMCPY - bool "memcpy()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of memcpy(). - -config MEMCPY_VIK - bool "Vik memcpy()" - default n - depends on !ARCH_MEMCPY - ---help--- - Select this option to use the optimized memcpy() function by Daniel Vik. - Select this option for improved performance at the expense of increased - size. See licensing information in the top-level COPYING file. - -if MEMCPY_VIK -config MEMCPY_PRE_INC_PTRS - bool "Pre-increment pointers" - default n - ---help--- - Use pre-increment of pointers. Default is post increment of pointers. - -config MEMCPY_INDEXED_COPY - bool "Array indexing" - default y - ---help--- - Copying data using array indexing. Using this option, disables the - MEMCPY_PRE_INC_PTRS option. - -config MEMCPY_64BIT - bool "64-bit memcpy()" - default n - ---help--- - Compiles memcpy() for architectures that suppport 64-bit operations - efficiently. - -endif - -config ARCH_MEMCMP - bool "memcmp()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of memcmp(). - -config ARCH_MEMMOVE - bool "memmove()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of memmove(). - -config ARCH_MEMSET - bool "memset()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of memset(). - -config MEMSET_OPTSPEED - bool "Optimize memset() for speed" - default n - depends on !ARCH_MEMSET - ---help--- - Select this option to use a version of memcpy() optimized for speed. - Default: memcpy() is optimized for size. - -config MEMSET_64BIT - bool "64-bit memset()" - default n - depends on MEMSET_OPTSPEED - ---help--- - Compiles memset() for architectures that suppport 64-bit operations - efficiently. - -config ARCH_STRCHR - bool "strchr()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of strchr(). - -config ARCH_STRCMP - bool "strcmp()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of strcmp(). - -config ARCH_STRCPY - bool "strcpy()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of strcpy(). - -config ARCH_STRNCPY - bool "strncpy()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of strncpy(). - -config ARCH_STRLEN - bool "strlen" - default n - ---help--- - Select this option if the architecture provides an optimized version - of strlen(). - -config ARCH_STRNLEN - bool "strlen()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of strnlen(). - -config ARCH_BZERO - bool "bzero()" - default n - ---help--- - Select this option if the architecture provides an optimized version - of bzero(). - -endif diff --git a/nuttx/lib/Makefile b/nuttx/lib/Makefile deleted file mode 100644 index 406c2276e..000000000 --- a/nuttx/lib/Makefile +++ /dev/null @@ -1,136 +0,0 @@ -############################################################################ -# lib/Makefile -# -# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt-# -# 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. -# -########################################################################### - --include $(TOPDIR)/Make.defs - -ASRCS = -CSRCS = - -DEPPATH := --dep-path . -VPATH := . - -include stdio/Make.defs -include stdlib/Make.defs -include unistd/Make.defs -include sched/Make.defs -include string/Make.defs -include pthread/Make.defs -include semaphore/Make.defs -include signal/Make.defs -include mqueue/Make.defs -include math/Make.defs -include fixedmath/Make.defs -include net/Make.defs -include time/Make.defs -include libgen/Make.defs -include dirent/Make.defs -include termios/Make.defs -include queue/Make.defs -include misc/Make.defs - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -UBIN = libulib$(LIBEXT) -KBIN = libklib$(LIBEXT) -BIN = liblib$(LIBEXT) - -all: $(BIN) - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -$(BIN): $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $@, $${obj}); \ - done ; ) - -ifneq ($(BIN),$(UBIN)) -.userlib: - @$(MAKE) $(UBIN) BIN=$(UBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) - @touch .userlib - -$(UBIN): kclean .userlib -endif - -ifneq ($(BIN),$(KBIN)) -.kernlib: - @$(MAKE) $(KBIN) BIN=$(KBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) - @touch .kernlib - -$(KBIN): uclean .kernlib -endif - -.depend: Makefile $(SRCS) - @$(MKDEP) $(DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -# Clean Targets: -# Clean user-mode temporary files (retaining the UBIN binary) - -uclean: -ifneq ($(OBJEXT),) - @( if [ -f .userlib ]; then rm -f *$(OBJEXT); fi ) -endif - @rm -f .userlib *~ .*.swp - -# Clean kernel-mode temporary files (retaining the KBIN binary) - -kclean: -ifneq ($(OBJEXT),) - @( if [ -f .kernlib ]; then rm -f *$(OBJEXT); fi ) -endif - @rm -f .kernlib *~ .*.swp - -# Really clean everything - -clean: uclean kclean - @rm -f $(BIN) $(UBIN) $(KBIN) *~ .*.swp - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean - @rm -f Make.dep .depend - --include Make.dep diff --git a/nuttx/lib/README.txt b/nuttx/lib/README.txt deleted file mode 100644 index e99304841..000000000 --- a/nuttx/lib/README.txt +++ /dev/null @@ -1,85 +0,0 @@ -lib -=== - -This directory contains numerous, small functions typically associated with -what you would expect to find in a standard C library. The sub-directories -in this directory contain standard interface that can be executed by user- -mode programs. - -Normally, NuttX is built with no protection and all threads running in kerne- -mode. In that model, there is no real architectural distinction between -what is a kernel-mode program and what is a user-mode program; the system is -more like on multi-threaded program that all runs in kernel-mode. - -But if the CONFIG_NUTTX_KERNEL option is selected, NuttX will be built into -distinct user-mode and kernel-mode sections. In that case, most of the -code in the nuttx/ directory will run in kernel-mode with with exceptions -of (1) the user-mode "proxies" found in syscall/proxies, and (2) the -standard C library functions found in this directory. In this build model, -it is critical to separate the user-mode OS interfaces in this way. - -Sub-Directories -=============== - -The files in the lib/ directory are organized (mostly) according which file -in the include/ directory provides the prototype for library functions. So -we have: - - libgen - libgen.h - fixedmath - fixedmath.h - math - math.h - mqueue - pthread.h - net - Various network-related header files: netinet/ether.h, arpa/inet.h - pthread - pthread.h - queue - queue.h - sched - sched.h - semaphore - semaphore.h - stdio - stdio.h - stdlib - stdlib.h - string - string.h - time - time.h - unistd - unistd.h - -There is also a misc/ subdirectory that contains various internal functions -and interfaces from header files that are too few to warrant their own sub- -directory: - - misc - Nonstandard "glue" logic, debug.h, crc32.h, dirent.h - -Library Database -================ - -Information about functions available in the NuttX C library information is -maintained in a database. That "database" is implemented as a simple comma- -separated-value file, lib.csv. Most spreadsheets programs will accept this -format and can be used to maintain the library database. - -This library database will (eventually) be used to generate symbol library -symbol table information that can be exported to external applications. - -The format of the CSV file for each line is: - - Field 1: Function name - Field 2: The header file that contains the function prototype - Field 3: Condition for compilation - Field 4: The type of function return value. - Field 5 - N+5: The type of each of the N formal parameters of the function - -Each type field has a format as follows: - - type name: - For all simpler types - formal type | actual type: - For array types where the form of the formal (eg. int parm[2]) - differs from the type of actual passed parameter (eg. int*). This - is necessary because you cannot do simple casts to array types. - formal type | union member actual type | union member fieldname: - A similar situation exists for unions. For example, the formal - parameter type union sigval -- You cannot cast a uintptr_t to - a union sigval, but you can cast to the type of one of the union - member types when passing the actual paramter. Similarly, we - cannot cast a union sigval to a uinptr_t either. Rather, we need - to cast a specific union member fieldname to uintptr_t. - -NOTE: The tool mksymtab can be used to generate a symbol table from this CSV -file. See nuttx/tools/README.txt for further details about the use of mksymtab. diff --git a/nuttx/lib/dirent/Make.defs b/nuttx/lib/dirent/Make.defs deleted file mode 100644 index cc1d6b783..000000000 --- a/nuttx/lib/dirent/Make.defs +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################ -# lib/dirent/Make.defs -# -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) - -# Add the dirent C files to the build - -CSRCS += lib_readdirr.c lib_telldir.c - -# Add the dirent directory to the build - -DEPPATH += --dep-path dirent -VPATH += :dirent - -endif - diff --git a/nuttx/lib/dirent/lib_readdirr.c b/nuttx/lib/dirent/lib_readdirr.c deleted file mode 100644 index 47c5b9a7b..000000000 --- a/nuttx/lib/dirent/lib_readdirr.c +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** - * lib/dirent/lib_readdirr.c - * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#include - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: readdir_r - * - * Description: - * The readdir() function returns a pointer to a dirent - * structure representing the next directory entry in the - * directory stream pointed to by dir. It returns NULL on - * reaching the end-of-file or if an error occurred. - * - * Inputs: - * dirp -- An instance of type DIR created by a previous - * call to opendir(); - * entry -- The storage pointed to by entry must be large - * enough for a dirent with an array of char d_name - * members containing at least {NAME_MAX}+1 elements. - * result -- Upon successful return, the pointer returned - * at *result shall have the same value as the - * argument entry. Upon reaching the end of the directory - * stream, this pointer shall have the value NULL. - * - * Return: - * If successful, the readdir_r() function return s zero; - * otherwise, an error number is returned to indicate the - * error. - * - * EBADF - Invalid directory stream descriptor dir - * - ****************************************************************************/ - -int readdir_r(FAR DIR *dirp, FAR struct dirent *entry, - FAR struct dirent **result) -{ - struct dirent *tmp; - - /* NOTE: The following use or errno is *not* thread-safe */ - - set_errno(0); - tmp = readdir(dirp); - if (!tmp) - { - int error = get_errno(); - if (!error) - { - if (result) - { - *result = NULL; - } - return 0; - } - else - { - return error; - } - } - - if (entry) - { - memcpy(entry, tmp, sizeof(struct dirent)); - } - - if (result) - { - *result = entry; - } - return 0; -} - diff --git a/nuttx/lib/dirent/lib_telldir.c b/nuttx/lib/dirent/lib_telldir.c deleted file mode 100644 index 3753b326e..000000000 --- a/nuttx/lib/dirent/lib_telldir.c +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** - * lib/dirent/fs_telldir.c - * - * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#include -#include - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: telldir - * - * Description: - * The telldir() function returns the current location - * associated with the directory stream dirp. - * - * Inputs: - * dirp -- An instance of type DIR created by a previous - * call to opendir(); - * - * Return: - * On success, the telldir() function returns the current - * location in the directory stream. On error, -1 is - * returned, and errno is set appropriately. - * - * EBADF - Invalid directory stream descriptor dir - * - ****************************************************************************/ - -off_t telldir(FAR DIR *dirp) -{ - struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp; - - if (!idir || !idir->fd_root) - { - set_errno(EBADF); - return (off_t)-1; - } - - /* Just return the current position */ - - return idir->fd_position; -} - diff --git a/nuttx/lib/fixedmath/Make.defs b/nuttx/lib/fixedmath/Make.defs deleted file mode 100644 index 578e33015..000000000 --- a/nuttx/lib/fixedmath/Make.defs +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# lib/fixedmath/Make.defs -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Add the fixed precision math C files to the build - -CSRCS += lib_rint.c lib_fixedmath.c lib_b16sin.c lib_b16cos.c lib_b16atan2.c - -# Add the fixed precision math directory to the build - -DEPPATH += --dep-path fixedmath -VPATH += :fixedmath diff --git a/nuttx/lib/fixedmath/lib_b16atan2.c b/nuttx/lib/fixedmath/lib_b16atan2.c deleted file mode 100644 index 69d132f80..000000000 --- a/nuttx/lib/fixedmath/lib_b16atan2.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** - * lib/fixedmath/lib_b16atan2.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define B16_C1 0x00000373 /* 0.013480470 */ -#define B16_C2 0x00000eb7 /* 0.057477314 */ -#define B16_C3 0x00001f0a /* 0.121239071 */ -#define B16_C4 0x00003215 /* 0.195635925 */ -#define B16_C5 0x0000553f /* 0.332994597 */ -#define B16_C6 0x00010000 /* 0.999995630 */ -#define B16_HALFPI 0x00019220 /* 1.570796327 */ -#define B16_PI 0x00032440 /* 3.141592654 */ - -#ifndef MAX -# define MAX(a,b) (a > b ? a : b) -#endif - -#ifndef MIN -# define MIN(a,b) (a < b ? a : b) -#endif - -#ifndef ABS -# define ABS(a) (a < 0 ? -a : a) -#endif - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: b16atan2 - * - * Description: - * atan2 calculates the arctangent of y/x. (Based on a algorithm I saw - * posted on the internet... now I have lost the link -- sorry). - * - ****************************************************************************/ - -b16_t b16atan2(b16_t y, b16_t x) -{ - b16_t t0; - b16_t t1; - b16_t t2; - b16_t t3; - - t2 = ABS(x); - t1 = ABS(y); - t0 = MAX(t2, t1); - t1 = MIN(t2, t1); - t2 = ub16inv(t0); - t2 = b16mulb16(t1, t2); - - t3 = b16mulb16(t2, t2); - t0 = - B16_C1; - t0 = b16mulb16(t0, t3) + B16_C2; - t0 = b16mulb16(t0, t3) - B16_C3; - t0 = b16mulb16(t0, t3) + B16_C4; - t0 = b16mulb16(t0, t3) - B16_C5; - t0 = b16mulb16(t0, t3) + B16_C6; - t2 = b16mulb16(t0, t2); - - t2 = (ABS(y) > ABS(x)) ? B16_HALFPI - t2 : t2; - t2 = (x < 0) ? B16_PI - t2 : t2; - t2 = (y < 0) ? -t2 : t2; - - return t2; -} diff --git a/nuttx/lib/fixedmath/lib_b16cos.c b/nuttx/lib/fixedmath/lib_b16cos.c deleted file mode 100644 index 3e9229029..000000000 --- a/nuttx/lib/fixedmath/lib_b16cos.c +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** - * lib/fixedmath/lib_b16cos.c - * - * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: b16cos - ****************************************************************************/ - -b16_t b16cos(b16_t rad) -{ - /* Compute cosine: sin(rad + PI/2) = cos(rad) */ - - rad += b16HALFPI; - if (rad > b16PI) - { - rad -= b16TWOPI; - } - return b16sin(rad); -} diff --git a/nuttx/lib/fixedmath/lib_b16sin.c b/nuttx/lib/fixedmath/lib_b16sin.c deleted file mode 100644 index 491b0ec78..000000000 --- a/nuttx/lib/fixedmath/lib_b16sin.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** - * lib/fixedmath/lib_b16sin.c - * - * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define b16_P225 0x0000399a -#define b16_P405284735 0x000067c1 -#define b16_1P27323954 0x000145f3 - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: b16sin - * Ref: http://lab.polygonal.de/2007/07/18/fast-and-accurate-sinecosine-approximation/ - ****************************************************************************/ - -b16_t b16sin(b16_t rad) -{ - b16_t tmp1; - b16_t tmp2; - b16_t tmp3; - - /* Force angle into the good range */ - - if (rad < -b16PI) - { - rad += b16TWOPI; - } - else if (rad > b16PI) - { - rad -= b16TWOPI; - } - - /* tmp1 = 1.27323954 * rad - * tmp2 = .405284735 * rad * rad - */ - - - tmp1 = b16mulb16(b16_1P27323954, rad); - tmp2 = b16mulb16(b16_P405284735, b16sqr(rad)); - - if (rad < 0) - { - /* tmp3 = 1.27323954 * rad + .405284735 * rad * rad */ - - tmp3 = tmp1 + tmp2; - } - else - { - /* tmp3 = 1.27323954 * rad - 0.405284735 * rad * rad */ - - tmp3 = tmp1 - tmp2; - } - - /* tmp1 = tmp3*tmp3 */ - - tmp1 = b16sqr(tmp3); - if (tmp3 < 0) - { - /* tmp1 = tmp3 * -tmp3 */ - - tmp1 = -tmp1; - } - - /* Return sin = .225 * (tmp3 * (+/-tmp3) - tmp3) + tmp3 */ - - return b16mulb16(b16_P225, (tmp1 - tmp3)) + tmp3; -} diff --git a/nuttx/lib/fixedmath/lib_fixedmath.c b/nuttx/lib/fixedmath/lib_fixedmath.c deleted file mode 100644 index c1a710e73..000000000 --- a/nuttx/lib/fixedmath/lib_fixedmath.c +++ /dev/null @@ -1,272 +0,0 @@ -/**************************************************************************** - * lib/math/lib_fixedmath.c - * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#ifndef CONFIG_HAVE_LONG_LONG - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Type Declarations - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Name: fixsign - ****************************************************************************/ - -static void fixsign(b16_t *parg1, b16_t *parg2, bool *pnegate) -{ - bool negate = false; - b16_t arg; - - arg = *parg1; - if (arg < 0) - { - *parg1 = -arg; - negate = true; - } - - arg = *parg2; - if (arg < 0) - { - *parg2 = -arg; - negate ^= true; - } - - *pnegate = negate; -} - -/**************************************************************************** - * Name: adjustsign - ****************************************************************************/ - -static b16_t adjustsign(b16_t result, bool negate) -{ - /* If the product is negative, then we overflowed */ - - if (result < 0) - { - if (result) - { - return b16MIN; - } - else - { - return b16MAX; - } - } - - /* correct the sign of the result */ - - if (negate) - { - return -result; - } - return result; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: b16mulb16 - ****************************************************************************/ - -b16_t b16mulb16(b16_t m1, b16_t m2) -{ - bool negate; - b16_t product; - - fixsign(&m1, &m2, &negate); - product = (b16_t)ub16mulub16((ub16_t)m1, (ub16_t)m2); - return adjustsign(product, negate); -} - -/**************************************************************************** - * Name: ub16mulub16 - **************************************************************************/ - -ub16_t ub16mulub16(ub16_t m1, ub16_t m2) -{ - /* Let: - * - * m1 = m1i*2**16 + m1f (b16) - * m2 = m2i*2**16 + m2f (b16) - * - * Then: - * - * m1*m2 = (m1i*m2i)*2**32 + (m1i*m2f + m2i*m1f)*2**16 + m1f*m2f (b32) - * = (m1i*m2i)*2**16 + (m1i*m2f + m2i*m1f) + m1f*m2f*2**-16 (b16) - * = a*2**16 + b + c*2**-16 - */ - - uint32_t m1i = ((uint32_t)m1 >> 16); - uint32_t m2i = ((uint32_t)m1 >> 16); - uint32_t m1f = ((uint32_t)m1 & 0x0000ffff); - uint32_t m2f = ((uint32_t)m2 & 0x0000ffff); - - return (m1i*m2i << 16) + m1i*m2f + m2i*m1f + (((m1f*m2f) + b16HALF) >> 16); -} - -/**************************************************************************** - * Name: b16sqr - **************************************************************************/ - -b16_t b16sqr(b16_t a) -{ - b16_t sq; - - /* The result is always positive. Just take the absolute value */ - - if (a < 0) - { - a = -a; - } - - /* Overflow occurred if the result is negative */ - - sq = (b16_t)ub16sqr(a); - if (sq < 0) - { - sq = b16MAX; - } - return sq; -} - -/**************************************************************************** - * Name: b16divb16 - **************************************************************************/ - -ub16_t ub16sqr(ub16_t a) -{ - /* Let: - * - * m = mi*2**16 + mf (b16) - * - * Then: - * - * m*m = (mi*mi)*2**32 + 2*(m1*m2)*2**16 + mf*mf (b32) - * = (mi*mi)*2**16 + 2*(mi*mf) + mf*mf*2**-16 (b16) - */ - - uint32_t mi = ((uint32_t)a >> 16); - uint32_t mf = ((uint32_t)a & 0x0000ffff); - - return (mi*mi << 16) + (mi*mf << 1) + ((mf*mf + b16HALF) >> 16); -} - -/**************************************************************************** - * Name: b16divb16 - **************************************************************************/ - -b16_t b16divb16(b16_t num, b16_t denom) -{ - bool negate; - b16_t quotient; - - fixsign(&num, &denom, &negate); - quotient = (b16_t)ub16divub16((ub16_t)num, (ub16_t)denom); - return adjustsign(quotient, negate); -} - -/**************************************************************************** - * Name: ub16divub16 - **************************************************************************/ - -ub16_t ub16divub16(ub16_t num, ub16_t denom) -{ - uint32_t term1; - uint32_t numf; - uint32_t product; - - /* Let: - * - * num = numi*2**16 + numf (b16) - * den = deni*2**16 + denf (b16) - * - * Then: - * - * num/den = numi*2**16 / den + numf / den (b0) - * = numi*2**32 / den + numf*2**16 /den (b16) - */ - - /* Check for overflow in the first part of the quotient */ - - term1 = ((uint32_t)num & 0xffff0000) / denom; - if (term1 >= 0x00010000) - { - return ub16MAX; /* Will overflow */ - } - - /* Finish the division */ - - numf = num - term1 * denom; - term1 <<= 16; - product = term1 + (numf + (denom >> 1)) / denom; - - /* Check for overflow */ - - if (product < term1) - { - return ub16MAX; /* Overflowed */ - } - return product; -} - -#endif diff --git a/nuttx/lib/fixedmath/lib_rint.c b/nuttx/lib/fixedmath/lib_rint.c deleted file mode 100644 index 3a6407b8c..000000000 --- a/nuttx/lib/fixedmath/lib_rint.c +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************ - * lib/fixedmath/lib_rint.c - * - * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************/ - -/************************************************************ - * Compilation Switches - ************************************************************/ - -/************************************************************ - * Included Files - ************************************************************/ - -#include -#include -#include - -/************************************************************ - * Definitions - ************************************************************/ - -/************************************************************ - * Private Type Declarations - ************************************************************/ - -/************************************************************ - * Private Function Prototypes - ************************************************************/ - -/********************************************************** - * Global Constant Data - **********************************************************/ - -/************************************************************ - * Global Variables - ************************************************************/ - -/********************************************************** - * Private Constant Data - **********************************************************/ - -/************************************************************ - * Private Variables - ************************************************************/ - -double_t rint(double_t x) -{ - double_t ret; - - /* If the current rounding mode rounds toward negative - * infinity, rint() is identical to floor(). If the current - * rounding mode rounds toward positive infinity, rint() is - * identical to ceil(). - */ - -#if defined(CONFIG_FP_ROUND_POSITIVE) && CONFIG_FP_ROUNDING_POSITIVE != 0 - - ret = ceil(x); - -#elif defined(CONFIG_FP_ROUND_NEGATIVE) && CONFIG_FP_ROUNDING_NEGATIVE != 0 - - ret = floor(x); - -#else - - /* In the default rounding mode (round to nearest), rint(x) is the - * integer nearest x with the additional stipulation that if - * |rint(x)-x|=1/2, then rint(x) is even. - */ - - long dwinteger = (long)x; - double_t fremainder = x - (double_t)dwinteger; - - if (x < 0.0) - { - /* fremainder should be in range 0 .. -1 */ - - if (fremainder == -0.5) - { - dwinteger = ((dwinteger+1)&~1); - } - else if (fremainder < -0.5) - { - dwinteger--; - } - } - else - { - /* fremainder should be in range 0 .. 1 */ - - if (fremainder == 0.5) - { - dwinteger = ((dwinteger+1)&~1); - } - else if (fremainder > 0.5) - { - dwinteger++; - } - } - - ret = (double_t)dwinteger; -#endif - - return ret; -} diff --git a/nuttx/lib/lib.csv b/nuttx/lib/lib.csv deleted file mode 100644 index 171f64e9b..000000000 --- a/nuttx/lib/lib.csv +++ /dev/null @@ -1,171 +0,0 @@ -"_inet_ntoa","arpa/inet.h","!defined(CONFIG_NET_IPv6) && !defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","in_addr_t" -"abort","stdlib.h","","void" -"abs","stdlib.h","","int","int" -"asprintf","stdio.h","","int","FAR char **","const char *","..." -"avsprintf","stdio.h","","int","FAR char **","const char *","va_list" -"b16atan2","fixedmath.h","","b16_t","b16_t","b16_t" -"b16cos","fixedmath.h","","b16_t","b16_t" -"b16divb16","fixedmath.h","","b16_t","b16_t","b16_t" -"b16mulb16","fixedmath.h","","b16_t","b16_t","b16_t" -"b16sin","fixedmath.h","","b16_t","b16_t" -"b16sqr","fixedmath.h","","b16_t","b16_t" -"basename","libgen.h","","FAR char","FAR char *" -"cfgetspeed","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","speed_t","FAR const struct termios *" -"cfsetspeed","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","FAR struct termios *","speed_t" -"chdir","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *" -"crc32","crc32.h","","uint32_t","FAR const uint8_t *","size_t" -"crc32part","crc32.h","","uint32_t","FAR const uint8_t *","size_t","uint32_t" -"dbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG)","int","const char *","..." -"dbg_enable","debug.h","defined(CONFIG_DEBUG_ENABLE)","void","bool" -"dirname","libgen.h","","FAR char","FAR char *" -"dq_addafter","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *" -"dq_addbefore","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *" -"dq_addfirst","queue.h","","void","FAR dq_entry_t *","dq_queue_t *" -"dq_addlast","queue.h","","void","FAR dq_entry_t *","dq_queue_t *" -"dq_rem","queue.h","","void","FAR dq_entry_t *","dq_queue_t *" -"dq_remfirst","queue.h","","FAR dq_entry_t","dq_queue_t *" -"dq_remlast","queue.h","","FAR dq_entry_t","dq_queue_t *" -"ether_ntoa","netinet/ether.h","","FAR char","FAR const struct ether_addr *" -"fclose","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *" -"fdopen","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","int","FAR const char *" -"fflush","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *" -"fgetc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *" -"fgetpos","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *" -"fgets","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *","int","FAR FILE *" -"fileno","stdio.h","","int","FAR FILE *" -"fopen","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","FAR const char *","FAR const char *" -"fprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const char *","..." -"fputc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int c","FAR FILE *" -"fputs","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","FAR FILE *" -"fread","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR void *","size_t","size_t","FAR FILE *" -"fseek","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","long int","int" -"fsetpos","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *" -"ftell","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","long","FAR FILE *" -"fwrite","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR const void *","size_t","size_t","FAR FILE *" -"getcwd","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","FAR char","FAR char *","size_t" -"getopt","unistd.h","","int","int","FAR char *const[]","FAR const char *" -"getoptargp","unistd.h","","FAR char *" -"getoptindp","unistd.h","","int" -"getoptoptp","unistd.h","","int" -"gets","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *" -"gmtime","time.h","","struct tm","const time_t *" -"gmtime_r","time.h","","FAR struct tm","FAR const time_t *","FAR struct tm *" -"htonl","arpa/inet.h","","uint32_t","uint32_t" -"htons","arpa/inet.h","","uint16_t","uint16_t" -"imaxabs","stdlib.h","","intmax_t","intmax_t" -"inet_addr","arpa/inet.h","","in_addr_t","FAR const char " -"inet_ntoa","arpa/inet.h","!defined(CONFIG_NET_IPv6) && defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","struct in_addr" -"inet_ntop","arpa/inet.h","","FAR const char","int","FAR const void *","FAR char *","socklen_t" -"inet_pton","arpa/inet.h","","int","int","FAR const char *","FAR void *" -"labs","stdlib.h","","long int","long int" -"lib_dumpbuffer","debug.h","","void","FAR const char *","FAR const uint8_t *","unsigned int" -"lib_lowprintf","debug.h","","int","FAR const char *","..." -"lib_rawprintf","debug.h","","int","FAR const char *","..." -"llabs","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long int","long long int" -"lldbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..." -"llvdbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..." -"match","","","int","const char *","const char *" -"memccpy","string.h","","FAR void","FAR void *","FAR const void *","int c","size_t" -"memchr","string.h","","FAR void","FAR const void *","int c","size_t" -"memcmp","string.h","","int","FAR const void *","FAR const void *","size_t" -"memcpy","string.h","","FAR void","FAR void *","FAR const void *","size_t" -"memmove","string.h","","FAR void","FAR void *","FAR const void *","size_t" -"memset","string.h","","FAR void","FAR void *","int c","size_t" -"mktime","time.h","","time_t","const struct tm *" -"mq_getattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","struct mq_attr *" -"mq_setattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct mq_attr *","struct mq_attr *" -"ntohl","arpa/inet.h","","uint32_t","uint32_t" -"ntohs","arpa/inet.h","","uint16_t","uint16_t" -"perror","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","void","FAR const char *" -"printf","stdio.h","","int","const char *","..." -"pthread_attr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *" -"pthread_attr_getinheritsched","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_attr_t *","FAR int *" -"pthread_attr_getschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR struct sched_param *" -"pthread_attr_getschedpolicy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int *" -"pthread_attr_getstacksize","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR long *" -"pthread_attr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *" -"pthread_attr_setinheritsched","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int" -"pthread_attr_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR const struct sched_param *" -"pthread_attr_setschedpolicy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int" -"pthread_attr_setstacksize","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","long" -"pthread_barrierattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *" -"pthread_barrierattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_barrierattr_t *","FAR int *" -"pthread_barrierattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *" -"pthread_barrierattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *","int" -"pthread_condattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *" -"pthread_condattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *" -"pthread_mutexattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *" -"pthread_mutexattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *","FAR int *" -"pthread_mutexattr_gettype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","const pthread_mutexattr_t *","int *" -"pthread_mutexattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *" -"pthread_mutexattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *","int " -"pthread_mutexattr_settype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","pthread_mutexattr_t *","int" -"puts","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *" -"qsort","stdlib.h","","void","void *","size_t","size_t","int(*)(const void *","const void *)" -"rand","stdlib.h","","int" -"readdir_r","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR *","FAR struct dirent *","FAR struct dirent **" -"rint","","","double_t","double_t" -"sched_get_priority_max","sched.h","","int","int" -"sched_get_priority_min","sched.h","","int","int" -"sem_getvalue","semaphore.h","","int","FAR sem_t *","FAR int *" -"sem_init","semaphore.h","","int","FAR sem_t *","int","unsigned int" -"sendfile","sys/sendfile.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","int","off_t","size_t" -"sigaddset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *","int" -"sigdelset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *","int" -"sigemptyset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *" -"sigfillset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *" -"sigismember","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t *","int" -"snprintf","stdio.h","","int","FAR char *","size_t","const char *","..." -"sprintf","stdio.h","","int","FAR char *","const char *","..." -"sq_addafter","queue.h","","void","FAR sq_entry_t *","FAR sq_entry_t *","FAR sq_queue_t *" -"sq_addfirst","queue.h","","void","FAR sq_entry_t *","sq_queue_t *" -"sq_addlast","queue.h","","void","FAR sq_entry_t *","sq_queue_t *" -"sq_rem","queue.h","","void","FAR sq_entry_t *","sq_queue_t *" -"sq_remafter","queue.h","","FAR sq_entry_t","FAR sq_entry_t *","sq_queue_t *" -"sq_remfirst","queue.h","","FAR sq_entry_t","sq_queue_t *" -"sq_remlast","queue.h","","FAR sq_entry_t","sq_queue_t *" -"srand","stdlib.h","","void","unsigned int" -"sscanf","stdio.h","","int","const char *","const char *","..." -"strcasecmp","string.h","","int","FAR const char *","FAR const char *" -"strcasestr","string.h","","FAR char","FAR const char *","FAR const char *" -"strcat","string.h","","FAR char","FAR char *","FAR const char *" -"strchr","string.h","","FAR char","FAR const char *","int" -"strcmp","string.h","","int","FAR const char *","FAR const char *" -"strcpy","string.h","","FAR char","char *","FAR const char *" -"strcspn","string.h","","size_t","FAR const char *","FAR const char *" -"strdup","string.h","","FAR char","FAR const char *" -"strerror","string.h","","FAR const char","int" -"strftime","time.h","","size_t","char *","size_t","const char *","const struct tm *" -"strlen","string.h","","size_t","FAR const char *" -"strncasecmp","string.h","","int","FAR const char *","FAR const char *","size_t" -"strncat","string.h","","FAR char","FAR char *","FAR const char *","size_t" -"strncmp","string.h","","int","FAR const char *","FAR const char *","size_t" -"strncpy","string.h","","FAR char","char *","FAR const char *","size_t" -"strndup","string.h","","FAR char","FAR const char *","size_t" -"strnlen","string.h","","size_t","FAR const char *","size_t" -"strpbrk","string.h","","FAR char","FAR const char *","FAR const char *" -"strrchr","string.h","","FAR char","FAR const char *","int" -"strspn","string.h","","size_t","FAR const char *","FAR const char *" -"strstr","string.h","","FAR char","FAR const char *","FAR const char *" -"strtod","stdlib.h","","double_t","const char *str","char **endptr" -"strtok","string.h","","FAR char","FAR char *","FAR const char *" -"strtok_r","string.h","","FAR char","FAR char *","FAR const char *","FAR char **" -"strtol","string.h","","long","const char *","char **","int" -"strtoll","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long","const char *nptr","char **endptr","int base" -"strtoul","stdlib.h","","unsigned long","const char *","char **","int" -"strtoull","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","unsigned long long","const char *","char **","int" -"tcflush","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int" -"tcgetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","FAR struct termios *" -"tcsetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int","FAR const struct termios *" -"telldir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","off_t","FAR DIR *" -"time","time.h","","time_t","time_t *" -"ub16divub16","fixedmath.h","","ub16_t","ub16_t","ub16_t" -"ub16mulub16","fixedmath.h","","ub16_t","ub16_t","ub16_t" -"ub16sqr","fixedmath.h","","ub16_t","ub16_t" -"ungetc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int","FAR FILE *" -"vdbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE)","int","const char *","..." -"vfprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","const char *","va_list" -"vprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","va_list" -"vsnprintf","stdio.h","","int","FAR char *","size_t","const char *","va_list" -"vsprintf","stdio.h","","int","FAR char *","const char *","va_list" -"vsscanf","stdio.h","","int","char *","const char *","va_list" diff --git a/nuttx/lib/lib_internal.h b/nuttx/lib/lib_internal.h deleted file mode 100644 index 5da0ac924..000000000 --- a/nuttx/lib/lib_internal.h +++ /dev/null @@ -1,211 +0,0 @@ -/**************************************************************************** - * lib/lib_internal.h - * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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 __LIB_LIB_INTERNAL_H -#define __LIB_LIB_INTERNAL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include -#include -#include - -#include - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* This configuration directory is used in environment variable processing - * when we need to reference the user's home directory. There are no user - * directories in NuttX so, by default, this always refers to the root - * directory. - */ - -#ifndef CONFIG_LIB_HOMEDIR -# define CONFIG_LIB_HOMEDIR "/" -#endif - -/* If C std I/O buffering is not supported, then we don't need its semaphore - * protection. - */ - -#if CONFIG_STDIO_BUFFER_SIZE <= 0 -# define lib_sem_initialize(s) -# define lib_take_semaphore(s) -# define lib_give_semaphore(s) -#endif - -/* The NuttX C library an be build in two modes: (1) as a standard, C-libary - * that can be used by normal, user-space applications, or (2) as a special, - * kernel-mode C-library only used within the OS. If NuttX is not being - * built as separated kernel- and user-space modules, then only the first - * mode is supported. - */ - -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) -# include -# define lib_malloc(s) kmalloc(s) -# define lib_zalloc(s) kzalloc(s) -# define lib_realloc(p,s) krealloc(p,s) -# define lib_free(p) kfree(p) -#else -# include -# define lib_malloc(s) malloc(s) -# define lib_zalloc(s) zalloc(s) -# define lib_realloc(p,s) realloc(p,s) -# define lib_free(p) free(p) -#endif - -#define LIB_BUFLEN_UNKNOWN INT_MAX - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* Debug output is initially disabled */ - -#ifdef CONFIG_DEBUG_ENABLE -extern bool g_dbgenable; -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* Defined in lib_streamsem.c */ - -#if CONFIG_NFILE_STREAMS > 0 -void stream_semtake(FAR struct streamlist *list); -void stream_semgive(FAR struct streamlist *list); -#endif - -/* Defined in lib_libnoflush.c */ - -#ifdef CONFIG_STDIO_LINEBUFFER -int lib_noflush(FAR struct lib_outstream_s *this); -#endif - -/* Defined in lib_libsprintf.c */ - -int lib_sprintf(FAR struct lib_outstream_s *obj, - const char *fmt, ...); - -/* Defined lib_libvsprintf.c */ - -int lib_vsprintf(FAR struct lib_outstream_s *obj, - FAR const char *src, va_list ap); - -/* Defined lib_rawprintf.c */ - -int lib_rawvprintf(const char *src, va_list ap); - -/* Defined lib_lowprintf.c */ - -int lib_lowvprintf(const char *src, va_list ap); - -/* Defined in lib_dtoa.c */ - -#ifdef CONFIG_LIBC_FLOATINGPOINT -char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, - char **rve); -#endif - -/* Defined in lib_libwrite.c */ - -ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream); - -/* Defined in lib_libfread.c */ - -ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream); - -/* Defined in lib_libfflush.c */ - -ssize_t lib_fflush(FAR FILE *stream, bool bforce); - -/* Defined in lib_rdflush.c */ - -int lib_rdflush(FAR FILE *stream); - -/* Defined in lib_wrflush.c */ - -int lib_wrflush(FAR FILE *stream); - -/* Defined in lib_sem.c */ - -#if CONFIG_STDIO_BUFFER_SIZE > 0 -void lib_sem_initialize(FAR struct file_struct *stream); -void lib_take_semaphore(FAR struct file_struct *stream); -void lib_give_semaphore(FAR struct file_struct *stream); -#endif - -/* Defined in lib_libgetbase.c */ - -int lib_getbase(const char *nptr, const char **endptr); - -/* Defined in lib_skipspace.c */ - -void lib_skipspace(const char **pptr); - -/* Defined in lib_isbasedigit.c */ - -bool lib_isbasedigit(int ch, int base, int *value); - -/* Defined in lib_checkbase.c */ - -int lib_checkbase(int base, const char **pptr); - -/* Defined in lib_expi.c */ - -#ifdef CONFIG_LIBM -double lib_expi(size_t n); -#endif - -/* Defined in lib_libsqrtapprox.c */ - -#ifdef CONFIG_LIBM -float lib_sqrtapprox(float x); -#endif - -#endif /* __LIB_LIB_INTERNAL_H */ diff --git a/nuttx/lib/libgen/Make.defs b/nuttx/lib/libgen/Make.defs deleted file mode 100644 index f12645512..000000000 --- a/nuttx/lib/libgen/Make.defs +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# lib/libgen/Make.defs -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Add the libgen C files to the build - -CSRCS += lib_basename.c lib_dirname.c - -# Add the libgen directory to the build - -DEPPATH += --dep-path libgen -VPATH += :libgen diff --git a/nuttx/lib/libgen/lib_basename.c b/nuttx/lib/libgen/lib_basename.c deleted file mode 100644 index 986c6b852..000000000 --- a/nuttx/lib/libgen/lib_basename.c +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** - * lib/libgen/lib_basename.c - * - * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char g_retchar[2]; - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Function: basename - * - * Description: - * basename() extracts the filename component from a null-terminated - * pathname string. In the usual case, basename() returns the component - * following the final '/'. Trailing '/' characters are not counted as - * part of the pathname. - * - * If path does not contain a slash, basename() returns a copy of path. - * If path is the string "/", then basename() returns the string "/". If - * path is a NULL pointer or points to an empty string, then basename() - * return the string ".". - * - * basename() may modify the contents of path, so copies should be passed. - * basename() may return pointers to statically allocated memory which may - * be overwritten by subsequent calls. - * - * Parameter: - * path The null-terminated string referring to the path to be decomposed - * - * Return: - * On success the filename component of the path is returned. - * - ****************************************************************************/ - -FAR char *basename(FAR char *path) -{ - char *p; - int len; - int ch; - - /* Handle some corner cases */ - - if (!path || *path == '\0') - { - ch = '.'; - goto out_retchar; - } - - /* Check for trailing slash characters */ - - len = strlen(path); - while (path[len-1] == '/') - { - /* Remove trailing '/' UNLESS this would make a zero length string */ - if (len > 1) - { - path[len-1] = '\0'; - len--; - } - else - { - ch = '/'; - goto out_retchar; - } - } - - /* Get the address of the last '/' which is not at the end of the path and, - * therefor, must be just before the beginning of the filename component. - */ - - p = strrchr(path, '/'); - if (p) - { - return p + 1; - } - - /* There is no '/' in the path */ - - return path; - -out_retchar: - g_retchar[0] = ch; - g_retchar[1] = '\0'; - return g_retchar; -} diff --git a/nuttx/lib/libgen/lib_dirname.c b/nuttx/lib/libgen/lib_dirname.c deleted file mode 100644 index 248293a60..000000000 --- a/nuttx/lib/libgen/lib_dirname.c +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** - * lib/libgen/lib_dirname.c - * - * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char g_retchar[2]; - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Function: dirname - * - * Description: - * dirname() extracts the directory component from a null-terminated - * pathname string. In the usual case, dirname() returns the string up - * to, but not including, the final '/'. Trailing '/' characters are not - * counted as part of the pathname. - * - * If path does not contain a slash, dirname() returns the string ".". If - * path is the string "/", then dirname() returns the string "/". If path - * is a NULL pointer or points to an empty string, then dirname() returns - * the string ".". - * - * dirname() may modify the contents of path, so copies should be passed. - * dirname() may return pointers to statically allocated memory which may - * be overwritten by subsequent calls. - * - * Parameter: - * path The null-terminated string referring to the path to be decomposed - * - * Return: - * On success the directory component of the path is returned. - * - ****************************************************************************/ - -FAR char *dirname(FAR char *path) -{ - char *p; - int len; - int ch; - - /* Handle some corner cases */ - - if (!path || *path == '\0') - { - ch = '.'; - goto out_retchar; - } - - /* Check for trailing slash characters */ - - len = strlen(path); - while (path[len-1] == '/') - { - /* Remove trailing '/' UNLESS this would make a zero length string */ - if (len > 1) - { - path[len-1] = '\0'; - len--; - } - else - { - ch = '/'; - goto out_retchar; - } - } - - /* Get the address of the last '/' which is not at the end of the path and, - * therefor, must be the end of the directory component. - */ - - p = strrchr(path, '/'); - if (p) - { - /* Handle the case where the only '/' in the string is the at the beginning - * of the path. - */ - - if (p == path) - { - ch = '/'; - goto out_retchar; - } - - /* No, the directory component is the substring before the '/'. */ - - *p = '\0'; - return path; - } - - /* There is no '/' in the path */ - - ch = '.'; - -out_retchar: - g_retchar[0] = ch; - g_retchar[1] = '\0'; - return g_retchar; -} diff --git a/nuttx/lib/math/Kconfig b/nuttx/lib/math/Kconfig deleted file mode 100644 index c24bfd53f..000000000 --- a/nuttx/lib/math/Kconfig +++ /dev/null @@ -1,26 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config LIBM - bool "Math library" - default n - depends on !ARCH_MATH_H - ---help--- - By default, no math library will be provided by NuttX. In this this case, it - is assumed that (1) no math library is required, or (2) you will be using the - math.h header file and the libm library provided by your toolchain. - - This is may be a very good choice is possible because your toolchain may have - have a highly optimized version of libm. - - Another possibility is that you have a custom, architecture-specific math - libary and that the corresponding math.h file resides at arch/ /include/math.h. - The option is selected via ARCH_MATH_H. If ARCH_MATH_H is selected,then the include/nuttx/math.h - header file will be copied to include/math.h where it can be used by your applications. - - If ARCH_MATH_H is not defined, then this option can be selected to build a generic, - math library built into NuttX. This math library comes from the Rhombus OS and - was written by Nick Johnson. The Rhombus OS math library port was contributed by - Darcy Gong. diff --git a/nuttx/lib/math/Make.defs b/nuttx/lib/math/Make.defs deleted file mode 100644 index 73d0be6f3..000000000 --- a/nuttx/lib/math/Make.defs +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################ -# lib/math/Make.defs -# -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -ifeq ($(CONFIG_LIBM),y) - -# Add the floating point math C files to the build - -CSRCS += lib_acosf.c lib_asinf.c lib_atan2f.c lib_atanf.c lib_ceilf.c lib_cosf.c -CSRCS += lib_coshf.c lib_expf.c lib_fabsf.c lib_floorf.c lib_fmodf.c lib_frexpf.c -CSRCS += lib_ldexpf.c lib_logf.c lib_log10f.c lib_log2f.c lib_modff.c lib_powf.c -CSRCS += lib_sinf.c lib_sinhf.c lib_sqrtf.c lib_tanf.c lib_tanhf.c - -CSRCS += lib_acos.c lib_asin.c lib_atan.c lib_atan2.c lib_ceil.c lib_cos.c -CSRCS += lib_cosh.c lib_exp.c lib_fabs.c lib_floor.c lib_fmod.c lib_frexp.c -CSRCS += lib_ldexp.c lib_log.c lib_log10.c lib_log2.c lib_modf.c lib_pow.c -CSRCS += lib_sin.c lib_sinh.c lib_sqrt.c lib_tan.c lib_tanh.c - -CSRCS += lib_acosl.c lib_asinl.c lib_atan2l.c lib_atanl.c lib_ceill.c lib_cosl.c -CSRCS += lib_coshl.c lib_expl.c lib_fabsl.c lib_floorl.c lib_fmodl.c lib_frexpl.c -CSRCS += lib_ldexpl.c lib_logl.c lib_log10l.c lib_log2l.c lib_modfl.c lib_powl.c -CSRCS += lib_sinl.c lib_sinhl.c lib_sqrtl.c lib_tanl.c lib_tanhl.c - -CSRCS += lib_libexpi.c lib_libsqrtapprox.c - -# Add the floating point math directory to the build - -DEPPATH += --dep-path math -VPATH += :math - -endif diff --git a/nuttx/lib/math/lib_acos.c b/nuttx/lib/math/lib_acos.c deleted file mode 100644 index d5ec36b9f..000000000 --- a/nuttx/lib/math/lib_acos.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_acos.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double acos(double x) -{ - return (M_PI_2 - asin(x)); -} -#endif diff --git a/nuttx/lib/math/lib_acosf.c b/nuttx/lib/math/lib_acosf.c deleted file mode 100644 index e14a73a6e..000000000 --- a/nuttx/lib/math/lib_acosf.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************ - * lib/math/lib_acosf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float acosf(float x) -{ - return (M_PI_2 - asinf(x)); -} diff --git a/nuttx/lib/math/lib_acosl.c b/nuttx/lib/math/lib_acosl.c deleted file mode 100644 index 911330577..000000000 --- a/nuttx/lib/math/lib_acosl.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_acos.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double acosl(long double x) -{ - return (M_PI_2 - asinl(x)); -} -#endif diff --git a/nuttx/lib/math/lib_asin.c b/nuttx/lib/math/lib_asin.c deleted file mode 100644 index 61b953531..000000000 --- a/nuttx/lib/math/lib_asin.c +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************ - * lib/math/lib_sin.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double asin(double x) -{ - long double y, y_sin, y_cos; - - y = 0; - - while (1) - { - y_sin = sin(y); - y_cos = cos(y); - - if (y > M_PI_2 || y < -M_PI_2) - { - y = fmod(y, M_PI); - } - - if (y_sin + DBL_EPSILON >= x && y_sin - DBL_EPSILON <= x) - { - break; - } - - y = y - (y_sin - x) / y_cos; - } - - return y; -} -#endif diff --git a/nuttx/lib/math/lib_asinf.c b/nuttx/lib/math/lib_asinf.c deleted file mode 100644 index 17669a934..000000000 --- a/nuttx/lib/math/lib_asinf.c +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************ - * lib/math/lib_sinf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float asinf(float x) -{ - long double y, y_sin, y_cos; - - y = 0; - - while (1) - { - y_sin = sinf(y); - y_cos = cosf(y); - - if (y > M_PI_2 || y < -M_PI_2) - { - y = fmodf(y, M_PI); - } - - if (y_sin + FLT_EPSILON >= x && y_sin - FLT_EPSILON <= x) - { - break; - } - - y = y - (y_sin - x) / y_cos; - } - - return y; -} - diff --git a/nuttx/lib/math/lib_asinl.c b/nuttx/lib/math/lib_asinl.c deleted file mode 100644 index dbb2bc3a2..000000000 --- a/nuttx/lib/math/lib_asinl.c +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************ - * lib/math/lib_sinl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double asinl(long double x) -{ - long double y, y_sin, y_cos; - - y = 0; - - while (1) - { - y_sin = sinl(y); - y_cos = cosl(y); - - if (y > M_PI_2 || y < -M_PI_2) - { - y = fmodl(y, M_PI); - } - - if (y_sin + LDBL_EPSILON >= x && y_sin - LDBL_EPSILON <= x) - { - break; - } - - y = y - (y_sin - x) / y_cos; - } - - return y; -} -#endif diff --git a/nuttx/lib/math/lib_atan.c b/nuttx/lib/math/lib_atan.c deleted file mode 100644 index b4db8fb31..000000000 --- a/nuttx/lib/math/lib_atan.c +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************ - * lib/math/lib_atan.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double atan(double x) -{ - return asin(x / sqrt(x * x + 1)); -} -#endif diff --git a/nuttx/lib/math/lib_atan2.c b/nuttx/lib/math/lib_atan2.c deleted file mode 100644 index 82d1f47ec..000000000 --- a/nuttx/lib/math/lib_atan2.c +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************ - * lib/math/lib_atan2.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double atan2(double y, double x) -{ - if (y == 0.0) - { - if (x >= 0.0) - { - return 0.0; - } - else - { - return M_PI; - } - } - else if (y > 0.0) - { - if (x == 0.0) - { - return M_PI_2; - } - else if (x > 0.0) - { - return atan(y / x); - } - else - { - return M_PI - atan(y / x); - } - } - else - { - if (x == 0.0) - { - return M_PI + M_PI_2; - } - else if (x > 0.0) - { - return 2 * M_PI - atan(y / x); - } - else - { - return M_PI + atan(y / x); - } - } -} -#endif diff --git a/nuttx/lib/math/lib_atan2f.c b/nuttx/lib/math/lib_atan2f.c deleted file mode 100644 index a60d32c65..000000000 --- a/nuttx/lib/math/lib_atan2f.c +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************ - * lib/math/lib_atan2f.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float atan2f(float y, float x) -{ - if (y == 0.0) - { - if (x >= 0.0) - { - return 0.0; - } - else - { - return M_PI; - } - } - else if (y > 0.0) - { - if (x == 0.0) - { - return M_PI_2; - } - else if (x > 0.0) - { - return atanf(y / x); - } - else - { - return M_PI - atanf(y / x); - } - } - else - { - if (x == 0.0) - { - return M_PI + M_PI_2; - } - else if (x > 0.0) - { - return 2 * M_PI - atanf(y / x); - } - else - { - return M_PI + atanf(y / x); - } - } -} diff --git a/nuttx/lib/math/lib_atan2l.c b/nuttx/lib/math/lib_atan2l.c deleted file mode 100644 index 07fcd9669..000000000 --- a/nuttx/lib/math/lib_atan2l.c +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************ - * lib/math/lib_atan2l.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double atan2l(long double y, long double x) -{ - - if (y == 0.0) - { - if (x >= 0.0) - { - return 0.0; - } - else - { - return M_PI; - } - } - else if (y > 0.0) - { - if (x == 0.0) - { - return M_PI_2; - } - else if (x > 0.0) - { - return atanl(y / x); - } - else - { - return M_PI - atanl(y / x); - } - } - else - { - if (x == 0.0) - { - return M_PI + M_PI_2; - } - else if (x > 0.0) - { - return 2 * M_PI - atanl(y / x); - } - else - { - return M_PI + atanl(y / x); - } - } -} -#endif diff --git a/nuttx/lib/math/lib_atanf.c b/nuttx/lib/math/lib_atanf.c deleted file mode 100644 index 7c540dd16..000000000 --- a/nuttx/lib/math/lib_atanf.c +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************ - * lib/math/lib_atanf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float atanf(float x) -{ - return asinf(x / sqrtf(x * x + 1)); -} diff --git a/nuttx/lib/math/lib_atanl.c b/nuttx/lib/math/lib_atanl.c deleted file mode 100644 index 0fa203098..000000000 --- a/nuttx/lib/math/lib_atanl.c +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************ - * lib/math/lib_atanl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double atanl(long double x) -{ - return asinl(x / sqrtl(x * x + 1)); -} -#endif diff --git a/nuttx/lib/math/lib_ceil.c b/nuttx/lib/math/lib_ceil.c deleted file mode 100644 index 0e7602996..000000000 --- a/nuttx/lib/math/lib_ceil.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************ - * lib/math/lib_ceil.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double ceil(double x) -{ - modf(x, &x); - if (x > 0.0) - { - x += 1.0; - } - - return x; -} -#endif diff --git a/nuttx/lib/math/lib_ceilf.c b/nuttx/lib/math/lib_ceilf.c deleted file mode 100644 index 0721ffc22..000000000 --- a/nuttx/lib/math/lib_ceilf.c +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************ - * lib/math/lib_ceilf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float ceilf(float x) -{ - modff(x, &x); - if (x > 0.0) - { - x += 1.0; - } - - return x; -} diff --git a/nuttx/lib/math/lib_ceill.c b/nuttx/lib/math/lib_ceill.c deleted file mode 100644 index a24b56f68..000000000 --- a/nuttx/lib/math/lib_ceill.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************ - * lib/math/lib_ceil;.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double ceill(long double x) -{ - modfl(x, &x); - if (x > 0.0) - { - x += 1.0; - } - - return x; -} -#endif diff --git a/nuttx/lib/math/lib_cos.c b/nuttx/lib/math/lib_cos.c deleted file mode 100644 index aa672b855..000000000 --- a/nuttx/lib/math/lib_cos.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_cos.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double cos(double x) -{ - return sin(x + M_PI_2); -} -#endif diff --git a/nuttx/lib/math/lib_cosf.c b/nuttx/lib/math/lib_cosf.c deleted file mode 100644 index 093a8a002..000000000 --- a/nuttx/lib/math/lib_cosf.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************ - * lib/math/lib_cosf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float cosf(float x) -{ - return sinf(x + M_PI_2); -} diff --git a/nuttx/lib/math/lib_cosh.c b/nuttx/lib/math/lib_cosh.c deleted file mode 100644 index 1be44d293..000000000 --- a/nuttx/lib/math/lib_cosh.c +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************ - * lib/math/lib_cosh.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double cosh(double x) -{ - x = exp(x); - return ((x + (1.0 / x)) / 2.0); -} -#endif diff --git a/nuttx/lib/math/lib_coshf.c b/nuttx/lib/math/lib_coshf.c deleted file mode 100644 index d5e5ea14d..000000000 --- a/nuttx/lib/math/lib_coshf.c +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************ - * lib/math/lib_coshf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float coshf(float x) -{ - x = expf(x); - return ((x + (1.0 / x)) / 2.0); -} diff --git a/nuttx/lib/math/lib_coshl.c b/nuttx/lib/math/lib_coshl.c deleted file mode 100644 index 4576b8876..000000000 --- a/nuttx/lib/math/lib_coshl.c +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************ - * lib/math/lib_coshl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double coshl(long double x) -{ - x = expl(x); - return ((x + (1.0 / x)) / 2.0); -} -#endif diff --git a/nuttx/lib/math/lib_cosl.c b/nuttx/lib/math/lib_cosl.c deleted file mode 100644 index 25dd86139..000000000 --- a/nuttx/lib/math/lib_cosl.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_cosl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double cosl(long double x) -{ - return sinl(x + M_PI_2); -} -#endif diff --git a/nuttx/lib/math/lib_exp.c b/nuttx/lib/math/lib_exp.c deleted file mode 100644 index 1e3120453..000000000 --- a/nuttx/lib/math/lib_exp.c +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************ - * lib/math/lib_exp.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -#include "lib_internal.h" - -#ifdef CONFIG_HAVE_DOUBLE - -/************************************************************************ - * Private Data - ************************************************************************/ - -static double _dbl_inv_fact[] = -{ - 1.0 / 1.0, // 1 / 0! - 1.0 / 1.0, // 1 / 1! - 1.0 / 2.0, // 1 / 2! - 1.0 / 6.0, // 1 / 3! - 1.0 / 24.0, // 1 / 4! - 1.0 / 120.0, // 1 / 5! - 1.0 / 720.0, // 1 / 6! - 1.0 / 5040.0, // 1 / 7! - 1.0 / 40320.0, // 1 / 8! - 1.0 / 362880.0, // 1 / 9! - 1.0 / 3628800.0, // 1 / 10! - 1.0 / 39916800.0, // 1 / 11! - 1.0 / 479001600.0, // 1 / 12! - 1.0 / 6227020800.0, // 1 / 13! - 1.0 / 87178291200.0, // 1 / 14! - 1.0 / 1307674368000.0, // 1 / 15! - 1.0 / 20922789888000.0, // 1 / 16! - 1.0 / 355687428096000.0, // 1 / 17! - 1.0 / 6402373705728000.0, // 1 / 18! -}; - -/************************************************************************ - * Public Functions - ************************************************************************/ - -double exp(double x) -{ - size_t int_part; - bool invert; - double value; - double x0; - size_t i; - - if (x == 0) - { - return 1; - } - else if (x < 0) - { - invert = true; - x = -x; - } - else - { - invert = false; - } - - /* Extract integer component */ - - int_part = (size_t) x; - - /* Set x to fractional component */ - - x -= (double)int_part; - - /* Perform Taylor series approximation with nineteen terms */ - - value = 0.0; - x0 = 1.0; - for (i = 0; i < 19; i++) - { - value += x0 * _dbl_inv_fact[i]; - x0 *= x; - } - - /* Multiply by exp of the integer component */ - - value *= lib_expi(int_part); - - if (invert) - { - return (1.0 / value); - } - else - { - return value; - } -} -#endif diff --git a/nuttx/lib/math/lib_expf.c b/nuttx/lib/math/lib_expf.c deleted file mode 100644 index eac4641c6..000000000 --- a/nuttx/lib/math/lib_expf.c +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************ - * lib/math/lib_expf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include "lib_internal.h" - -/************************************************************************ - * Private Data - ************************************************************************/ - -static float _flt_inv_fact[] = -{ - 1.0 / 1.0, // 1/0! - 1.0 / 1.0, // 1/1! - 1.0 / 2.0, // 1/2! - 1.0 / 6.0, // 1/3! - 1.0 / 24.0, // 1/4! - 1.0 / 120.0, // 1/5! - 1.0 / 720.0, // 1/6! - 1.0 / 5040.0, // 1/7! - 1.0 / 40320.0, // 1/8! - 1.0 / 362880.0, // 1/9! - 1.0 / 3628800.0, // 1/10! -}; - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float expf(float x) -{ - size_t int_part; - bool invert; - float value; - float x0; - size_t i; - - if (x == 0) - { - return 1; - } - else if (x < 0) - { - invert = true; - x = -x; - } - else - { - invert = false; - } - - /* Extract integer component */ - - int_part = (size_t) x; - - /* set x to fractional component */ - - x -= (float)int_part; - - /* Perform Taylor series approximation with eleven terms */ - - value = 0.0; - x0 = 1.0; - for (i = 0; i < 10; i++) - { - value += x0 * _flt_inv_fact[i]; - x0 *= x; - } - - /* Multiply by exp of the integer component */ - - value *= lib_expi(int_part); - - if (invert) - { - return (1.0 / value); - } - else - { - return value; - } -} diff --git a/nuttx/lib/math/lib_expl.c b/nuttx/lib/math/lib_expl.c deleted file mode 100644 index 053103c9b..000000000 --- a/nuttx/lib/math/lib_expl.c +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************ - * lib/math/lib_expl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -#include "lib_internal.h" - -#ifdef CONFIG_HAVE_LONG_DOUBLE - -/************************************************************************ - * Private Data - ************************************************************************/ - -static long double _ldbl_inv_fact[] = -{ - 1.0 / 1.0, // 1 / 0! - 1.0 / 1.0, // 1 / 1! - 1.0 / 2.0, // 1 / 2! - 1.0 / 6.0, // 1 / 3! - 1.0 / 24.0, // 1 / 4! - 1.0 / 120.0, // 1 / 5! - 1.0 / 720.0, // 1 / 6! - 1.0 / 5040.0, // 1 / 7! - 1.0 / 40320.0, // 1 / 8! - 1.0 / 362880.0, // 1 / 9! - 1.0 / 3628800.0, // 1 / 10! - 1.0 / 39916800.0, // 1 / 11! - 1.0 / 479001600.0, // 1 / 12! - 1.0 / 6227020800.0, // 1 / 13! - 1.0 / 87178291200.0, // 1 / 14! - 1.0 / 1307674368000.0, // 1 / 15! - 1.0 / 20922789888000.0, // 1 / 16! - 1.0 / 355687428096000.0, // 1 / 17! - 1.0 / 6402373705728000.0, // 1 / 18! -}; - -/************************************************************************ - * Public Functions - ************************************************************************/ - -long double expl(long double x) -{ - size_t int_part; - bool invert; - long double value; - long double x0; - size_t i; - - if (x == 0) - { - return 1; - } - else if (x < 0) - { - invert = true; - x = -x; - } - else - { - invert = false; - } - - /* Extract integer component */ - - int_part = (size_t) x; - - /* Set x to fractional component */ - - x -= (long double)int_part; - - /* Perform Taylor series approximation with nineteen terms */ - - value = 0.0; - x0 = 1.0; - for (i = 0; i < 19; i++) - { - value += x0 * _ldbl_inv_fact[i]; - x0 *= x; - } - - /* Multiply by exp of the integer component */ - - value *= lib_expi(int_part); - - if (invert) - { - return (1.0 / value); - } - else - { - return value; - } -} -#endif diff --git a/nuttx/lib/math/lib_fabs.c b/nuttx/lib/math/lib_fabs.c deleted file mode 100644 index ff99ceb64..000000000 --- a/nuttx/lib/math/lib_fabs.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_fabs.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double fabs(double x) -{ - return ((x < 0) ? -x : x); -} -#endif diff --git a/nuttx/lib/math/lib_fabsf.c b/nuttx/lib/math/lib_fabsf.c deleted file mode 100644 index 0ea186ca0..000000000 --- a/nuttx/lib/math/lib_fabsf.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************ - * lib/math/lib_fabsf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float fabsf(float x) -{ - return ((x < 0) ? -x : x); -} diff --git a/nuttx/lib/math/lib_fabsl.c b/nuttx/lib/math/lib_fabsl.c deleted file mode 100644 index 5313d897d..000000000 --- a/nuttx/lib/math/lib_fabsl.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_fabsl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double fabsl(long double x) -{ - return ((x < 0) ? -x : x); -} -#endif diff --git a/nuttx/lib/math/lib_floor.c b/nuttx/lib/math/lib_floor.c deleted file mode 100644 index f0c4477a0..000000000 --- a/nuttx/lib/math/lib_floor.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************ - * lib/math/lib_floor.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double floor(double x) -{ - modf(x, &x); - if (x < 0.0) - { - x -= 1.0; - } - - return x; -} -#endif diff --git a/nuttx/lib/math/lib_floorf.c b/nuttx/lib/math/lib_floorf.c deleted file mode 100644 index 2becb5fac..000000000 --- a/nuttx/lib/math/lib_floorf.c +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************ - * lib/math/lib_floorf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float floorf(float x) -{ - modff(x, &x); - if (x < 0.0) - { - x -= 1.0; - } - - return x; -} diff --git a/nuttx/lib/math/lib_floorl.c b/nuttx/lib/math/lib_floorl.c deleted file mode 100644 index e38ce80ed..000000000 --- a/nuttx/lib/math/lib_floorl.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************ - * lib/math/lib_floorl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double floorl(long double x) -{ - modfl(x, &x); - if (x < 0.0) - { - x -= 1.0; - } - - return x; -} -#endif diff --git a/nuttx/lib/math/lib_fmod.c b/nuttx/lib/math/lib_fmod.c deleted file mode 100644 index 939e7e18a..000000000 --- a/nuttx/lib/math/lib_fmod.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************ - * lib/math/lib_fmod.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double fmod(double x, double div) -{ - double n0; - - x /= div; - x = modf(x, &n0); - x *= div; - - return x; -} -#endif diff --git a/nuttx/lib/math/lib_fmodf.c b/nuttx/lib/math/lib_fmodf.c deleted file mode 100644 index 085786f17..000000000 --- a/nuttx/lib/math/lib_fmodf.c +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************ - * lib/math/lib_fmodf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float fmodf(float x, float div) -{ - float n0; - - x /= div; - x = modff(x, &n0); - x *= div; - - return x; -} diff --git a/nuttx/lib/math/lib_fmodl.c b/nuttx/lib/math/lib_fmodl.c deleted file mode 100644 index 51c5e95ec..000000000 --- a/nuttx/lib/math/lib_fmodl.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************ - * lib/math/lib_fmodl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double fmodl(long double x, long double div) -{ - long double n0; - - x /= div; - x = modfl(x, &n0); - x *= div; - - return x; -} -#endif diff --git a/nuttx/lib/math/lib_frexp.c b/nuttx/lib/math/lib_frexp.c deleted file mode 100644 index 56feee863..000000000 --- a/nuttx/lib/math/lib_frexp.c +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************ - * lib/math/lib_frexp.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double frexp(double x, int *exponent) -{ - *exponent = (int)ceil(log2(x)); - return x / ldexp(1.0, *exponent); -} -#endif diff --git a/nuttx/lib/math/lib_frexpf.c b/nuttx/lib/math/lib_frexpf.c deleted file mode 100644 index 1fb0df3d8..000000000 --- a/nuttx/lib/math/lib_frexpf.c +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************ - * lib/math/lib_frexpf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float frexpf(float x, int *exponent) -{ - *exponent = (int)ceilf(log2f(x)); - return x / ldexpf(1.0, *exponent); -} diff --git a/nuttx/lib/math/lib_frexpl.c b/nuttx/lib/math/lib_frexpl.c deleted file mode 100644 index 87708ad86..000000000 --- a/nuttx/lib/math/lib_frexpl.c +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************ - * lib/math/lib_frexpl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double frexpl(long double x, int *exponent) -{ - *exponent = (int)ceill(log2(x)); - return x / ldexpl(1.0, *exponent); -} -#endif diff --git a/nuttx/lib/math/lib_ldexp.c b/nuttx/lib/math/lib_ldexp.c deleted file mode 100644 index 4c7b2b721..000000000 --- a/nuttx/lib/math/lib_ldexp.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_ldexp.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double ldexp(double x, int n) -{ - return (x * pow(2.0, (double)n)); -} -#endif diff --git a/nuttx/lib/math/lib_ldexpf.c b/nuttx/lib/math/lib_ldexpf.c deleted file mode 100644 index c61d633d5..000000000 --- a/nuttx/lib/math/lib_ldexpf.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************ - * lib/math/lib_ldexpf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float ldexpf(float x, int n) -{ - return (x * powf(2.0, (float)n)); -} diff --git a/nuttx/lib/math/lib_ldexpl.c b/nuttx/lib/math/lib_ldexpl.c deleted file mode 100644 index b9a0f4a86..000000000 --- a/nuttx/lib/math/lib_ldexpl.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_ldexpl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double ldexpl(long double x, int n) -{ - return (x * powl(2.0, (long double)n)); -} -#endif diff --git a/nuttx/lib/math/lib_libexpi.c b/nuttx/lib/math/lib_libexpi.c deleted file mode 100644 index 1ec947a71..000000000 --- a/nuttx/lib/math/lib_libexpi.c +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************ - * lib/math/lib_libexpi.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -/************************************************************************ - * Pre-processor Definitions - ************************************************************************/ - -#define M_E2 (M_E * M_E) -#define M_E4 (M_E2 * M_E2) -#define M_E8 (M_E4 * M_E4) -#define M_E16 (M_E8 * M_E8) -#define M_E32 (M_E16 * M_E16) -#define M_E64 (M_E32 * M_E32) -#define M_E128 (M_E64 * M_E64) -#define M_E256 (M_E128 * M_E128) -#define M_E512 (M_E256 * M_E256) -#define M_E1024 (M_E512 * M_E512) - -/************************************************************************ - * Private Data - ************************************************************************/ - -static double _expi_square_tbl[11] = -{ - M_E, // e^1 - M_E2, // e^2 - M_E4, // e^4 - M_E8, // e^8 - M_E16, // e^16 - M_E32, // e^32 - M_E64, // e^64 - M_E128, // e^128 - M_E256, // e^256 - M_E512, // e^512 - M_E1024, // e^1024 -}; - -/************************************************************************ - * Public Functions - ************************************************************************/ - -double lib_expi(size_t n) -{ - size_t i; - double val; - - if (n > 1024) - { - return INFINITY; - } - - val = 1.0; - - for (i = 0; n; i++) - { - if (n & (1 << i)) - { - n &= ~(1 << i); - val *= _expi_square_tbl[i]; - } - } - - return val; -} - diff --git a/nuttx/lib/math/lib_libsqrtapprox.c b/nuttx/lib/math/lib_libsqrtapprox.c deleted file mode 100644 index 5c556c3a0..000000000 --- a/nuttx/lib/math/lib_libsqrtapprox.c +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************ - * lib/math/lib_libsqrtapprox.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float lib_sqrtapprox(float x) -{ - int32_t i; - - /* Floats + bit manipulation = +inf fun! */ - - i = *((int32_t *) & x); - i = 0x1fc00000 + (i >> 1); - x = *((float *)&i); - - return x; -} diff --git a/nuttx/lib/math/lib_log.c b/nuttx/lib/math/lib_log.c deleted file mode 100644 index 1350ba4fe..000000000 --- a/nuttx/lib/math/lib_log.c +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************ - * lib/math/lib_log.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double log(double x) -{ - double y, y_old, ey, epsilon; - - y = 0.0; - y_old = 1.0; - epsilon = DBL_EPSILON; - - while (y > y_old + epsilon || y < y_old - epsilon) - { - y_old = y; - ey = exp(y); - y -= (ey - x) / ey; - - if (y > 700.0) - { - y = 700.0; - } - - if (y < -700.0) - { - y = -700.0; - } - - epsilon = (fabs(y) > 1.0) ? fabs(y) * DBL_EPSILON : DBL_EPSILON; - } - - if (y == 700.0) - { - return INFINITY; - } - - if (y == -700.0) - { - return INFINITY; - } - - return y; -} -#endif diff --git a/nuttx/lib/math/lib_log10.c b/nuttx/lib/math/lib_log10.c deleted file mode 100644 index 47854fca4..000000000 --- a/nuttx/lib/math/lib_log10.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_log10.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double log10(double x) -{ - return (log(x) / M_LN10); -} -#endif diff --git a/nuttx/lib/math/lib_log10f.c b/nuttx/lib/math/lib_log10f.c deleted file mode 100644 index 651071920..000000000 --- a/nuttx/lib/math/lib_log10f.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************ - * lib/math/lib_log10f.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float log10f(float x) -{ - return (logf(x) / M_LN10); -} diff --git a/nuttx/lib/math/lib_log10l.c b/nuttx/lib/math/lib_log10l.c deleted file mode 100644 index 65892262a..000000000 --- a/nuttx/lib/math/lib_log10l.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_log10l.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double log10l(long double x) -{ - return (logl(x) / M_LN10); -} -#endif diff --git a/nuttx/lib/math/lib_log2.c b/nuttx/lib/math/lib_log2.c deleted file mode 100644 index 0aa1e8010..000000000 --- a/nuttx/lib/math/lib_log2.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_log2.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double log2(double x) -{ - return (log(x) / M_LN2); -} -#endif diff --git a/nuttx/lib/math/lib_log2f.c b/nuttx/lib/math/lib_log2f.c deleted file mode 100644 index e160ca59e..000000000 --- a/nuttx/lib/math/lib_log2f.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************ - * lib/math/lib_log2f.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float log2f(float x) -{ - return (logf(x) / M_LN2); -} diff --git a/nuttx/lib/math/lib_log2l.c b/nuttx/lib/math/lib_log2l.c deleted file mode 100644 index 21d26d4d7..000000000 --- a/nuttx/lib/math/lib_log2l.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_log2l.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double log2l(long double x) -{ - return (logl(x) / M_LN2); -} -#endif diff --git a/nuttx/lib/math/lib_logf.c b/nuttx/lib/math/lib_logf.c deleted file mode 100644 index 1d31aa0c0..000000000 --- a/nuttx/lib/math/lib_logf.c +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************ - * lib/math/lib_logf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float logf(float x) -{ - float y, y_old, ey, epsilon; - - y = 0.0; - y_old = 1.0; - epsilon = FLT_EPSILON; - - while (y > y_old + epsilon || y < y_old - epsilon) - { - y_old = y; - ey = exp(y); - y -= (ey - x) / ey; - - if (y > 700.0) - { - y = 700.0; - } - - if (y < -700.0) - { - y = -700.0; - } - - epsilon = (fabs(y) > 1.0) ? fabs(y) * FLT_EPSILON : FLT_EPSILON; - } - - if (y == 700.0) - { - return INFINITY; - } - - if (y == -700.0) - { - return INFINITY; - } - - return y; -} diff --git a/nuttx/lib/math/lib_logl.c b/nuttx/lib/math/lib_logl.c deleted file mode 100644 index 577f9cee2..000000000 --- a/nuttx/lib/math/lib_logl.c +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************ - * lib/math/lib_lol.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double logl(long double x) -{ - long double y, y_old, ey, epsilon; - - y = 0.0; - y_old = 1.0; - epsilon = LDBL_EPSILON; - - while (y > y_old + epsilon || y < y_old - epsilon) - { - y_old = y; - ey = expl(y); - y -= (ey - x) / ey; - - if (y > 700.0) - { - y = 700.0; - } - - if (y < -700.0) - { - y = -700.0; - } - } - - if (y == 700.0) - { - return INFINITY; - } - - if (y == -700.0) - { - return INFINITY; - } - - return y; -} -#endif diff --git a/nuttx/lib/math/lib_modf.c b/nuttx/lib/math/lib_modf.c deleted file mode 100644 index 9dc6284c2..000000000 --- a/nuttx/lib/math/lib_modf.c +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************ - * lib/math/lib_modf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double modf(double x, double *iptr) -{ - if (fabs(x) >= 4503599627370496.0) - { - *iptr = x; - return 0.0; - } - else if (fabs(x) < 1.0) - { - *iptr = 0.0; - return x; - } - else - { - *iptr = (double)(int64_t) x; - return (x - *iptr); - } -} -#endif diff --git a/nuttx/lib/math/lib_modff.c b/nuttx/lib/math/lib_modff.c deleted file mode 100644 index 4eec2ae17..000000000 --- a/nuttx/lib/math/lib_modff.c +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************ - * lib/math/lib_modff.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float modff(float x, float *iptr) -{ - if (fabsf(x) >= 8388608.0) - { - *iptr = x; - return 0.0; - } - else if (fabs(x) < 1.0) - { - *iptr = 0.0; - return x; - } - else - { - *iptr = (float)(int)x; - return (x - *iptr); - } -} diff --git a/nuttx/lib/math/lib_modfl.c b/nuttx/lib/math/lib_modfl.c deleted file mode 100644 index 3b04571f3..000000000 --- a/nuttx/lib/math/lib_modfl.c +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************ - * lib/math/lib_modfl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009-2011 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_LONG_DOUBLE -long double modfl(long double x, long double *iptr) -{ - if (fabs(x) >= 4503599627370496.0) - { - *iptr = x; - return 0.0; - } - else if (fabs(x) < 1.0) - { - *iptr = 0.0; - return x; - } - else - { - *iptr = (long double)(int64_t) x; - return (x - *iptr); - } -} -#endif diff --git a/nuttx/lib/math/lib_pow.c b/nuttx/lib/math/lib_pow.c deleted file mode 100644 index af0a55d32..000000000 --- a/nuttx/lib/math/lib_pow.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_pow.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -#ifdef CONFIG_HAVE_DOUBLE -double pow(double b, double e) -{ - return exp(e * log(b)); -} -#endif diff --git a/nuttx/lib/math/lib_powf.c b/nuttx/lib/math/lib_powf.c deleted file mode 100644 index a43f9cf82..000000000 --- a/nuttx/lib/math/lib_powf.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************ - * lib/math/lib_powf.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include - -/************************************************************************ - * Public Functions - ************************************************************************/ - -float powf(float b, float e) -{ - return expf(e * logf(b)); -} diff --git a/nuttx/lib/math/lib_powl.c b/nuttx/lib/math/lib_powl.c deleted file mode 100644 index f5fbf042e..000000000 --- a/nuttx/lib/math/lib_powl.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - * lib/math/lib_powl.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * It derives from the Rhombs OS math library by Nick Johnson which has - * a compatibile, MIT-style license: - * - * Copyright (C) 2009, 2010 Nick Johnson - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - ************************************************************************/ - -/************************************************************************ - * Included Files - ************************************************************************/ - -#include -#include - -#include