From 6d8270ffc52370931aa7a0ac985078ea10718457 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 10 Nov 2012 16:19:12 +0000 Subject: Still trying to recover directory contents git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5330 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/libc/math/Kconfig | 26 ++++++++ nuttx/libc/math/Make.defs | 62 ++++++++++++++++++ nuttx/libc/math/lib_acos.c | 46 +++++++++++++ nuttx/libc/math/lib_acosf.c | 41 ++++++++++++ nuttx/libc/math/lib_acosl.c | 46 +++++++++++++ nuttx/libc/math/lib_asin.c | 69 ++++++++++++++++++++ nuttx/libc/math/lib_asinf.c | 65 +++++++++++++++++++ nuttx/libc/math/lib_asinl.c | 69 ++++++++++++++++++++ nuttx/libc/math/lib_atan.c | 48 ++++++++++++++ nuttx/libc/math/lib_atan2.c | 86 ++++++++++++++++++++++++ nuttx/libc/math/lib_atan2f.c | 81 +++++++++++++++++++++++ nuttx/libc/math/lib_atan2l.c | 87 +++++++++++++++++++++++++ nuttx/libc/math/lib_atanf.c | 43 ++++++++++++ nuttx/libc/math/lib_atanl.c | 48 ++++++++++++++ nuttx/libc/math/lib_ceil.c | 52 +++++++++++++++ nuttx/libc/math/lib_ceilf.c | 47 ++++++++++++++ nuttx/libc/math/lib_ceill.c | 52 +++++++++++++++ nuttx/libc/math/lib_cos.c | 46 +++++++++++++ nuttx/libc/math/lib_cosf.c | 41 ++++++++++++ nuttx/libc/math/lib_cosh.c | 47 ++++++++++++++ nuttx/libc/math/lib_coshf.c | 42 ++++++++++++ nuttx/libc/math/lib_coshl.c | 47 ++++++++++++++ nuttx/libc/math/lib_cosl.c | 46 +++++++++++++ nuttx/libc/math/lib_exp.c | 126 ++++++++++++++++++++++++++++++++++++ nuttx/libc/math/lib_expf.c | 112 ++++++++++++++++++++++++++++++++ nuttx/libc/math/lib_expl.c | 126 ++++++++++++++++++++++++++++++++++++ nuttx/libc/math/lib_fabs.c | 46 +++++++++++++ nuttx/libc/math/lib_fabsf.c | 41 ++++++++++++ nuttx/libc/math/lib_fabsl.c | 46 +++++++++++++ nuttx/libc/math/lib_floor.c | 52 +++++++++++++++ nuttx/libc/math/lib_floorf.c | 47 ++++++++++++++ nuttx/libc/math/lib_floorl.c | 52 +++++++++++++++ nuttx/libc/math/lib_fmod.c | 52 +++++++++++++++ nuttx/libc/math/lib_fmodf.c | 47 ++++++++++++++ nuttx/libc/math/lib_fmodl.c | 52 +++++++++++++++ nuttx/libc/math/lib_frexp.c | 47 ++++++++++++++ nuttx/libc/math/lib_frexpf.c | 42 ++++++++++++ nuttx/libc/math/lib_frexpl.c | 47 ++++++++++++++ nuttx/libc/math/lib_ldexp.c | 46 +++++++++++++ nuttx/libc/math/lib_ldexpf.c | 41 ++++++++++++ nuttx/libc/math/lib_ldexpl.c | 46 +++++++++++++ nuttx/libc/math/lib_libexpi.c | 103 +++++++++++++++++++++++++++++ nuttx/libc/math/lib_libsqrtapprox.c | 50 ++++++++++++++ nuttx/libc/math/lib_log.c | 82 +++++++++++++++++++++++ nuttx/libc/math/lib_log10.c | 46 +++++++++++++ nuttx/libc/math/lib_log10f.c | 41 ++++++++++++ nuttx/libc/math/lib_log10l.c | 46 +++++++++++++ nuttx/libc/math/lib_log2.c | 46 +++++++++++++ nuttx/libc/math/lib_log2f.c | 41 ++++++++++++ nuttx/libc/math/lib_log2l.c | 46 +++++++++++++ nuttx/libc/math/lib_logf.c | 77 ++++++++++++++++++++++ nuttx/libc/math/lib_logl.c | 80 +++++++++++++++++++++++ nuttx/libc/math/lib_modf.c | 58 +++++++++++++++++ nuttx/libc/math/lib_modff.c | 55 ++++++++++++++++ nuttx/libc/math/lib_modfl.c | 61 +++++++++++++++++ nuttx/libc/math/lib_pow.c | 46 +++++++++++++ nuttx/libc/math/lib_powf.c | 41 ++++++++++++ nuttx/libc/math/lib_powl.c | 46 +++++++++++++ nuttx/libc/math/lib_sin.c | 114 ++++++++++++++++++++++++++++++++ nuttx/libc/math/lib_sinf.c | 104 +++++++++++++++++++++++++++++ nuttx/libc/math/lib_sinh.c | 47 ++++++++++++++ nuttx/libc/math/lib_sinhf.c | 42 ++++++++++++ nuttx/libc/math/lib_sinhl.c | 47 ++++++++++++++ nuttx/libc/math/lib_sinl.c | 114 ++++++++++++++++++++++++++++++++ nuttx/libc/math/lib_sqrt.c | 99 ++++++++++++++++++++++++++++ nuttx/libc/math/lib_sqrtf.c | 84 ++++++++++++++++++++++++ nuttx/libc/math/lib_sqrtl.c | 101 +++++++++++++++++++++++++++++ nuttx/libc/math/lib_tan.c | 46 +++++++++++++ nuttx/libc/math/lib_tanf.c | 41 ++++++++++++ nuttx/libc/math/lib_tanh.c | 49 ++++++++++++++ nuttx/libc/math/lib_tanhf.c | 44 +++++++++++++ nuttx/libc/math/lib_tanhl.c | 49 ++++++++++++++ nuttx/libc/math/lib_tanl.c | 46 +++++++++++++ 73 files changed, 4297 insertions(+) create mode 100644 nuttx/libc/math/Kconfig create mode 100644 nuttx/libc/math/Make.defs create mode 100644 nuttx/libc/math/lib_acos.c create mode 100644 nuttx/libc/math/lib_acosf.c create mode 100644 nuttx/libc/math/lib_acosl.c create mode 100644 nuttx/libc/math/lib_asin.c create mode 100644 nuttx/libc/math/lib_asinf.c create mode 100644 nuttx/libc/math/lib_asinl.c create mode 100644 nuttx/libc/math/lib_atan.c create mode 100644 nuttx/libc/math/lib_atan2.c create mode 100644 nuttx/libc/math/lib_atan2f.c create mode 100644 nuttx/libc/math/lib_atan2l.c create mode 100644 nuttx/libc/math/lib_atanf.c create mode 100644 nuttx/libc/math/lib_atanl.c create mode 100644 nuttx/libc/math/lib_ceil.c create mode 100644 nuttx/libc/math/lib_ceilf.c create mode 100644 nuttx/libc/math/lib_ceill.c create mode 100644 nuttx/libc/math/lib_cos.c create mode 100644 nuttx/libc/math/lib_cosf.c create mode 100644 nuttx/libc/math/lib_cosh.c create mode 100644 nuttx/libc/math/lib_coshf.c create mode 100644 nuttx/libc/math/lib_coshl.c create mode 100644 nuttx/libc/math/lib_cosl.c create mode 100644 nuttx/libc/math/lib_exp.c create mode 100644 nuttx/libc/math/lib_expf.c create mode 100644 nuttx/libc/math/lib_expl.c create mode 100644 nuttx/libc/math/lib_fabs.c create mode 100644 nuttx/libc/math/lib_fabsf.c create mode 100644 nuttx/libc/math/lib_fabsl.c create mode 100644 nuttx/libc/math/lib_floor.c create mode 100644 nuttx/libc/math/lib_floorf.c create mode 100644 nuttx/libc/math/lib_floorl.c create mode 100644 nuttx/libc/math/lib_fmod.c create mode 100644 nuttx/libc/math/lib_fmodf.c create mode 100644 nuttx/libc/math/lib_fmodl.c create mode 100644 nuttx/libc/math/lib_frexp.c create mode 100644 nuttx/libc/math/lib_frexpf.c create mode 100644 nuttx/libc/math/lib_frexpl.c create mode 100644 nuttx/libc/math/lib_ldexp.c create mode 100644 nuttx/libc/math/lib_ldexpf.c create mode 100644 nuttx/libc/math/lib_ldexpl.c create mode 100644 nuttx/libc/math/lib_libexpi.c create mode 100644 nuttx/libc/math/lib_libsqrtapprox.c create mode 100644 nuttx/libc/math/lib_log.c create mode 100644 nuttx/libc/math/lib_log10.c create mode 100644 nuttx/libc/math/lib_log10f.c create mode 100644 nuttx/libc/math/lib_log10l.c create mode 100644 nuttx/libc/math/lib_log2.c create mode 100644 nuttx/libc/math/lib_log2f.c create mode 100644 nuttx/libc/math/lib_log2l.c create mode 100644 nuttx/libc/math/lib_logf.c create mode 100644 nuttx/libc/math/lib_logl.c create mode 100644 nuttx/libc/math/lib_modf.c create mode 100644 nuttx/libc/math/lib_modff.c create mode 100644 nuttx/libc/math/lib_modfl.c create mode 100644 nuttx/libc/math/lib_pow.c create mode 100644 nuttx/libc/math/lib_powf.c create mode 100644 nuttx/libc/math/lib_powl.c create mode 100644 nuttx/libc/math/lib_sin.c create mode 100644 nuttx/libc/math/lib_sinf.c create mode 100644 nuttx/libc/math/lib_sinh.c create mode 100644 nuttx/libc/math/lib_sinhf.c create mode 100644 nuttx/libc/math/lib_sinhl.c create mode 100644 nuttx/libc/math/lib_sinl.c create mode 100644 nuttx/libc/math/lib_sqrt.c create mode 100644 nuttx/libc/math/lib_sqrtf.c create mode 100644 nuttx/libc/math/lib_sqrtl.c create mode 100644 nuttx/libc/math/lib_tan.c create mode 100644 nuttx/libc/math/lib_tanf.c create mode 100644 nuttx/libc/math/lib_tanh.c create mode 100644 nuttx/libc/math/lib_tanhf.c create mode 100644 nuttx/libc/math/lib_tanhl.c create mode 100644 nuttx/libc/math/lib_tanl.c (limited to 'nuttx/libc/math') diff --git a/nuttx/libc/math/Kconfig b/nuttx/libc/math/Kconfig new file mode 100644 index 000000000..c24bfd53f --- /dev/null +++ b/nuttx/libc/math/Kconfig @@ -0,0 +1,26 @@ +# +# 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/libc/math/Make.defs b/nuttx/libc/math/Make.defs new file mode 100644 index 000000000..73d0be6f3 --- /dev/null +++ b/nuttx/libc/math/Make.defs @@ -0,0 +1,62 @@ +############################################################################ +# 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/libc/math/lib_acos.c b/nuttx/libc/math/lib_acos.c new file mode 100644 index 000000000..d5ec36b9f --- /dev/null +++ b/nuttx/libc/math/lib_acos.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_acosf.c b/nuttx/libc/math/lib_acosf.c new file mode 100644 index 000000000..e14a73a6e --- /dev/null +++ b/nuttx/libc/math/lib_acosf.c @@ -0,0 +1,41 @@ +/************************************************************************ + * 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/libc/math/lib_acosl.c b/nuttx/libc/math/lib_acosl.c new file mode 100644 index 000000000..911330577 --- /dev/null +++ b/nuttx/libc/math/lib_acosl.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_asin.c b/nuttx/libc/math/lib_asin.c new file mode 100644 index 000000000..61b953531 --- /dev/null +++ b/nuttx/libc/math/lib_asin.c @@ -0,0 +1,69 @@ +/************************************************************************ + * 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/libc/math/lib_asinf.c b/nuttx/libc/math/lib_asinf.c new file mode 100644 index 000000000..17669a934 --- /dev/null +++ b/nuttx/libc/math/lib_asinf.c @@ -0,0 +1,65 @@ +/************************************************************************ + * 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/libc/math/lib_asinl.c b/nuttx/libc/math/lib_asinl.c new file mode 100644 index 000000000..dbb2bc3a2 --- /dev/null +++ b/nuttx/libc/math/lib_asinl.c @@ -0,0 +1,69 @@ +/************************************************************************ + * 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/libc/math/lib_atan.c b/nuttx/libc/math/lib_atan.c new file mode 100644 index 000000000..b4db8fb31 --- /dev/null +++ b/nuttx/libc/math/lib_atan.c @@ -0,0 +1,48 @@ +/************************************************************************ + * 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/libc/math/lib_atan2.c b/nuttx/libc/math/lib_atan2.c new file mode 100644 index 000000000..82d1f47ec --- /dev/null +++ b/nuttx/libc/math/lib_atan2.c @@ -0,0 +1,86 @@ +/************************************************************************ + * 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/libc/math/lib_atan2f.c b/nuttx/libc/math/lib_atan2f.c new file mode 100644 index 000000000..a60d32c65 --- /dev/null +++ b/nuttx/libc/math/lib_atan2f.c @@ -0,0 +1,81 @@ +/************************************************************************ + * 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/libc/math/lib_atan2l.c b/nuttx/libc/math/lib_atan2l.c new file mode 100644 index 000000000..07fcd9669 --- /dev/null +++ b/nuttx/libc/math/lib_atan2l.c @@ -0,0 +1,87 @@ +/************************************************************************ + * 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/libc/math/lib_atanf.c b/nuttx/libc/math/lib_atanf.c new file mode 100644 index 000000000..7c540dd16 --- /dev/null +++ b/nuttx/libc/math/lib_atanf.c @@ -0,0 +1,43 @@ +/************************************************************************ + * 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/libc/math/lib_atanl.c b/nuttx/libc/math/lib_atanl.c new file mode 100644 index 000000000..0fa203098 --- /dev/null +++ b/nuttx/libc/math/lib_atanl.c @@ -0,0 +1,48 @@ +/************************************************************************ + * 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/libc/math/lib_ceil.c b/nuttx/libc/math/lib_ceil.c new file mode 100644 index 000000000..0e7602996 --- /dev/null +++ b/nuttx/libc/math/lib_ceil.c @@ -0,0 +1,52 @@ +/************************************************************************ + * 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/libc/math/lib_ceilf.c b/nuttx/libc/math/lib_ceilf.c new file mode 100644 index 000000000..0721ffc22 --- /dev/null +++ b/nuttx/libc/math/lib_ceilf.c @@ -0,0 +1,47 @@ +/************************************************************************ + * 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/libc/math/lib_ceill.c b/nuttx/libc/math/lib_ceill.c new file mode 100644 index 000000000..a24b56f68 --- /dev/null +++ b/nuttx/libc/math/lib_ceill.c @@ -0,0 +1,52 @@ +/************************************************************************ + * 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/libc/math/lib_cos.c b/nuttx/libc/math/lib_cos.c new file mode 100644 index 000000000..aa672b855 --- /dev/null +++ b/nuttx/libc/math/lib_cos.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_cosf.c b/nuttx/libc/math/lib_cosf.c new file mode 100644 index 000000000..093a8a002 --- /dev/null +++ b/nuttx/libc/math/lib_cosf.c @@ -0,0 +1,41 @@ +/************************************************************************ + * 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/libc/math/lib_cosh.c b/nuttx/libc/math/lib_cosh.c new file mode 100644 index 000000000..1be44d293 --- /dev/null +++ b/nuttx/libc/math/lib_cosh.c @@ -0,0 +1,47 @@ +/************************************************************************ + * 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/libc/math/lib_coshf.c b/nuttx/libc/math/lib_coshf.c new file mode 100644 index 000000000..d5e5ea14d --- /dev/null +++ b/nuttx/libc/math/lib_coshf.c @@ -0,0 +1,42 @@ +/************************************************************************ + * 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/libc/math/lib_coshl.c b/nuttx/libc/math/lib_coshl.c new file mode 100644 index 000000000..4576b8876 --- /dev/null +++ b/nuttx/libc/math/lib_coshl.c @@ -0,0 +1,47 @@ +/************************************************************************ + * 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/libc/math/lib_cosl.c b/nuttx/libc/math/lib_cosl.c new file mode 100644 index 000000000..25dd86139 --- /dev/null +++ b/nuttx/libc/math/lib_cosl.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_exp.c b/nuttx/libc/math/lib_exp.c new file mode 100644 index 000000000..1e3120453 --- /dev/null +++ b/nuttx/libc/math/lib_exp.c @@ -0,0 +1,126 @@ +/************************************************************************ + * 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/libc/math/lib_expf.c b/nuttx/libc/math/lib_expf.c new file mode 100644 index 000000000..eac4641c6 --- /dev/null +++ b/nuttx/libc/math/lib_expf.c @@ -0,0 +1,112 @@ +/************************************************************************ + * 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/libc/math/lib_expl.c b/nuttx/libc/math/lib_expl.c new file mode 100644 index 000000000..053103c9b --- /dev/null +++ b/nuttx/libc/math/lib_expl.c @@ -0,0 +1,126 @@ +/************************************************************************ + * 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/libc/math/lib_fabs.c b/nuttx/libc/math/lib_fabs.c new file mode 100644 index 000000000..ff99ceb64 --- /dev/null +++ b/nuttx/libc/math/lib_fabs.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_fabsf.c b/nuttx/libc/math/lib_fabsf.c new file mode 100644 index 000000000..0ea186ca0 --- /dev/null +++ b/nuttx/libc/math/lib_fabsf.c @@ -0,0 +1,41 @@ +/************************************************************************ + * 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/libc/math/lib_fabsl.c b/nuttx/libc/math/lib_fabsl.c new file mode 100644 index 000000000..5313d897d --- /dev/null +++ b/nuttx/libc/math/lib_fabsl.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_floor.c b/nuttx/libc/math/lib_floor.c new file mode 100644 index 000000000..f0c4477a0 --- /dev/null +++ b/nuttx/libc/math/lib_floor.c @@ -0,0 +1,52 @@ +/************************************************************************ + * 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/libc/math/lib_floorf.c b/nuttx/libc/math/lib_floorf.c new file mode 100644 index 000000000..2becb5fac --- /dev/null +++ b/nuttx/libc/math/lib_floorf.c @@ -0,0 +1,47 @@ +/************************************************************************ + * 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/libc/math/lib_floorl.c b/nuttx/libc/math/lib_floorl.c new file mode 100644 index 000000000..e38ce80ed --- /dev/null +++ b/nuttx/libc/math/lib_floorl.c @@ -0,0 +1,52 @@ +/************************************************************************ + * 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/libc/math/lib_fmod.c b/nuttx/libc/math/lib_fmod.c new file mode 100644 index 000000000..939e7e18a --- /dev/null +++ b/nuttx/libc/math/lib_fmod.c @@ -0,0 +1,52 @@ +/************************************************************************ + * 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/libc/math/lib_fmodf.c b/nuttx/libc/math/lib_fmodf.c new file mode 100644 index 000000000..085786f17 --- /dev/null +++ b/nuttx/libc/math/lib_fmodf.c @@ -0,0 +1,47 @@ +/************************************************************************ + * 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/libc/math/lib_fmodl.c b/nuttx/libc/math/lib_fmodl.c new file mode 100644 index 000000000..51c5e95ec --- /dev/null +++ b/nuttx/libc/math/lib_fmodl.c @@ -0,0 +1,52 @@ +/************************************************************************ + * 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/libc/math/lib_frexp.c b/nuttx/libc/math/lib_frexp.c new file mode 100644 index 000000000..56feee863 --- /dev/null +++ b/nuttx/libc/math/lib_frexp.c @@ -0,0 +1,47 @@ +/************************************************************************ + * 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/libc/math/lib_frexpf.c b/nuttx/libc/math/lib_frexpf.c new file mode 100644 index 000000000..1fb0df3d8 --- /dev/null +++ b/nuttx/libc/math/lib_frexpf.c @@ -0,0 +1,42 @@ +/************************************************************************ + * 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/libc/math/lib_frexpl.c b/nuttx/libc/math/lib_frexpl.c new file mode 100644 index 000000000..87708ad86 --- /dev/null +++ b/nuttx/libc/math/lib_frexpl.c @@ -0,0 +1,47 @@ +/************************************************************************ + * 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/libc/math/lib_ldexp.c b/nuttx/libc/math/lib_ldexp.c new file mode 100644 index 000000000..4c7b2b721 --- /dev/null +++ b/nuttx/libc/math/lib_ldexp.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_ldexpf.c b/nuttx/libc/math/lib_ldexpf.c new file mode 100644 index 000000000..c61d633d5 --- /dev/null +++ b/nuttx/libc/math/lib_ldexpf.c @@ -0,0 +1,41 @@ +/************************************************************************ + * 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/libc/math/lib_ldexpl.c b/nuttx/libc/math/lib_ldexpl.c new file mode 100644 index 000000000..b9a0f4a86 --- /dev/null +++ b/nuttx/libc/math/lib_ldexpl.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_libexpi.c b/nuttx/libc/math/lib_libexpi.c new file mode 100644 index 000000000..1ec947a71 --- /dev/null +++ b/nuttx/libc/math/lib_libexpi.c @@ -0,0 +1,103 @@ +/************************************************************************ + * 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/libc/math/lib_libsqrtapprox.c b/nuttx/libc/math/lib_libsqrtapprox.c new file mode 100644 index 000000000..5c556c3a0 --- /dev/null +++ b/nuttx/libc/math/lib_libsqrtapprox.c @@ -0,0 +1,50 @@ +/************************************************************************ + * 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/libc/math/lib_log.c b/nuttx/libc/math/lib_log.c new file mode 100644 index 000000000..1350ba4fe --- /dev/null +++ b/nuttx/libc/math/lib_log.c @@ -0,0 +1,82 @@ +/************************************************************************ + * 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/libc/math/lib_log10.c b/nuttx/libc/math/lib_log10.c new file mode 100644 index 000000000..47854fca4 --- /dev/null +++ b/nuttx/libc/math/lib_log10.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_log10f.c b/nuttx/libc/math/lib_log10f.c new file mode 100644 index 000000000..651071920 --- /dev/null +++ b/nuttx/libc/math/lib_log10f.c @@ -0,0 +1,41 @@ +/************************************************************************ + * 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/libc/math/lib_log10l.c b/nuttx/libc/math/lib_log10l.c new file mode 100644 index 000000000..65892262a --- /dev/null +++ b/nuttx/libc/math/lib_log10l.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_log2.c b/nuttx/libc/math/lib_log2.c new file mode 100644 index 000000000..0aa1e8010 --- /dev/null +++ b/nuttx/libc/math/lib_log2.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_log2f.c b/nuttx/libc/math/lib_log2f.c new file mode 100644 index 000000000..e160ca59e --- /dev/null +++ b/nuttx/libc/math/lib_log2f.c @@ -0,0 +1,41 @@ +/************************************************************************ + * 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/libc/math/lib_log2l.c b/nuttx/libc/math/lib_log2l.c new file mode 100644 index 000000000..21d26d4d7 --- /dev/null +++ b/nuttx/libc/math/lib_log2l.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_logf.c b/nuttx/libc/math/lib_logf.c new file mode 100644 index 000000000..1d31aa0c0 --- /dev/null +++ b/nuttx/libc/math/lib_logf.c @@ -0,0 +1,77 @@ +/************************************************************************ + * 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/libc/math/lib_logl.c b/nuttx/libc/math/lib_logl.c new file mode 100644 index 000000000..577f9cee2 --- /dev/null +++ b/nuttx/libc/math/lib_logl.c @@ -0,0 +1,80 @@ +/************************************************************************ + * 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/libc/math/lib_modf.c b/nuttx/libc/math/lib_modf.c new file mode 100644 index 000000000..9dc6284c2 --- /dev/null +++ b/nuttx/libc/math/lib_modf.c @@ -0,0 +1,58 @@ +/************************************************************************ + * 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/libc/math/lib_modff.c b/nuttx/libc/math/lib_modff.c new file mode 100644 index 000000000..4eec2ae17 --- /dev/null +++ b/nuttx/libc/math/lib_modff.c @@ -0,0 +1,55 @@ +/************************************************************************ + * 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/libc/math/lib_modfl.c b/nuttx/libc/math/lib_modfl.c new file mode 100644 index 000000000..3b04571f3 --- /dev/null +++ b/nuttx/libc/math/lib_modfl.c @@ -0,0 +1,61 @@ +/************************************************************************ + * 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/libc/math/lib_pow.c b/nuttx/libc/math/lib_pow.c new file mode 100644 index 000000000..af0a55d32 --- /dev/null +++ b/nuttx/libc/math/lib_pow.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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/libc/math/lib_powf.c b/nuttx/libc/math/lib_powf.c new file mode 100644 index 000000000..a43f9cf82 --- /dev/null +++ b/nuttx/libc/math/lib_powf.c @@ -0,0 +1,41 @@ +/************************************************************************ + * 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/libc/math/lib_powl.c b/nuttx/libc/math/lib_powl.c new file mode 100644 index 000000000..f5fbf042e --- /dev/null +++ b/nuttx/libc/math/lib_powl.c @@ -0,0 +1,46 @@ +/************************************************************************ + * 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 + +/************************************************************************ + * Public Functions + ************************************************************************/ + +#ifdef CONFIG_HAVE_LONG_DOUBLE +long double powl(long double b, long double e) +{ + return expl(e * logl(b)); +} +#endif diff --git a/nuttx/libc/math/lib_sin.c b/nuttx/libc/math/lib_sin.c new file mode 100644 index 000000000..c04d6b88b --- /dev/null +++ b/nuttx/libc/math/lib_sin.c @@ -0,0 +1,114 @@ +/************************************************************************ + * 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 + +#ifdef CONFIG_HAVE_DOUBLE + +/************************************************************************ + * Private Data + ************************************************************************/ + +static double _dbl_inv_fact[] = +{ + 1.0 / 1.0, // 1 / 1! + 1.0 / 6.0, // 1 / 3! + 1.0 / 120.0, // 1 / 5! + 1.0 / 5040.0, // 1 / 7! + 1.0 / 362880.0, // 1 / 9! + 1.0 / 39916800.0, // 1 / 11! + 1.0 / 6227020800.0, // 1 / 13! + 1.0 / 1307674368000.0, // 1 / 15! + 1.0 / 355687428096000.0, // 1 / 17! + 1.0 / 121645100408832000.0, // 1 / 19! +}; + +/************************************************************************ + * Public Functions + ************************************************************************/ + +double sin(double x) +{ + double x_squared; + double sin_x; + size_t i; + + /* Move x to [-pi, pi) */ + + x = fmod(x, 2 * M_PI); + if (x >= M_PI) + { + x -= 2 * M_PI; + } + + if (x < -M_PI) + { + x += 2 * M_PI; + } + + /* Move x to [-pi/2, pi/2) */ + + if (x >= M_PI_2) + { + x = M_PI - x; + } + + if (x < -M_PI_2) + { + x = -M_PI - x; + } + + x_squared = x * x; + sin_x = 0.0; + + /* Perform Taylor series approximation for sin(x) with ten terms */ + + for (i = 0; i < 10; i++) + { + if (i % 2 == 0) + { + sin_x += x * _dbl_inv_fact[i]; + } + else + { + sin_x -= x * _dbl_inv_fact[i]; + } + + x *= x_squared; + } + + return sin_x; +} +#endif diff --git a/nuttx/libc/math/lib_sinf.c b/nuttx/libc/math/lib_sinf.c new file mode 100644 index 000000000..e298bbba4 --- /dev/null +++ b/nuttx/libc/math/lib_sinf.c @@ -0,0 +1,104 @@ +/************************************************************************ + * 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 + +/************************************************************************ + * Private Data + ************************************************************************/ + +static float _flt_inv_fact[] = +{ + 1.0 / 1.0, // 1 / 1! + 1.0 / 6.0, // 1 / 3! + 1.0 / 120.0, // 1 / 5! + 1.0 / 5040.0, // 1 / 7! + 1.0 / 362880.0, // 1 / 9! + 1.0 / 39916800.0, // 1 / 11! +}; + +/************************************************************************ + * Public Functions + ************************************************************************/ + +float sinf(float x) +{ + float x_squared; + float sin_x; + size_t i; + + /* Move x to [-pi, pi) */ + + x = fmodf(x, 2 * M_PI); + if (x >= M_PI) + { + x -= 2 * M_PI; + } + + if (x < -M_PI) + { + x += 2 * M_PI; + } + + /* Move x to [-pi/2, pi/2) */ + + if (x >= M_PI_2) + { + x = M_PI - x; + } + + if (x < -M_PI_2) + { + x = -M_PI - x; + } + + x_squared = x * x; + sin_x = 0.0; + + /* Perform Taylor series approximation for sin(x) with six terms */ + + for (i = 0; i < 6; i++) + { + if (i % 2 == 0) + { + sin_x += x * _flt_inv_fact[i]; + } + else + { + sin_x -= x * _flt_inv_fact[i]; + } + + x *= x_squared; + } + + return sin_x; +} diff --git a/nuttx/libc/math/lib_sinh.c b/nuttx/libc/math/lib_sinh.c new file mode 100644 index 000000000..f33852433 --- /dev/null +++ b/nuttx/libc/math/lib_sinh.c @@ -0,0 +1,47 @@ +/************************************************************************ + * lib/math/lib_sinh.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 sinh(double x) +{ + x = exp(x); + return ((x - (1.0 / x)) / 2.0); +} +#endif diff --git a/nuttx/libc/math/lib_sinhf.c b/nuttx/libc/math/lib_sinhf.c new file mode 100644 index 000000000..e15cb14dc --- /dev/null +++ b/nuttx/libc/math/lib_sinhf.c @@ -0,0 +1,42 @@ +/************************************************************************ + * lib/math/lib_sinhf.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 sinhf(float x) +{ + x = expf(x); + return ((x - (1.0 / x)) / 2.0); +} diff --git a/nuttx/libc/math/lib_sinhl.c b/nuttx/libc/math/lib_sinhl.c new file mode 100644 index 000000000..b0fea2914 --- /dev/null +++ b/nuttx/libc/math/lib_sinhl.c @@ -0,0 +1,47 @@ +/************************************************************************ + * lib/math/lib_sinhl.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 sinhl(long double x) +{ + x = expl(x); + return ((x - (1.0 / x)) / 2.0); +} +#endif diff --git a/nuttx/libc/math/lib_sinl.c b/nuttx/libc/math/lib_sinl.c new file mode 100644 index 000000000..a69b548cb --- /dev/null +++ b/nuttx/libc/math/lib_sinl.c @@ -0,0 +1,114 @@ +/************************************************************************ + * 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 + +#ifdef CONFIG_HAVE_LONG_DOUBLE + +/************************************************************************ + * Private Data + ************************************************************************/ + +static long double _ldbl_inv_fact[] = +{ + 1.0 / 1.0, // 1 / 1! + 1.0 / 6.0, // 1 / 3! + 1.0 / 120.0, // 1 / 5! + 1.0 / 5040.0, // 1 / 7! + 1.0 / 362880.0, // 1 / 9! + 1.0 / 39916800.0, // 1 / 11! + 1.0 / 6227020800.0, // 1 / 13! + 1.0 / 1307674368000.0, // 1 / 15! + 1.0 / 355687428096000.0, // 1 / 17! + 1.0 / 121645100408832000.0, // 1 / 19! +}; + +/************************************************************************ + * Public Functions + ************************************************************************/ + +long double sinl(long double x) +{ + long double x_squared; + long double sin_x; + size_t i; + + /* Move x to [-pi, pi) */ + + x = fmodl(x, 2 * M_PI); + if (x >= M_PI) + { + x -= 2 * M_PI; + } + + if (x < -M_PI) + { + x += 2 * M_PI; + } + + /* Move x to [-pi/2, pi/2) */ + + if (x >= M_PI_2) + { + x = M_PI - x; + } + + if (x < -M_PI_2) + { + x = -M_PI - x; + } + + x_squared = x * x; + sin_x = 0.0; + + /* Perform Taylor series approximation for sin(x) with ten terms */ + + for (i = 0; i < 10; i++) + { + if (i % 2 == 0) + { + sin_x += x * _ldbl_inv_fact[i]; + } + else + { + sin_x -= x * _ldbl_inv_fact[i]; + } + + x *= x_squared; + } + + return sin_x; +} +#endif diff --git a/nuttx/libc/math/lib_sqrt.c b/nuttx/libc/math/lib_sqrt.c new file mode 100644 index 000000000..d77997f7c --- /dev/null +++ b/nuttx/libc/math/lib_sqrt.c @@ -0,0 +1,99 @@ +/************************************************************************ + * lib/math/lib_sqrt.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" + +/************************************************************************ + * Public Functions + ************************************************************************/ + +#ifdef CONFIG_HAVE_DOUBLE +double sqrt(double x) +{ + long double y, y1; + + if (x < 0.0) + { + errno = EDOM; + return NAN; + } + + if (isnan(x)) + { + return NAN; + } + + if (isinf(x)) + { + return INFINITY; + } + + if (x == 0.0) + { + return 0.0; + } + + /* Guess square root (using bit manipulation) */ + + y = lib_sqrtapprox(x); + + /* Perform four iterations of approximation. This number (4) is + * definitely optimal + */ + + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + + /* If guess was terribe (out of range of float). Repeat approximation + * until convergence. + */ + + if (y * y < x - 1.0 || y * y > x + 1.0) + { + y1 = -1.0; + while (y != y1) + { + y1 = y; + y = 0.5 * (y + x / y); + } + } + + return y; +} +#endif diff --git a/nuttx/libc/math/lib_sqrtf.c b/nuttx/libc/math/lib_sqrtf.c new file mode 100644 index 000000000..81817a040 --- /dev/null +++ b/nuttx/libc/math/lib_sqrtf.c @@ -0,0 +1,84 @@ +/************************************************************************ + * lib/math/lib_sqrtf.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" + +/************************************************************************ + * Public Functions + ************************************************************************/ + +float sqrtf(float x) +{ + float y; + + /* Filter out invalid/trivial inputs */ + + if (x < 0.0) + { + errno = EDOM; + return NAN; + } + + if (isnan(x)) + { + return NAN; + } + + if (isinf(x)) + { + return INFINITY; + } + + if (x == 0.0) + { + return 0.0; + } + + /* Guess square root (using bit manipulation) */ + + y = lib_sqrtapprox(x); + + /* Perform three iterations of approximation. This number (3) is + * definitely optimal + */ + + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + + return y; +} diff --git a/nuttx/libc/math/lib_sqrtl.c b/nuttx/libc/math/lib_sqrtl.c new file mode 100644 index 000000000..6674fe50f --- /dev/null +++ b/nuttx/libc/math/lib_sqrtl.c @@ -0,0 +1,101 @@ +/************************************************************************ + * lib/math/lib_sqrtl.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" + +/************************************************************************ + * Public Functions + ************************************************************************/ + +#ifdef CONFIG_HAVE_LONG_DOUBLE +long double sqrtl(long double x) +{ + long double y, y1; + + /* Filter out invalid/trivial inputs */ + + if (x < 0.0) + { + errno = EDOM; + return NAN; + } + + if (isnan(x)) + { + return NAN; + } + + if (isinf(x)) + { + return INFINITY; + } + + if (x == 0.0) + { + return 0.0; + } + + /* Guess square root (using bit manipulation) */ + + y = lib_sqrtapprox(x); + + /* Perform four iterations of approximation. This number (4) is + * definitely optimal + */ + + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + y = 0.5 * (y + x / y); + + /* If guess was terribe (out of range of float). Repeat approximation + * until convergence + */ + + if (y * y < x - 1.0 || y * y > x + 1.0) + { + y1 = -1.0; + while (y != y1) + { + y1 = y; + y = 0.5 * (y + x / y); + } + } + + return y; +} +#endif diff --git a/nuttx/libc/math/lib_tan.c b/nuttx/libc/math/lib_tan.c new file mode 100644 index 000000000..bce14b327 --- /dev/null +++ b/nuttx/libc/math/lib_tan.c @@ -0,0 +1,46 @@ +/************************************************************************ + * lib/math/lib_tan.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 tan(double x) +{ + return (sin(x) / cos(x)); +} +#endif diff --git a/nuttx/libc/math/lib_tanf.c b/nuttx/libc/math/lib_tanf.c new file mode 100644 index 000000000..3db3bda26 --- /dev/null +++ b/nuttx/libc/math/lib_tanf.c @@ -0,0 +1,41 @@ +/************************************************************************ + * lib/math/lib_tanf.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 tanf(float x) +{ + return (sinf(x) / cosf(x)); +} diff --git a/nuttx/libc/math/lib_tanh.c b/nuttx/libc/math/lib_tanh.c new file mode 100644 index 000000000..46fddd06d --- /dev/null +++ b/nuttx/libc/math/lib_tanh.c @@ -0,0 +1,49 @@ +/************************************************************************ + * lib/math/lib_tanh.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 tanh(double x) +{ + double x0 = exp(x); + double x1 = 1.0 / x0; + + return ((x0 + x1) / (x0 - x1)); +} +#endif diff --git a/nuttx/libc/math/lib_tanhf.c b/nuttx/libc/math/lib_tanhf.c new file mode 100644 index 000000000..94d15cc60 --- /dev/null +++ b/nuttx/libc/math/lib_tanhf.c @@ -0,0 +1,44 @@ +/************************************************************************ + * lib/math/lib_tanhf.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 tanhf(float x) +{ + float x0 = expf(x); + float x1 = 1.0 / x0; + + return ((x0 + x1) / (x0 - x1)); +} diff --git a/nuttx/libc/math/lib_tanhl.c b/nuttx/libc/math/lib_tanhl.c new file mode 100644 index 000000000..23c11d667 --- /dev/null +++ b/nuttx/libc/math/lib_tanhl.c @@ -0,0 +1,49 @@ +/************************************************************************ + * lib/math/lib_tanhl.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 tanhl(long double x) +{ + long double x0 = exp(x); + long double x1 = 1.0 / x0; + + return ((x0 + x1) / (x0 - x1)); +} +#endif diff --git a/nuttx/libc/math/lib_tanl.c b/nuttx/libc/math/lib_tanl.c new file mode 100644 index 000000000..4973aa073 --- /dev/null +++ b/nuttx/libc/math/lib_tanl.c @@ -0,0 +1,46 @@ +/************************************************************************ + * lib/math/lib_tanl.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 tanl(long double x) +{ + return (sinl(x) / cosl(x)); +} +#endif -- cgit v1.2.3 From 5b5b007db3961ef389227030f3490becca6b11c3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 10 Nov 2012 16:34:46 +0000 Subject: OK.. I think the directory has been recovered and renamed git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5331 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/libc/Kconfig | 2 +- nuttx/libc/Makefile | 8 +- nuttx/libc/README.txt | 2 +- nuttx/libc/dirent/Make.defs | 2 +- nuttx/libc/dirent/lib_readdirr.c | 2 +- nuttx/libc/dirent/lib_telldir.c | 2 +- nuttx/libc/fixedmath/Make.defs | 2 +- nuttx/libc/fixedmath/lib_b16atan2.c | 2 +- nuttx/libc/fixedmath/lib_b16cos.c | 2 +- nuttx/libc/fixedmath/lib_b16sin.c | 2 +- nuttx/libc/fixedmath/lib_fixedmath.c | 2 +- nuttx/libc/fixedmath/lib_rint.c | 2 +- nuttx/libc/lib_internal.h | 2 +- nuttx/libc/libgen/Make.defs | 2 +- nuttx/libc/libgen/lib_basename.c | 2 +- nuttx/libc/libgen/lib_dirname.c | 2 +- nuttx/libc/math/Make.defs | 2 +- nuttx/libc/math/lib_acos.c | 2 +- nuttx/libc/math/lib_acosf.c | 2 +- nuttx/libc/math/lib_acosl.c | 2 +- nuttx/libc/math/lib_asin.c | 2 +- nuttx/libc/math/lib_asinf.c | 2 +- nuttx/libc/math/lib_asinl.c | 2 +- nuttx/libc/math/lib_atan.c | 2 +- nuttx/libc/math/lib_atan2.c | 2 +- nuttx/libc/math/lib_atan2f.c | 2 +- nuttx/libc/math/lib_atan2l.c | 2 +- nuttx/libc/math/lib_atanf.c | 2 +- nuttx/libc/math/lib_atanl.c | 2 +- nuttx/libc/math/lib_ceil.c | 2 +- nuttx/libc/math/lib_ceilf.c | 2 +- nuttx/libc/math/lib_ceill.c | 2 +- nuttx/libc/math/lib_cos.c | 2 +- nuttx/libc/math/lib_cosf.c | 2 +- nuttx/libc/math/lib_cosh.c | 2 +- nuttx/libc/math/lib_coshf.c | 2 +- nuttx/libc/math/lib_coshl.c | 2 +- nuttx/libc/math/lib_cosl.c | 2 +- nuttx/libc/math/lib_exp.c | 2 +- nuttx/libc/math/lib_expf.c | 2 +- nuttx/libc/math/lib_expl.c | 2 +- nuttx/libc/math/lib_fabs.c | 2 +- nuttx/libc/math/lib_fabsf.c | 2 +- nuttx/libc/math/lib_fabsl.c | 2 +- nuttx/libc/math/lib_floor.c | 2 +- nuttx/libc/math/lib_floorf.c | 2 +- nuttx/libc/math/lib_floorl.c | 2 +- nuttx/libc/math/lib_fmod.c | 2 +- nuttx/libc/math/lib_fmodf.c | 2 +- nuttx/libc/math/lib_fmodl.c | 2 +- nuttx/libc/math/lib_frexp.c | 2 +- nuttx/libc/math/lib_frexpf.c | 2 +- nuttx/libc/math/lib_frexpl.c | 2 +- nuttx/libc/math/lib_ldexp.c | 2 +- nuttx/libc/math/lib_ldexpf.c | 2 +- nuttx/libc/math/lib_ldexpl.c | 2 +- nuttx/libc/math/lib_libexpi.c | 2 +- nuttx/libc/math/lib_libsqrtapprox.c | 2 +- nuttx/libc/math/lib_log.c | 2 +- nuttx/libc/math/lib_log10.c | 2 +- nuttx/libc/math/lib_log10f.c | 2 +- nuttx/libc/math/lib_log10l.c | 2 +- nuttx/libc/math/lib_log2.c | 2 +- nuttx/libc/math/lib_log2f.c | 2 +- nuttx/libc/math/lib_log2l.c | 2 +- nuttx/libc/math/lib_logf.c | 2 +- nuttx/libc/math/lib_logl.c | 2 +- nuttx/libc/math/lib_modf.c | 2 +- nuttx/libc/math/lib_modff.c | 2 +- nuttx/libc/math/lib_modfl.c | 2 +- nuttx/libc/math/lib_pow.c | 2 +- nuttx/libc/math/lib_powf.c | 2 +- nuttx/libc/math/lib_powl.c | 2 +- nuttx/libc/math/lib_sin.c | 2 +- nuttx/libc/math/lib_sinf.c | 2 +- nuttx/libc/math/lib_sinh.c | 2 +- nuttx/libc/math/lib_sinhf.c | 2 +- nuttx/libc/math/lib_sinhl.c | 2 +- nuttx/libc/math/lib_sinl.c | 2 +- nuttx/libc/math/lib_sqrt.c | 2 +- nuttx/libc/math/lib_sqrtf.c | 2 +- nuttx/libc/math/lib_sqrtl.c | 2 +- nuttx/libc/math/lib_tan.c | 2 +- nuttx/libc/math/lib_tanf.c | 2 +- nuttx/libc/math/lib_tanh.c | 2 +- nuttx/libc/math/lib_tanhf.c | 2 +- nuttx/libc/math/lib_tanhl.c | 2 +- nuttx/libc/math/lib_tanl.c | 2 +- nuttx/libc/misc/Make.defs | 2 +- nuttx/libc/misc/lib_crc32.c | 2 +- nuttx/libc/misc/lib_dbg.c | 2 +- nuttx/libc/misc/lib_dumpbuffer.c | 2 +- nuttx/libc/misc/lib_filesem.c | 2 +- nuttx/libc/misc/lib_init.c | 2 +- nuttx/libc/misc/lib_match.c | 2 +- nuttx/libc/misc/lib_sendfile.c | 2 +- nuttx/libc/misc/lib_streamsem.c | 2 +- nuttx/libc/mqueue/Make.defs | 2 +- nuttx/libc/mqueue/mq_getattr.c | 2 +- nuttx/libc/mqueue/mq_setattr.c | 2 +- nuttx/libc/net/Make.defs | 2 +- nuttx/libc/net/lib_etherntoa.c | 2 +- nuttx/libc/net/lib_htonl.c | 2 +- nuttx/libc/net/lib_htons.c | 2 +- nuttx/libc/net/lib_inetaddr.c | 2 +- nuttx/libc/net/lib_inetntoa.c | 2 +- nuttx/libc/net/lib_inetntop.c | 2 +- nuttx/libc/net/lib_inetpton.c | 2 +- nuttx/libc/pthread/Make.defs | 2 +- nuttx/libc/pthread/pthread_attrdestroy.c | 2 +- nuttx/libc/pthread/pthread_attrgetinheritsched.c | 2 +- nuttx/libc/pthread/pthread_attrgetschedparam.c | 2 +- nuttx/libc/pthread/pthread_attrgetschedpolicy.c | 2 +- nuttx/libc/pthread/pthread_attrgetstacksize.c | 2 +- nuttx/libc/pthread/pthread_attrinit.c | 2 +- nuttx/libc/pthread/pthread_attrsetinheritsched.c | 2 +- nuttx/libc/pthread/pthread_attrsetschedparam.c | 2 +- nuttx/libc/pthread/pthread_attrsetschedpolicy.c | 2 +- nuttx/libc/pthread/pthread_attrsetstacksize.c | 2 +- nuttx/libc/pthread/pthread_barrierattrdestroy.c | 2 +- nuttx/libc/pthread/pthread_barrierattrgetpshared.c | 2 +- nuttx/libc/pthread/pthread_barrierattrinit.c | 2 +- nuttx/libc/pthread/pthread_barrierattrsetpshared.c | 2 +- nuttx/libc/pthread/pthread_condattrdestroy.c | 2 +- nuttx/libc/pthread/pthread_condattrinit.c | 2 +- nuttx/libc/pthread/pthread_mutexattrdestroy.c | 2 +- nuttx/libc/pthread/pthread_mutexattrgetpshared.c | 2 +- nuttx/libc/pthread/pthread_mutexattrgettype.c | 2 +- nuttx/libc/pthread/pthread_mutexattrinit.c | 2 +- nuttx/libc/pthread/pthread_mutexattrsetpshared.c | 2 +- nuttx/libc/pthread/pthread_mutexattrsettype.c | 2 +- nuttx/libc/queue/Make.defs | 2 +- nuttx/libc/queue/dq_addafter.c | 2 +- nuttx/libc/queue/dq_addbefore.c | 2 +- nuttx/libc/queue/dq_addfirst.c | 2 +- nuttx/libc/queue/dq_addlast.c | 2 +- nuttx/libc/queue/dq_rem.c | 2 +- nuttx/libc/queue/dq_remfirst.c | 2 +- nuttx/libc/queue/dq_remlast.c | 2 +- nuttx/libc/queue/sq_addafter.c | 2 +- nuttx/libc/queue/sq_addfirst.c | 2 +- nuttx/libc/queue/sq_addlast.c | 2 +- nuttx/libc/queue/sq_rem.c | 2 +- nuttx/libc/queue/sq_remafter.c | 2 +- nuttx/libc/queue/sq_remfirst.c | 2 +- nuttx/libc/queue/sq_remlast.c | 2 +- nuttx/libc/sched/Make.defs | 2 +- nuttx/libc/sched/sched_getprioritymax.c | 2 +- nuttx/libc/sched/sched_getprioritymin.c | 2 +- nuttx/libc/semaphore/Make.defs | 2 +- nuttx/libc/semaphore/sem_getvalue.c | 2 +- nuttx/libc/semaphore/sem_init.c | 2 +- nuttx/libc/signal/Make.defs | 2 +- nuttx/libc/signal/sig_addset.c | 2 +- nuttx/libc/signal/sig_delset.c | 2 +- nuttx/libc/signal/sig_emptyset.c | 2 +- nuttx/libc/signal/sig_fillset.c | 2 +- nuttx/libc/signal/sig_ismember.c | 2 +- nuttx/libc/stdio/Make.defs | 2 +- nuttx/libc/stdio/lib_asprintf.c | 2 +- nuttx/libc/stdio/lib_avsprintf.c | 2 +- nuttx/libc/stdio/lib_clearerr.c | 2 +- nuttx/libc/stdio/lib_dtoa.c | 2 +- nuttx/libc/stdio/lib_fclose.c | 2 +- nuttx/libc/stdio/lib_feof.c | 2 +- nuttx/libc/stdio/lib_ferror.c | 2 +- nuttx/libc/stdio/lib_fflush.c | 2 +- nuttx/libc/stdio/lib_fgetc.c | 2 +- nuttx/libc/stdio/lib_fgetpos.c | 2 +- nuttx/libc/stdio/lib_fgets.c | 2 +- nuttx/libc/stdio/lib_fileno.c | 2 +- nuttx/libc/stdio/lib_fopen.c | 2 +- nuttx/libc/stdio/lib_fprintf.c | 2 +- nuttx/libc/stdio/lib_fputc.c | 2 +- nuttx/libc/stdio/lib_fputs.c | 2 +- nuttx/libc/stdio/lib_fread.c | 2 +- nuttx/libc/stdio/lib_fseek.c | 2 +- nuttx/libc/stdio/lib_fsetpos.c | 2 +- nuttx/libc/stdio/lib_ftell.c | 2 +- nuttx/libc/stdio/lib_fwrite.c | 2 +- nuttx/libc/stdio/lib_gets.c | 2 +- nuttx/libc/stdio/lib_libdtoa.c | 2 +- nuttx/libc/stdio/lib_libfflush.c | 2 +- nuttx/libc/stdio/lib_libflushall.c | 2 +- nuttx/libc/stdio/lib_libfread.c | 2 +- nuttx/libc/stdio/lib_libfwrite.c | 2 +- nuttx/libc/stdio/lib_libnoflush.c | 2 +- nuttx/libc/stdio/lib_libsprintf.c | 2 +- nuttx/libc/stdio/lib_libvsprintf.c | 4 +- nuttx/libc/stdio/lib_lowinstream.c | 2 +- nuttx/libc/stdio/lib_lowoutstream.c | 2 +- nuttx/libc/stdio/lib_lowprintf.c | 2 +- nuttx/libc/stdio/lib_meminstream.c | 2 +- nuttx/libc/stdio/lib_memoutstream.c | 2 +- nuttx/libc/stdio/lib_nullinstream.c | 2 +- nuttx/libc/stdio/lib_nulloutstream.c | 2 +- nuttx/libc/stdio/lib_perror.c | 2 +- nuttx/libc/stdio/lib_printf.c | 2 +- nuttx/libc/stdio/lib_puts.c | 2 +- nuttx/libc/stdio/lib_rawinstream.c | 2 +- nuttx/libc/stdio/lib_rawoutstream.c | 2 +- nuttx/libc/stdio/lib_rawprintf.c | 2 +- nuttx/libc/stdio/lib_rdflush.c | 2 +- nuttx/libc/stdio/lib_snprintf.c | 2 +- nuttx/libc/stdio/lib_sprintf.c | 2 +- nuttx/libc/stdio/lib_sscanf.c | 2 +- nuttx/libc/stdio/lib_stdinstream.c | 2 +- nuttx/libc/stdio/lib_stdoutstream.c | 2 +- nuttx/libc/stdio/lib_syslogstream.c | 2 +- nuttx/libc/stdio/lib_ungetc.c | 2 +- nuttx/libc/stdio/lib_vfprintf.c | 2 +- nuttx/libc/stdio/lib_vprintf.c | 2 +- nuttx/libc/stdio/lib_vsnprintf.c | 2 +- nuttx/libc/stdio/lib_vsprintf.c | 4 +- nuttx/libc/stdio/lib_wrflush.c | 2 +- nuttx/libc/stdio/lib_zeroinstream.c | 2 +- nuttx/libc/stdlib/Make.defs | 2 +- nuttx/libc/stdlib/lib_abort.c | 2 +- nuttx/libc/stdlib/lib_abs.c | 2 +- nuttx/libc/stdlib/lib_imaxabs.c | 2 +- nuttx/libc/stdlib/lib_labs.c | 2 +- nuttx/libc/stdlib/lib_llabs.c | 2 +- nuttx/libc/stdlib/lib_qsort.c | 2 +- nuttx/libc/stdlib/lib_rand.c | 2 +- nuttx/libc/string/Make.defs | 2 +- nuttx/libc/string/lib_checkbase.c | 2 +- nuttx/libc/string/lib_isbasedigit.c | 2 +- nuttx/libc/string/lib_memccpy.c | 2 +- nuttx/libc/string/lib_memchr.c | 2 +- nuttx/libc/string/lib_memcmp.c | 2 +- nuttx/libc/string/lib_memcpy.c | 2 +- nuttx/libc/string/lib_memmove.c | 2 +- nuttx/libc/string/lib_memset.c | 2 +- nuttx/libc/string/lib_skipspace.c | 2 +- nuttx/libc/string/lib_strcasecmp.c | 2 +- nuttx/libc/string/lib_strcasestr.c | 2 +- nuttx/libc/string/lib_strcat.c | 2 +- nuttx/libc/string/lib_strchr.c | 2 +- nuttx/libc/string/lib_strcmp.c | 2 +- nuttx/libc/string/lib_strcpy.c | 2 +- nuttx/libc/string/lib_strcspn.c | 2 +- nuttx/libc/string/lib_strdup.c | 2 +- nuttx/libc/string/lib_strerror.c | 2 +- nuttx/libc/string/lib_strlen.c | 2 +- nuttx/libc/string/lib_strncasecmp.c | 2 +- nuttx/libc/string/lib_strncat.c | 2 +- nuttx/libc/string/lib_strncmp.c | 2 +- nuttx/libc/string/lib_strncpy.c | 2 +- nuttx/libc/string/lib_strndup.c | 2 +- nuttx/libc/string/lib_strnlen.c | 4 +- nuttx/libc/string/lib_strpbrk.c | 2 +- nuttx/libc/string/lib_strrchr.c | 2 +- nuttx/libc/string/lib_strspn.c | 2 +- nuttx/libc/string/lib_strstr.c | 2 +- nuttx/libc/string/lib_strtod.c | 2 +- nuttx/libc/string/lib_strtok.c | 2 +- nuttx/libc/string/lib_strtokr.c | 2 +- nuttx/libc/string/lib_strtol.c | 2 +- nuttx/libc/string/lib_strtoll.c | 2 +- nuttx/libc/string/lib_strtoul.c | 2 +- nuttx/libc/string/lib_strtoull.c | 2 +- nuttx/libc/string/lib_vikmemcpy.c | 696 ++++++++++----------- nuttx/libc/termios/Make.defs | 2 +- nuttx/libc/termios/lib_cfgetspeed.c | 2 +- nuttx/libc/termios/lib_cfsetspeed.c | 2 +- nuttx/libc/termios/lib_tcflush.c | 2 +- nuttx/libc/termios/lib_tcgetattr.c | 2 +- nuttx/libc/termios/lib_tcsetattr.c | 2 +- nuttx/libc/time/Make.defs | 2 +- nuttx/libc/time/lib_calendar2utc.c | 2 +- nuttx/libc/time/lib_daysbeforemonth.c | 2 +- nuttx/libc/time/lib_gmtime.c | 2 +- nuttx/libc/time/lib_gmtimer.c | 2 +- nuttx/libc/time/lib_isleapyear.c | 2 +- nuttx/libc/time/lib_mktime.c | 2 +- nuttx/libc/time/lib_strftime.c | 2 +- nuttx/libc/time/lib_time.c | 2 +- nuttx/libc/unistd/Make.defs | 2 +- nuttx/libc/unistd/lib_chdir.c | 2 +- nuttx/libc/unistd/lib_getcwd.c | 2 +- nuttx/libc/unistd/lib_getopt.c | 2 +- nuttx/libc/unistd/lib_getoptargp.c | 2 +- nuttx/libc/unistd/lib_getoptindp.c | 2 +- nuttx/libc/unistd/lib_getoptoptp.c | 2 +- 284 files changed, 637 insertions(+), 637 deletions(-) (limited to 'nuttx/libc/math') diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index 1c93bb047..bd470be7f 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -30,7 +30,7 @@ config LIB_HOMEDIR ---help--- The home directory to use with operations like such as 'cd ~' -source lib/math/Kconfig +source libc/math/Kconfig config NOPRINTF_FIELDWIDTH bool "Disable sprintf support fieldwidth" diff --git a/nuttx/libc/Makefile b/nuttx/libc/Makefile index 406c2276e..318816ba7 100644 --- a/nuttx/libc/Makefile +++ b/nuttx/libc/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# lib/Makefile +# libc/Makefile # # Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -66,9 +66,9 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -UBIN = libulib$(LIBEXT) -KBIN = libklib$(LIBEXT) -BIN = liblib$(LIBEXT) +UBIN = libuc$(LIBEXT) +KBIN = libkc$(LIBEXT) +BIN = libc$(LIBEXT) all: $(BIN) diff --git a/nuttx/libc/README.txt b/nuttx/libc/README.txt index e99304841..ed672d038 100644 --- a/nuttx/libc/README.txt +++ b/nuttx/libc/README.txt @@ -21,7 +21,7 @@ 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 +The files in the libc/ directory are organized (mostly) according which file in the include/ directory provides the prototype for library functions. So we have: diff --git a/nuttx/libc/dirent/Make.defs b/nuttx/libc/dirent/Make.defs index cc1d6b783..f2927bed8 100644 --- a/nuttx/libc/dirent/Make.defs +++ b/nuttx/libc/dirent/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/dirent/Make.defs +# libc/dirent/Make.defs # # Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/dirent/lib_readdirr.c b/nuttx/libc/dirent/lib_readdirr.c index 47c5b9a7b..93c99ac28 100644 --- a/nuttx/libc/dirent/lib_readdirr.c +++ b/nuttx/libc/dirent/lib_readdirr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/dirent/lib_readdirr.c + * libc/dirent/lib_readdirr.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/dirent/lib_telldir.c b/nuttx/libc/dirent/lib_telldir.c index 3753b326e..f77a4a1c2 100644 --- a/nuttx/libc/dirent/lib_telldir.c +++ b/nuttx/libc/dirent/lib_telldir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/dirent/fs_telldir.c + * libc/dirent/fs_telldir.c * * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/fixedmath/Make.defs b/nuttx/libc/fixedmath/Make.defs index 578e33015..b53df2b2c 100644 --- a/nuttx/libc/fixedmath/Make.defs +++ b/nuttx/libc/fixedmath/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/fixedmath/Make.defs +# libc/fixedmath/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/fixedmath/lib_b16atan2.c b/nuttx/libc/fixedmath/lib_b16atan2.c index 69d132f80..443ab7be3 100644 --- a/nuttx/libc/fixedmath/lib_b16atan2.c +++ b/nuttx/libc/fixedmath/lib_b16atan2.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/fixedmath/lib_b16atan2.c + * libc/fixedmath/lib_b16atan2.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/fixedmath/lib_b16cos.c b/nuttx/libc/fixedmath/lib_b16cos.c index 3e9229029..0ebe48262 100644 --- a/nuttx/libc/fixedmath/lib_b16cos.c +++ b/nuttx/libc/fixedmath/lib_b16cos.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/fixedmath/lib_b16cos.c + * libc/fixedmath/lib_b16cos.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/fixedmath/lib_b16sin.c b/nuttx/libc/fixedmath/lib_b16sin.c index 491b0ec78..9cd2f0da3 100644 --- a/nuttx/libc/fixedmath/lib_b16sin.c +++ b/nuttx/libc/fixedmath/lib_b16sin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/fixedmath/lib_b16sin.c + * libc/fixedmath/lib_b16sin.c * * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/fixedmath/lib_fixedmath.c b/nuttx/libc/fixedmath/lib_fixedmath.c index c1a710e73..9e9213b4f 100644 --- a/nuttx/libc/fixedmath/lib_fixedmath.c +++ b/nuttx/libc/fixedmath/lib_fixedmath.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/math/lib_fixedmath.c + * libc/math/lib_fixedmath.c * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/fixedmath/lib_rint.c b/nuttx/libc/fixedmath/lib_rint.c index 3a6407b8c..a1212c970 100644 --- a/nuttx/libc/fixedmath/lib_rint.c +++ b/nuttx/libc/fixedmath/lib_rint.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/fixedmath/lib_rint.c + * libc/fixedmath/lib_rint.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/lib_internal.h b/nuttx/libc/lib_internal.h index 5da0ac924..c09c751d4 100644 --- a/nuttx/libc/lib_internal.h +++ b/nuttx/libc/lib_internal.h @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/lib_internal.h + * libc/lib_internal.h * * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/libgen/Make.defs b/nuttx/libc/libgen/Make.defs index f12645512..6e786655d 100644 --- a/nuttx/libc/libgen/Make.defs +++ b/nuttx/libc/libgen/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/libgen/Make.defs +# libc/libgen/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/libgen/lib_basename.c b/nuttx/libc/libgen/lib_basename.c index 986c6b852..68188edbf 100644 --- a/nuttx/libc/libgen/lib_basename.c +++ b/nuttx/libc/libgen/lib_basename.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/libgen/lib_basename.c + * libc/libgen/lib_basename.c * * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/libgen/lib_dirname.c b/nuttx/libc/libgen/lib_dirname.c index 248293a60..6d076fd61 100644 --- a/nuttx/libc/libgen/lib_dirname.c +++ b/nuttx/libc/libgen/lib_dirname.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/libgen/lib_dirname.c + * libc/libgen/lib_dirname.c * * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/math/Make.defs b/nuttx/libc/math/Make.defs index 73d0be6f3..bc6a265f0 100644 --- a/nuttx/libc/math/Make.defs +++ b/nuttx/libc/math/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/math/Make.defs +# libc/math/Make.defs # # Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/math/lib_acos.c b/nuttx/libc/math/lib_acos.c index d5ec36b9f..147003237 100644 --- a/nuttx/libc/math/lib_acos.c +++ b/nuttx/libc/math/lib_acos.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_acos.c + * libc/math/lib_acos.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_acosf.c b/nuttx/libc/math/lib_acosf.c index e14a73a6e..447b2767f 100644 --- a/nuttx/libc/math/lib_acosf.c +++ b/nuttx/libc/math/lib_acosf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_acosf.c + * libc/math/lib_acosf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_acosl.c b/nuttx/libc/math/lib_acosl.c index 911330577..a0f226238 100644 --- a/nuttx/libc/math/lib_acosl.c +++ b/nuttx/libc/math/lib_acosl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_acos.c + * libc/math/lib_acos.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_asin.c b/nuttx/libc/math/lib_asin.c index 61b953531..d9941a7e5 100644 --- a/nuttx/libc/math/lib_asin.c +++ b/nuttx/libc/math/lib_asin.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sin.c + * libc/math/lib_sin.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_asinf.c b/nuttx/libc/math/lib_asinf.c index 17669a934..57e518acb 100644 --- a/nuttx/libc/math/lib_asinf.c +++ b/nuttx/libc/math/lib_asinf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sinf.c + * libc/math/lib_sinf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_asinl.c b/nuttx/libc/math/lib_asinl.c index dbb2bc3a2..19f284e53 100644 --- a/nuttx/libc/math/lib_asinl.c +++ b/nuttx/libc/math/lib_asinl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sinl.c + * libc/math/lib_sinl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_atan.c b/nuttx/libc/math/lib_atan.c index b4db8fb31..44d68ece2 100644 --- a/nuttx/libc/math/lib_atan.c +++ b/nuttx/libc/math/lib_atan.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_atan.c + * libc/math/lib_atan.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_atan2.c b/nuttx/libc/math/lib_atan2.c index 82d1f47ec..6d7d2ad48 100644 --- a/nuttx/libc/math/lib_atan2.c +++ b/nuttx/libc/math/lib_atan2.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_atan2.c + * libc/math/lib_atan2.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_atan2f.c b/nuttx/libc/math/lib_atan2f.c index a60d32c65..7ff9af130 100644 --- a/nuttx/libc/math/lib_atan2f.c +++ b/nuttx/libc/math/lib_atan2f.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_atan2f.c + * libc/math/lib_atan2f.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_atan2l.c b/nuttx/libc/math/lib_atan2l.c index 07fcd9669..48bfd06f3 100644 --- a/nuttx/libc/math/lib_atan2l.c +++ b/nuttx/libc/math/lib_atan2l.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_atan2l.c + * libc/math/lib_atan2l.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_atanf.c b/nuttx/libc/math/lib_atanf.c index 7c540dd16..a84605787 100644 --- a/nuttx/libc/math/lib_atanf.c +++ b/nuttx/libc/math/lib_atanf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_atanf.c + * libc/math/lib_atanf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_atanl.c b/nuttx/libc/math/lib_atanl.c index 0fa203098..752d49307 100644 --- a/nuttx/libc/math/lib_atanl.c +++ b/nuttx/libc/math/lib_atanl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_atanl.c + * libc/math/lib_atanl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_ceil.c b/nuttx/libc/math/lib_ceil.c index 0e7602996..3c6678dc1 100644 --- a/nuttx/libc/math/lib_ceil.c +++ b/nuttx/libc/math/lib_ceil.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_ceil.c + * libc/math/lib_ceil.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_ceilf.c b/nuttx/libc/math/lib_ceilf.c index 0721ffc22..afbe2cf13 100644 --- a/nuttx/libc/math/lib_ceilf.c +++ b/nuttx/libc/math/lib_ceilf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_ceilf.c + * libc/math/lib_ceilf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_ceill.c b/nuttx/libc/math/lib_ceill.c index a24b56f68..757016b53 100644 --- a/nuttx/libc/math/lib_ceill.c +++ b/nuttx/libc/math/lib_ceill.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_ceil;.c + * libc/math/lib_ceil;.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_cos.c b/nuttx/libc/math/lib_cos.c index aa672b855..4b4e1a20b 100644 --- a/nuttx/libc/math/lib_cos.c +++ b/nuttx/libc/math/lib_cos.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_cos.c + * libc/math/lib_cos.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_cosf.c b/nuttx/libc/math/lib_cosf.c index 093a8a002..d9ac951f6 100644 --- a/nuttx/libc/math/lib_cosf.c +++ b/nuttx/libc/math/lib_cosf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_cosf.c + * libc/math/lib_cosf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_cosh.c b/nuttx/libc/math/lib_cosh.c index 1be44d293..3246ea5f9 100644 --- a/nuttx/libc/math/lib_cosh.c +++ b/nuttx/libc/math/lib_cosh.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_cosh.c + * libc/math/lib_cosh.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_coshf.c b/nuttx/libc/math/lib_coshf.c index d5e5ea14d..f0c28ab2e 100644 --- a/nuttx/libc/math/lib_coshf.c +++ b/nuttx/libc/math/lib_coshf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_coshf.c + * libc/math/lib_coshf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_coshl.c b/nuttx/libc/math/lib_coshl.c index 4576b8876..957ec61a7 100644 --- a/nuttx/libc/math/lib_coshl.c +++ b/nuttx/libc/math/lib_coshl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_coshl.c + * libc/math/lib_coshl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_cosl.c b/nuttx/libc/math/lib_cosl.c index 25dd86139..972d4aa9d 100644 --- a/nuttx/libc/math/lib_cosl.c +++ b/nuttx/libc/math/lib_cosl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_cosl.c + * libc/math/lib_cosl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_exp.c b/nuttx/libc/math/lib_exp.c index 1e3120453..62494251d 100644 --- a/nuttx/libc/math/lib_exp.c +++ b/nuttx/libc/math/lib_exp.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_exp.c + * libc/math/lib_exp.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_expf.c b/nuttx/libc/math/lib_expf.c index eac4641c6..3e43c54a6 100644 --- a/nuttx/libc/math/lib_expf.c +++ b/nuttx/libc/math/lib_expf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_expf.c + * libc/math/lib_expf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_expl.c b/nuttx/libc/math/lib_expl.c index 053103c9b..231faa35f 100644 --- a/nuttx/libc/math/lib_expl.c +++ b/nuttx/libc/math/lib_expl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_expl.c + * libc/math/lib_expl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_fabs.c b/nuttx/libc/math/lib_fabs.c index ff99ceb64..774755087 100644 --- a/nuttx/libc/math/lib_fabs.c +++ b/nuttx/libc/math/lib_fabs.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_fabs.c + * libc/math/lib_fabs.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_fabsf.c b/nuttx/libc/math/lib_fabsf.c index 0ea186ca0..4c8ebae62 100644 --- a/nuttx/libc/math/lib_fabsf.c +++ b/nuttx/libc/math/lib_fabsf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_fabsf.c + * libc/math/lib_fabsf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_fabsl.c b/nuttx/libc/math/lib_fabsl.c index 5313d897d..96ac7d5db 100644 --- a/nuttx/libc/math/lib_fabsl.c +++ b/nuttx/libc/math/lib_fabsl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_fabsl.c + * libc/math/lib_fabsl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_floor.c b/nuttx/libc/math/lib_floor.c index f0c4477a0..3330607ce 100644 --- a/nuttx/libc/math/lib_floor.c +++ b/nuttx/libc/math/lib_floor.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_floor.c + * libc/math/lib_floor.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_floorf.c b/nuttx/libc/math/lib_floorf.c index 2becb5fac..81483d4c9 100644 --- a/nuttx/libc/math/lib_floorf.c +++ b/nuttx/libc/math/lib_floorf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_floorf.c + * libc/math/lib_floorf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_floorl.c b/nuttx/libc/math/lib_floorl.c index e38ce80ed..0d9ec43b4 100644 --- a/nuttx/libc/math/lib_floorl.c +++ b/nuttx/libc/math/lib_floorl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_floorl.c + * libc/math/lib_floorl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_fmod.c b/nuttx/libc/math/lib_fmod.c index 939e7e18a..c66210cde 100644 --- a/nuttx/libc/math/lib_fmod.c +++ b/nuttx/libc/math/lib_fmod.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_fmod.c + * libc/math/lib_fmod.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_fmodf.c b/nuttx/libc/math/lib_fmodf.c index 085786f17..d70bb791c 100644 --- a/nuttx/libc/math/lib_fmodf.c +++ b/nuttx/libc/math/lib_fmodf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_fmodf.c + * libc/math/lib_fmodf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_fmodl.c b/nuttx/libc/math/lib_fmodl.c index 51c5e95ec..1299bf6e8 100644 --- a/nuttx/libc/math/lib_fmodl.c +++ b/nuttx/libc/math/lib_fmodl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_fmodl.c + * libc/math/lib_fmodl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_frexp.c b/nuttx/libc/math/lib_frexp.c index 56feee863..b9576dfd4 100644 --- a/nuttx/libc/math/lib_frexp.c +++ b/nuttx/libc/math/lib_frexp.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_frexp.c + * libc/math/lib_frexp.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_frexpf.c b/nuttx/libc/math/lib_frexpf.c index 1fb0df3d8..d93ffb173 100644 --- a/nuttx/libc/math/lib_frexpf.c +++ b/nuttx/libc/math/lib_frexpf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_frexpf.c + * libc/math/lib_frexpf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_frexpl.c b/nuttx/libc/math/lib_frexpl.c index 87708ad86..90993b137 100644 --- a/nuttx/libc/math/lib_frexpl.c +++ b/nuttx/libc/math/lib_frexpl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_frexpl.c + * libc/math/lib_frexpl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_ldexp.c b/nuttx/libc/math/lib_ldexp.c index 4c7b2b721..9b74d53d7 100644 --- a/nuttx/libc/math/lib_ldexp.c +++ b/nuttx/libc/math/lib_ldexp.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_ldexp.c + * libc/math/lib_ldexp.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_ldexpf.c b/nuttx/libc/math/lib_ldexpf.c index c61d633d5..f3aaf555b 100644 --- a/nuttx/libc/math/lib_ldexpf.c +++ b/nuttx/libc/math/lib_ldexpf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_ldexpf.c + * libc/math/lib_ldexpf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_ldexpl.c b/nuttx/libc/math/lib_ldexpl.c index b9a0f4a86..29764aaba 100644 --- a/nuttx/libc/math/lib_ldexpl.c +++ b/nuttx/libc/math/lib_ldexpl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_ldexpl.c + * libc/math/lib_ldexpl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_libexpi.c b/nuttx/libc/math/lib_libexpi.c index 1ec947a71..33ba537b1 100644 --- a/nuttx/libc/math/lib_libexpi.c +++ b/nuttx/libc/math/lib_libexpi.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_libexpi.c + * libc/math/lib_libexpi.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_libsqrtapprox.c b/nuttx/libc/math/lib_libsqrtapprox.c index 5c556c3a0..b6a9b0d54 100644 --- a/nuttx/libc/math/lib_libsqrtapprox.c +++ b/nuttx/libc/math/lib_libsqrtapprox.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_libsqrtapprox.c + * libc/math/lib_libsqrtapprox.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_log.c b/nuttx/libc/math/lib_log.c index 1350ba4fe..7156f6b41 100644 --- a/nuttx/libc/math/lib_log.c +++ b/nuttx/libc/math/lib_log.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_log.c + * libc/math/lib_log.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_log10.c b/nuttx/libc/math/lib_log10.c index 47854fca4..9daa91492 100644 --- a/nuttx/libc/math/lib_log10.c +++ b/nuttx/libc/math/lib_log10.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_log10.c + * libc/math/lib_log10.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_log10f.c b/nuttx/libc/math/lib_log10f.c index 651071920..778daedd5 100644 --- a/nuttx/libc/math/lib_log10f.c +++ b/nuttx/libc/math/lib_log10f.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_log10f.c + * libc/math/lib_log10f.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_log10l.c b/nuttx/libc/math/lib_log10l.c index 65892262a..efbeb721b 100644 --- a/nuttx/libc/math/lib_log10l.c +++ b/nuttx/libc/math/lib_log10l.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_log10l.c + * libc/math/lib_log10l.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_log2.c b/nuttx/libc/math/lib_log2.c index 0aa1e8010..4da39acdc 100644 --- a/nuttx/libc/math/lib_log2.c +++ b/nuttx/libc/math/lib_log2.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_log2.c + * libc/math/lib_log2.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_log2f.c b/nuttx/libc/math/lib_log2f.c index e160ca59e..f514e5a9e 100644 --- a/nuttx/libc/math/lib_log2f.c +++ b/nuttx/libc/math/lib_log2f.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_log2f.c + * libc/math/lib_log2f.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_log2l.c b/nuttx/libc/math/lib_log2l.c index 21d26d4d7..21e80a930 100644 --- a/nuttx/libc/math/lib_log2l.c +++ b/nuttx/libc/math/lib_log2l.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_log2l.c + * libc/math/lib_log2l.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_logf.c b/nuttx/libc/math/lib_logf.c index 1d31aa0c0..3815fef84 100644 --- a/nuttx/libc/math/lib_logf.c +++ b/nuttx/libc/math/lib_logf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_logf.c + * libc/math/lib_logf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_logl.c b/nuttx/libc/math/lib_logl.c index 577f9cee2..612816011 100644 --- a/nuttx/libc/math/lib_logl.c +++ b/nuttx/libc/math/lib_logl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_lol.c + * libc/math/lib_lol.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_modf.c b/nuttx/libc/math/lib_modf.c index 9dc6284c2..f3f25f6fb 100644 --- a/nuttx/libc/math/lib_modf.c +++ b/nuttx/libc/math/lib_modf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_modf.c + * libc/math/lib_modf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_modff.c b/nuttx/libc/math/lib_modff.c index 4eec2ae17..28d3a3ae0 100644 --- a/nuttx/libc/math/lib_modff.c +++ b/nuttx/libc/math/lib_modff.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_modff.c + * libc/math/lib_modff.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_modfl.c b/nuttx/libc/math/lib_modfl.c index 3b04571f3..77bba0e0c 100644 --- a/nuttx/libc/math/lib_modfl.c +++ b/nuttx/libc/math/lib_modfl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_modfl.c + * libc/math/lib_modfl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_pow.c b/nuttx/libc/math/lib_pow.c index af0a55d32..a19d491fa 100644 --- a/nuttx/libc/math/lib_pow.c +++ b/nuttx/libc/math/lib_pow.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_pow.c + * libc/math/lib_pow.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_powf.c b/nuttx/libc/math/lib_powf.c index a43f9cf82..570904898 100644 --- a/nuttx/libc/math/lib_powf.c +++ b/nuttx/libc/math/lib_powf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_powf.c + * libc/math/lib_powf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_powl.c b/nuttx/libc/math/lib_powl.c index f5fbf042e..81438217c 100644 --- a/nuttx/libc/math/lib_powl.c +++ b/nuttx/libc/math/lib_powl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_powl.c + * libc/math/lib_powl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sin.c b/nuttx/libc/math/lib_sin.c index c04d6b88b..e005d98cb 100644 --- a/nuttx/libc/math/lib_sin.c +++ b/nuttx/libc/math/lib_sin.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sin.c + * libc/math/lib_sin.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sinf.c b/nuttx/libc/math/lib_sinf.c index e298bbba4..9e493d8ef 100644 --- a/nuttx/libc/math/lib_sinf.c +++ b/nuttx/libc/math/lib_sinf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sinf.c + * libc/math/lib_sinf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sinh.c b/nuttx/libc/math/lib_sinh.c index f33852433..0c3e2d11d 100644 --- a/nuttx/libc/math/lib_sinh.c +++ b/nuttx/libc/math/lib_sinh.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sinh.c + * libc/math/lib_sinh.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sinhf.c b/nuttx/libc/math/lib_sinhf.c index e15cb14dc..e9d198440 100644 --- a/nuttx/libc/math/lib_sinhf.c +++ b/nuttx/libc/math/lib_sinhf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sinhf.c + * libc/math/lib_sinhf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sinhl.c b/nuttx/libc/math/lib_sinhl.c index b0fea2914..a1bcad81e 100644 --- a/nuttx/libc/math/lib_sinhl.c +++ b/nuttx/libc/math/lib_sinhl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sinhl.c + * libc/math/lib_sinhl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sinl.c b/nuttx/libc/math/lib_sinl.c index a69b548cb..6ed539a39 100644 --- a/nuttx/libc/math/lib_sinl.c +++ b/nuttx/libc/math/lib_sinl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sinl.c + * libc/math/lib_sinl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sqrt.c b/nuttx/libc/math/lib_sqrt.c index d77997f7c..e8a1c42ea 100644 --- a/nuttx/libc/math/lib_sqrt.c +++ b/nuttx/libc/math/lib_sqrt.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sqrt.c + * libc/math/lib_sqrt.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sqrtf.c b/nuttx/libc/math/lib_sqrtf.c index 81817a040..cf45ccacc 100644 --- a/nuttx/libc/math/lib_sqrtf.c +++ b/nuttx/libc/math/lib_sqrtf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sqrtf.c + * libc/math/lib_sqrtf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_sqrtl.c b/nuttx/libc/math/lib_sqrtl.c index 6674fe50f..4035992fe 100644 --- a/nuttx/libc/math/lib_sqrtl.c +++ b/nuttx/libc/math/lib_sqrtl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_sqrtl.c + * libc/math/lib_sqrtl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_tan.c b/nuttx/libc/math/lib_tan.c index bce14b327..4c091c09b 100644 --- a/nuttx/libc/math/lib_tan.c +++ b/nuttx/libc/math/lib_tan.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_tan.c + * libc/math/lib_tan.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_tanf.c b/nuttx/libc/math/lib_tanf.c index 3db3bda26..0c9110a0b 100644 --- a/nuttx/libc/math/lib_tanf.c +++ b/nuttx/libc/math/lib_tanf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_tanf.c + * libc/math/lib_tanf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_tanh.c b/nuttx/libc/math/lib_tanh.c index 46fddd06d..3b9ea0f41 100644 --- a/nuttx/libc/math/lib_tanh.c +++ b/nuttx/libc/math/lib_tanh.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_tanh.c + * libc/math/lib_tanh.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_tanhf.c b/nuttx/libc/math/lib_tanhf.c index 94d15cc60..43d418204 100644 --- a/nuttx/libc/math/lib_tanhf.c +++ b/nuttx/libc/math/lib_tanhf.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_tanhf.c + * libc/math/lib_tanhf.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_tanhl.c b/nuttx/libc/math/lib_tanhl.c index 23c11d667..5aafd1e7b 100644 --- a/nuttx/libc/math/lib_tanhl.c +++ b/nuttx/libc/math/lib_tanhl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_tanhl.c + * libc/math/lib_tanhl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/math/lib_tanl.c b/nuttx/libc/math/lib_tanl.c index 4973aa073..e77abe0f1 100644 --- a/nuttx/libc/math/lib_tanl.c +++ b/nuttx/libc/math/lib_tanl.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/math/lib_tanl.c + * libc/math/lib_tanl.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/misc/Make.defs b/nuttx/libc/misc/Make.defs index c12533f75..f4284ac60 100644 --- a/nuttx/libc/misc/Make.defs +++ b/nuttx/libc/misc/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/misc/Make.defs +# libc/misc/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/misc/lib_crc32.c b/nuttx/libc/misc/lib_crc32.c index f851598e0..ae73ba3d7 100644 --- a/nuttx/libc/misc/lib_crc32.c +++ b/nuttx/libc/misc/lib_crc32.c @@ -1,5 +1,5 @@ /************************************************************************************************ - * lib/misc/lib_crc32.c + * libc/misc/lib_crc32.c * * This file is a part of NuttX: * diff --git a/nuttx/libc/misc/lib_dbg.c b/nuttx/libc/misc/lib_dbg.c index aacdaa30a..5605ff828 100644 --- a/nuttx/libc/misc/lib_dbg.c +++ b/nuttx/libc/misc/lib_dbg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/misc/lib_dbg.c + * libc/misc/lib_dbg.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/misc/lib_dumpbuffer.c b/nuttx/libc/misc/lib_dumpbuffer.c index 155468ca1..52158b220 100644 --- a/nuttx/libc/misc/lib_dumpbuffer.c +++ b/nuttx/libc/misc/lib_dumpbuffer.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/misc/lib_dumpbuffer.c + * libc/misc/lib_dumpbuffer.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/misc/lib_filesem.c b/nuttx/libc/misc/lib_filesem.c index 1d1f25c2f..5cc4624ec 100644 --- a/nuttx/libc/misc/lib_filesem.c +++ b/nuttx/libc/misc/lib_filesem.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/misc/lib_filesem.c + * libc/misc/lib_filesem.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/misc/lib_init.c b/nuttx/libc/misc/lib_init.c index 3403a837b..6a120f7b1 100644 --- a/nuttx/libc/misc/lib_init.c +++ b/nuttx/libc/misc/lib_init.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/misc/lib_init.c + * libc/misc/lib_init.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/misc/lib_match.c b/nuttx/libc/misc/lib_match.c index 18e0632ec..a8cfad329 100644 --- a/nuttx/libc/misc/lib_match.c +++ b/nuttx/libc/misc/lib_match.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/misc/lib_match.c - simple shell-style filename matcher + * libc/misc/lib_match.c - simple shell-style filename matcher * * Simple shell-style filename pattern matcher written by Jef Poskanzer * This pattern matcher only handles '?', '*' and '**', and multiple diff --git a/nuttx/libc/misc/lib_sendfile.c b/nuttx/libc/misc/lib_sendfile.c index a82eb325e..8a38dc317 100644 --- a/nuttx/libc/misc/lib_sendfile.c +++ b/nuttx/libc/misc/lib_sendfile.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/misc/lib_streamsem.c + * libc/misc/lib_streamsem.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/misc/lib_streamsem.c b/nuttx/libc/misc/lib_streamsem.c index fdf494e75..e38298bdb 100644 --- a/nuttx/libc/misc/lib_streamsem.c +++ b/nuttx/libc/misc/lib_streamsem.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/misc/lib_streamsem.c + * libc/misc/lib_streamsem.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/mqueue/Make.defs b/nuttx/libc/mqueue/Make.defs index 40dc6c13e..826970fa3 100644 --- a/nuttx/libc/mqueue/Make.defs +++ b/nuttx/libc/mqueue/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/mqueue/Make.defs +# libc/mqueue/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/mqueue/mq_getattr.c b/nuttx/libc/mqueue/mq_getattr.c index 9c9f47fdc..2fc0e131b 100644 --- a/nuttx/libc/mqueue/mq_getattr.c +++ b/nuttx/libc/mqueue/mq_getattr.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/mqueue/mq_getattr.c + * libc/mqueue/mq_getattr.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/mqueue/mq_setattr.c b/nuttx/libc/mqueue/mq_setattr.c index 1276d64e8..45a848e6d 100644 --- a/nuttx/libc/mqueue/mq_setattr.c +++ b/nuttx/libc/mqueue/mq_setattr.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/mqueue/mq_setattr.c + * libc/mqueue/mq_setattr.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/net/Make.defs b/nuttx/libc/net/Make.defs index ae041bd2c..9d4e5c06b 100644 --- a/nuttx/libc/net/Make.defs +++ b/nuttx/libc/net/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/net/Make.defs +# libc/net/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/net/lib_etherntoa.c b/nuttx/libc/net/lib_etherntoa.c index f89f205a2..91fb01c57 100644 --- a/nuttx/libc/net/lib_etherntoa.c +++ b/nuttx/libc/net/lib_etherntoa.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/net/lib_etherntoa.c + * libc/net/lib_etherntoa.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/net/lib_htonl.c b/nuttx/libc/net/lib_htonl.c index e4c3e5383..a10f54f37 100644 --- a/nuttx/libc/net/lib_htonl.c +++ b/nuttx/libc/net/lib_htonl.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/net/lib_ntohl.c + * libc/net/lib_ntohl.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/net/lib_htons.c b/nuttx/libc/net/lib_htons.c index b4117e1dc..13addd913 100644 --- a/nuttx/libc/net/lib_htons.c +++ b/nuttx/libc/net/lib_htons.c @@ -1,5 +1,5 @@ /*************************************************************************** - * lib/net/lib_htons.c + * libc/net/lib_htons.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/net/lib_inetaddr.c b/nuttx/libc/net/lib_inetaddr.c index 48b01d682..46c6c548d 100644 --- a/nuttx/libc/net/lib_inetaddr.c +++ b/nuttx/libc/net/lib_inetaddr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/net/lib_inetaddr.c + * libc/net/lib_inetaddr.c * * Copyright (C) 2011 Yu Qiang. All rights reserved. * Author: Yu Qiang diff --git a/nuttx/libc/net/lib_inetntoa.c b/nuttx/libc/net/lib_inetntoa.c index 0f4fb61df..e2d92d864 100644 --- a/nuttx/libc/net/lib_inetntoa.c +++ b/nuttx/libc/net/lib_inetntoa.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/net/lib_inetntoa.c + * libc/net/lib_inetntoa.c * * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/net/lib_inetntop.c b/nuttx/libc/net/lib_inetntop.c index dc6a2d0d7..25c32c48c 100644 --- a/nuttx/libc/net/lib_inetntop.c +++ b/nuttx/libc/net/lib_inetntop.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/net/lib_inetntop.c + * libc/net/lib_inetntop.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/net/lib_inetpton.c b/nuttx/libc/net/lib_inetpton.c index 5371cd3f2..c5f117535 100644 --- a/nuttx/libc/net/lib_inetpton.c +++ b/nuttx/libc/net/lib_inetpton.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/net/lib_inetpton.c + * libc/net/lib_inetpton.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/Make.defs b/nuttx/libc/pthread/Make.defs index a1eba7bb0..07e4f0570 100644 --- a/nuttx/libc/pthread/Make.defs +++ b/nuttx/libc/pthread/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/pthread/Make.defs +# libc/pthread/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrdestroy.c b/nuttx/libc/pthread/pthread_attrdestroy.c index 103528c7e..37ad46ebc 100644 --- a/nuttx/libc/pthread/pthread_attrdestroy.c +++ b/nuttx/libc/pthread/pthread_attrdestroy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrdestroy.c + * libc/pthread/pthread_attrdestroy.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrgetinheritsched.c b/nuttx/libc/pthread/pthread_attrgetinheritsched.c index 02d6e0b7c..6ec8ae71f 100644 --- a/nuttx/libc/pthread/pthread_attrgetinheritsched.c +++ b/nuttx/libc/pthread/pthread_attrgetinheritsched.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrgetinheritsched.c + * libc/pthread/pthread_attrgetinheritsched.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrgetschedparam.c b/nuttx/libc/pthread/pthread_attrgetschedparam.c index c6bf55dea..6bcc9618e 100644 --- a/nuttx/libc/pthread/pthread_attrgetschedparam.c +++ b/nuttx/libc/pthread/pthread_attrgetschedparam.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrgetschedparam.c + * libc/pthread/pthread_attrgetschedparam.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrgetschedpolicy.c b/nuttx/libc/pthread/pthread_attrgetschedpolicy.c index c42b828c9..8845e2bd8 100644 --- a/nuttx/libc/pthread/pthread_attrgetschedpolicy.c +++ b/nuttx/libc/pthread/pthread_attrgetschedpolicy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrgetschedpolicy.c + * libc/pthread/pthread_attrgetschedpolicy.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrgetstacksize.c b/nuttx/libc/pthread/pthread_attrgetstacksize.c index 2faa586ba..9fde29e81 100644 --- a/nuttx/libc/pthread/pthread_attrgetstacksize.c +++ b/nuttx/libc/pthread/pthread_attrgetstacksize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrgetstacksize.c + * libc/pthread/pthread_attrgetstacksize.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrinit.c b/nuttx/libc/pthread/pthread_attrinit.c index d06a535d7..427a582b9 100644 --- a/nuttx/libc/pthread/pthread_attrinit.c +++ b/nuttx/libc/pthread/pthread_attrinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrinit.c + * libc/pthread/pthread_attrinit.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrsetinheritsched.c b/nuttx/libc/pthread/pthread_attrsetinheritsched.c index df2c2fba3..1102fe176 100644 --- a/nuttx/libc/pthread/pthread_attrsetinheritsched.c +++ b/nuttx/libc/pthread/pthread_attrsetinheritsched.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrsetinheritsched.c + * libc/pthread/pthread_attrsetinheritsched.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrsetschedparam.c b/nuttx/libc/pthread/pthread_attrsetschedparam.c index c2ab4d1c4..587d62206 100644 --- a/nuttx/libc/pthread/pthread_attrsetschedparam.c +++ b/nuttx/libc/pthread/pthread_attrsetschedparam.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrsetschedparam.c + * libc/pthread/pthread_attrsetschedparam.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrsetschedpolicy.c b/nuttx/libc/pthread/pthread_attrsetschedpolicy.c index 4e43e635d..e1d1c8619 100644 --- a/nuttx/libc/pthread/pthread_attrsetschedpolicy.c +++ b/nuttx/libc/pthread/pthread_attrsetschedpolicy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrsetschedpolicy.c + * libc/pthread/pthread_attrsetschedpolicy.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_attrsetstacksize.c b/nuttx/libc/pthread/pthread_attrsetstacksize.c index 8a826dd3a..fca993baf 100644 --- a/nuttx/libc/pthread/pthread_attrsetstacksize.c +++ b/nuttx/libc/pthread/pthread_attrsetstacksize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_attrsetstacksize.c + * libc/pthread/pthread_attrsetstacksize.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_barrierattrdestroy.c b/nuttx/libc/pthread/pthread_barrierattrdestroy.c index 6d16b9cff..5519caa61 100644 --- a/nuttx/libc/pthread/pthread_barrierattrdestroy.c +++ b/nuttx/libc/pthread/pthread_barrierattrdestroy.c @@ -1,5 +1,5 @@ /******************************************************************************** - * lib/pthread/pthread_barrierattrdestroy.c + * libc/pthread/pthread_barrierattrdestroy.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_barrierattrgetpshared.c b/nuttx/libc/pthread/pthread_barrierattrgetpshared.c index d29bc6dfc..83faffae0 100644 --- a/nuttx/libc/pthread/pthread_barrierattrgetpshared.c +++ b/nuttx/libc/pthread/pthread_barrierattrgetpshared.c @@ -1,5 +1,5 @@ /******************************************************************************** - * lib/pthread/pthread_barrierattrgetpshared.c + * libc/pthread/pthread_barrierattrgetpshared.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_barrierattrinit.c b/nuttx/libc/pthread/pthread_barrierattrinit.c index b5f35ca91..7ab101883 100644 --- a/nuttx/libc/pthread/pthread_barrierattrinit.c +++ b/nuttx/libc/pthread/pthread_barrierattrinit.c @@ -1,5 +1,5 @@ /******************************************************************************** - * lib/pthread/pthread_barrierattrinit.c + * libc/pthread/pthread_barrierattrinit.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_barrierattrsetpshared.c b/nuttx/libc/pthread/pthread_barrierattrsetpshared.c index d0eecbf5a..2585de7a0 100644 --- a/nuttx/libc/pthread/pthread_barrierattrsetpshared.c +++ b/nuttx/libc/pthread/pthread_barrierattrsetpshared.c @@ -1,5 +1,5 @@ /******************************************************************************** - * lib/pthread/pthread_barrierattrsetpshared.c + * libc/pthread/pthread_barrierattrsetpshared.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_condattrdestroy.c b/nuttx/libc/pthread/pthread_condattrdestroy.c index d6c3df5d1..30a0c4db1 100644 --- a/nuttx/libc/pthread/pthread_condattrdestroy.c +++ b/nuttx/libc/pthread/pthread_condattrdestroy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_condattrdestroy.c + * libc/pthread/pthread_condattrdestroy.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_condattrinit.c b/nuttx/libc/pthread/pthread_condattrinit.c index 5721c6159..511376f2e 100644 --- a/nuttx/libc/pthread/pthread_condattrinit.c +++ b/nuttx/libc/pthread/pthread_condattrinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_condattrinit.c + * libc/pthread/pthread_condattrinit.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_mutexattrdestroy.c b/nuttx/libc/pthread/pthread_mutexattrdestroy.c index e9868df68..82a13c300 100644 --- a/nuttx/libc/pthread/pthread_mutexattrdestroy.c +++ b/nuttx/libc/pthread/pthread_mutexattrdestroy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_mutexattrdestroy.c + * libc/pthread/pthread_mutexattrdestroy.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_mutexattrgetpshared.c b/nuttx/libc/pthread/pthread_mutexattrgetpshared.c index bc6379db5..dc18484ec 100644 --- a/nuttx/libc/pthread/pthread_mutexattrgetpshared.c +++ b/nuttx/libc/pthread/pthread_mutexattrgetpshared.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_mutexattrgetpshared.c + * libc/pthread/pthread_mutexattrgetpshared.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_mutexattrgettype.c b/nuttx/libc/pthread/pthread_mutexattrgettype.c index 5fb10f301..3b8b3ec05 100644 --- a/nuttx/libc/pthread/pthread_mutexattrgettype.c +++ b/nuttx/libc/pthread/pthread_mutexattrgettype.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_mutexattrgettype.c + * libc/pthread/pthread_mutexattrgettype.c * * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_mutexattrinit.c b/nuttx/libc/pthread/pthread_mutexattrinit.c index f815bf16c..f8c272195 100644 --- a/nuttx/libc/pthread/pthread_mutexattrinit.c +++ b/nuttx/libc/pthread/pthread_mutexattrinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_mutexattrinit.c + * libc/pthread/pthread_mutexattrinit.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_mutexattrsetpshared.c b/nuttx/libc/pthread/pthread_mutexattrsetpshared.c index 900476fdd..7501fd980 100644 --- a/nuttx/libc/pthread/pthread_mutexattrsetpshared.c +++ b/nuttx/libc/pthread/pthread_mutexattrsetpshared.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_mutexattrsetpshared.c + * libc/pthread/pthread_mutexattrsetpshared.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/pthread/pthread_mutexattrsettype.c b/nuttx/libc/pthread/pthread_mutexattrsettype.c index 81427c757..068a27dc2 100644 --- a/nuttx/libc/pthread/pthread_mutexattrsettype.c +++ b/nuttx/libc/pthread/pthread_mutexattrsettype.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/pthread/pthread_mutexattrsettype.c + * libc/pthread/pthread_mutexattrsettype.c * * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/Make.defs b/nuttx/libc/queue/Make.defs index 976e7a2b8..9a843dbdc 100644 --- a/nuttx/libc/queue/Make.defs +++ b/nuttx/libc/queue/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/queue/Make.defs +# libc/queue/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/queue/dq_addafter.c b/nuttx/libc/queue/dq_addafter.c index bfbe0052d..e4d1abf63 100644 --- a/nuttx/libc/queue/dq_addafter.c +++ b/nuttx/libc/queue/dq_addafter.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/dq_addafter.c + * libc/queue/dq_addafter.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/dq_addbefore.c b/nuttx/libc/queue/dq_addbefore.c index d740ea830..3c403fc94 100644 --- a/nuttx/libc/queue/dq_addbefore.c +++ b/nuttx/libc/queue/dq_addbefore.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/queue/dq_addbefore.c + * libc/queue/dq_addbefore.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/dq_addfirst.c b/nuttx/libc/queue/dq_addfirst.c index 7c7312de3..56767b928 100644 --- a/nuttx/libc/queue/dq_addfirst.c +++ b/nuttx/libc/queue/dq_addfirst.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/dq_addfirst.c + * libc/queue/dq_addfirst.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/dq_addlast.c b/nuttx/libc/queue/dq_addlast.c index 745deb27d..3ef08abd0 100644 --- a/nuttx/libc/queue/dq_addlast.c +++ b/nuttx/libc/queue/dq_addlast.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/dq_addlast.c + * libc/queue/dq_addlast.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/dq_rem.c b/nuttx/libc/queue/dq_rem.c index 218427bf8..db20762c7 100644 --- a/nuttx/libc/queue/dq_rem.c +++ b/nuttx/libc/queue/dq_rem.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/dq_rem.c + * libc/queue/dq_rem.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/dq_remfirst.c b/nuttx/libc/queue/dq_remfirst.c index 26c5fd7a6..e87acc338 100644 --- a/nuttx/libc/queue/dq_remfirst.c +++ b/nuttx/libc/queue/dq_remfirst.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/dq_remfirst.c + * libc/queue/dq_remfirst.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/dq_remlast.c b/nuttx/libc/queue/dq_remlast.c index 35adc73e2..18c182335 100644 --- a/nuttx/libc/queue/dq_remlast.c +++ b/nuttx/libc/queue/dq_remlast.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/queue/dq_remlast.c + * libc/queue/dq_remlast.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/sq_addafter.c b/nuttx/libc/queue/sq_addafter.c index 965ac2844..5d47feba0 100644 --- a/nuttx/libc/queue/sq_addafter.c +++ b/nuttx/libc/queue/sq_addafter.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/sq_addafter.c + * libc/queue/sq_addafter.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/sq_addfirst.c b/nuttx/libc/queue/sq_addfirst.c index 8fc8e0619..962486154 100644 --- a/nuttx/libc/queue/sq_addfirst.c +++ b/nuttx/libc/queue/sq_addfirst.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/sq_addfirst.c + * libc/queue/sq_addfirst.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/sq_addlast.c b/nuttx/libc/queue/sq_addlast.c index f9f9625cc..faa07efb5 100644 --- a/nuttx/libc/queue/sq_addlast.c +++ b/nuttx/libc/queue/sq_addlast.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/sq_addlast.c + * libc/queue/sq_addlast.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/sq_rem.c b/nuttx/libc/queue/sq_rem.c index 6ba52354d..720be182c 100644 --- a/nuttx/libc/queue/sq_rem.c +++ b/nuttx/libc/queue/sq_rem.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/sq_rem.c + * libc/queue/sq_rem.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/sq_remafter.c b/nuttx/libc/queue/sq_remafter.c index 4dcfb06e4..0545a00f9 100644 --- a/nuttx/libc/queue/sq_remafter.c +++ b/nuttx/libc/queue/sq_remafter.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/sq_remafter.c + * libc/queue/sq_remafter.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/sq_remfirst.c b/nuttx/libc/queue/sq_remfirst.c index 43df6de41..f81c18dc2 100644 --- a/nuttx/libc/queue/sq_remfirst.c +++ b/nuttx/libc/queue/sq_remfirst.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/sq_remfirst.c + * libc/queue/sq_remfirst.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/queue/sq_remlast.c b/nuttx/libc/queue/sq_remlast.c index 92cdbde98..8f045e493 100644 --- a/nuttx/libc/queue/sq_remlast.c +++ b/nuttx/libc/queue/sq_remlast.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/queue/sq_remlast.c + * libc/queue/sq_remlast.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/sched/Make.defs b/nuttx/libc/sched/Make.defs index f398b755e..d2356db0f 100644 --- a/nuttx/libc/sched/Make.defs +++ b/nuttx/libc/sched/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/sched/Make.defs +# libc/sched/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/sched/sched_getprioritymax.c b/nuttx/libc/sched/sched_getprioritymax.c index 14b368dfc..6ea37e76a 100644 --- a/nuttx/libc/sched/sched_getprioritymax.c +++ b/nuttx/libc/sched/sched_getprioritymax.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/sched/sched_getprioritymax.c + * libc/sched/sched_getprioritymax.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/sched/sched_getprioritymin.c b/nuttx/libc/sched/sched_getprioritymin.c index 86410cb0f..dbb46d81e 100644 --- a/nuttx/libc/sched/sched_getprioritymin.c +++ b/nuttx/libc/sched/sched_getprioritymin.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/sched/sched_getprioritymin.c + * libc/sched/sched_getprioritymin.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/semaphore/Make.defs b/nuttx/libc/semaphore/Make.defs index fdc0fe7d5..b6551ff96 100644 --- a/nuttx/libc/semaphore/Make.defs +++ b/nuttx/libc/semaphore/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/semaphore/Make.defs +# libc/semaphore/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/semaphore/sem_getvalue.c b/nuttx/libc/semaphore/sem_getvalue.c index 31c6bb7e0..ce9d12611 100644 --- a/nuttx/libc/semaphore/sem_getvalue.c +++ b/nuttx/libc/semaphore/sem_getvalue.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/semaphore/sem_getvalue.c + * libc/semaphore/sem_getvalue.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/semaphore/sem_init.c b/nuttx/libc/semaphore/sem_init.c index bc14415f9..7732eb57a 100644 --- a/nuttx/libc/semaphore/sem_init.c +++ b/nuttx/libc/semaphore/sem_init.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/sem/sem_init.c + * libc/sem/sem_init.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/signal/Make.defs b/nuttx/libc/signal/Make.defs index e27da9b2e..fe7eb180e 100644 --- a/nuttx/libc/signal/Make.defs +++ b/nuttx/libc/signal/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/signal/Make.defs +# libc/signal/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/signal/sig_addset.c b/nuttx/libc/signal/sig_addset.c index 19ba0cb6b..06ddabd6b 100644 --- a/nuttx/libc/signal/sig_addset.c +++ b/nuttx/libc/signal/sig_addset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/signal/sig_addset.c + * libc/signal/sig_addset.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/signal/sig_delset.c b/nuttx/libc/signal/sig_delset.c index 1c661d37f..04112d872 100644 --- a/nuttx/libc/signal/sig_delset.c +++ b/nuttx/libc/signal/sig_delset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/signal/sig_delset.c + * libc/signal/sig_delset.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/signal/sig_emptyset.c b/nuttx/libc/signal/sig_emptyset.c index ac0c6b3e8..16ddd3f68 100644 --- a/nuttx/libc/signal/sig_emptyset.c +++ b/nuttx/libc/signal/sig_emptyset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/signal/sig_emptyset.c + * libc/signal/sig_emptyset.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/signal/sig_fillset.c b/nuttx/libc/signal/sig_fillset.c index 8697d7577..99ee95c1f 100644 --- a/nuttx/libc/signal/sig_fillset.c +++ b/nuttx/libc/signal/sig_fillset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/signal/sig_fillset.c + * libc/signal/sig_fillset.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/signal/sig_ismember.c b/nuttx/libc/signal/sig_ismember.c index c5bb091b7..1a8590e00 100644 --- a/nuttx/libc/signal/sig_ismember.c +++ b/nuttx/libc/signal/sig_ismember.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/signal/sig_ismember.c + * libc/signal/sig_ismember.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/Make.defs b/nuttx/libc/stdio/Make.defs index e4ee5e969..e18ab0220 100644 --- a/nuttx/libc/stdio/Make.defs +++ b/nuttx/libc/stdio/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/stdio/Make.defs +# libc/stdio/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_asprintf.c b/nuttx/libc/stdio/lib_asprintf.c index 84aaafa46..20ca6de32 100644 --- a/nuttx/libc/stdio/lib_asprintf.c +++ b/nuttx/libc/stdio/lib_asprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_asprintf.c + * libc/stdio/lib_asprintf.c * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_avsprintf.c b/nuttx/libc/stdio/lib_avsprintf.c index 8561b97c2..15ff8c9fb 100644 --- a/nuttx/libc/stdio/lib_avsprintf.c +++ b/nuttx/libc/stdio/lib_avsprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_avsprintf.c + * libc/stdio/lib_avsprintf.c * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_clearerr.c b/nuttx/libc/stdio/lib_clearerr.c index 7f7ded5bb..589b56feb 100644 --- a/nuttx/libc/stdio/lib_clearerr.c +++ b/nuttx/libc/stdio/lib_clearerr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_clearerr.c + * libc/stdio/lib_clearerr.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_dtoa.c b/nuttx/libc/stdio/lib_dtoa.c index b8c7db980..44290ae32 100644 --- a/nuttx/libc/stdio/lib_dtoa.c +++ b/nuttx/libc/stdio/lib_dtoa.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_dtoa.c + * libc/stdio/lib_dtoa.c * * This file was ported to NuttX by Yolande Cates. * diff --git a/nuttx/libc/stdio/lib_fclose.c b/nuttx/libc/stdio/lib_fclose.c index 8cecb8af3..c04537adf 100644 --- a/nuttx/libc/stdio/lib_fclose.c +++ b/nuttx/libc/stdio/lib_fclose.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fclose.c + * libc/stdio/lib_fclose.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_feof.c b/nuttx/libc/stdio/lib_feof.c index e44c6a3c9..e036398fd 100644 --- a/nuttx/libc/stdio/lib_feof.c +++ b/nuttx/libc/stdio/lib_feof.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_feof.c + * libc/stdio/lib_feof.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_ferror.c b/nuttx/libc/stdio/lib_ferror.c index 4ad7d8cfc..a977394cb 100644 --- a/nuttx/libc/stdio/lib_ferror.c +++ b/nuttx/libc/stdio/lib_ferror.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_ferror.c + * libc/stdio/lib_ferror.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fflush.c b/nuttx/libc/stdio/lib_fflush.c index d0b5e0185..a84a14a59 100644 --- a/nuttx/libc/stdio/lib_fflush.c +++ b/nuttx/libc/stdio/lib_fflush.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fflush.c + * libc/stdio/lib_fflush.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fgetc.c b/nuttx/libc/stdio/lib_fgetc.c index 4b3d0ec44..81e2e4ba7 100644 --- a/nuttx/libc/stdio/lib_fgetc.c +++ b/nuttx/libc/stdio/lib_fgetc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fgetc.c + * libc/stdio/lib_fgetc.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fgetpos.c b/nuttx/libc/stdio/lib_fgetpos.c index e9e9f4d10..7663ca2db 100644 --- a/nuttx/libc/stdio/lib_fgetpos.c +++ b/nuttx/libc/stdio/lib_fgetpos.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fgetpos.c + * libc/stdio/lib_fgetpos.c * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fgets.c b/nuttx/libc/stdio/lib_fgets.c index a4f9089ed..c2c98a38b 100644 --- a/nuttx/libc/stdio/lib_fgets.c +++ b/nuttx/libc/stdio/lib_fgets.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fgets.c + * libc/stdio/lib_fgets.c * * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fileno.c b/nuttx/libc/stdio/lib_fileno.c index fca08fc0d..f227aa372 100644 --- a/nuttx/libc/stdio/lib_fileno.c +++ b/nuttx/libc/stdio/lib_fileno.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fileno.c + * libc/stdio/lib_fileno.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fopen.c b/nuttx/libc/stdio/lib_fopen.c index 29ff4569c..cb68b3584 100644 --- a/nuttx/libc/stdio/lib_fopen.c +++ b/nuttx/libc/stdio/lib_fopen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fopen.c + * libc/stdio/lib_fopen.c * * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fprintf.c b/nuttx/libc/stdio/lib_fprintf.c index a803de4bd..5b6fe58f4 100644 --- a/nuttx/libc/stdio/lib_fprintf.c +++ b/nuttx/libc/stdio/lib_fprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fprintf.c + * libc/stdio/lib_fprintf.c * * Copyright (C) 2007, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fputc.c b/nuttx/libc/stdio/lib_fputc.c index 121161f10..5d8065b43 100644 --- a/nuttx/libc/stdio/lib_fputc.c +++ b/nuttx/libc/stdio/lib_fputc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fputc.c + * libc/stdio/lib_fputc.c * * Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fputs.c b/nuttx/libc/stdio/lib_fputs.c index 2d6217d4a..7b87a89d0 100644 --- a/nuttx/libc/stdio/lib_fputs.c +++ b/nuttx/libc/stdio/lib_fputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fputs.c + * libc/stdio/lib_fputs.c * * Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fread.c b/nuttx/libc/stdio/lib_fread.c index 4a4b29256..671714122 100644 --- a/nuttx/libc/stdio/lib_fread.c +++ b/nuttx/libc/stdio/lib_fread.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fread.c + * libc/stdio/lib_fread.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fseek.c b/nuttx/libc/stdio/lib_fseek.c index 7380f83b3..36216d94a 100644 --- a/nuttx/libc/stdio/lib_fseek.c +++ b/nuttx/libc/stdio/lib_fseek.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fseek.c + * libc/stdio/lib_fseek.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fsetpos.c b/nuttx/libc/stdio/lib_fsetpos.c index 13d556521..3d79a1877 100644 --- a/nuttx/libc/stdio/lib_fsetpos.c +++ b/nuttx/libc/stdio/lib_fsetpos.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fsetpos.c + * libc/stdio/lib_fsetpos.c * * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_ftell.c b/nuttx/libc/stdio/lib_ftell.c index 947648152..99fc20f34 100644 --- a/nuttx/libc/stdio/lib_ftell.c +++ b/nuttx/libc/stdio/lib_ftell.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_ftell.c + * libc/stdio/lib_ftell.c * * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_fwrite.c b/nuttx/libc/stdio/lib_fwrite.c index 60e001746..e8de004fe 100644 --- a/nuttx/libc/stdio/lib_fwrite.c +++ b/nuttx/libc/stdio/lib_fwrite.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_fwrite.c + * libc/stdio/lib_fwrite.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_gets.c b/nuttx/libc/stdio/lib_gets.c index 95a6b36eb..39c31d273 100644 --- a/nuttx/libc/stdio/lib_gets.c +++ b/nuttx/libc/stdio/lib_gets.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_gets.c + * libc/stdio/lib_gets.c * * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_libdtoa.c b/nuttx/libc/stdio/lib_libdtoa.c index 667c49c53..29f61fd76 100644 --- a/nuttx/libc/stdio/lib_libdtoa.c +++ b/nuttx/libc/stdio/lib_libdtoa.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/unistd/lib_libdtoa.c + * libc/unistd/lib_libdtoa.c * * This file was ported to NuttX by Yolande Cates. * diff --git a/nuttx/libc/stdio/lib_libfflush.c b/nuttx/libc/stdio/lib_libfflush.c index 2a4fe2932..f2f0cfe14 100644 --- a/nuttx/libc/stdio/lib_libfflush.c +++ b/nuttx/libc/stdio/lib_libfflush.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_libfflush.c + * libc/stdio/lib_libfflush.c * * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_libflushall.c b/nuttx/libc/stdio/lib_libflushall.c index 9d0a89e9c..7ac3da7e0 100644 --- a/nuttx/libc/stdio/lib_libflushall.c +++ b/nuttx/libc/stdio/lib_libflushall.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_libflushall.c + * libc/stdio/lib_libflushall.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_libfread.c b/nuttx/libc/stdio/lib_libfread.c index 5585acbae..bc6479037 100644 --- a/nuttx/libc/stdio/lib_libfread.c +++ b/nuttx/libc/stdio/lib_libfread.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_libfread.c + * libc/stdio/lib_libfread.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_libfwrite.c b/nuttx/libc/stdio/lib_libfwrite.c index e71866b49..b917b3b56 100644 --- a/nuttx/libc/stdio/lib_libfwrite.c +++ b/nuttx/libc/stdio/lib_libfwrite.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_libfwrite.c + * libc/stdio/lib_libfwrite.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_libnoflush.c b/nuttx/libc/stdio/lib_libnoflush.c index e3b891153..076f8a17e 100644 --- a/nuttx/libc/stdio/lib_libnoflush.c +++ b/nuttx/libc/stdio/lib_libnoflush.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_libnoflush.c + * libc/stdio/lib_libnoflush.c * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_libsprintf.c b/nuttx/libc/stdio/lib_libsprintf.c index 2474a6f01..2d820ab37 100644 --- a/nuttx/libc/stdio/lib_libsprintf.c +++ b/nuttx/libc/stdio/lib_libsprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_libsprintf.c + * libc/stdio/lib_libsprintf.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_libvsprintf.c b/nuttx/libc/stdio/lib_libvsprintf.c index 30c988599..9a391610d 100644 --- a/nuttx/libc/stdio/lib_libvsprintf.c +++ b/nuttx/libc/stdio/lib_libvsprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_libvsprintf.c + * libc/stdio/lib_libvsprintf.c * * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -1161,7 +1161,7 @@ static void postjustify(FAR struct lib_outstream_s *obj, uint8_t fmt, ****************************************************************************/ /**************************************************************************** - * lib/stdio/lib_vsprintf + * libc/stdio/lib_vsprintf ****************************************************************************/ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list ap) diff --git a/nuttx/libc/stdio/lib_lowinstream.c b/nuttx/libc/stdio/lib_lowinstream.c index 499a647ea..7284601e8 100644 --- a/nuttx/libc/stdio/lib_lowinstream.c +++ b/nuttx/libc/stdio/lib_lowinstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_lowinstream.c + * libc/stdio/lib_lowinstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_lowoutstream.c b/nuttx/libc/stdio/lib_lowoutstream.c index 092f39ca2..f600bc614 100644 --- a/nuttx/libc/stdio/lib_lowoutstream.c +++ b/nuttx/libc/stdio/lib_lowoutstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_lowoutstream.c + * libc/stdio/lib_lowoutstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_lowprintf.c b/nuttx/libc/stdio/lib_lowprintf.c index 392ef2c6a..f7d4ffe2f 100644 --- a/nuttx/libc/stdio/lib_lowprintf.c +++ b/nuttx/libc/stdio/lib_lowprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_lowprintf.c + * libc/stdio/lib_lowprintf.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_meminstream.c b/nuttx/libc/stdio/lib_meminstream.c index a842096fb..2a30d956d 100644 --- a/nuttx/libc/stdio/lib_meminstream.c +++ b/nuttx/libc/stdio/lib_meminstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_meminstream.c + * libc/stdio/lib_meminstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_memoutstream.c b/nuttx/libc/stdio/lib_memoutstream.c index 21197358b..efd527cbc 100644 --- a/nuttx/libc/stdio/lib_memoutstream.c +++ b/nuttx/libc/stdio/lib_memoutstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_memoutstream.c + * libc/stdio/lib_memoutstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_nullinstream.c b/nuttx/libc/stdio/lib_nullinstream.c index 0eadb0a8e..aeb0af379 100644 --- a/nuttx/libc/stdio/lib_nullinstream.c +++ b/nuttx/libc/stdio/lib_nullinstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_nullinstream.c + * libc/stdio/lib_nullinstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_nulloutstream.c b/nuttx/libc/stdio/lib_nulloutstream.c index 69878fd57..574295344 100644 --- a/nuttx/libc/stdio/lib_nulloutstream.c +++ b/nuttx/libc/stdio/lib_nulloutstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_nulloutstream.c + * libc/stdio/lib_nulloutstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_perror.c b/nuttx/libc/stdio/lib_perror.c index 867e113f9..181898329 100644 --- a/nuttx/libc/stdio/lib_perror.c +++ b/nuttx/libc/stdio/lib_perror.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_perror.c + * libc/stdio/lib_perror.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_printf.c b/nuttx/libc/stdio/lib_printf.c index 50db06c47..0e90c7ca5 100644 --- a/nuttx/libc/stdio/lib_printf.c +++ b/nuttx/libc/stdio/lib_printf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_printf.c + * libc/stdio/lib_printf.c * * Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_puts.c b/nuttx/libc/stdio/lib_puts.c index e63a63917..53eda7081 100644 --- a/nuttx/libc/stdio/lib_puts.c +++ b/nuttx/libc/stdio/lib_puts.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_puts.c + * libc/stdio/lib_puts.c * * Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_rawinstream.c b/nuttx/libc/stdio/lib_rawinstream.c index 9671a2716..55456769e 100644 --- a/nuttx/libc/stdio/lib_rawinstream.c +++ b/nuttx/libc/stdio/lib_rawinstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_rawinstream.c + * libc/stdio/lib_rawinstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_rawoutstream.c b/nuttx/libc/stdio/lib_rawoutstream.c index ed813f87a..e1fe37134 100644 --- a/nuttx/libc/stdio/lib_rawoutstream.c +++ b/nuttx/libc/stdio/lib_rawoutstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_rawoutstream.c + * libc/stdio/lib_rawoutstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_rawprintf.c b/nuttx/libc/stdio/lib_rawprintf.c index 19dfa895e..98bbbea05 100644 --- a/nuttx/libc/stdio/lib_rawprintf.c +++ b/nuttx/libc/stdio/lib_rawprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_rawprintf.c + * libc/stdio/lib_rawprintf.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_rdflush.c b/nuttx/libc/stdio/lib_rdflush.c index 35c5495c1..c6136792b 100644 --- a/nuttx/libc/stdio/lib_rdflush.c +++ b/nuttx/libc/stdio/lib_rdflush.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_rdflush.c + * libc/stdio/lib_rdflush.c * * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_snprintf.c b/nuttx/libc/stdio/lib_snprintf.c index e5ce7b0f0..a4ba0dbb3 100644 --- a/nuttx/libc/stdio/lib_snprintf.c +++ b/nuttx/libc/stdio/lib_snprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_snprintf.c + * libc/stdio/lib_snprintf.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_sprintf.c b/nuttx/libc/stdio/lib_sprintf.c index 89fd61033..deb0669a3 100644 --- a/nuttx/libc/stdio/lib_sprintf.c +++ b/nuttx/libc/stdio/lib_sprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_sprintf.c + * libc/stdio/lib_sprintf.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_sscanf.c b/nuttx/libc/stdio/lib_sscanf.c index 7e1fae276..77a6cf212 100644 --- a/nuttx/libc/stdio/lib_sscanf.c +++ b/nuttx/libc/stdio/lib_sscanf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_sscanf.c + * libc/stdio/lib_sscanf.c * * Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_stdinstream.c b/nuttx/libc/stdio/lib_stdinstream.c index 77aab9ec8..261b26634 100644 --- a/nuttx/libc/stdio/lib_stdinstream.c +++ b/nuttx/libc/stdio/lib_stdinstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_stdinstream.c + * libc/stdio/lib_stdinstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_stdoutstream.c b/nuttx/libc/stdio/lib_stdoutstream.c index 20da5b702..dfe67271f 100644 --- a/nuttx/libc/stdio/lib_stdoutstream.c +++ b/nuttx/libc/stdio/lib_stdoutstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_stdoutstream.c + * libc/stdio/lib_stdoutstream.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_syslogstream.c b/nuttx/libc/stdio/lib_syslogstream.c index 21151b43a..5529c5de8 100644 --- a/nuttx/libc/stdio/lib_syslogstream.c +++ b/nuttx/libc/stdio/lib_syslogstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_syslogstream.c + * libc/stdio/lib_syslogstream.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_ungetc.c b/nuttx/libc/stdio/lib_ungetc.c index c10d4fba1..178aeddd1 100644 --- a/nuttx/libc/stdio/lib_ungetc.c +++ b/nuttx/libc/stdio/lib_ungetc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_ungetc.c + * libc/stdio/lib_ungetc.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_vfprintf.c b/nuttx/libc/stdio/lib_vfprintf.c index 1c3a2d7fc..cd117ddc3 100644 --- a/nuttx/libc/stdio/lib_vfprintf.c +++ b/nuttx/libc/stdio/lib_vfprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_vfprintf.c + * libc/stdio/lib_vfprintf.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_vprintf.c b/nuttx/libc/stdio/lib_vprintf.c index d085d5886..6ddfe2b24 100644 --- a/nuttx/libc/stdio/lib_vprintf.c +++ b/nuttx/libc/stdio/lib_vprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_vprintf.c + * libc/stdio/lib_vprintf.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_vsnprintf.c b/nuttx/libc/stdio/lib_vsnprintf.c index c6f52092d..f7fd02e42 100644 --- a/nuttx/libc/stdio/lib_vsnprintf.c +++ b/nuttx/libc/stdio/lib_vsnprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_vsnprintf.c + * libc/stdio/lib_vsnprintf.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_vsprintf.c b/nuttx/libc/stdio/lib_vsprintf.c index 5db46664e..b6d80808f 100644 --- a/nuttx/libc/stdio/lib_vsprintf.c +++ b/nuttx/libc/stdio/lib_vsprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_vsprintf.c + * libc/stdio/lib_vsprintf.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -84,7 +84,7 @@ int vsprintf(FAR char *dest, const char *src, va_list ap) struct lib_memoutstream_s memoutstream; /* Wrap the destination buffer in a stream object and let - * lib/stdio/lib_vsprintf do the work. + * libc/stdio/lib_vsprintf do the work. */ lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, dest, LIB_BUFLEN_UNKNOWN); diff --git a/nuttx/libc/stdio/lib_wrflush.c b/nuttx/libc/stdio/lib_wrflush.c index 39680da6a..40b8e38c8 100644 --- a/nuttx/libc/stdio/lib_wrflush.c +++ b/nuttx/libc/stdio/lib_wrflush.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_wrflush.c + * libc/stdio/lib_wrflush.c * * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdio/lib_zeroinstream.c b/nuttx/libc/stdio/lib_zeroinstream.c index 39a6c22ef..a52ecc1d0 100644 --- a/nuttx/libc/stdio/lib_zeroinstream.c +++ b/nuttx/libc/stdio/lib_zeroinstream.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdio/lib_zeroinstream.c + * libc/stdio/lib_zeroinstream.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/Make.defs b/nuttx/libc/stdlib/Make.defs index 76e285808..dcc4dab26 100644 --- a/nuttx/libc/stdlib/Make.defs +++ b/nuttx/libc/stdlib/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/stdlib/Make.defs +# libc/stdlib/Make.defs # # Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/lib_abort.c b/nuttx/libc/stdlib/lib_abort.c index 84b600950..1c7442c7f 100644 --- a/nuttx/libc/stdlib/lib_abort.c +++ b/nuttx/libc/stdlib/lib_abort.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/stdlib/lib_abort.c + * libc/stdlib/lib_abort.c * * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/lib_abs.c b/nuttx/libc/stdlib/lib_abs.c index 1a0c1671c..a4e4ec669 100644 --- a/nuttx/libc/stdlib/lib_abs.c +++ b/nuttx/libc/stdlib/lib_abs.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/stdlib/lib_abs.c + * libc/stdlib/lib_abs.c * * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/lib_imaxabs.c b/nuttx/libc/stdlib/lib_imaxabs.c index c6e227c7d..d36504372 100644 --- a/nuttx/libc/stdlib/lib_imaxabs.c +++ b/nuttx/libc/stdlib/lib_imaxabs.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/stdlib//lib_abs.c + * libc/stdlib//lib_abs.c * * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/lib_labs.c b/nuttx/libc/stdlib/lib_labs.c index f7218ee83..7cf92a0a1 100644 --- a/nuttx/libc/stdlib/lib_labs.c +++ b/nuttx/libc/stdlib/lib_labs.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/stdlib/lib_labs.c + * libc/stdlib/lib_labs.c * * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/lib_llabs.c b/nuttx/libc/stdlib/lib_llabs.c index db7d3dbe0..3630d1716 100644 --- a/nuttx/libc/stdlib/lib_llabs.c +++ b/nuttx/libc/stdlib/lib_llabs.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/stdlib/lib_llabs.c + * libc/stdlib/lib_llabs.c * * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/lib_qsort.c b/nuttx/libc/stdlib/lib_qsort.c index 9dd5c0040..021e782d4 100644 --- a/nuttx/libc/stdlib/lib_qsort.c +++ b/nuttx/libc/stdlib/lib_qsort.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/stdlib/lib_qsort.c + * libc/stdlib/lib_qsort.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/stdlib/lib_rand.c b/nuttx/libc/stdlib/lib_rand.c index 7227c52d0..cb998fb12 100644 --- a/nuttx/libc/stdlib/lib_rand.c +++ b/nuttx/libc/stdlib/lib_rand.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/stdlib/lib_rand.c + * libc/stdlib/lib_rand.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/Make.defs b/nuttx/libc/string/Make.defs index 191b9ffea..311c8afd2 100644 --- a/nuttx/libc/string/Make.defs +++ b/nuttx/libc/string/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/string/Make.defs +# libc/string/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_checkbase.c b/nuttx/libc/string/lib_checkbase.c index bc79ab2ce..32ae58dca 100644 --- a/nuttx/libc/string/lib_checkbase.c +++ b/nuttx/libc/string/lib_checkbase.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_checkbase.c + * libc/string/lib_checkbase.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_isbasedigit.c b/nuttx/libc/string/lib_isbasedigit.c index a2421bf2a..dff813881 100644 --- a/nuttx/libc/string/lib_isbasedigit.c +++ b/nuttx/libc/string/lib_isbasedigit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_isbasedigit.c + * libc/string/lib_isbasedigit.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_memccpy.c b/nuttx/libc/string/lib_memccpy.c index 1f3dbb52d..1d77f58fe 100644 --- a/nuttx/libc/string/lib_memccpy.c +++ b/nuttx/libc/string/lib_memccpy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_memccpy.c + * libc/string/lib_memccpy.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_memchr.c b/nuttx/libc/string/lib_memchr.c index e0dec8270..0ac609104 100644 --- a/nuttx/libc/string/lib_memchr.c +++ b/nuttx/libc/string/lib_memchr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_memchr.c + * libc/string/lib_memchr.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_memcmp.c b/nuttx/libc/string/lib_memcmp.c index eb2e1fd12..e1722a4d8 100644 --- a/nuttx/libc/string/lib_memcmp.c +++ b/nuttx/libc/string/lib_memcmp.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_memcmp.c + * libc/string/lib_memcmp.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_memcpy.c b/nuttx/libc/string/lib_memcpy.c index 3b62edbab..2ebd5beee 100644 --- a/nuttx/libc/string/lib_memcpy.c +++ b/nuttx/libc/string/lib_memcpy.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_memcpy.c + * libc/string/lib_memcpy.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_memmove.c b/nuttx/libc/string/lib_memmove.c index 85cb79e17..cbc26fb26 100644 --- a/nuttx/libc/string/lib_memmove.c +++ b/nuttx/libc/string/lib_memmove.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_memmove.c + * libc/string/lib_memmove.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_memset.c b/nuttx/libc/string/lib_memset.c index 31c386e92..0b98ebf96 100644 --- a/nuttx/libc/string/lib_memset.c +++ b/nuttx/libc/string/lib_memset.c @@ -1,6 +1,6 @@ /**************************************************************************** - * lib/string/lib_memset.c + * libc/string/lib_memset.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_skipspace.c b/nuttx/libc/string/lib_skipspace.c index b4e6588e5..4b72b1ec3 100644 --- a/nuttx/libc/string/lib_skipspace.c +++ b/nuttx/libc/string/lib_skipspace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_skipspace.c + * libc/string/lib_skipspace.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strcasecmp.c b/nuttx/libc/string/lib_strcasecmp.c index d4aa8cc03..df6f08118 100644 --- a/nuttx/libc/string/lib_strcasecmp.c +++ b/nuttx/libc/string/lib_strcasecmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcasecmp.c + * libc/string/lib_strcasecmp.c * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strcasestr.c b/nuttx/libc/string/lib_strcasestr.c index 23f0ab57e..5a8d53bee 100644 --- a/nuttx/libc/string/lib_strcasestr.c +++ b/nuttx/libc/string/lib_strcasestr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strstr.c + * libc/string/lib_strstr.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strcat.c b/nuttx/libc/string/lib_strcat.c index 20350fec0..b331d3f1c 100644 --- a/nuttx/libc/string/lib_strcat.c +++ b/nuttx/libc/string/lib_strcat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcat.c + * libc/string/lib_strcat.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strchr.c b/nuttx/libc/string/lib_strchr.c index d0bd22a0e..e6af56eee 100644 --- a/nuttx/libc/string/lib_strchr.c +++ b/nuttx/libc/string/lib_strchr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strchr.c + * libc/string/lib_strchr.c * * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strcmp.c b/nuttx/libc/string/lib_strcmp.c index 0e3eee890..d4036cd3e 100644 --- a/nuttx/libc/string/lib_strcmp.c +++ b/nuttx/libc/string/lib_strcmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcmp.c + * libc/string/lib_strcmp.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strcpy.c b/nuttx/libc/string/lib_strcpy.c index e2f70b94e..7a0576f5a 100644 --- a/nuttx/libc/string/lib_strcpy.c +++ b/nuttx/libc/string/lib_strcpy.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string/lib_strcpy.c + * libc/string/lib_strcpy.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strcspn.c b/nuttx/libc/string/lib_strcspn.c index 9da89241c..23e913fad 100644 --- a/nuttx/libc/string/lib_strcspn.c +++ b/nuttx/libc/string/lib_strcspn.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strcspn.c + * libc/string/lib_strcspn.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strdup.c b/nuttx/libc/string/lib_strdup.c index 44a0cbc0d..a5b3a1e8c 100644 --- a/nuttx/libc/string/lib_strdup.c +++ b/nuttx/libc/string/lib_strdup.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string//lib_strdup.c + * libc/string//lib_strdup.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strerror.c b/nuttx/libc/string/lib_strerror.c index 249f695c1..0c7ca28fd 100644 --- a/nuttx/libc/string/lib_strerror.c +++ b/nuttx/libc/string/lib_strerror.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string/lib_strerror.c + * libc/string/lib_strerror.c * * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strlen.c b/nuttx/libc/string/lib_strlen.c index 833305809..6077858e2 100644 --- a/nuttx/libc/string/lib_strlen.c +++ b/nuttx/libc/string/lib_strlen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strlen.c + * libc/string/lib_strlen.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strncasecmp.c b/nuttx/libc/string/lib_strncasecmp.c index be369cf0d..35f701c5e 100644 --- a/nuttx/libc/string/lib_strncasecmp.c +++ b/nuttx/libc/string/lib_strncasecmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strncasecmp.c + * libc/string/lib_strncasecmp.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strncat.c b/nuttx/libc/string/lib_strncat.c index af893e0f9..78c54835e 100644 --- a/nuttx/libc/string/lib_strncat.c +++ b/nuttx/libc/string/lib_strncat.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_strncat.c + * libc/string/lib_strncat.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strncmp.c b/nuttx/libc/string/lib_strncmp.c index ce2282024..dd8b57fd0 100644 --- a/nuttx/libc/string/lib_strncmp.c +++ b/nuttx/libc/string/lib_strncmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/lib_strncmp.c + * libc/lib_strncmp.c * * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strncpy.c b/nuttx/libc/string/lib_strncpy.c index 149369d50..8a97aa67b 100644 --- a/nuttx/libc/string/lib_strncpy.c +++ b/nuttx/libc/string/lib_strncpy.c @@ -1,5 +1,5 @@ /************************************************************ - * lib/string/lib_strncpy.c + * libc/string/lib_strncpy.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strndup.c b/nuttx/libc/string/lib_strndup.c index ffaf892ea..524e09754 100644 --- a/nuttx/libc/string/lib_strndup.c +++ b/nuttx/libc/string/lib_strndup.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string//lib_strndup.c + * libc/string//lib_strndup.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strnlen.c b/nuttx/libc/string/lib_strnlen.c index 2b64fe984..9bc3064cb 100644 --- a/nuttx/libc/string/lib_strnlen.c +++ b/nuttx/libc/string/lib_strnlen.c @@ -1,12 +1,12 @@ /**************************************************************************** - * lib/string/lib_strnlen.c + * libc/string/lib_strnlen.c * * This file is part of NuttX, contributed by Michael Hrabanek * * Copyright (C) 2010 Gregory Nutt. All rights reserved. * Author: Michael Hrabanek * - * Derives from the file lib/lib_strlen.c: + * Derives from the file libc/lib_strlen.c: * * Copyright (C) 2007, 2008, 2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strpbrk.c b/nuttx/libc/string/lib_strpbrk.c index 02e2ea2c7..ef9b0f3e9 100644 --- a/nuttx/libc/string/lib_strpbrk.c +++ b/nuttx/libc/string/lib_strpbrk.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strpbrk.c + * libc/string/lib_strpbrk.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strrchr.c b/nuttx/libc/string/lib_strrchr.c index 91243ce58..08575c82b 100644 --- a/nuttx/libc/string/lib_strrchr.c +++ b/nuttx/libc/string/lib_strrchr.c @@ -1,5 +1,5 @@ /************************************************************************ - * lib/string/lib_strrchr.c + * libc/string/lib_strrchr.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strspn.c b/nuttx/libc/string/lib_strspn.c index e7b5ea0a5..6894b2b9d 100644 --- a/nuttx/libc/string/lib_strspn.c +++ b/nuttx/libc/string/lib_strspn.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strspn.c + * libc/string/lib_strspn.c * * Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strstr.c b/nuttx/libc/string/lib_strstr.c index b8c896fa2..02f4809d2 100644 --- a/nuttx/libc/string/lib_strstr.c +++ b/nuttx/libc/string/lib_strstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strstr.c + * libc/string/lib_strstr.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strtod.c b/nuttx/libc/string/lib_strtod.c index 8fecd4571..58dfd6a29 100644 --- a/nuttx/libc/string/lib_strtod.c +++ b/nuttx/libc/string/lib_strtod.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtod.c + * libc/string/lib_strtod.c * Convert string to double * * Copyright (C) 2002 Michael Ringgaard. All rights reserved. diff --git a/nuttx/libc/string/lib_strtok.c b/nuttx/libc/string/lib_strtok.c index c40993135..85d6597d7 100644 --- a/nuttx/libc/string/lib_strtok.c +++ b/nuttx/libc/string/lib_strtok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtok.c + * libc/string/lib_strtok.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strtokr.c b/nuttx/libc/string/lib_strtokr.c index 1c571b6ae..c7845be64 100644 --- a/nuttx/libc/string/lib_strtokr.c +++ b/nuttx/libc/string/lib_strtokr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtokr.c + * libc/string/lib_strtokr.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strtol.c b/nuttx/libc/string/lib_strtol.c index c17d87e63..6ac0d6827 100644 --- a/nuttx/libc/string/lib_strtol.c +++ b/nuttx/libc/string/lib_strtol.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtol.c + * libc/string/lib_strtol.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strtoll.c b/nuttx/libc/string/lib_strtoll.c index 242e025c0..99fba08eb 100644 --- a/nuttx/libc/string/lib_strtoll.c +++ b/nuttx/libc/string/lib_strtoll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/string/lib_strtoll.c + * libc/string/lib_strtoll.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strtoul.c b/nuttx/libc/string/lib_strtoul.c index b0d2d090e..8f27ae3f2 100644 --- a/nuttx/libc/string/lib_strtoul.c +++ b/nuttx/libc/string/lib_strtoul.c @@ -1,5 +1,5 @@ /**************************************************************************** - * /lib/string/lib_strtoul.c + * /libc/string/lib_strtoul.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_strtoull.c b/nuttx/libc/string/lib_strtoull.c index 6567457c0..4808114af 100644 --- a/nuttx/libc/string/lib_strtoull.c +++ b/nuttx/libc/string/lib_strtoull.c @@ -1,5 +1,5 @@ /**************************************************************************** - * /lib/string/lib_strtoull.c + * /libc/string/lib_strtoull.c * * Copyright (C) 2009, 2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/string/lib_vikmemcpy.c b/nuttx/libc/string/lib_vikmemcpy.c index b50942aaa..28bf4a4ce 100644 --- a/nuttx/libc/string/lib_vikmemcpy.c +++ b/nuttx/libc/string/lib_vikmemcpy.c @@ -1,348 +1,348 @@ -/**************************************************************************** - * File: lib/string/lib_vikmemcpy.c - * - * This is version of the optimized memcpy by Daniel Vik, adapted to the - * NuttX environment. - * - * Copyright (C) 1999-2010 Daniel Vik - * - * Adaptations include: - * - File name change - * - Use of types defined in stdint.h - * - Integration with the NuttX configuration system - * - Other cosmetic changes for consistency with NuttX coding standards - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you - * use this software in a product, an acknowledgment in the - * use this software in a product, an acknowledgment in the - * product documentation would be appreciated but is not - * required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - * - * Description: Implementation of the standard library function memcpy. - * This implementation of memcpy() is ANSI-C89 compatible. - * - * The following configuration options can be set: - * - * CONFIG_ENDIAN_BIG - * Uses processor with big endian addressing. Default is little endian. - * - * CONFIG_MEMCPY_PRE_INC_PTRS - * Use pre increment of pointers. Default is post increment of pointers. - * - * CONFIG_MEMCPY_INDEXED_COPY - * Copying data using array indexing. Using this option, disables the - * CONFIG_MEMCPY_PRE_INC_PTRS option. - * - * CONFIG_MEMCPY_64BIT - Compiles memcpy for 64 bit architectures - * - ****************************************************************************/ - -/**************************************************************************** - * Configuration definitions. - ****************************************************************************/ - -#define CONFIG_MEMCPY_INDEXED_COPY - -/******************************************************************** - * Included Files - *******************************************************************/ - -#include -#include - -#include -#include -#include - -/******************************************************************** - * Pre-processor Definitions - *******************************************************************/ - -/* Can't support CONFIG_MEMCPY_64BIT if the platform does not have 64-bit - * integer types. - */ - -#ifndef CONFIG_HAVE_LONG_LONG -# undef CONFIG_MEMCPY_64BIT -#endif - -/* Remove definitions when CONFIG_MEMCPY_INDEXED_COPY is defined */ - -#if defined (CONFIG_MEMCPY_INDEXED_COPY) -# if defined (CONFIG_MEMCPY_PRE_INC_PTRS) -# undef CONFIG_MEMCPY_PRE_INC_PTRS -# endif /* CONFIG_MEMCPY_PRE_INC_PTRS */ -#endif /* CONFIG_MEMCPY_INDEXED_COPY */ - -/* Definitions for pre and post increment of pointers */ - -#if defined (CONFIG_MEMCPY_PRE_INC_PTRS) - -# define START_VAL(x) (x)-- -# define INC_VAL(x) *++(x) -# define CAST_TO_U8(p, o) ((uint8_t*)p + o + TYPE_WIDTH) -# define WHILE_DEST_BREAK (TYPE_WIDTH - 1) -# define PRE_LOOP_ADJUST - (TYPE_WIDTH - 1) -# define PRE_SWITCH_ADJUST + 1 - -#else /* CONFIG_MEMCPY_PRE_INC_PTRS */ - -# define START_VAL(x) -# define INC_VAL(x) *(x)++ -# define CAST_TO_U8(p, o) ((uint8_t*)p + o) -# define WHILE_DEST_BREAK 0 -# define PRE_LOOP_ADJUST -# define PRE_SWITCH_ADJUST - -#endif /* CONFIG_MEMCPY_PRE_INC_PTRS */ - -/* Definitions for endian-ness */ - -#ifdef CONFIG_ENDIAN_BIG - -# define SHL << -# define SHR >> - -#else /* CONFIG_ENDIAN_BIG */ - -# define SHL >> -# define SHR << - -#endif /* CONFIG_ENDIAN_BIG */ - -/******************************************************************** - * Macros for copying words of different alignment. - * Uses incremening pointers. - *******************************************************************/ - -#define CP_INCR() \ -{ \ - INC_VAL(dstN) = INC_VAL(srcN); \ -} - -#define CP_INCR_SH(shl, shr) \ -{ \ - dstWord = srcWord SHL shl; \ - srcWord = INC_VAL(srcN); \ - dstWord |= srcWord SHR shr; \ - INC_VAL(dstN) = dstWord; \ -} - -/******************************************************************** - * Macros for copying words of different alignment. - * Uses array indexes. - *******************************************************************/ - -#define CP_INDEX(idx) \ -{ \ - dstN[idx] = srcN[idx]; \ -} - -#define CP_INDEX_SH(x, shl, shr) \ -{ \ - dstWord = srcWord SHL shl; \ - srcWord = srcN[x]; \ - dstWord |= srcWord SHR shr; \ - dstN[x] = dstWord; \ -} - -/******************************************************************** - * Macros for copying words of different alignment. - * Uses incremening pointers or array indexes depending on - * configuration. - *******************************************************************/ - -#if defined (CONFIG_MEMCPY_INDEXED_COPY) - -# define CP(idx) CP_INDEX(idx) -# define CP_SH(idx, shl, shr) CP_INDEX_SH(idx, shl, shr) - -# define INC_INDEX(p, o) ((p) += (o)) - -#else /* CONFIG_MEMCPY_INDEXED_COPY */ - -# define CP(idx) CP_INCR() -# define CP_SH(idx, shl, shr) CP_INCR_SH(shl, shr) - -# define INC_INDEX(p, o) - -#endif /* CONFIG_MEMCPY_INDEXED_COPY */ - -#define COPY_REMAINING(count) \ -{ \ - START_VAL(dst8); \ - START_VAL(src8); \ - \ - switch (count) \ - { \ - case 7: INC_VAL(dst8) = INC_VAL(src8); \ - case 6: INC_VAL(dst8) = INC_VAL(src8); \ - case 5: INC_VAL(dst8) = INC_VAL(src8); \ - case 4: INC_VAL(dst8) = INC_VAL(src8); \ - case 3: INC_VAL(dst8) = INC_VAL(src8); \ - case 2: INC_VAL(dst8) = INC_VAL(src8); \ - case 1: INC_VAL(dst8) = INC_VAL(src8); \ - case 0: \ - default: break; \ - } \ -} - -#define COPY_NO_SHIFT() \ -{ \ - UIntN* dstN = (UIntN*)(dst8 PRE_LOOP_ADJUST); \ - UIntN* srcN = (UIntN*)(src8 PRE_LOOP_ADJUST); \ - size_t length = count / TYPE_WIDTH; \ - \ - while (length & 7) \ - { \ - CP_INCR(); \ - length--; \ - } \ - \ - length /= 8; \ - \ - while (length--) \ - { \ - CP(0); \ - CP(1); \ - CP(2); \ - CP(3); \ - CP(4); \ - CP(5); \ - CP(6); \ - CP(7); \ - \ - INC_INDEX(dstN, 8); \ - INC_INDEX(srcN, 8); \ - } \ - \ - src8 = CAST_TO_U8(srcN, 0); \ - dst8 = CAST_TO_U8(dstN, 0); \ - \ - COPY_REMAINING(count & (TYPE_WIDTH - 1)); \ - \ - return dest; \ -} - -#define COPY_SHIFT(shift) \ -{ \ - UIntN* dstN = (UIntN*)((((UIntN)dst8) PRE_LOOP_ADJUST) & \ - ~(TYPE_WIDTH - 1)); \ - UIntN* srcN = (UIntN*)((((UIntN)src8) PRE_LOOP_ADJUST) & \ - ~(TYPE_WIDTH - 1)); \ - size_t length = count / TYPE_WIDTH; \ - UIntN srcWord = INC_VAL(srcN); \ - UIntN dstWord; \ - \ - while (length & 7) \ - { \ - CP_INCR_SH(8 * shift, 8 * (TYPE_WIDTH - shift)); \ - length--; \ - } \ - \ - length /= 8; \ - \ - while (length--) \ - { \ - CP_SH(0, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - CP_SH(1, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - CP_SH(2, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - CP_SH(3, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - CP_SH(4, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - CP_SH(5, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - CP_SH(6, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - CP_SH(7, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ - \ - INC_INDEX(dstN, 8); \ - INC_INDEX(srcN, 8); \ - } \ - \ - src8 = CAST_TO_U8(srcN, (shift - TYPE_WIDTH)); \ - dst8 = CAST_TO_U8(dstN, 0); \ - \ - COPY_REMAINING(count & (TYPE_WIDTH - 1)); \ - \ - return dest; \ -} - -/******************************************************************** - * Type Definitions - *******************************************************************/ - -#ifdef CONFIG_MEMCPY_64BIT -typedef uint64_t UIntN; -# define TYPE_WIDTH 8L -#else -typedef uint32_t UIntN; -# define TYPE_WIDTH 4L -#endif - -/******************************************************************** - * Public Functions - *******************************************************************/ -/******************************************************************** - * Name: memcpy - * - * Description: - * Copies count bytes from src to dest. No overlap check is performed. - * - * Input Parameters: - * dest - pointer to destination buffer - * src - pointer to source buffer - * count - number of bytes to copy - * - * Returned Value: - * A pointer to destination buffer - * - *******************************************************************/ - -void *memcpy(void *dest, const void *src, size_t count) -{ - uint8_t *dst8 = (uint8_t*)dest; - uint8_t *src8 = (uint8_t*)src; - - if (count < 8) - { - COPY_REMAINING(count); - return dest; - } - - START_VAL(dst8); - START_VAL(src8); - - while (((UIntN)dst8 & (TYPE_WIDTH - 1)) != WHILE_DEST_BREAK) - { - INC_VAL(dst8) = INC_VAL(src8); - count--; - } - - switch ((((UIntN)src8) PRE_SWITCH_ADJUST) & (TYPE_WIDTH - 1)) - { - case 0: COPY_NO_SHIFT(); break; - case 1: COPY_SHIFT(1); break; - case 2: COPY_SHIFT(2); break; - case 3: COPY_SHIFT(3); break; -#if TYPE_WIDTH > 4 - case 4: COPY_SHIFT(4); break; - case 5: COPY_SHIFT(5); break; - case 6: COPY_SHIFT(6); break; - case 7: COPY_SHIFT(7); break; -#endif - } - - return dest; -} +/**************************************************************************** + * File: libc/string/lib_vikmemcpy.c + * + * This is version of the optimized memcpy by Daniel Vik, adapted to the + * NuttX environment. + * + * Copyright (C) 1999-2010 Daniel Vik + * + * Adaptations include: + * - File name change + * - Use of types defined in stdint.h + * - Integration with the NuttX configuration system + * - Other cosmetic changes for consistency with NuttX coding standards + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you + * use this software in a product, an acknowledgment in the + * use this software in a product, an acknowledgment in the + * product documentation would be appreciated but is not + * required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + * + * Description: Implementation of the standard library function memcpy. + * This implementation of memcpy() is ANSI-C89 compatible. + * + * The following configuration options can be set: + * + * CONFIG_ENDIAN_BIG + * Uses processor with big endian addressing. Default is little endian. + * + * CONFIG_MEMCPY_PRE_INC_PTRS + * Use pre increment of pointers. Default is post increment of pointers. + * + * CONFIG_MEMCPY_INDEXED_COPY + * Copying data using array indexing. Using this option, disables the + * CONFIG_MEMCPY_PRE_INC_PTRS option. + * + * CONFIG_MEMCPY_64BIT - Compiles memcpy for 64 bit architectures + * + ****************************************************************************/ + +/**************************************************************************** + * Configuration definitions. + ****************************************************************************/ + +#define CONFIG_MEMCPY_INDEXED_COPY + +/******************************************************************** + * Included Files + *******************************************************************/ + +#include +#include + +#include +#include +#include + +/******************************************************************** + * Pre-processor Definitions + *******************************************************************/ + +/* Can't support CONFIG_MEMCPY_64BIT if the platform does not have 64-bit + * integer types. + */ + +#ifndef CONFIG_HAVE_LONG_LONG +# undef CONFIG_MEMCPY_64BIT +#endif + +/* Remove definitions when CONFIG_MEMCPY_INDEXED_COPY is defined */ + +#if defined (CONFIG_MEMCPY_INDEXED_COPY) +# if defined (CONFIG_MEMCPY_PRE_INC_PTRS) +# undef CONFIG_MEMCPY_PRE_INC_PTRS +# endif /* CONFIG_MEMCPY_PRE_INC_PTRS */ +#endif /* CONFIG_MEMCPY_INDEXED_COPY */ + +/* Definitions for pre and post increment of pointers */ + +#if defined (CONFIG_MEMCPY_PRE_INC_PTRS) + +# define START_VAL(x) (x)-- +# define INC_VAL(x) *++(x) +# define CAST_TO_U8(p, o) ((uint8_t*)p + o + TYPE_WIDTH) +# define WHILE_DEST_BREAK (TYPE_WIDTH - 1) +# define PRE_LOOP_ADJUST - (TYPE_WIDTH - 1) +# define PRE_SWITCH_ADJUST + 1 + +#else /* CONFIG_MEMCPY_PRE_INC_PTRS */ + +# define START_VAL(x) +# define INC_VAL(x) *(x)++ +# define CAST_TO_U8(p, o) ((uint8_t*)p + o) +# define WHILE_DEST_BREAK 0 +# define PRE_LOOP_ADJUST +# define PRE_SWITCH_ADJUST + +#endif /* CONFIG_MEMCPY_PRE_INC_PTRS */ + +/* Definitions for endian-ness */ + +#ifdef CONFIG_ENDIAN_BIG + +# define SHL << +# define SHR >> + +#else /* CONFIG_ENDIAN_BIG */ + +# define SHL >> +# define SHR << + +#endif /* CONFIG_ENDIAN_BIG */ + +/******************************************************************** + * Macros for copying words of different alignment. + * Uses incremening pointers. + *******************************************************************/ + +#define CP_INCR() \ +{ \ + INC_VAL(dstN) = INC_VAL(srcN); \ +} + +#define CP_INCR_SH(shl, shr) \ +{ \ + dstWord = srcWord SHL shl; \ + srcWord = INC_VAL(srcN); \ + dstWord |= srcWord SHR shr; \ + INC_VAL(dstN) = dstWord; \ +} + +/******************************************************************** + * Macros for copying words of different alignment. + * Uses array indexes. + *******************************************************************/ + +#define CP_INDEX(idx) \ +{ \ + dstN[idx] = srcN[idx]; \ +} + +#define CP_INDEX_SH(x, shl, shr) \ +{ \ + dstWord = srcWord SHL shl; \ + srcWord = srcN[x]; \ + dstWord |= srcWord SHR shr; \ + dstN[x] = dstWord; \ +} + +/******************************************************************** + * Macros for copying words of different alignment. + * Uses incremening pointers or array indexes depending on + * configuration. + *******************************************************************/ + +#if defined (CONFIG_MEMCPY_INDEXED_COPY) + +# define CP(idx) CP_INDEX(idx) +# define CP_SH(idx, shl, shr) CP_INDEX_SH(idx, shl, shr) + +# define INC_INDEX(p, o) ((p) += (o)) + +#else /* CONFIG_MEMCPY_INDEXED_COPY */ + +# define CP(idx) CP_INCR() +# define CP_SH(idx, shl, shr) CP_INCR_SH(shl, shr) + +# define INC_INDEX(p, o) + +#endif /* CONFIG_MEMCPY_INDEXED_COPY */ + +#define COPY_REMAINING(count) \ +{ \ + START_VAL(dst8); \ + START_VAL(src8); \ + \ + switch (count) \ + { \ + case 7: INC_VAL(dst8) = INC_VAL(src8); \ + case 6: INC_VAL(dst8) = INC_VAL(src8); \ + case 5: INC_VAL(dst8) = INC_VAL(src8); \ + case 4: INC_VAL(dst8) = INC_VAL(src8); \ + case 3: INC_VAL(dst8) = INC_VAL(src8); \ + case 2: INC_VAL(dst8) = INC_VAL(src8); \ + case 1: INC_VAL(dst8) = INC_VAL(src8); \ + case 0: \ + default: break; \ + } \ +} + +#define COPY_NO_SHIFT() \ +{ \ + UIntN* dstN = (UIntN*)(dst8 PRE_LOOP_ADJUST); \ + UIntN* srcN = (UIntN*)(src8 PRE_LOOP_ADJUST); \ + size_t length = count / TYPE_WIDTH; \ + \ + while (length & 7) \ + { \ + CP_INCR(); \ + length--; \ + } \ + \ + length /= 8; \ + \ + while (length--) \ + { \ + CP(0); \ + CP(1); \ + CP(2); \ + CP(3); \ + CP(4); \ + CP(5); \ + CP(6); \ + CP(7); \ + \ + INC_INDEX(dstN, 8); \ + INC_INDEX(srcN, 8); \ + } \ + \ + src8 = CAST_TO_U8(srcN, 0); \ + dst8 = CAST_TO_U8(dstN, 0); \ + \ + COPY_REMAINING(count & (TYPE_WIDTH - 1)); \ + \ + return dest; \ +} + +#define COPY_SHIFT(shift) \ +{ \ + UIntN* dstN = (UIntN*)((((UIntN)dst8) PRE_LOOP_ADJUST) & \ + ~(TYPE_WIDTH - 1)); \ + UIntN* srcN = (UIntN*)((((UIntN)src8) PRE_LOOP_ADJUST) & \ + ~(TYPE_WIDTH - 1)); \ + size_t length = count / TYPE_WIDTH; \ + UIntN srcWord = INC_VAL(srcN); \ + UIntN dstWord; \ + \ + while (length & 7) \ + { \ + CP_INCR_SH(8 * shift, 8 * (TYPE_WIDTH - shift)); \ + length--; \ + } \ + \ + length /= 8; \ + \ + while (length--) \ + { \ + CP_SH(0, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(1, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(2, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(3, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(4, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(5, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(6, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + CP_SH(7, 8 * shift, 8 * (TYPE_WIDTH - shift)); \ + \ + INC_INDEX(dstN, 8); \ + INC_INDEX(srcN, 8); \ + } \ + \ + src8 = CAST_TO_U8(srcN, (shift - TYPE_WIDTH)); \ + dst8 = CAST_TO_U8(dstN, 0); \ + \ + COPY_REMAINING(count & (TYPE_WIDTH - 1)); \ + \ + return dest; \ +} + +/******************************************************************** + * Type Definitions + *******************************************************************/ + +#ifdef CONFIG_MEMCPY_64BIT +typedef uint64_t UIntN; +# define TYPE_WIDTH 8L +#else +typedef uint32_t UIntN; +# define TYPE_WIDTH 4L +#endif + +/******************************************************************** + * Public Functions + *******************************************************************/ +/******************************************************************** + * Name: memcpy + * + * Description: + * Copies count bytes from src to dest. No overlap check is performed. + * + * Input Parameters: + * dest - pointer to destination buffer + * src - pointer to source buffer + * count - number of bytes to copy + * + * Returned Value: + * A pointer to destination buffer + * + *******************************************************************/ + +void *memcpy(void *dest, const void *src, size_t count) +{ + uint8_t *dst8 = (uint8_t*)dest; + uint8_t *src8 = (uint8_t*)src; + + if (count < 8) + { + COPY_REMAINING(count); + return dest; + } + + START_VAL(dst8); + START_VAL(src8); + + while (((UIntN)dst8 & (TYPE_WIDTH - 1)) != WHILE_DEST_BREAK) + { + INC_VAL(dst8) = INC_VAL(src8); + count--; + } + + switch ((((UIntN)src8) PRE_SWITCH_ADJUST) & (TYPE_WIDTH - 1)) + { + case 0: COPY_NO_SHIFT(); break; + case 1: COPY_SHIFT(1); break; + case 2: COPY_SHIFT(2); break; + case 3: COPY_SHIFT(3); break; +#if TYPE_WIDTH > 4 + case 4: COPY_SHIFT(4); break; + case 5: COPY_SHIFT(5); break; + case 6: COPY_SHIFT(6); break; + case 7: COPY_SHIFT(7); break; +#endif + } + + return dest; +} diff --git a/nuttx/libc/termios/Make.defs b/nuttx/libc/termios/Make.defs index a6bb77f83..d20a5f95c 100644 --- a/nuttx/libc/termios/Make.defs +++ b/nuttx/libc/termios/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/misc/Make.defs +# libc/misc/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/termios/lib_cfgetspeed.c b/nuttx/libc/termios/lib_cfgetspeed.c index d7f0dc473..da10daac1 100644 --- a/nuttx/libc/termios/lib_cfgetspeed.c +++ b/nuttx/libc/termios/lib_cfgetspeed.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/termios/lib_cfgetspeed.c + * libc/termios/lib_cfgetspeed.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/termios/lib_cfsetspeed.c b/nuttx/libc/termios/lib_cfsetspeed.c index 714562ff5..a2a9475c4 100644 --- a/nuttx/libc/termios/lib_cfsetspeed.c +++ b/nuttx/libc/termios/lib_cfsetspeed.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/termios/lib_cfsetspeed.c + * libc/termios/lib_cfsetspeed.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/termios/lib_tcflush.c b/nuttx/libc/termios/lib_tcflush.c index 338524bdd..1a9710f6a 100644 --- a/nuttx/libc/termios/lib_tcflush.c +++ b/nuttx/libc/termios/lib_tcflush.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/termios/lib_tcflush.c + * libc/termios/lib_tcflush.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/termios/lib_tcgetattr.c b/nuttx/libc/termios/lib_tcgetattr.c index 500871d9f..e8d311260 100644 --- a/nuttx/libc/termios/lib_tcgetattr.c +++ b/nuttx/libc/termios/lib_tcgetattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/termios/lib_tcgetattr.c + * libc/termios/lib_tcgetattr.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/termios/lib_tcsetattr.c b/nuttx/libc/termios/lib_tcsetattr.c index 791b519c8..901f2a136 100644 --- a/nuttx/libc/termios/lib_tcsetattr.c +++ b/nuttx/libc/termios/lib_tcsetattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/termios/lib_tcsetattr.c + * libc/termios/lib_tcsetattr.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/Make.defs b/nuttx/libc/time/Make.defs index ab7414229..4848813d1 100644 --- a/nuttx/libc/time/Make.defs +++ b/nuttx/libc/time/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/time/Make.defs +# libc/time/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_calendar2utc.c b/nuttx/libc/time/lib_calendar2utc.c index e80c292fc..1b8c40a9e 100644 --- a/nuttx/libc/time/lib_calendar2utc.c +++ b/nuttx/libc/time/lib_calendar2utc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_calendar2utc.c + * libc/time/lib_calendar2utc.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_daysbeforemonth.c b/nuttx/libc/time/lib_daysbeforemonth.c index 8000b0e7a..28f4d67a9 100644 --- a/nuttx/libc/time/lib_daysbeforemonth.c +++ b/nuttx/libc/time/lib_daysbeforemonth.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_daysbeforemonth.c + * libc/time/lib_daysbeforemonth.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_gmtime.c b/nuttx/libc/time/lib_gmtime.c index 99afeded9..7a4d0f5e1 100644 --- a/nuttx/libc/time/lib_gmtime.c +++ b/nuttx/libc/time/lib_gmtime.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_gmtime.c + * libc/time/lib_gmtime.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_gmtimer.c b/nuttx/libc/time/lib_gmtimer.c index ba1c9724f..d98620527 100644 --- a/nuttx/libc/time/lib_gmtimer.c +++ b/nuttx/libc/time/lib_gmtimer.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_gmtimer.c + * libc/time/lib_gmtimer.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_isleapyear.c b/nuttx/libc/time/lib_isleapyear.c index 966c248e0..386e205b2 100644 --- a/nuttx/libc/time/lib_isleapyear.c +++ b/nuttx/libc/time/lib_isleapyear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_isleapyear.c + * libc/time/lib_isleapyear.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_mktime.c b/nuttx/libc/time/lib_mktime.c index 8c17e7c0a..25254d70e 100644 --- a/nuttx/libc/time/lib_mktime.c +++ b/nuttx/libc/time/lib_mktime.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_mktime.c + * libc/time/lib_mktime.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_strftime.c b/nuttx/libc/time/lib_strftime.c index cd0804f55..3b0c8dd8f 100644 --- a/nuttx/libc/time/lib_strftime.c +++ b/nuttx/libc/time/lib_strftime.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_strftime.c + * libc/time/lib_strftime.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/time/lib_time.c b/nuttx/libc/time/lib_time.c index 106a04c36..673f6fdcd 100644 --- a/nuttx/libc/time/lib_time.c +++ b/nuttx/libc/time/lib_time.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/time/lib_time.c + * libc/time/lib_time.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/unistd/Make.defs b/nuttx/libc/unistd/Make.defs index e1441a48d..67fce9b1d 100644 --- a/nuttx/libc/unistd/Make.defs +++ b/nuttx/libc/unistd/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# lib/unistd/Make.defs +# libc/unistd/Make.defs # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/libc/unistd/lib_chdir.c b/nuttx/libc/unistd/lib_chdir.c index 3dd1333ce..8953fb19b 100644 --- a/nuttx/libc/unistd/lib_chdir.c +++ b/nuttx/libc/unistd/lib_chdir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/unistd/lib_chdir.c + * libc/unistd/lib_chdir.c * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/unistd/lib_getcwd.c b/nuttx/libc/unistd/lib_getcwd.c index b94823300..717ef2971 100644 --- a/nuttx/libc/unistd/lib_getcwd.c +++ b/nuttx/libc/unistd/lib_getcwd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/unistd/lib_getcwd.c + * libc/unistd/lib_getcwd.c * * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/unistd/lib_getopt.c b/nuttx/libc/unistd/lib_getopt.c index 832d28721..1a9190976 100644 --- a/nuttx/libc/unistd/lib_getopt.c +++ b/nuttx/libc/unistd/lib_getopt.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/unistd/lib_getopt.c + * libc/unistd/lib_getopt.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/unistd/lib_getoptargp.c b/nuttx/libc/unistd/lib_getoptargp.c index 98a485016..5610342ca 100644 --- a/nuttx/libc/unistd/lib_getoptargp.c +++ b/nuttx/libc/unistd/lib_getoptargp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/unistd/lib_getoptargp.c + * libc/unistd/lib_getoptargp.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/unistd/lib_getoptindp.c b/nuttx/libc/unistd/lib_getoptindp.c index 7714f8e70..94ea4d3fc 100644 --- a/nuttx/libc/unistd/lib_getoptindp.c +++ b/nuttx/libc/unistd/lib_getoptindp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/unistd/lib_getoptindp.c + * libc/unistd/lib_getoptindp.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/libc/unistd/lib_getoptoptp.c b/nuttx/libc/unistd/lib_getoptoptp.c index 4805b7ac3..cd99b172f 100644 --- a/nuttx/libc/unistd/lib_getoptoptp.c +++ b/nuttx/libc/unistd/lib_getoptoptp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib/unistd/lib_getoptoptp.c + * libc/unistd/lib_getoptoptp.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt -- cgit v1.2.3 From 756aa6b90920d0087ad708c3ad10e091be79e46e Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 7 Dec 2012 16:00:56 +0000 Subject: Patches from Petteri Aimonen + stdbool and rand() changes for Freddie Chopin git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5415 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/ChangeLog.txt | 6 +- NxWidgets/libnxwidgets/include/cnxwidget.hxx | 2 +- NxWidgets/libnxwidgets/src/cscrollingpanel.cxx | 46 +- NxWidgets/nxwm/include/cstartwindow.hxx | 4 +- nuttx/ChangeLog | 23 +- nuttx/arch/8051/include/limits.h | 16 +- nuttx/arch/arm/include/limits.h | 18 +- nuttx/arch/avr/include/avr/limits.h | 18 +- nuttx/arch/avr/include/avr32/limits.h | 18 +- nuttx/arch/hc/include/hc12/limits.h | 19 +- nuttx/arch/hc/include/hcs12/limits.h | 19 +- nuttx/arch/mips/include/limits.h | 18 +- nuttx/arch/rgmp/include/limits.h | 18 +- nuttx/arch/sh/include/m16c/limits.h | 14 +- nuttx/arch/sh/include/sh1/limits.h | 18 +- nuttx/arch/sim/include/limits.h | 18 +- nuttx/arch/x86/include/i486/limits.h | 18 +- nuttx/arch/z16/include/limits.h | 22 +- nuttx/arch/z80/include/ez80/limits.h | 19 +- nuttx/arch/z80/include/z8/limits.h | 16 +- nuttx/arch/z80/include/z80/limits.h | 16 +- nuttx/drivers/mtd/Make.defs | 4 + nuttx/drivers/mtd/at25.c | 708 +++++++++++++++++++++++++ nuttx/drivers/mtd/ftl.c | 31 +- nuttx/graphics/nxtk/nxtk_getwindow.c | 11 +- nuttx/graphics/nxtk/nxtk_subwindowmove.c | 12 +- nuttx/include/cxx/cmath | 3 + nuttx/include/cxx/cstdlib | 1 + nuttx/include/nuttx/fs/fs.h | 2 +- nuttx/include/nuttx/math.h | 8 + nuttx/include/nuttx/mtd.h | 3 +- nuttx/include/stdbool.h | 35 +- nuttx/libc/math/Make.defs | 6 +- nuttx/libc/math/lib_round.c | 40 ++ nuttx/libc/math/lib_roundf.c | 38 ++ nuttx/libc/math/lib_roundl.c | 40 ++ nuttx/libc/stdlib/lib_rand.c | 33 +- nuttx/libxx/Kconfig | 8 + 38 files changed, 1157 insertions(+), 192 deletions(-) create mode 100644 nuttx/drivers/mtd/at25.c create mode 100644 nuttx/libc/math/lib_round.c create mode 100644 nuttx/libc/math/lib_roundf.c create mode 100644 nuttx/libc/math/lib_roundl.c (limited to 'nuttx/libc/math') diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index c3ae00d6a..7f7b21247 100644 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -213,4 +213,8 @@ Submitted by Petteri Aimonen. * NxWidgets:CText and NxWidgets:CNumericEdite: Fix some memory freeing bugs (from Petteri Aimonen). - \ No newline at end of file +* NxWidgets::CScrollingPanel: Usability improvements. It is borderless for now, + because there was no easy way to redraw only the required part of the border. + Contributed by Petteri Aimonen. +* NxWidgets::CNxWidgets and NxWM::CStartWindow: Small changes to make sub- + classing easier (from Petteri Aimonen). diff --git a/NxWidgets/libnxwidgets/include/cnxwidget.hxx b/NxWidgets/libnxwidgets/include/cnxwidget.hxx index 2ca055c1c..dda8efc1d 100644 --- a/NxWidgets/libnxwidgets/include/cnxwidget.hxx +++ b/NxWidgets/libnxwidgets/include/cnxwidget.hxx @@ -1058,7 +1058,7 @@ namespace NXWidgets * @return True if the click was successful. */ - bool click(nxgl_coord_t x, nxgl_coord_t y); + virtual bool click(nxgl_coord_t x, nxgl_coord_t y); /** * Check if the click is a double-click. diff --git a/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx index d3ee40cf9..b7c507bb2 100644 --- a/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx +++ b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx @@ -70,11 +70,12 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include #include +#include #include "cwidgetcontrol.hxx" #include "cscrollingpanel.hxx" @@ -113,6 +114,13 @@ CScrollingPanel::CScrollingPanel(CWidgetControl *pWidgetControl, : CNxWidget(pWidgetControl, x, y, width, height, flags, style) { m_widgetControl = pWidgetControl; + + // NOTE: CScrollingPanel is temporarily borderless because there was no + // easy way to redraw only the required part of the border. + + m_flags.permeable = true; + m_flags.borderless = true; + CRect rect; getClientRect(rect); @@ -120,12 +128,10 @@ CScrollingPanel::CScrollingPanel(CWidgetControl *pWidgetControl, m_canvasHeight = rect.getHeight(); m_canvasX = 0; m_canvasY = 0; - + setAllowsVerticalScroll(true); setAllowsHorizontalScroll(true); setContentScrolled(true); - - m_flags.permeable = true; } /** @@ -186,6 +192,24 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) CGraphicsPort *port = m_widgetControl->getGraphicsPort(); port->move(getX(), getY(), dx, dy, rect.getWidth(), rect.getHeight()); + if (dx > 0) + { + revealedRects.push_back(CRect(getX(), getY(), dx, rect.getHeight())); + } + else if (dx < 0) + { + revealedRects.push_back(CRect(getX() + rect.getWidth() + dx, getY(), -dx, rect.getHeight())); + } + + if (dy > 0) + { + revealedRects.push_back(CRect(getX(), getY(), rect.getWidth(), dy)); + } + else if (dy < 0) + { + revealedRects.push_back(CRect(getX(), getY() + rect.getHeight() + dy, rect.getWidth(), -dy)); + } + // Adjust the scroll values m_canvasY += dy; @@ -193,12 +217,20 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) if (revealedRects.size() > 0) { - // Draw revealed sections + // Draw background to revealed sections + // Children will redraw themselves in moveTo. for (int i = 0; i < revealedRects.size(); ++i) { - drawBorder(port); - drawContents(port); + CRect &rrect = revealedRects[i]; + + gvdbg("Redrawing %d,%d,%d,%d after scroll\n", + rrect.getX(), rrect.getY(), + rrect.getWidth(), rrect.getHeight()); + + port->drawFilledRect(rrect.getX(), rrect.getY(), + rrect.getWidth(), rrect.getHeight(), + getBackgroundColor()); } } } diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx index 671b01087..52a67fbd4 100644 --- a/NxWidgets/nxwm/include/cstartwindow.hxx +++ b/NxWidgets/nxwm/include/cstartwindow.hxx @@ -97,8 +97,8 @@ namespace NxWM */ class CStartWindow : public IApplication, - private IApplicationCallback, - private NXWidgets::CWidgetEventHandler + protected IApplicationCallback, + protected NXWidgets::CWidgetEventHandler { protected: /** diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index ab1412ae2..0ec0fdc3d 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3737,4 +3737,25 @@ * arch/z80/src/Makefile.sdccw: Renamed makefiles with extensions zdiil, zdiiw, sdccl, and sdccw for the ZDS-II vs SDCC compilers and for the POSIX vs Windows native builds. - + * nuttx/drivers/mtd/ftl.c: Fix for the flash translation layer. Short + unaligned writes were buggy. From Petteri Aimonen. + * nuttx/libc/math/lib_round*.c: Add rounding functions to the math + library. Contributed by Petteri Aimonen. + * include/cxx/cstdlib: Add stroul(). From Petteri Aimonen. + * arch/*/include/limits.h: Change signed minimum values from, for example, + (-128) to (-127 - 1) to avoid overflows under certain conditions. From + Peterri Aimonen. + * graphics/nxtk/nxtk_subwindowmove.c: Previously it was very difficult to + do e.g. "scroll by dx, dy". When given the full window area, nxtk_subwindowmove + would clip the offset always to 0,0. It makes more sense for it to clip the + source area and not modify the offset. From Petteri Aimonen. + * graphics/nxtk/nxtk_getwindow.c: Clipping would change the offset of returned + data, and caller has no way to know what the new offset would be. This messes + up font drawing when the text is partially out of window, e.g. when scrolling. + Also from Petteri Aimonen. + * include/stdbool.h: Can now be disabled for C++ files if CONFIG_C99_BOOL8 is + defined. CONFIG_C99_BOOL8 indicates (1) that the sizeof(_Bool) is one in both + C and C++, and (2) the the C compiler is C99 and supports the _Bool intrinsic + type. Requested by Freddie Chopin. + * include/stdlib/lib_rand.c: Various additional changes so that the integer + value zero can be returned. Requested by Freddie Chopin. diff --git a/nuttx/arch/8051/include/limits.h b/nuttx/arch/8051/include/limits.h index f3021f6cc..fd8c086aa 100644 --- a/nuttx/arch/8051/include/limits.h +++ b/nuttx/arch/8051/include/limits.h @@ -45,7 +45,7 @@ ************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,17 +59,17 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-32768) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 32767 -#define UINT_MAX 65535 +#define UINT_MAX 65535U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL @@ -77,8 +77,8 @@ * first byte holding data space information. */ -#define PTR_MIN (-8388608) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 8388607 -#define UPTR_MAX 16777215 +#define UPTR_MAX 16777215U #endif /* __ARCH_8051_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/arm/include/limits.h b/nuttx/arch/arm/include/limits.h index 12c92f6cf..640db7e7b 100644 --- a/nuttx/arch/arm/include/limits.h +++ b/nuttx/arch/arm/include/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,28 +59,28 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 4 bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_ARM_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/avr/include/avr/limits.h b/nuttx/arch/avr/include/avr/limits.h index 67d66ce7a..db97a9a4a 100644 --- a/nuttx/arch/avr/include/avr/limits.h +++ b/nuttx/arch/avr/include/avr/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,31 +59,31 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U /* Integer is two bytes */ -#define INT_MIN (-32768) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 32767 -#define UINT_MAX 65535 +#define UINT_MAX 65535U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is two bytes */ -#define PTR_MIN (-32768) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 32767 -#define UPTR_MAX 65535 +#define UPTR_MAX 65535U #endif /* __ARCH_AVR_INCLUDE_AVR_LIMITS_H */ diff --git a/nuttx/arch/avr/include/avr32/limits.h b/nuttx/arch/avr/include/avr32/limits.h index f4fad08ff..ce3dd783d 100644 --- a/nuttx/arch/avr/include/avr32/limits.h +++ b/nuttx/arch/avr/include/avr32/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,31 +59,31 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U /* Integer is four bytes */ -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is four bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_AVR_INCLUDE_AVR32_LIMITS_H */ diff --git a/nuttx/arch/hc/include/hc12/limits.h b/nuttx/arch/hc/include/hc12/limits.h index edb92c7e6..c35148a56 100644 --- a/nuttx/arch/hc/include/hc12/limits.h +++ b/nuttx/arch/hc/include/hc12/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,39 +59,38 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U /* The size of an integer is controlled with the -mshort or -mnoshort GCC * options. GCC will set the pre-defined symbol __INT__ to indicate the size * of an integer */ +#define INT_MIN (-INT_MAX - 1) #if __INT__ == 32 -# define INT_MIN (-2147483648) # define INT_MAX 2147483647 # define UINT_MAX 4294967295 #else -# define INT_MIN (-32768) # define INT_MAX 32767 -# define UINT_MAX 65535 +# define UINT_MAX 65535U #endif /* Long is 4-bytes and long long is 8 bytes in any case */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 2 bytes */ -#define PTR_MIN (-32768) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 32767 -#define UPTR_MAX 65535 +#define UPTR_MAX 65535U #endif /* __ARCH_HC_INCLUDE_HC12_LIMITS_H */ diff --git a/nuttx/arch/hc/include/hcs12/limits.h b/nuttx/arch/hc/include/hcs12/limits.h index 597626484..5b10d910f 100644 --- a/nuttx/arch/hc/include/hcs12/limits.h +++ b/nuttx/arch/hc/include/hcs12/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,39 +59,38 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U /* The size of an integer is controlled with the -mshort or -mnoshort GCC * options. GCC will set the pre-defined symbol __INT__ to indicate the size * of an integer */ +#define INT_MIN (-INT_MAX - 1) #if __INT__ == 32 -# define INT_MIN (-2147483648) # define INT_MAX 2147483647 # define UINT_MAX 4294967295 #else -# define INT_MIN (-32768) # define INT_MAX 32767 -# define UINT_MAX 65535 +# define UINT_MAX 65535U #endif /* Long is 4-bytes and long long is 8 bytes in any case */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 2 bytes */ -#define PTR_MIN (-32768) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 32767 -#define UPTR_MAX 65535 +#define UPTR_MAX 65535U #endif /* __ARCH_HC_INCLUDE_HCS12_LIMITS_H */ diff --git a/nuttx/arch/mips/include/limits.h b/nuttx/arch/mips/include/limits.h index 4feff7fe1..04001e55c 100644 --- a/nuttx/arch/mips/include/limits.h +++ b/nuttx/arch/mips/include/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,29 +59,29 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 4 bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_MIPS_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/rgmp/include/limits.h b/nuttx/arch/rgmp/include/limits.h index fdd8bfd10..a4458e301 100644 --- a/nuttx/arch/rgmp/include/limits.h +++ b/nuttx/arch/rgmp/include/limits.h @@ -45,7 +45,7 @@ ************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,28 +59,28 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 4 bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_RGMP_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/sh/include/m16c/limits.h b/nuttx/arch/sh/include/m16c/limits.h index d836522e7..dba3e4fdc 100644 --- a/nuttx/arch/sh/include/m16c/limits.h +++ b/nuttx/arch/sh/include/m16c/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,9 +59,9 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U /* For M16C, type int is 16-bits, the same size as type 'short int' */ @@ -71,18 +71,18 @@ /* For M16C, typle 'long int' is 32-bits */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 2 bytes */ -#define PTR_MIN (-32768) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 32767 -#define UPTR_MAX 65535 +#define UPTR_MAX 65535U #endif /* __ARCH_SH_INCLUDE_M16C_LIMITS_H */ diff --git a/nuttx/arch/sh/include/sh1/limits.h b/nuttx/arch/sh/include/sh1/limits.h index ce9085bfb..33c8ebcd3 100644 --- a/nuttx/arch/sh/include/sh1/limits.h +++ b/nuttx/arch/sh/include/sh1/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,30 +59,30 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U /* On SH-1, type 'int' is 32-bits */ -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U /* On SH-1, type 'long' is the same size as type 'int', 32-bits */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 4 bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_SH_INCLUDE_SH1_LIMITS_H */ diff --git a/nuttx/arch/sim/include/limits.h b/nuttx/arch/sim/include/limits.h index 9aa36b1d0..9288cb585 100644 --- a/nuttx/arch/sim/include/limits.h +++ b/nuttx/arch/sim/include/limits.h @@ -45,7 +45,7 @@ ************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,28 +59,28 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 4 bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_SIM_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/x86/include/i486/limits.h b/nuttx/arch/x86/include/i486/limits.h index c2a9a620f..aa167a0af 100644 --- a/nuttx/arch/x86/include/i486/limits.h +++ b/nuttx/arch/x86/include/i486/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,28 +59,28 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-9223372036854775808LL) +#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL /* A pointer is 4 bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_X86_INCLUDE_I486_LIMITS_H */ diff --git a/nuttx/arch/z16/include/limits.h b/nuttx/arch/z16/include/limits.h index 55ee7a2c5..6601c4737 100644 --- a/nuttx/arch/z16/include/limits.h +++ b/nuttx/arch/z16/include/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,26 +59,26 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-2147483648) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 2147483647 -#define UINT_MAX 4294967295 +#define UINT_MAX 4294967295U -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL -#define LLONG_MIN (-2147483648L) -#define LLONG_MAX 2147483647L -#define ULLONG_MAX 4294967295UL +#define LLONG_MIN (-LLONG_MAX - 1) +#define LLONG_MAX 2147483647LL +#define ULLONG_MAX 4294967295ULL /* A pointer is 4 bytes */ -#define PTR_MIN (-2147483648) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295 +#define UPTR_MAX 4294967295U #endif /* __ARCH_Z16_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/z80/include/ez80/limits.h b/nuttx/arch/z80/include/ez80/limits.h index 1dfa2afee..9e27b14e6 100644 --- a/nuttx/arch/z80/include/ez80/limits.h +++ b/nuttx/arch/z80/include/ez80/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,17 +59,17 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-32768) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 32767 -#define UINT_MAX 65535 +#define UINT_MAX 65535U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL @@ -80,14 +80,13 @@ * ADL mode - 24 bits */ +#define PTR_MIN (-PTR_MAX - 1) #ifdef CONFIG_EZ80_Z80MODE -#define PTR_MIN (-32768) #define PTR_MAX 32767 -#define UPTR_MAX 65535 +#define UPTR_MAX 65535U #else -#define PTR_MIN (-8388608) #define PTR_MAX 8388607 -#define UPTR_MAX 16777215 +#define UPTR_MAX 16777215U #endif #endif /* __ARCH_Z80_INCLUDE_EZ80_LIMITS_H */ diff --git a/nuttx/arch/z80/include/z8/limits.h b/nuttx/arch/z80/include/z8/limits.h index 94614ee25..724d8c98d 100644 --- a/nuttx/arch/z80/include/z8/limits.h +++ b/nuttx/arch/z80/include/z8/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,24 +59,24 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-32768) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 32767 -#define UINT_MAX 65535 +#define UINT_MAX 65535U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL /* A pointer is 2 bytes */ -#define PTR_MIN (-32768) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 32767 -#define UPTR_MAX 65535 +#define UPTR_MAX 65535U #endif /* __ARCH_Z80_INCLUDE_Z8_LIMITS_H */ diff --git a/nuttx/arch/z80/include/z80/limits.h b/nuttx/arch/z80/include/z80/limits.h index ff5770442..f1a1c1e17 100644 --- a/nuttx/arch/z80/include/z80/limits.h +++ b/nuttx/arch/z80/include/z80/limits.h @@ -45,7 +45,7 @@ ****************************************************************************/ #define CHAR_BIT 8 -#define SCHAR_MIN (-128) +#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MAX 127 #define UCHAR_MAX 255 @@ -59,24 +59,24 @@ #define CHAR_MAX SCHAR_MAX #endif -#define SHRT_MIN (-32768) +#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MAX 32767 -#define USHRT_MAX 65535 +#define USHRT_MAX 65535U -#define INT_MIN (-32768) +#define INT_MIN (-INT_MAX - 1) #define INT_MAX 32767 -#define UINT_MAX 65535 +#define UINT_MAX 65535U /* These change on 32-bit and 64-bit platforms */ -#define LONG_MIN (-2147483648L) +#define LONG_MIN (-LONG_MAX - 1) #define LONG_MAX 2147483647L #define ULONG_MAX 4294967295UL /* A pointer is 2 bytes */ -#define PTR_MIN (-32768) +#define PTR_MIN (-PTR_MAX - 1) #define PTR_MAX 32767 -#define UPTR_MAX 65535 +#define UPTR_MAX 65535U #endif /* __ARCH_Z80_INCLUDE_Z80_LIMITS_H */ diff --git a/nuttx/drivers/mtd/Make.defs b/nuttx/drivers/mtd/Make.defs index 258e77ec9..7db7592d4 100644 --- a/nuttx/drivers/mtd/Make.defs +++ b/nuttx/drivers/mtd/Make.defs @@ -51,6 +51,10 @@ ifeq ($(CONFIG_MTD_W25),y) CSRCS += w25.c endif +ifeq ($(CONFIG_MTD_AT25),y) +CSRCS += at25.c +endif + # Include MTD driver support DEPPATH += --dep-path mtd diff --git a/nuttx/drivers/mtd/at25.c b/nuttx/drivers/mtd/at25.c new file mode 100644 index 000000000..e35b794a5 --- /dev/null +++ b/nuttx/drivers/mtd/at25.c @@ -0,0 +1,708 @@ +/************************************************************************************ + * drivers/mtd/at25.c + * Driver for SPI-based AT25DF321 (32Mbit) flash. + * + * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * Petteri Aimonen + * + * 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 +#include +#include + +#include +#include +#include +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +#ifndef CONFIG_AT25_SPIMODE +# define CONFIG_AT25_SPIMODE SPIDEV_MODE0 +#endif + +/* AT25 Registers *******************************************************************/ +/* Indentification register values */ + +#define AT25_MANUFACTURER 0x1F +#define AT25_AT25DF321_TYPE 0x47 /* 32 M-bit */ + +/* AT25DF321 capacity is 4,194,304 bytes: + * (64 sectors) * (65,536 bytes per sector) + * (16384 pages) * (256 bytes per page) + */ + +#define AT25_AT25DF321_SECTOR_SHIFT 12 /* Sector size 1 << 12 = 4096 */ +#define AT25_AT25DF321_NSECTORS 1024 +#define AT25_AT25DF321_PAGE_SHIFT 9 /* Page size 1 << 9 = 512 */ +#define AT25_AT25DF321_NPAGES 8192 + +/* Instructions */ +/* Command Value N Description Addr Dummy Data */ +#define AT25_WREN 0x06 /* 1 Write Enable 0 0 0 */ +#define AT25_WRDI 0x04 /* 1 Write Disable 0 0 0 */ +#define AT25_RDID 0x9f /* 1 Read Identification 0 0 1-3 */ +#define AT25_RDSR 0x05 /* 1 Read Status Register 0 0 >=1 */ +#define AT25_WRSR 0x01 /* 1 Write Status Register 0 0 1 */ +#define AT25_READ 0x03 /* 1 Read Data Bytes 3 0 >=1 */ +#define AT25_FAST_READ 0x0b /* 1 Higher speed read 3 1 >=1 */ +#define AT25_PP 0x02 /* 1 Page Program 3 0 1-256 */ +#define AT25_SE 0x20 /* 1 Sector Erase 3 0 0 */ +#define AT25_BE 0xc7 /* 1 Bulk Erase 0 0 0 */ +#define AT25_DP 0xb9 /* 2 Deep power down 0 0 0 */ +#define AT25_RES 0xab /* 2 Read Electronic Signature 0 3 >=1 */ + +/* Status register bit definitions */ + +#define AT25_SR_WIP (1 << 0) /* Bit 0: Write in progress bit */ +#define AT25_SR_WEL (1 << 1) /* Bit 1: Write enable latch bit */ +#define AT25_SR_EPE (1 << 5) /* Bit 5: Erase/program error */ +#define AT25_SR_UNPROT 0x00 /* Global unprotect command */ + +#define AT25_DUMMY 0xa5 + +/************************************************************************************ + * Private Types + ************************************************************************************/ + +/* This type represents the state of the MTD device. The struct mtd_dev_s + * must appear at the beginning of the definition so that you can freely + * cast between pointers to struct mtd_dev_s and struct at25_dev_s. + */ + +struct at25_dev_s +{ + struct mtd_dev_s mtd; /* MTD interface */ + FAR struct spi_dev_s *dev; /* Saved SPI interface instance */ + uint8_t sectorshift; /* 16 or 18 */ + uint8_t pageshift; /* 8 */ + uint16_t nsectors; /* 128 or 64 */ + uint32_t npages; /* 32,768 or 65,536 */ +}; + +/************************************************************************************ + * Private Function Prototypes + ************************************************************************************/ + +/* Helpers */ + +static void at25_lock(FAR struct spi_dev_s *dev); +static inline void at25_unlock(FAR struct spi_dev_s *dev); +static inline int at25_readid(struct at25_dev_s *priv); +static void at25_waitwritecomplete(struct at25_dev_s *priv); +static void at25_writeenable(struct at25_dev_s *priv); +static inline void at25_sectorerase(struct at25_dev_s *priv, off_t offset); +static inline int at25_bulkerase(struct at25_dev_s *priv); +static inline void at25_pagewrite(struct at25_dev_s *priv, FAR const uint8_t *buffer, + off_t offset); + +/* MTD driver methods */ + +static int at25_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks); +static ssize_t at25_bread(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks, FAR uint8_t *buf); +static ssize_t at25_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks, FAR const uint8_t *buf); +static ssize_t at25_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, + FAR uint8_t *buffer); +static int at25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg); + +/************************************************************************************ + * Private Data + ************************************************************************************/ + +/************************************************************************************ + * Private Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: at25_lock + ************************************************************************************/ + +static void at25_lock(FAR struct spi_dev_s *dev) +{ + /* On SPI busses where there are multiple devices, it will be necessary to + * lock SPI to have exclusive access to the busses for a sequence of + * transfers. The bus should be locked before the chip is selected. + * + * This is a blocking call and will not return until we have exclusiv access to + * the SPI buss. We will retain that exclusive access until the bus is unlocked. + */ + + (void)SPI_LOCK(dev, true); + + /* After locking the SPI bus, the we also need call the setfrequency, setbits, and + * setmode methods to make sure that the SPI is properly configured for the device. + * If the SPI buss is being shared, then it may have been left in an incompatible + * state. + */ + + SPI_SETMODE(dev, CONFIG_AT25_SPIMODE); + SPI_SETBITS(dev, 8); + (void)SPI_SETFREQUENCY(dev, 20000000); +} + +/************************************************************************************ + * Name: at25_unlock + ************************************************************************************/ + +static inline void at25_unlock(FAR struct spi_dev_s *dev) +{ + (void)SPI_LOCK(dev, false); +} + +/************************************************************************************ + * Name: at25_readid + ************************************************************************************/ + +static inline int at25_readid(struct at25_dev_s *priv) +{ + uint16_t manufacturer; + uint16_t memory; + uint16_t version; + + fvdbg("priv: %p\n", priv); + + /* Lock the SPI bus, configure the bus, and select this FLASH part. */ + + at25_lock(priv->dev); + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + + /* Send the "Read ID (RDID)" command and read the first three ID bytes */ + + (void)SPI_SEND(priv->dev, AT25_RDID); + manufacturer = SPI_SEND(priv->dev, AT25_DUMMY); + memory = SPI_SEND(priv->dev, AT25_DUMMY); + + /* Deselect the FLASH and unlock the bus */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + at25_unlock(priv->dev); + + fvdbg("manufacturer: %02x memory: %02x\n", + manufacturer, memory); + + /* Check for a valid manufacturer and memory type */ + + if (manufacturer == AT25_MANUFACTURER && memory == AT25_AT25DF321_TYPE) + { + priv->sectorshift = AT25_AT25DF321_SECTOR_SHIFT; + priv->nsectors = AT25_AT25DF321_NSECTORS; + priv->pageshift = AT25_AT25DF321_PAGE_SHIFT; + priv->npages = AT25_AT25DF321_NPAGES; + return OK; + } + + return -ENODEV; +} + +/************************************************************************************ + * Name: at25_waitwritecomplete + ************************************************************************************/ + +static void at25_waitwritecomplete(struct at25_dev_s *priv) +{ + uint8_t status; + + /* Are we the only device on the bus? */ + +#ifdef CONFIG_SPI_OWNBUS + + /* Select this FLASH part */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + + /* Send "Read Status Register (RDSR)" command */ + + (void)SPI_SEND(priv->dev, AT25_RDSR); + + /* Loop as long as the memory is busy with a write cycle */ + + do + { + /* Send a dummy byte to generate the clock needed to shift out the status */ + + status = SPI_SEND(priv->dev, AT25_DUMMY); + } + while ((status & AT25_SR_WIP) != 0); + + /* Deselect the FLASH */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + +#else + + /* Loop as long as the memory is busy with a write cycle */ + + do + { + /* Select this FLASH part */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + + /* Send "Read Status Register (RDSR)" command */ + + (void)SPI_SEND(priv->dev, AT25_RDSR); + + /* Send a dummy byte to generate the clock needed to shift out the status */ + + status = SPI_SEND(priv->dev, AT25_DUMMY); + + /* Deselect the FLASH */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + + /* Given that writing could take up to few tens of milliseconds, and erasing + * could take more. The following short delay in the "busy" case will allow + * other peripherals to access the SPI bus. + */ + + if ((status & AT25_SR_WIP) != 0) + { + at25_unlock(priv->dev); + usleep(10000); + at25_lock(priv->dev); + } + } + while ((status & AT25_SR_WIP) != 0); +#endif + + if (status & AT25_SR_EPE) + { + fdbg("Write error, status: 0x%02x\n", status); + } + + fvdbg("Complete, status: 0x%02x\n", status); +} + +/************************************************************************************ + * Name: at25_writeenable + ************************************************************************************/ + +static void at25_writeenable(struct at25_dev_s *priv) +{ + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + (void)SPI_SEND(priv->dev, AT25_WREN); + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + fvdbg("Enabled\n"); +} + +/************************************************************************************ + * Name: at25_sectorerase + ************************************************************************************/ + +static inline void at25_sectorerase(struct at25_dev_s *priv, off_t sector) +{ + off_t offset = sector << priv->sectorshift; + + fvdbg("sector: %08lx\n", (long)sector); + + /* Wait for any preceding write to complete. We could simplify things by + * perform this wait at the end of each write operation (rather than at + * the beginning of ALL operations), but have the wait first will slightly + * improve performance. + */ + + at25_waitwritecomplete(priv); + + /* Send write enable instruction */ + + at25_writeenable(priv); + + /* Select this FLASH part */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + + /* Send the "Sector Erase (SE)" instruction */ + + (void)SPI_SEND(priv->dev, AT25_SE); + + /* Send the sector offset high byte first. For all of the supported + * parts, the sector number is completely contained in the first byte + * and the values used in the following two bytes don't really matter. + */ + + (void)SPI_SEND(priv->dev, (offset >> 16) & 0xff); + (void)SPI_SEND(priv->dev, (offset >> 8) & 0xff); + (void)SPI_SEND(priv->dev, offset & 0xff); + + /* Deselect the FLASH */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + fvdbg("Erased\n"); +} + +/************************************************************************************ + * Name: at25_bulkerase + ************************************************************************************/ + +static inline int at25_bulkerase(struct at25_dev_s *priv) +{ + fvdbg("priv: %p\n", priv); + + /* Wait for any preceding write to complete. We could simplify things by + * perform this wait at the end of each write operation (rather than at + * the beginning of ALL operations), but have the wait first will slightly + * improve performance. + */ + + at25_waitwritecomplete(priv); + + /* Send write enable instruction */ + + at25_writeenable(priv); + + /* Select this FLASH part */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + + /* Send the "Bulk Erase (BE)" instruction */ + + (void)SPI_SEND(priv->dev, AT25_BE); + + /* Deselect the FLASH */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + fvdbg("Return: OK\n"); + return OK; +} + +/************************************************************************************ + * Name: at25_pagewrite + ************************************************************************************/ + +static inline void at25_pagewrite(struct at25_dev_s *priv, FAR const uint8_t *buffer, + off_t page) +{ + off_t offset = page << 8; + + fvdbg("page: %08lx offset: %08lx\n", (long)page, (long)offset); + + /* Wait for any preceding write to complete. We could simplify things by + * perform this wait at the end of each write operation (rather than at + * the beginning of ALL operations), but have the wait first will slightly + * improve performance. + */ + + at25_waitwritecomplete(priv); + + /* Enable the write access to the FLASH */ + + at25_writeenable(priv); + + /* Select this FLASH part */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + + /* Send "Page Program (PP)" command */ + + (void)SPI_SEND(priv->dev, AT25_PP); + + /* Send the page offset high byte first. */ + + (void)SPI_SEND(priv->dev, (offset >> 16) & 0xff); + (void)SPI_SEND(priv->dev, (offset >> 8) & 0xff); + (void)SPI_SEND(priv->dev, offset & 0xff); + + /* Then write the specified number of bytes */ + + SPI_SNDBLOCK(priv->dev, buffer, 256); + + /* Deselect the FLASH: Chip Select high */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + fvdbg("Written\n"); +} + +/************************************************************************************ + * Name: at25_erase + ************************************************************************************/ + +static int at25_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks) +{ + FAR struct at25_dev_s *priv = (FAR struct at25_dev_s *)dev; + size_t blocksleft = nblocks; + + fvdbg("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks); + + /* Lock access to the SPI bus until we complete the erase */ + + at25_lock(priv->dev); + while (blocksleft-- > 0) + { + /* Erase each sector */ + + at25_sectorerase(priv, startblock); + startblock++; + } + + at25_unlock(priv->dev); + return (int)nblocks; +} + +/************************************************************************************ + * Name: at25_bread + ************************************************************************************/ + +static ssize_t at25_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, + FAR uint8_t *buffer) +{ + FAR struct at25_dev_s *priv = (FAR struct at25_dev_s *)dev; + ssize_t nbytes; + + fvdbg("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks); + + /* On this device, we can handle the block read just like the byte-oriented read */ + + nbytes = at25_read(dev, startblock << priv->pageshift, nblocks << priv->pageshift, buffer); + if (nbytes > 0) + { + return nbytes >> priv->pageshift; + } + + return (int)nbytes; +} + +/************************************************************************************ + * Name: at25_bwrite + ************************************************************************************/ + +static ssize_t at25_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, + FAR const uint8_t *buffer) +{ + FAR struct at25_dev_s *priv = (FAR struct at25_dev_s *)dev; + size_t blocksleft = nblocks; + + fvdbg("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks); + + /* Lock the SPI bus and write each page to FLASH */ + + at25_lock(priv->dev); + while (blocksleft-- > 0) + { + at25_pagewrite(priv, buffer, startblock * 2); + at25_pagewrite(priv, buffer + 256, startblock * 2 + 1); + buffer += 1 << priv->pageshift; + startblock++; + } + + at25_unlock(priv->dev); + return nblocks; +} + +/************************************************************************************ + * Name: at25_read + ************************************************************************************/ + +static ssize_t at25_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, + FAR uint8_t *buffer) +{ + FAR struct at25_dev_s *priv = (FAR struct at25_dev_s *)dev; + + fvdbg("offset: %08lx nbytes: %d\n", (long)offset, (int)nbytes); + + /* Wait for any preceding write to complete. We could simplify things by + * perform this wait at the end of each write operation (rather than at + * the beginning of ALL operations), but have the wait first will slightly + * improve performance. + */ + + at25_waitwritecomplete(priv); + + /* Lock the SPI bus and select this FLASH part */ + + at25_lock(priv->dev); + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + + /* Send "Read from Memory " instruction */ + + (void)SPI_SEND(priv->dev, AT25_READ); + + /* Send the page offset high byte first. */ + + (void)SPI_SEND(priv->dev, (offset >> 16) & 0xff); + (void)SPI_SEND(priv->dev, (offset >> 8) & 0xff); + (void)SPI_SEND(priv->dev, offset & 0xff); + + /* Then read all of the requested bytes */ + + SPI_RECVBLOCK(priv->dev, buffer, nbytes); + + /* Deselect the FLASH and unlock the SPI bus */ + + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + at25_unlock(priv->dev); + + fvdbg("return nbytes: %d\n", (int)nbytes); + return nbytes; +} + +/************************************************************************************ + * Name: at25_ioctl + ************************************************************************************/ + +static int at25_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) +{ + FAR struct at25_dev_s *priv = (FAR struct at25_dev_s *)dev; + int ret = -EINVAL; /* Assume good command with bad parameters */ + + fvdbg("cmd: %d \n", cmd); + + switch (cmd) + { + case MTDIOC_GEOMETRY: + { + FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)((uintptr_t)arg); + if (geo) + { + /* Populate the geometry structure with information need to know + * the capacity and how to access the device. + * + * NOTE: that the device is treated as though it where just an array + * of fixed size blocks. That is most likely not true, but the client + * will expect the device logic to do whatever is necessary to make it + * appear so. + */ + + geo->blocksize = (1 << priv->pageshift); + geo->erasesize = (1 << priv->sectorshift); + geo->neraseblocks = priv->nsectors; + ret = OK; + + fvdbg("blocksize: %d erasesize: %d neraseblocks: %d\n", + geo->blocksize, geo->erasesize, geo->neraseblocks); + } + } + break; + + case MTDIOC_BULKERASE: + { + /* Erase the entire device */ + + at25_lock(priv->dev); + ret = at25_bulkerase(priv); + at25_unlock(priv->dev); + } + break; + + case MTDIOC_XIPBASE: + default: + ret = -ENOTTY; /* Bad command */ + break; + } + + fvdbg("return %d\n", ret); + return ret; +} + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: at25_initialize + * + * Description: + * Create an initialize MTD device instance. MTD devices are not registered + * in the file system, but are created as instances that can be bound to + * other functions (such as a block or character driver front end). + * + ************************************************************************************/ + +FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev) +{ + FAR struct at25_dev_s *priv; + int ret; + + fvdbg("dev: %p\n", dev); + + /* Allocate a state structure (we allocate the structure instead of using + * a fixed, static allocation so that we can handle multiple FLASH devices. + * The current implementation would handle only one FLASH part per SPI + * device (only because of the SPIDEV_FLASH definition) and so would have + * to be extended to handle multiple FLASH parts on the same SPI bus. + */ + + priv = (FAR struct at25_dev_s *)kmalloc(sizeof(struct at25_dev_s)); + if (priv) + { + /* Initialize the allocated structure */ + + priv->mtd.erase = at25_erase; + priv->mtd.bread = at25_bread; + priv->mtd.bwrite = at25_bwrite; + priv->mtd.read = at25_read; + priv->mtd.ioctl = at25_ioctl; + priv->dev = dev; + + /* Deselect the FLASH */ + + SPI_SELECT(dev, SPIDEV_FLASH, false); + + /* Identify the FLASH chip and get its capacity */ + + ret = at25_readid(priv); + if (ret != OK) + { + /* Unrecognized! Discard all of that work we just did and return NULL */ + + fdbg("Unrecognized\n"); + kfree(priv); + priv = NULL; + } + + /* Unprotect all sectors */ + + at25_writeenable(priv); + SPI_SELECT(priv->dev, SPIDEV_FLASH, true); + (void)SPI_SEND(priv->dev, AT25_WRSR); + (void)SPI_SEND(priv->dev, AT25_SR_UNPROT); + SPI_SELECT(priv->dev, SPIDEV_FLASH, false); + } + + /* Return the implementation-specific state structure as the MTD device */ + + fvdbg("Return %p\n", priv); + return (FAR struct mtd_dev_s *)priv; +} diff --git a/nuttx/drivers/mtd/ftl.c b/nuttx/drivers/mtd/ftl.c index cdb35aa5c..6cf8f0317 100644 --- a/nuttx/drivers/mtd/ftl.c +++ b/nuttx/drivers/mtd/ftl.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/mtd/ftl.c * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -229,6 +229,10 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, remaining = nblocks; if (alignedblock > startblock) { + /* Check if the write is shorter than to the end of the erase block */ + + bool short_write = (remaining < (alignedblock - startblock)); + /* Read the full erase block into the buffer */ rwblock = startblock & ~mask; @@ -252,9 +256,19 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, /* Copy the user data at the end of the buffered erase block */ offset = (startblock & mask) * dev->geo.blocksize; - nbytes = dev->geo.erasesize - offset; + + if (short_write) + { + nbytes = remaining * dev->geo.blocksize; + } + else + { + nbytes = dev->geo.erasesize - offset; + } + fvdbg("Copy %d bytes into erase block=%d at offset=%d\n", nbytes, eraseblock, offset); + memcpy(dev->eblock + offset, buffer, nbytes); /* And write the erase back to flash */ @@ -268,8 +282,16 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, /* Then update for amount written */ - remaining -= dev->blkper - (startblock & mask); - buffer += nbytes; + if (short_write) + { + remaining = 0; + } + else + { + remaining -= dev->blkper - (startblock & mask); + } + + buffer += nbytes; } /* How handle full erase pages in the middle */ @@ -290,6 +312,7 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer, fvdbg("Write %d bytes into erase block=%d at offset=0\n", dev->geo.erasesize, alignedblock); + nxfrd = MTD_BWRITE(dev->mtd, alignedblock, dev->blkper, buffer); if (nxfrd != dev->blkper) { diff --git a/nuttx/graphics/nxtk/nxtk_getwindow.c b/nuttx/graphics/nxtk/nxtk_getwindow.c index 121c7702a..c91f2d22f 100644 --- a/nuttx/graphics/nxtk/nxtk_getwindow.c +++ b/nuttx/graphics/nxtk/nxtk_getwindow.c @@ -110,12 +110,15 @@ int nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, } #endif - /* Clip the rectangle so that it lies within the sub-window bounds - * then move the rectangle to that it is relative to the containing - * window. + /* Move the rectangle to that it is relative to the containing + * window. If part of the rectangle lies outside the window, + * it will contain garbage data, but the contained area will be + * valid. */ - nxtk_subwindowclip(fwnd, &getrect, rect, &fwnd->fwrect); + nxgl_rectoffset(&getrect, rect, + fwnd->fwrect.pt1.x - fwnd->wnd.bounds.pt1.x, + fwnd->fwrect.pt1.y - fwnd->wnd.bounds.pt1.y); /* Then get it */ diff --git a/nuttx/graphics/nxtk/nxtk_subwindowmove.c b/nuttx/graphics/nxtk/nxtk_subwindowmove.c index a6fd9f5dd..3c2bb7f37 100644 --- a/nuttx/graphics/nxtk/nxtk_subwindowmove.c +++ b/nuttx/graphics/nxtk/nxtk_subwindowmove.c @@ -112,21 +112,19 @@ void nxtk_subwindowmove(FAR struct nxtk_framedwindow_s *fwnd, nxgl_rectintersect(&abssrc, &abssrc, &fwnd->fwrect); - /* Clip the offset so that the source rectangle does not move out of the - * the client sub-window. - */ + /* Clip the source rectangle so that destination area is within the window. */ destoffset->x = srcoffset->x; if (destoffset->x < 0) { if (abssrc.pt1.x + destoffset->x < bounds->pt1.x) { - destoffset->x = bounds->pt1.x - abssrc.pt1.x; + abssrc.pt1.x = bounds->pt1.x - destoffset->x; } } else if (abssrc.pt2.x + destoffset->x > bounds->pt2.x) { - destoffset->x = bounds->pt2.x - abssrc.pt2.x; + abssrc.pt2.x = bounds->pt2.x - destoffset->x; } destoffset->y = srcoffset->y; @@ -134,12 +132,12 @@ void nxtk_subwindowmove(FAR struct nxtk_framedwindow_s *fwnd, { if (abssrc.pt1.y + destoffset->y < bounds->pt1.y) { - destoffset->y = bounds->pt1.y - abssrc.pt1.y; + abssrc.pt1.y = bounds->pt1.y - destoffset->y; } } else if (abssrc.pt2.y + destoffset->y > bounds->pt2.y) { - destoffset->y = bounds->pt2.y - abssrc.pt2.y; + abssrc.pt2.y = bounds->pt2.y - destoffset->y; } diff --git a/nuttx/include/cxx/cmath b/nuttx/include/cxx/cmath index 55c7c1dcc..b30d5548b 100644 --- a/nuttx/include/cxx/cmath +++ b/nuttx/include/cxx/cmath @@ -69,6 +69,7 @@ namespace std using ::log10f; using ::log2f; using ::modff; + using ::roundf; using ::powf; using ::sinf; using ::sinhf; @@ -95,6 +96,7 @@ namespace std using ::log10; using ::log2; using ::modf; + using ::round; using ::pow; using ::sin; using ::sinh; @@ -121,6 +123,7 @@ namespace std using ::log10l; using ::log2l; using ::modfl; + using ::roundl; using ::powl; using ::sinl; using ::sinhl; diff --git a/nuttx/include/cxx/cstdlib b/nuttx/include/cxx/cstdlib index 522f3fdb1..1bf8ed9da 100644 --- a/nuttx/include/cxx/cstdlib +++ b/nuttx/include/cxx/cstdlib @@ -70,6 +70,7 @@ namespace std #endif using ::strtol; + using ::strtoul; using ::strtod; using ::malloc; diff --git a/nuttx/include/nuttx/fs/fs.h b/nuttx/include/nuttx/fs/fs.h index aab4ae4be..1759310bc 100644 --- a/nuttx/include/nuttx/fs/fs.h +++ b/nuttx/include/nuttx/fs/fs.h @@ -176,7 +176,7 @@ struct mountpt_operations int (*statfs)(FAR struct inode *mountpt, FAR struct statfs *buf); - /* Operations on pathes */ + /* Operations on paths */ int (*unlink)(FAR struct inode *mountpt, FAR const char *relpath); int (*mkdir)(FAR struct inode *mountpt, FAR const char *relpath, mode_t mode); diff --git a/nuttx/include/nuttx/math.h b/nuttx/include/nuttx/math.h index 160926d07..aaadb9c91 100644 --- a/nuttx/include/nuttx/math.h +++ b/nuttx/include/nuttx/math.h @@ -141,6 +141,14 @@ double floor (double x); long double floorl(long double x); #endif +float roundf(float x); +#if CONFIG_HAVE_DOUBLE +double round (double x); +#endif +#ifdef CONFIG_HAVE_LONG_DOUBLE +long double roundl(long double x); +#endif + float fabsf (float x); #if CONFIG_HAVE_DOUBLE double fabs (double x); diff --git a/nuttx/include/nuttx/mtd.h b/nuttx/include/nuttx/mtd.h index 44582c412..ff48d313f 100644 --- a/nuttx/include/nuttx/mtd.h +++ b/nuttx/include/nuttx/mtd.h @@ -220,7 +220,6 @@ EXTERN FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev); EXTERN FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev); - /**************************************************************************** * Name: w25_initialize * @@ -233,6 +232,8 @@ EXTERN FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev); EXTERN FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *dev); +EXTERN FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev); + #undef EXTERN #ifdef __cplusplus } diff --git a/nuttx/include/stdbool.h b/nuttx/include/stdbool.h index f11219912..9c16aee29 100644 --- a/nuttx/include/stdbool.h +++ b/nuttx/include/stdbool.h @@ -42,10 +42,33 @@ #include +/* If CONFIG_ARCH_STDBOOL_H is set, then the archecture will provide its own + * stdbool.h file. In this case, this header file will simply re-direct to + * the architecture-specfiic stdbool.h header file. + */ + #ifdef CONFIG_ARCH_STDBOOL_H # include + +/* NuttX will insist that the sizeof(bool) is 8-bits. The sizeof of _Bool + * used by any specific compiler is implementation specific: It can vary from + * compiler-to-compiler and even vary between different versions of the same + * compiler. Compilers seems to be converging to sizeof(_Bool) == 1. If that + * is true for your compiler, you should define CONFIG_C99_BOOL8 in your NuttX + * configuration for better standards compatibility. + * + * CONFIG_C99_BOOL8 - Means (1) your C++ compiler has sizeof(_Bool) == 8, + * (2) your C compiler supports the C99 _Bool intrinsic type, and (2) that + * the C99 _Bool type also has size 1. + */ + #else + + /* nuttx/compiler.h may also define or undefine CONFIG_C99_BOOL8 */ + # include + +#if !defined(__cplusplus) || !defined(CONFIG_C99_BOOL8) # include /**************************************************************************** @@ -58,10 +81,15 @@ * NOTE: Under C99 'bool' is required to be defined to be the intrinsic type * _Bool. However, in this NuttX context, we need backward compatibility * to pre-C99 standards where _Bool is not an intrinsic type. Hence, we - * use _Bool8 as the underlying type. + * use _Bool8 as the underlying type (unless CONFIG_C99_BOOL8 is defined) */ -#define bool _Bool8 +#ifdef CONFIG_C99_BOOL8 +# define bool _Bool +#else +# define bool _Bool8 +#endif + #define true 1 #define false 0 @@ -83,7 +111,10 @@ * as the underlying type. */ +#ifndef CONFIG_C99_BOOL8 typedef uint8_t _Bool8; +#endif +#endif /* __cplusplus && CONFIG_C99_BOOL8 */ #endif /* CONFIG_ARCH_STDBOOL_H */ #endif /* __INCLUDE_STDBOOL_H */ diff --git a/nuttx/libc/math/Make.defs b/nuttx/libc/math/Make.defs index bc6a265f0..ece25f4e5 100644 --- a/nuttx/libc/math/Make.defs +++ b/nuttx/libc/math/Make.defs @@ -40,17 +40,17 @@ ifeq ($(CONFIG_LIBM),y) 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_roundf.c 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_round.c 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_roundl.c lib_sinl.c lib_sinhl.c lib_sqrtl.c lib_tanl.c lib_tanhl.c CSRCS += lib_libexpi.c lib_libsqrtapprox.c diff --git a/nuttx/libc/math/lib_round.c b/nuttx/libc/math/lib_round.c new file mode 100644 index 000000000..6191cee5b --- /dev/null +++ b/nuttx/libc/math/lib_round.c @@ -0,0 +1,40 @@ +/************************************************************************ + * lib/math/lib_round.c + * + * This file is a part of NuttX: + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * (C) 2012 Petteri Aimonen + * + ************************************************************************/ + +/************************************************************************ + * Included Files + ************************************************************************/ + +#include +#include + +#include + +/************************************************************************ + * Public Functions + ************************************************************************/ + +#ifdef CONFIG_HAVE_DOUBLE +double round(double x) +{ + double f = modf(x, &x); + if (x <= 0.0 && f <= -0.5) + { + x -= 1.0; + } + + if (x >= 0.0 && f >= 0.5) + { + x += 1.0; + } + + return x; +} +#endif diff --git a/nuttx/libc/math/lib_roundf.c b/nuttx/libc/math/lib_roundf.c new file mode 100644 index 000000000..145cf3df6 --- /dev/null +++ b/nuttx/libc/math/lib_roundf.c @@ -0,0 +1,38 @@ +/************************************************************************ + * lib/math/lib_roundf.c + * + * This file is a part of NuttX: + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * (C) 2012 Petteri Aimonen + * + ************************************************************************/ + +/************************************************************************ + * Included Files + ************************************************************************/ + +#include +#include + +#include + +/************************************************************************ + * Public Functions + ************************************************************************/ + +float roundf(float x) +{ + float f = modff(x, &x); + if (x <= 0.0f && f <= -0.5f) + { + x -= 1.0f; + } + + if (x >= 0.0f && f >= 0.5f) + { + x += 1.0f; + } + + return x; +} diff --git a/nuttx/libc/math/lib_roundl.c b/nuttx/libc/math/lib_roundl.c new file mode 100644 index 000000000..b2ddba670 --- /dev/null +++ b/nuttx/libc/math/lib_roundl.c @@ -0,0 +1,40 @@ +/************************************************************************ + * lib/math/lib_round.c + * + * This file is a part of NuttX: + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * (C) 2012 Petteri Aimonen + * + ************************************************************************/ + +/************************************************************************ + * Included Files + ************************************************************************/ + +#include +#include + +#include + +/************************************************************************ + * Public Functions + ************************************************************************/ + +#ifdef CONFIG_HAVE_LONG_DOUBLE +long double roundl(long double x) +{ + long double f = modfl(x, &x); + if (x <= 0.0 && f <= -0.5) + { + x -= 1.0; + } + + if (x >= 0.0 && f >= 0.5) + { + x += 1.0; + } + + return x; +} +#endif diff --git a/nuttx/libc/stdlib/lib_rand.c b/nuttx/libc/stdlib/lib_rand.c index 0faef5d66..453a4537a 100644 --- a/nuttx/libc/stdlib/lib_rand.c +++ b/nuttx/libc/stdlib/lib_rand.c @@ -74,7 +74,7 @@ static unsigned int nrand(unsigned int nLimit); /* First order congruential generators */ -static inline void fgenerate1(void); +static inline unsigned long fgenerate1(void); #if (CONFIG_LIB_RAND_ORDER == 1) static double_t frand1(void); #endif @@ -82,7 +82,7 @@ static double_t frand1(void); /* Second order congruential generators */ #if (CONFIG_LIB_RAND_ORDER > 1) -static inline void fgenerate2(void); +static inline unsigned long fgenerate2(void); #if (CONFIG_LIB_RAND_ORDER == 2) static double_t frand2(void); #endif @@ -90,7 +90,7 @@ static double_t frand2(void); /* Third order congruential generators */ #if (CONFIG_LIB_RAND_ORDER > 2) -static inline void fgenerate3(void); +static inline unsigned long fgenerate3(void); static double_t frand3(void); #endif #endif @@ -141,7 +141,7 @@ static unsigned int nrand(unsigned int nLimit) /* First order congruential generators */ -static inline void fgenerate1(void) +static inline unsigned long fgenerate1(void) { unsigned long randint; @@ -152,6 +152,7 @@ static inline void fgenerate1(void) randint = (RND1_CONSTK * g_randint1) % RND1_CONSTP; g_randint1 = (randint == 0 ? 1 : randint); + return randint; } #if (CONFIG_LIB_RAND_ORDER == 1) @@ -159,18 +160,18 @@ static double_t frand1(void) { /* First order congruential generator. */ - fgenerate1(); + unsigned long randint = fgenerate1(); /* Construct an floating point value in the range from 0.0 up to 1.0 */ - return ((double_t)g_randint1) / ((double_t)RND1_CONSTP); + return ((double_t)randint) / ((double_t)RND1_CONSTP); } #endif /* Second order congruential generators */ #if (CONFIG_LIB_RAND_ORDER > 1) -static inline void fgenerate2(void) +static inline unsigned long fgenerate2(void) { unsigned long randint; @@ -190,6 +191,8 @@ static inline void fgenerate2(void) { g_randint2 = 1; } + + return randint; } #if (CONFIG_LIB_RAND_ORDER == 2) @@ -197,18 +200,18 @@ static double_t frand2(void) { /* Second order congruential generator */ - fgenerate2(); + unsigned long randint = fgenerate2(); /* Construct an floating point value in the range from 0.0 up to 1.0 */ - return ((double_t)g_randint1) / ((double_t)RND2_CONSTP); + return ((double_t)randint) / ((double_t)RND2_CONSTP); } #endif /* Third order congruential generators */ #if (CONFIG_LIB_RAND_ORDER > 2) -static inline void fgenerate3(void) +static inline unsigned long fgenerate3(void) { unsigned long randint; @@ -230,17 +233,19 @@ static inline void fgenerate3(void) { g_randint3 = 1; } + + return randint; } static double_t frand3(void) { /* Third order congruential generator */ - fgenerate3(); + unsigned long randint = fgenerate3(); /* Construct an floating point value in the range from 0.0 up to 1.0 */ - return ((double_t)g_randint1) / ((double_t)RND3_CONSTP); + return ((double_t)randint) / ((double_t)RND3_CONSTP); } #endif #endif @@ -258,10 +263,10 @@ void srand(unsigned int seed) g_randint1 = seed; #if (CONFIG_LIB_RAND_ORDER > 1) g_randint2 = seed; - fgenerate1(); + (void)fgenerate1(); #if (CONFIG_LIB_RAND_ORDER > 2) g_randint3 = seed; - fgenerate2(); + (void)fgenerate2(); #endif #endif } diff --git a/nuttx/libxx/Kconfig b/nuttx/libxx/Kconfig index 8b5fc42e8..9c78342c2 100644 --- a/nuttx/libxx/Kconfig +++ b/nuttx/libxx/Kconfig @@ -5,6 +5,14 @@ comment "Basic CXX Support" +config C99_BOOL8 + bool "sizeof(_Bool) is 8-bits" + default n + ---help--- + This setting means (1) your C++ compiler has sizeof(_Bool) == 8, (2) + your C compiler supports the C99 _Bool intrinsic type, and (2) that + the C99 _Bool type also has size 1. + config HAVE_CXX bool "Have C++ compiler" default n -- cgit v1.2.3 From 88bccb641eccf8ca1a91ab0583976a211deb1ed5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 26 Dec 2012 21:37:50 +0000 Subject: Verified USB HID KBD driver encoding of special characters; apps/examples/hidkbd now decodes encoded keyboar characters. git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5463 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/examples/README.txt | 18 +++- apps/examples/hidkbd/Kconfig | 31 +++++++ apps/examples/hidkbd/hidkbd_main.c | 106 ++++++++++++++++++++++- nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig | 20 ++++- nuttx/drivers/usbhost/Kconfig | 4 +- nuttx/drivers/usbhost/usbhost_hidkbd.c | 34 +++++--- nuttx/include/nuttx/input/kbd_codec.h | 5 +- nuttx/libc/Kconfig | 28 ++++++ nuttx/libc/math/Kconfig | 2 +- nuttx/libc/misc/Make.defs | 8 +- 11 files changed, 234 insertions(+), 24 deletions(-) (limited to 'nuttx/libc/math') diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index ea1b247f5..d156b1065 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -453,4 +453,6 @@ in place early in the dependency generation phase to avoid warnings. It is not important if they are only stubbed out header files at this build phase. + * apps/examples/hidbkd: Now supports decoding of encoded special keys + if CONFIG_EXAMPLES_HIDKBD_ENCODED is defined. diff --git a/apps/examples/README.txt b/apps/examples/README.txt index e40a63be9..7bfba721a 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -540,9 +540,21 @@ examples/hidkbd This is a simple test to debug/verify the USB host HID keyboard class driver. - CONFIG_EXAMPLES_HIDKBD_DEFPRIO - Priority of "waiter" thread. - CONFIG_EXAMPLES_HIDKBD_STACKSIZE - Stacksize of "waiter" thread. - + CONFIG_EXAMPLES_HIDKBD_DEFPRIO - Priority of "waiter" thread. Default: + 50 + CONFIG_EXAMPLES_HIDKBD_STACKSIZE - Stacksize of "waiter" thread. Default + 1024 + CONFIG_EXAMPLES_HIDKBD_DEVNAME - Name of keyboard device to be used. + Default: "/dev/kbda" + CONFIG_EXAMPLES_HIDKBD_ENCODED - Decode special key press events in the + user buffer. In this case, the example coded will use the interfaces + defined in include/nuttx/input/kbd_codec.h to decode the returned + keyboard data. These special keys include such things as up/down + arrows, home and end keys, etc. If this not defined, only 7-bit print- + able and control ASCII characters will be provided to the user. + Requires CONFIG_HIDKBD_ENCODED && CONFIG_LIB_KBDCODEC + +endif examples/igmp ^^^^^^^^^^^^^ diff --git a/apps/examples/hidkbd/Kconfig b/apps/examples/hidkbd/Kconfig index 503d9d9d9..81f817ef9 100644 --- a/apps/examples/hidkbd/Kconfig +++ b/apps/examples/hidkbd/Kconfig @@ -10,4 +10,35 @@ config EXAMPLES_HIDKBD Enable the USB HID keyboard example if EXAMPLES_HIDKBD + +config EXAMPLES_HIDKBD_DEFPRIO + int "Waiter Thread Priority" + default 50 + ---help--- + Priority of "waiter" thread. Default: 50 + +config EXAMPLES_HIDKBD_STACKSIZE + int "Waiter Thread Stack Size" + default 1024 + ---help--- + Stacksize of "waiter" thread. Default 1024 + +config EXAMPLES_HIDKBD_DEVNAME + string "Keyboard Device Name" + default "/dev/kbda" + ---help--- + Name of keyboard device to be used. Default: "/dev/kbda" + +config EXAMPLES_HIDKBD_ENCODED + bool "Encode Special Keys" + default y + depends on HIDKBD_ENCODED && LIB_KBDCODEC + ---help--- + Decode special key press events in the user buffer. In this case, + the example coded will use the interfaces defined in + include/nuttx/input/kbd_codec.h to decode the returned keyboard + data. These special keys include such things as up/down arrows, + home and end keys, etc. If this not defined, only 7-bit print-able + and control ASCII characters will be provided to the user. + endif diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c index 8c9f6fa95..8a632bab7 100644 --- a/apps/examples/hidkbd/hidkbd_main.c +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -46,10 +46,18 @@ #include #include #include +#include +#include +#include #include #include +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +# include +# include +#endif + /**************************************************************************** * Definitions ****************************************************************************/ @@ -83,10 +91,23 @@ # define CONFIG_EXAMPLES_HIDKBD_DEVNAME "/dev/kbda" #endif +#if !defined(CONFIG_HIDKBD_ENCODED) || !defined(CONFIG_LIB_KBDCODEC) +# undef CONFIG_EXAMPLES_HIDKBD_ENCODED +#endif + /**************************************************************************** * Private Types ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +struct hidbkd_instream_s +{ + struct lib_instream_s stream; + FAR char *buffer; + ssize_t nbytes; +}; +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -98,9 +119,84 @@ static struct usbhost_driver_s *g_drvr; ****************************************************************************/ /**************************************************************************** - * Public Functions + * Name: hidkbd_getstream + * + * Description: + * Get one character from the keyboard. + * ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +static int hidkbd_getstream(FAR struct lib_instream_s *this) +{ + FAR struct hidbkd_instream_s *kbdstream = (FAR struct hidbkd_instream_s *)this; + + DEBUGASSERT(kbdstream && kbdstream->buffer); + if (kbdstream->nbytes > 0) + { + kbdstream->nbytes--; + kbdstream->stream.nget++; + return (int)*kbdstream->buffer++; + } + + return EOF; +} +#endif + +/**************************************************************************** + * Name: hidkbd_decode + * + * Description: + * Decode encoded keyboard input + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +static void hidkbd_decode(FAR char *buffer, ssize_t nbytes) +{ + struct hidbkd_instream_s kbdstream; + struct kbd_getstate_s state; + uint8_t ch; + int ret; + + /* Initialize */ + + memset(&state, 0, sizeof(struct kbd_getstate_s)); + kbdstream.stream.get = hidkbd_getstream; + kbdstream.stream.nget = 0; + kbdstream.buffer = buffer; + kbdstream.nbytes = nbytes; + + /* Loop until all of the bytes have been consumed. We implicitly assume + * that the the escaped sequences do not cross buffer boundaries. That + * might be true if the read buffer were small or the data rates high. + */ + + for (;;) + { + /* Decode the next thing from the buffer */ + + ret = kbd_get((FAR struct lib_instream_s *)&kbdstream, &state, &ch); + if (ret == KBD_ERROR) + { + break; + } + + /* Normal data? Or special key? */ + + if (ret == KBD_NORMAL) + { + printf("Data: %c [%02x]\n", isprint(ch) ? ch : '.', ch); + } + else + { + DEBUGASSERT(ret == KBD_SPECIAL); + printf("Special: %d\n", ch); + } + } +} +#endif + /**************************************************************************** * Name: hidkbd_waiter * @@ -140,6 +236,10 @@ static int hidkbd_waiter(int argc, char *argv[]) return 0; } +/**************************************************************************** + * Public Functions + ****************************************************************************/ + /**************************************************************************** * Name: hidkbd_main ****************************************************************************/ @@ -217,7 +317,11 @@ int hidkbd_main(int argc, char *argv[]) { /* On success, echo the buffer to stdout */ +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED + hidkbd_decode(buffer, nbytes); +#else (void)write(1, buffer, nbytes); +#endif } } while (nbytes > 0); diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig index 78e411560..35a7bfc3d 100755 --- a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig @@ -316,7 +316,10 @@ CONFIG_DEV_NULL=y # CONFIG_WATCHDOG is not set # CONFIG_ANALOG is not set # CONFIG_BCH is not set -# CONFIG_INPUT is not set +CONFIG_INPUT=y +# CONFIG_INPUT_TSC2007 is not set +# CONFIG_INPUT_ADS7843E is not set +# CONFIG_INPUT_STMPE811 is not set # CONFIG_LCD is not set CONFIG_MMCSD=y CONFIG_MMCSD_NSLOTS=1 @@ -364,7 +367,7 @@ CONFIG_HIDKBD_STACKSIZE=1024 CONFIG_HIDKBD_BUFSIZE=64 CONFIG_HIDKBD_NPOLLWAITERS=2 # CONFIG_HIDKBD_RAWSCANCODES is not set -# CONFIG_HIDKBD_ENCODED is not set +CONFIG_HIDKBD_ENCODED=y # CONFIG_HIDKBD_ALLSCANCODES is not set # CONFIG_HIDKBD_NODEBOUNCE is not set # CONFIG_WIRELESS is not set @@ -425,6 +428,10 @@ CONFIG_MM_REGIONS=2 # # Library Routines # + +# +# Standard C Library Options +# CONFIG_STDIO_BUFFER_SIZE=256 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 @@ -443,6 +450,11 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_ARCH_ROMGETC is not set # CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set +# +# Non-standard Helper Functions +# +CONFIG_LIB_KBDCODEC=y + # # Basic CXX Support # @@ -473,6 +485,10 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_EXAMPLES_HELLOXX is not set # CONFIG_EXAMPLES_JSON is not set CONFIG_EXAMPLES_HIDKBD=y +CONFIG_EXAMPLES_HIDKBD_DEFPRIO=50 +CONFIG_EXAMPLES_HIDKBD_STACKSIZE=1024 +CONFIG_EXAMPLES_HIDKBD_DEVNAME="/dev/kbda" +CONFIG_EXAMPLES_HIDKBD_ENCODED=y # CONFIG_EXAMPLES_KEYPADTEST is not set # CONFIG_EXAMPLES_IGMP is not set # CONFIG_EXAMPLES_LCDRW is not set diff --git a/nuttx/drivers/usbhost/Kconfig b/nuttx/drivers/usbhost/Kconfig index de8469b41..531e94442 100644 --- a/nuttx/drivers/usbhost/Kconfig +++ b/nuttx/drivers/usbhost/Kconfig @@ -89,10 +89,10 @@ config HIDKBD_RAWSCANCODES config HIDKBD_ENCODED bool "Enocode Special Keys" default n - depends on !HIDKBD_RAWSCANCODES + depends on !HIDKBD_RAWSCANCODES && LIB_KBDCODEC ---help--- Encode special key press events in the user buffer. In this case, - the use end must decode the encoded special key values using the + the user end must decode the encoded special key values using the interfaces defined in include/nuttx/input/kbd_codec.h. These special keys include such things as up/down arrows, home and end keys, etc. If this not defined, only 7-bit print-able and control diff --git a/nuttx/drivers/usbhost/usbhost_hidkbd.c b/nuttx/drivers/usbhost/usbhost_hidkbd.c index 5022793ca..917ebfa3f 100644 --- a/nuttx/drivers/usbhost/usbhost_hidkbd.c +++ b/nuttx/drivers/usbhost/usbhost_hidkbd.c @@ -131,6 +131,14 @@ # endif #endif +/* We cant support encoding of special characters of unless the Keyboard + * CODEC is enabled. + */ + +#ifndef CONFIG_LIB_KBDCODEC +# undef CONFIG_HIDKBD_ENCODED +#endif + /* If we are using raw scancodes, then we cannot support encoding of * special characters either. */ @@ -398,11 +406,11 @@ static struct usbhost_state_s *g_priv; /* Data passed to thread */ /* The first and last scancode values with encode-able values */ -#define FIRST_ENCODING USBHID_KBDUSE_ENTER /* 0x28 Keyboard Return (ENTER) */ -#ifdef CONFIG_HIDKBD_ALLSCANCODES -# define LAST_ENCODING USBHID_KBDUSE_POWER /* 0x66 Keyboard Power */ +#define FIRST_ENCODING USBHID_KBDUSE_ENTER /* 0x28 Keyboard Return (ENTER) */ +#ifndef CONFIG_HIDKBD_ALLSCANCODES +# define LAST_ENCODING USBHID_KBDUSE_POWER /* 0x66 Keyboard Power */ #else -#define LAST_ENCODING USBHID_KBDUSE_KPDHEXADECIMAL /* 0xdd Keypad Hexadecimal */ +# define LAST_ENCODING USBHID_KBDUSE_KPDHEXADECIMAL /* 0xdd Keypad Hexadecimal */ #endif #define USBHID_NUMENCODINGS (LAST_ENCODING - FIRST_ENCODING + 1) @@ -874,10 +882,10 @@ static void usbhost_putbuffer(FAR struct usbhost_state_s *priv, #ifdef CONFIG_HIDKBD_ENCODED static void usbhost_putstream(FAR struct lib_outstream_s *stream, int ch) { - FAR struct usbhost_outstream_s *privstream = (FAR struct lib_outstream_s *)stream; + FAR struct usbhost_outstream_s *privstream = (FAR struct usbhost_outstream_s *)stream; DEBUGASSERT(privstream && privstream->priv); - usbhost_putbuffer(privstream->priv), (uint8_t)ch); + usbhost_putbuffer(privstream->priv, (uint8_t)ch); stream->nput++; } #endif @@ -945,7 +953,6 @@ static inline uint8_t usbhost_mapscancode(uint8_t scancode, uint8_t modifier) static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, uint8_t scancode, uint8_t modifier) { - struct usbhost_outstream_s stream; uint8_t encoded; /* Check if the raw scancode is in a valid range */ @@ -954,7 +961,7 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, { /* Yes the value is within range */ - encoded = encoding(scancode - FIRST_ENCODING); + encoded = encoding[scancode - FIRST_ENCODING]; ivdbg(" scancode: %02x modifier: %02x encoded: %d\n", scancode, modifier, encoded); @@ -964,13 +971,14 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, /* And it does correspond to a special function key */ - usbstream->stream.put = usbhost_putstream; - usbstream->stream.nput = 0; - usbstream->priv = priv; + usbstream.stream.put = usbhost_putstream; + usbstream.stream.nput = 0; + usbstream.priv = priv; /* Add the special function value to the user buffer */ - kbd_putspecial((enum kbd_keycode_e)encoded, &usbstream); + kbd_putspecial((enum kbd_keycode_e)encoded, + (FAR struct lib_outstream_s *)&usbstream); } } } @@ -1156,7 +1164,7 @@ static int usbhost_kbdpoll(int argc, char *argv[]) #ifdef CONFIG_HIDKBD_ENCODED else { - usbhost_encodescancode(priv, rpt->key[i], rpt->modifier)); + usbhost_encodescancode(priv, rpt->key[i], rpt->modifier); } #endif } diff --git a/nuttx/include/nuttx/input/kbd_codec.h b/nuttx/include/nuttx/input/kbd_codec.h index d374ed8d3..0a3a54d2d 100644 --- a/nuttx/include/nuttx/input/kbd_codec.h +++ b/nuttx/include/nuttx/input/kbd_codec.h @@ -44,6 +44,8 @@ #include #include +#ifdef CONFIG_LIB_KBDCODEC + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -87,7 +89,7 @@ enum kbd_keycode_e KEYCODE_CUT, /* Cut */ KEYCODE_COPY, /* Copy */ KEYCODE_PASTE, /* Paste */ - KEYCODE_FIND , /* Find */ + KEYCODE_FIND, /* Find */ /* Selection codes */ @@ -294,5 +296,6 @@ int kbd_get(FAR struct lib_instream_s *stream, } #endif +#endif /* CONFIG_LIB_KBDCODEC */ #endif /* __INCLUDE_NUTTX_INPUT_KBD_CODEC_H */ diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index bd470be7f..a5ff7fd43 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -3,6 +3,8 @@ # see misc/tools/kconfig-language.txt. # +comment "Standard C Library Options" + config STDIO_BUFFER_SIZE int "C STDIO buffer size" default 64 @@ -273,3 +275,29 @@ config ARCH_BZERO of bzero(). endif + +comment "Non-standard Helper Functions" + +config LIB_KBDCODEC + bool "Keyboard CODEC" + default y + ---help--- + In NuttX, a keyboard/keypad driver is simply a character driver that + may have an (optional) encoding/decoding layer on the data returned + by the character driver. A keyboard may return simple text data + (alphabetic, numeric, and punctuaction) or control characters + (enter, control-C, etc.). We can think about this the normal + "in-band" keyboard data stream. However, in addition, most + keyboards support actions that cannot be represented as text data. + Such actions include things like cursor controls (home, up arrow, + page down, etc.), editing functions (insert, delete, etc.), volume + controls, (mute, volume up, etc.) and other special functions. We + can think about this as special, "out-of-band" keyboard commands. + In this case, some special encoding may be required to multiplex + the in-band text data and out-of-band command streams. + + This option enables the functions that implement the encoding and + decoding of keyboard data. These are the interfaces prototyped in + include/nuttx/input/kbd_codec.h. While not correctly a part of + the C library, it is included here because the decoding side of this + interface must be accessible by end user programs. diff --git a/nuttx/libc/math/Kconfig b/nuttx/libc/math/Kconfig index c24bfd53f..db9dfae63 100644 --- a/nuttx/libc/math/Kconfig +++ b/nuttx/libc/math/Kconfig @@ -4,7 +4,7 @@ # config LIBM - bool "Math library" + bool "Standard Math library" default n depends on !ARCH_MATH_H ---help--- diff --git a/nuttx/libc/misc/Make.defs b/nuttx/libc/misc/Make.defs index c6af5f860..ad0313346 100644 --- a/nuttx/libc/misc/Make.defs +++ b/nuttx/libc/misc/Make.defs @@ -35,7 +35,7 @@ # Add the internal C files to the build -CSRCS += lib_init.c lib_filesem.c lib_kbdencode.c lib_kbddecode.c +CSRCS += lib_init.c lib_filesem.c # Add C files that depend on file OR socket descriptors @@ -63,6 +63,12 @@ CSRCS += lib_match.c CSRCS += lib_crc32.c CSRCS += lib_dbg.c lib_dumpbuffer.c +# Keyboard driver encoder/decoder + +ifneq ($(CONFIG_LIB_KBDCODEC),0) +CSRCS += lib_kbdencode.c lib_kbddecode.c +endif + # Add the misc directory to the build DEPPATH += --dep-path misc -- cgit v1.2.3