diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-12-07 16:00:56 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-12-07 16:00:56 +0000 |
commit | 3c5cba9b94c3f5365034f044e18a58d425508c87 (patch) | |
tree | c29f3db20b8275cd22e7c4d36c3d722f2fdf6277 /nuttx/include | |
parent | 73bf549bd5a335d66ef80e50b551d356386facad (diff) | |
download | px4-nuttx-3c5cba9b94c3f5365034f044e18a58d425508c87.tar.gz px4-nuttx-3c5cba9b94c3f5365034f044e18a58d425508c87.tar.bz2 px4-nuttx-3c5cba9b94c3f5365034f044e18a58d425508c87.zip |
Patches from Petteri Aimonen + stdbool and rand() changes for Freddie Chopin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5415 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/cxx/cmath | 3 | ||||
-rw-r--r-- | nuttx/include/cxx/cstdlib | 1 | ||||
-rw-r--r-- | nuttx/include/nuttx/fs/fs.h | 2 | ||||
-rw-r--r-- | nuttx/include/nuttx/math.h | 8 | ||||
-rw-r--r-- | nuttx/include/nuttx/mtd.h | 3 | ||||
-rw-r--r-- | nuttx/include/stdbool.h | 35 |
6 files changed, 48 insertions, 4 deletions
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 <nuttx/config.h> +/* 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 <arch/stdbool.h> + +/* 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 <nuttx/compiler.h> + +#if !defined(__cplusplus) || !defined(CONFIG_C99_BOOL8) # include <stdint.h> /**************************************************************************** @@ -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 */ |