diff --git a/cpu/msp430_common/include/cpu.h b/cpu/msp430_common/include/cpu.h index 871e0ae2a6..6af17c0d1d 100644 --- a/cpu/msp430_common/include/cpu.h +++ b/cpu/msp430_common/include/cpu.h @@ -28,7 +28,6 @@ #include "sched.h" #include "thread.h" -#include "msp430_types.h" #include "cpu_conf.h" #ifdef __cplusplus diff --git a/cpu/msp430_common/include/msp430_types.h b/cpu/msp430_common/include/msp430_types.h deleted file mode 100644 index a1acec8c86..0000000000 --- a/cpu/msp430_common/include/msp430_types.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2014 INRIA - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_msp430_common - * @{ - * - * @file - * @brief basic types for MSP430 - */ - -#ifndef MSP430_TYPES_H -#define MSP430_TYPES_H - -#include -#include - -/** defining signed type for size_t */ -#include "kernel_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef EINVAL -/** - * @brief defines EINVAL if MSP430 toolchain is too old to provide it itself - * via errno.h - */ -#define EINVAL (28) -#endif - -#ifndef EOVERFLOW -/** - * @brief defines EOVERFLOW if MSP430 toolchain is too old to provide it itself - * via errno.h - */ -#define EOVERFLOW (65) -#endif - -/** - * @brief Definition of `time_t` for the MSP430 - * - * @todo Remove once msp430 libc supports `time_t` - */ -typedef unsigned long time_t; - -/** - * @brief Definition of `struct timespec` for the MSP430 - * - * @todo Remove once msp430 libc supports `struct timespec` - */ -struct timespec { - time_t tv_sec; /**< seconds */ - long tv_nsec; /**< nanoseconds */ -}; - -/** - * @brief Definition of `struct timeval` for the MSP430 - * - * @todo Remove once msp430 libc supports struct timeval - */ -struct timeval { - time_t tv_sec; /**< seconds */ - time_t tv_usec; /**< microseconds */ -}; - -typedef int32_t blkcnt_t; /**< Used for file block counts */ -typedef int32_t blksize_t; /**< Used for block sizes */ -typedef uint32_t clock_t; /**< Used for system times in clock ticks */ -typedef uint32_t clockid_t; /**< Used for clock ID type in the clock and timer functions */ -typedef int16_t dev_t; /**< Used for device IDs */ -typedef uint32_t fsblkcnt_t; /**< Used for file system block counts */ -typedef uint32_t fsfilcnt_t; /**< Used for file system file counts */ -typedef uint16_t gid_t; /**< Used for group IDs */ -typedef uint16_t id_t; /**< Used as a general identifier */ -typedef uint32_t ino_t; /**< Used for file serial numbers */ -typedef uint32_t key_t; /**< Used for XSI interprocess communication */ -typedef uint32_t mode_t; /**< Used for some file attributes */ -typedef uint16_t nlink_t; /**< Used for link counts */ -typedef int32_t off_t; /**< Used for file sizes and offsets */ -typedef int pid_t; /**< Used for process IDs and process group IDs */ -typedef unsigned int size_t; /**< Used for sizes of objects */ -typedef signed int ssize_t; /**< Used for a count of bytes or an error indication */ -typedef int32_t suseconds_t; /**< Used for time in microseconds */ -typedef uint32_t timer_t; /**< Used for timer ID returned by timer_create() */ -typedef uint16_t uid_t; /**< Used for user IDs */ -typedef uint32_t useconds_t; /**< Used for time in microseconds */ - -#ifdef __cplusplus -} -#endif - -#endif /* MSP430_TYPES_H */ -/** @} */ diff --git a/cpu/msp430_common/include/stdatomic.h b/cpu/msp430_common/include/stdatomic.h deleted file mode 100644 index 9d653f0d93..0000000000 --- a/cpu/msp430_common/include/stdatomic.h +++ /dev/null @@ -1,427 +0,0 @@ -/*- - * Copyright (c) 2011 Ed Schouten - * David Chisnall - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -/* This file was imported into RIOT from newlib 2.3.0 */ - -#ifndef STDATOMIC_H -#define STDATOMIC_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if __has_extension(c_atomic) || __has_extension(cxx_atomic) -#define __CLANG_ATOMICS -#elif __GNUC_PREREQ__(4, 7) -#define __GNUC_ATOMICS -#elif defined(__GNUC__) -#define __SYNC_ATOMICS -#else -#error "stdatomic.h does not support your compiler" -#endif - -/* - * 7.17.1 Atomic lock-free macros. - */ - -#ifdef __GCC_ATOMIC_BOOL_LOCK_FREE -#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_CHAR_LOCK_FREE -#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE -#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE -#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE -#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_SHORT_LOCK_FREE -#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_INT_LOCK_FREE -#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_LONG_LOCK_FREE -#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_LLONG_LOCK_FREE -#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -#endif -#ifdef __GCC_ATOMIC_POINTER_LOCK_FREE -#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE -#endif - -/* - * 7.17.2 Initialization. - */ - -#if defined(__CLANG_ATOMICS) -#define ATOMIC_VAR_INIT(value) (value) -#define atomic_init(obj, value) __c11_atomic_init(obj, value) -#else -#define ATOMIC_VAR_INIT(value) { .__val = (value) } -#define atomic_init(obj, value) ((void)((obj)->__val = (value))) -#endif - -/* - * Clang and recent GCC both provide predefined macros for the memory - * orderings. If we are using a compiler that doesn't define them, use the - * clang values - these will be ignored in the fallback path. - */ - -#ifndef __ATOMIC_RELAXED -#define __ATOMIC_RELAXED 0 -#endif -#ifndef __ATOMIC_CONSUME -#define __ATOMIC_CONSUME 1 -#endif -#ifndef __ATOMIC_ACQUIRE -#define __ATOMIC_ACQUIRE 2 -#endif -#ifndef __ATOMIC_RELEASE -#define __ATOMIC_RELEASE 3 -#endif -#ifndef __ATOMIC_ACQ_REL -#define __ATOMIC_ACQ_REL 4 -#endif -#ifndef __ATOMIC_SEQ_CST -#define __ATOMIC_SEQ_CST 5 -#endif - -/* - * 7.17.3 Order and consistency. - * - * The memory_order_* constants that denote the barrier behaviour of the - * atomic operations. - */ - -typedef enum { - memory_order_relaxed = __ATOMIC_RELAXED, - memory_order_consume = __ATOMIC_CONSUME, - memory_order_acquire = __ATOMIC_ACQUIRE, - memory_order_release = __ATOMIC_RELEASE, - memory_order_acq_rel = __ATOMIC_ACQ_REL, - memory_order_seq_cst = __ATOMIC_SEQ_CST -} memory_order; - -/* - * 7.17.4 Fences. - */ - -static __inline void -atomic_thread_fence(memory_order __order) -{ - -#ifdef __CLANG_ATOMICS - __c11_atomic_thread_fence(__order); -#elif defined(__GNUC_ATOMICS) - __atomic_thread_fence(__order); -#else - (void) __order; - __sync_synchronize(); -#endif -} - -static __inline void -atomic_signal_fence(memory_order __order) -{ - -#ifdef __CLANG_ATOMICS - __c11_atomic_signal_fence(__order); -#elif defined(__GNUC_ATOMICS) - __atomic_signal_fence(__order); -#else - (void) __order; - __asm volatile ("" ::: "memory"); -#endif -} - -/* - * 7.17.5 Lock-free property. - */ - -#if defined(_KERNEL) -/* Atomics in kernelspace are always lock-free. */ -#define atomic_is_lock_free(obj) \ - ((void)(obj), (_Bool)1) -#elif defined(__CLANG_ATOMICS) -#define atomic_is_lock_free(obj) \ - __atomic_is_lock_free(sizeof(*(obj)), obj) -#elif defined(__GNUC_ATOMICS) -#define atomic_is_lock_free(obj) \ - __atomic_is_lock_free(sizeof((obj)->__val), &(obj)->__val) -#else -#define atomic_is_lock_free(obj) \ - ((void)(obj), sizeof((obj)->__val) <= sizeof(void *)) -#endif - -/* - * 7.17.6 Atomic integer types. - */ - -typedef _Atomic(_Bool) atomic_bool; -typedef _Atomic(char) atomic_char; -typedef _Atomic(signed char) atomic_schar; -typedef _Atomic(unsigned char) atomic_uchar; -typedef _Atomic(short) atomic_short; -typedef _Atomic(unsigned short) atomic_ushort; -typedef _Atomic(int) atomic_int; -typedef _Atomic(unsigned int) atomic_uint; -typedef _Atomic(long) atomic_long; -typedef _Atomic(unsigned long) atomic_ulong; -typedef _Atomic(long long) atomic_llong; -typedef _Atomic(unsigned long long) atomic_ullong; -#if 0 -typedef _Atomic(__char16_t) atomic_char16_t; -typedef _Atomic(__char32_t) atomic_char32_t; -#endif -typedef _Atomic(wchar_t) atomic_wchar_t; -typedef _Atomic(int_least8_t) atomic_int_least8_t; -typedef _Atomic(uint_least8_t) atomic_uint_least8_t; -typedef _Atomic(int_least16_t) atomic_int_least16_t; -typedef _Atomic(uint_least16_t) atomic_uint_least16_t; -typedef _Atomic(int_least32_t) atomic_int_least32_t; -typedef _Atomic(uint_least32_t) atomic_uint_least32_t; -typedef _Atomic(int_least64_t) atomic_int_least64_t; -typedef _Atomic(uint_least64_t) atomic_uint_least64_t; -typedef _Atomic(int_fast8_t) atomic_int_fast8_t; -typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t; -typedef _Atomic(int_fast16_t) atomic_int_fast16_t; -typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t; -typedef _Atomic(int_fast32_t) atomic_int_fast32_t; -typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t; -typedef _Atomic(int_fast64_t) atomic_int_fast64_t; -typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t; -typedef _Atomic(intptr_t) atomic_intptr_t; -typedef _Atomic(uintptr_t) atomic_uintptr_t; -typedef _Atomic(size_t) atomic_size_t; -typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t; -typedef _Atomic(intmax_t) atomic_intmax_t; -typedef _Atomic(uintmax_t) atomic_uintmax_t; - -/* - * 7.17.7 Operations on atomic types. - */ - -/* - * Compiler-specific operations. - */ - -#if defined(__CLANG_ATOMICS) -#define atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) \ - __c11_atomic_compare_exchange_strong(object, expected, desired, \ - success, failure) -#define atomic_compare_exchange_weak_explicit(object, expected, \ - desired, success, failure) \ - __c11_atomic_compare_exchange_weak(object, expected, desired, \ - success, failure) -#define atomic_exchange_explicit(object, desired, order) \ - __c11_atomic_exchange(object, desired, order) -#define atomic_fetch_add_explicit(object, operand, order) \ - __c11_atomic_fetch_add(object, operand, order) -#define atomic_fetch_and_explicit(object, operand, order) \ - __c11_atomic_fetch_and(object, operand, order) -#define atomic_fetch_or_explicit(object, operand, order) \ - __c11_atomic_fetch_or(object, operand, order) -#define atomic_fetch_sub_explicit(object, operand, order) \ - __c11_atomic_fetch_sub(object, operand, order) -#define atomic_fetch_xor_explicit(object, operand, order) \ - __c11_atomic_fetch_xor(object, operand, order) -#define atomic_load_explicit(object, order) \ - __c11_atomic_load(object, order) -#define atomic_store_explicit(object, desired, order) \ - __c11_atomic_store(object, desired, order) -#elif defined(__GNUC_ATOMICS) -#define atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) \ - __atomic_compare_exchange_n(&(object)->__val, expected, \ - desired, 0, success, failure) -#define atomic_compare_exchange_weak_explicit(object, expected, \ - desired, success, failure) \ - __atomic_compare_exchange_n(&(object)->__val, expected, \ - desired, 1, success, failure) -#define atomic_exchange_explicit(object, desired, order) \ - __atomic_exchange_n(&(object)->__val, desired, order) -#define atomic_fetch_add_explicit(object, operand, order) \ - __atomic_fetch_add(&(object)->__val, operand, order) -#define atomic_fetch_and_explicit(object, operand, order) \ - __atomic_fetch_and(&(object)->__val, operand, order) -#define atomic_fetch_or_explicit(object, operand, order) \ - __atomic_fetch_or(&(object)->__val, operand, order) -#define atomic_fetch_sub_explicit(object, operand, order) \ - __atomic_fetch_sub(&(object)->__val, operand, order) -#define atomic_fetch_xor_explicit(object, operand, order) \ - __atomic_fetch_xor(&(object)->__val, operand, order) -#define atomic_load_explicit(object, order) \ - __atomic_load_n(&(object)->__val, order) -#define atomic_store_explicit(object, desired, order) \ - __atomic_store_n(&(object)->__val, desired, order) -#else -#define __atomic_apply_stride(object, operand) \ - (((__typeof__((object)->__val))0) + (operand)) -#define atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) __extension__ ({ \ - __typeof__(expected) __ep = (expected); \ - __typeof__(*__ep) __e = *__ep; \ - (void)(success); (void)(failure); \ - (_Bool)((*__ep = __sync_val_compare_and_swap(&(object)->__val, \ - __e, desired)) == __e); \ -}) -#define atomic_compare_exchange_weak_explicit(object, expected, \ - desired, success, failure) \ - atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) -#if __has_builtin(__sync_swap) -/* Clang provides a full-barrier atomic exchange - use it if available. */ -#define atomic_exchange_explicit(object, desired, order) \ - __sync_swap(&(object)->__val, desired) -#else -/* - * __sync_lock_test_and_set() is only an acquire barrier in theory (although in - * practice it is usually a full barrier) so we need an explicit barrier before - * it. - */ -#define atomic_exchange_explicit(object, desired, order) \ -__extension__ ({ \ - __typeof__(object) __o = (object); \ - __typeof__(desired) __d = (desired); \ - (void)(order); \ - __sync_synchronize(); \ - __sync_lock_test_and_set(&(__o)->__val, __d); \ -}) -#endif -/* Ignoring the order argument when using __sync builtins */ -#define atomic_fetch_add_explicit(object, operand, order) \ - __sync_fetch_and_add(&(object)->__val, \ - __atomic_apply_stride(object, operand)) -#define atomic_fetch_and_explicit(object, operand, order) \ - __sync_fetch_and_and(&(object)->__val, operand) -#define atomic_fetch_or_explicit(object, operand, order) \ - __sync_fetch_and_or(&(object)->__val, operand) -#define atomic_fetch_sub_explicit(object, operand, order) \ - __sync_fetch_and_sub(&(object)->__val, \ - __atomic_apply_stride(object, operand)) -#define atomic_fetch_xor_explicit(object, operand, order) \ - __sync_fetch_and_xor(&(object)->__val, operand) -#define atomic_load_explicit(object, order) \ - __sync_fetch_and_add(&(object)->__val, 0) -#define atomic_store_explicit(object, desired, order) \ - ((void)atomic_exchange_explicit(object, desired, order)) -#endif - -/* - * Convenience functions. - * - * Don't provide these in kernel space. In kernel space, we should be - * disciplined enough to always provide explicit barriers. - */ - -#ifndef _KERNEL -#define atomic_compare_exchange_strong(object, expected, desired) \ - atomic_compare_exchange_strong_explicit(object, expected, \ - desired, memory_order_seq_cst, memory_order_seq_cst) -#define atomic_compare_exchange_weak(object, expected, desired) \ - atomic_compare_exchange_weak_explicit(object, expected, \ - desired, memory_order_seq_cst, memory_order_seq_cst) -#define atomic_exchange(object, desired) \ - atomic_exchange_explicit(object, desired, memory_order_seq_cst) -#define atomic_fetch_add(object, operand) \ - atomic_fetch_add_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_and(object, operand) \ - atomic_fetch_and_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_or(object, operand) \ - atomic_fetch_or_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_sub(object, operand) \ - atomic_fetch_sub_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_xor(object, operand) \ - atomic_fetch_xor_explicit(object, operand, memory_order_seq_cst) -#define atomic_load(object) \ - atomic_load_explicit(object, memory_order_seq_cst) -#define atomic_store(object, desired) \ - atomic_store_explicit(object, desired, memory_order_seq_cst) -#endif /* !_KERNEL */ - -/* - * 7.17.8 Atomic flag type and operations. - * - * XXX: Assume atomic_bool can be used as an atomic_flag. Is there some - * kind of compiler built-in type we could use? - */ - -typedef struct { - atomic_bool __flag; -} atomic_flag; - -#define ATOMIC_FLAG_INIT { ATOMIC_VAR_INIT(0) } - -static __inline _Bool -atomic_flag_test_and_set_explicit(volatile atomic_flag *__object, - memory_order __order) -{ - return (atomic_exchange_explicit(&__object->__flag, 1, __order)); -} - -static __inline void -atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order) -{ - - atomic_store_explicit(&__object->__flag, 0, __order); -} - -#ifndef _KERNEL -static __inline _Bool -atomic_flag_test_and_set(volatile atomic_flag *__object) -{ - - return (atomic_flag_test_and_set_explicit(__object, - memory_order_seq_cst)); -} - -static __inline void -atomic_flag_clear(volatile atomic_flag *__object) -{ - - atomic_flag_clear_explicit(__object, memory_order_seq_cst); -} -#endif /* !_KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* STDATOMIC_H */ diff --git a/cpu/msp430_common/include/stdio.h b/cpu/msp430_common/include/stdio.h deleted file mode 100644 index 2a67eb2ac1..0000000000 --- a/cpu/msp430_common/include/stdio.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2015 Eistec AB - * - * This file is subject to the terms and conditions of the GNU Lesser General - * Public License v2.1. See the file LICENSE in the top level directory for more - * details. - */ - -/** - * @ingroup cpu_msp430_common - * @{ - * - * @file - * @brief stdio.h wrapper for MSP430 - * @see http://www.cplusplus.com/reference/cstdio/ - * - * @author Joakim Nohlgård - -#ifdef __cplusplus -extern "C" { -#endif - -#define SEEK_SET 0 /* Seek from beginning of file. */ -#define SEEK_CUR 1 /* Seek from current position. */ -#define SEEK_END 2 /* Seek from end of file. */ - -int getchar(void); - -#ifdef __cplusplus -} -#endif - -#endif /* STDIO_H */ -/** @} */ diff --git a/cpu/msp430_common/include/stdlib.h b/cpu/msp430_common/include/stdlib.h deleted file mode 100644 index 30549a61a0..0000000000 --- a/cpu/msp430_common/include/stdlib.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2015 Eistec AB - * - * This file is subject to the terms and conditions of the GNU Lesser General - * Public License v2.1. See the file LICENSE in the top level directory for more - * details. - */ - -/** - * @ingroup cpu_msp430_common - * @{ - * - * @file - * @brief stdlib.h wrapper for MSP430 - * @see http://www.cplusplus.com/reference/cstdlib/ - * - * @author Joakim Nohlgård - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* STDLIB_H */ -/** @} */ diff --git a/cpu/msp430_common/include/sys/cdefs.h b/cpu/msp430_common/include/sys/cdefs.h deleted file mode 100644 index ce9db6c5fb..0000000000 --- a/cpu/msp430_common/include/sys/cdefs.h +++ /dev/null @@ -1,711 +0,0 @@ -/* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */ - -/* Written 2000 by Werner Almesberger */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Berkeley Software Design, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. - * - * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 - * $FreeBSD$ - */ - -/* This file was imported into RIOT from newlib 2.3.0 */ - -#ifndef SYS_CDEFS_H -#define SYS_CDEFS_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define __PMT(args) args -#define __DOTS , ... -#define __THROW - -#ifdef __GNUC__ -# define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname -#endif - -#define __ptr_t void * -#define __long_double_t long double - -#define __attribute_malloc__ -#define __attribute_pure__ -#define __attribute_format_strfmon__(a,b) -#define __flexarr [0] - -#ifndef __BOUNDED_POINTERS__ -# define __bounded /* nothing */ -# define __unbounded /* nothing */ -# define __ptrvalue /* nothing */ -#endif - -/* - * Testing against Clang-specific extensions. - */ -#ifndef __has_attribute -#define __has_attribute(x) 0 -#endif -#ifndef __has_extension -#define __has_extension __has_feature -#endif -#ifndef __has_feature -#define __has_feature(x) 0 -#endif -#ifndef __has_include -#define __has_include(x) 0 -#endif -#ifndef __has_builtin -#define __has_builtin(x) 0 -#endif - -#if defined(__cplusplus) -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS } -#else -#define __BEGIN_DECLS -#define __END_DECLS -#endif - -/* - * This code has been put in place to help reduce the addition of - * compiler specific defines in FreeBSD code. It helps to aid in - * having a compiler-agnostic source tree. - */ - -#if defined(__GNUC__) || defined(__INTEL_COMPILER) - -#if __GNUC__ >= 3 || defined(__INTEL_COMPILER) -#define __GNUCLIKE_ASM 3 -#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS -#else -#define __GNUCLIKE_ASM 2 -#endif -#define __GNUCLIKE___TYPEOF 1 -#define __GNUCLIKE___OFFSETOF 1 -#define __GNUCLIKE___SECTION 1 - -#ifndef __INTEL_COMPILER -#define __GNUCLIKE_CTOR_SECTION_HANDLING 1 -#endif - -#define __GNUCLIKE_BUILTIN_CONSTANT_P 1 -#if defined(__INTEL_COMPILER) && defined(__cplusplus) && \ - __INTEL_COMPILER < 800 -#undef __GNUCLIKE_BUILTIN_CONSTANT_P -#endif - -#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) -#define __GNUCLIKE_BUILTIN_VARARGS 1 -#define __GNUCLIKE_BUILTIN_STDARG 1 -#define __GNUCLIKE_BUILTIN_VAALIST 1 -#endif - -#if defined(__GNUC__) -#define __GNUC_VA_LIST_COMPATIBILITY 1 -#endif - -/* - * Compiler memory barriers, specific to gcc and clang. - */ -#if defined(__GNUC__) -#define __compiler_membar() __asm __volatile(" " : : : "memory") -#endif - -#ifndef __INTEL_COMPILER -#define __GNUCLIKE_BUILTIN_NEXT_ARG 1 -#define __GNUCLIKE_MATH_BUILTIN_RELOPS -#endif - -#define __GNUCLIKE_BUILTIN_MEMCPY 1 - -/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */ -#define __CC_SUPPORTS_INLINE 1 -#define __CC_SUPPORTS___INLINE 1 -#define __CC_SUPPORTS___INLINE__ 1 - -#define __CC_SUPPORTS___FUNC__ 1 -#define __CC_SUPPORTS_WARNING 1 - -#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */ - -#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1 - -#endif /* __GNUC__ || __INTEL_COMPILER */ - -/* - * The __CONCAT macro is used to concatenate parts of symbol names, e.g. - * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. - * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI - * mode -- there must be no spaces between its arguments, and for nested - * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also - * concatenate double-quoted strings produced by the __STRING macro, but - * this only works with ANSI C. - * - * __XSTRING is like __STRING, but it expands any macros in its argument - * first. It is only available with ANSI C. - */ -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* full-blown ANSI C */ -#define __CONCAT1(x,y) x ## y -#define __CONCAT(x,y) __CONCAT1(x,y) -#define __STRING(x) #x /* stringify without expanding x */ -#define __XSTRING(x) __STRING(x) /* expand x, then stringify */ - -#define __const const /* define reserved names to standard */ -#define __signed signed -#define __volatile volatile -#if defined(__cplusplus) -#define __inline inline /* convert to C++ keyword */ -#else -#if !(defined(__CC_SUPPORTS___INLINE)) -#define __inline /* delete GCC keyword */ -#endif /* ! __CC_SUPPORTS___INLINE */ -#endif /* !__cplusplus */ - -#else /* !(__STDC__ || __cplusplus) */ -#define __P(protos) () /* traditional C preprocessor */ -#define __CONCAT(x,y) x/**/y -#define __STRING(x) "x" - -#if !defined(__CC_SUPPORTS___INLINE) -#define __const /* delete pseudo-ANSI C keywords */ -#define __inline -#define __signed -#define __volatile -/* - * In non-ANSI C environments, new programs will want ANSI-only C keywords - * deleted from the program and old programs will want them left alone. - * When using a compiler other than gcc, programs using the ANSI C keywords - * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. - * When using "gcc -traditional", we assume that this is the intent; if - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. - */ -#ifndef NO_ANSI_KEYWORDS -#define const /* delete ANSI C keywords */ -#define inline -#define signed -#define volatile -#endif /* !NO_ANSI_KEYWORDS */ -#endif /* !__CC_SUPPORTS___INLINE */ -#endif /* !(__STDC__ || __cplusplus) */ - -/* - * Compiler-dependent macros to help declare dead (non-returning) and - * pure (no side effects) functions, and unused variables. They are - * null except for versions of gcc that are known to support the features - * properly (old versions of gcc-2 supported the dead and pure features - * in a different (wrong) way). If we do not provide an implementation - * for a given compiler, let the compile fail if it is told to use - * a feature that we cannot live without. - */ -#ifdef lint -#define __dead2 -#define __pure2 -#define __unused -#define __packed -#define __aligned(x) -#define __alloc_align(x) -#define __alloc_size(x) -#define __section(x) -#define __weak_symbol -#else -#define __weak_symbol __attribute__((__weak__)) -#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) -#define __dead2 -#define __pure2 -#define __unused -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER) -#define __dead2 __attribute__((__noreturn__)) -#define __pure2 __attribute__((__const__)) -#define __unused -/* XXX Find out what to do for __packed, __aligned and __section */ -#endif -#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) -#define __dead2 __attribute__((__noreturn__)) -#define __pure2 __attribute__((__const__)) -#define __unused __attribute__((__unused__)) -#define __used __attribute__((__used__)) -#define __packed __attribute__((__packed__)) -#define __aligned(x) __attribute__((__aligned__(x))) -#define __section(x) __attribute__((__section__(x))) -#endif -#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) -#define __alloc_size(x) __attribute__((__alloc_size__(x))) -#else -#define __alloc_size(x) -#endif -#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) -#define __alloc_align(x) __attribute__((__alloc_align__(x))) -#else -#define __alloc_align(x) -#endif -#endif /* lint */ - -#if !__GNUC_PREREQ__(2, 95) -#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) -#endif - -/* - * Keywords added in C11. - */ - -#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint) - -#if !__has_extension(c_alignas) -#if (defined(__cplusplus) && __cplusplus >= 201103L) || \ - __has_extension(cxx_alignas) -#define _Alignas(x) alignas(x) -#else -/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */ -#define _Alignas(x) __aligned(x) -#endif -#endif - -#if defined(__cplusplus) && __cplusplus >= 201103L -#define _Alignof(x) alignof(x) -#else -#define _Alignof(x) __alignof(x) -#endif - -#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic) -/* - * No native support for _Atomic(). Place object in structure to prevent - * most forms of direct non-atomic access. - */ -#define _Atomic(T) struct { T volatile __val; } -#endif - -#if defined(__cplusplus) && __cplusplus >= 201103L -#define _Noreturn [[noreturn]] -#else -#define _Noreturn __dead2 -#endif - -#if !__has_extension(c_static_assert) -#if (defined(__cplusplus) && __cplusplus >= 201103L) || \ - __has_extension(cxx_static_assert) -#define _Static_assert(x, y) static_assert(x, y) -#elif __GNUC_PREREQ__(4,6) -/* Nothing, gcc 4.6 and higher has _Static_assert built-in */ -#elif defined(__COUNTER__) -#define _Static_assert(x, y) __Static_assert(x, __COUNTER__) -#define __Static_assert(x, y) ___Static_assert(x, y) -#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \ - __unused -#else -#define _Static_assert(x, y) struct __hack -#endif -#endif - -#if !__has_extension(c_thread_local) -/* - * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode - * without actually supporting the thread_local keyword. Don't check for - * the presence of C++11 when defining _Thread_local. - */ -#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \ - __has_extension(cxx_thread_local) -#define _Thread_local thread_local -#else -#define _Thread_local __thread -#endif -#endif - -#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */ - -/* - * Emulation of C11 _Generic(). Unlike the previously defined C11 - * keywords, it is not possible to implement this using exactly the same - * syntax. Therefore implement something similar under the name - * __generic(). Unlike _Generic(), this macro can only distinguish - * between a single type, so it requires nested invocations to - * distinguish multiple cases. - */ - -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ - __has_extension(c_generic_selections) -#define __generic(expr, t, yes, no) \ - _Generic(expr, t: yes, default: no) -#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) -#define __generic(expr, t, yes, no) \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(__typeof(expr), t), yes, no) -#endif - -#if __GNUC_PREREQ__(2, 96) -#define __malloc_like __attribute__((__malloc__)) -#define __pure __attribute__((__pure__)) -#else -#define __malloc_like -#define __pure -#endif - -#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) -#define __always_inline __attribute__((__always_inline__)) -#else -#define __always_inline -#endif - -#if __GNUC_PREREQ__(3, 1) -#define __noinline __attribute__ ((__noinline__)) -#else -#define __noinline -#endif - -#if __GNUC_PREREQ__(3, 3) -#define __nonnull(x) __attribute__((__nonnull__(x))) -#define __nonnull_all __attribute__((__nonnull__)) -#else -#define __nonnull(x) -#define __nonnull_all -#endif - -#if __GNUC_PREREQ__(3, 4) -#define __fastcall __attribute__((__fastcall__)) -#define __result_use_check __attribute__((__warn_unused_result__)) -#else -#define __fastcall -#define __result_use_check -#endif - -#if __GNUC_PREREQ__(4, 1) -#define __returns_twice __attribute__((__returns_twice__)) -#else -#define __returns_twice -#endif - -#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) -#define __unreachable() __builtin_unreachable() -#else -#define __unreachable() ((void)0) -#endif - -/* XXX: should use `#if __STDC_VERSION__ < 199901'. */ -#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) -#define __func__ NULL -#endif - -/* - * GCC 2.95 provides `__restrict' as an extension to C90 to support the - * C99-specific `restrict' type qualifier. We happen to use `__restrict' as - * a way to define the `restrict' type qualifier without disturbing older - * software that is unaware of C99 keywords. - */ -#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) -#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint) -#define __restrict -#else -#define __restrict restrict -#endif -#endif - -/* - * GNU C version 2.96 adds explicit branch prediction so that - * the CPU back-end can hint the processor and also so that - * code blocks can be reordered such that the predicted path - * sees a more linear flow, thus improving cache behavior, etc. - * - * The following two macros provide us with a way to utilize this - * compiler feature. Use __predict_true() if you expect the expression - * to evaluate to true, and __predict_false() if you expect the - * expression to evaluate to false. - * - * A few notes about usage: - * - * * Generally, __predict_false() error condition checks (unless - * you have some _strong_ reason to do otherwise, in which case - * document it), and/or __predict_true() `no-error' condition - * checks, assuming you want to optimize for the no-error case. - * - * * Other than that, if you don't know the likelihood of a test - * succeeding from empirical or other `hard' evidence, don't - * make predictions. - * - * * These are meant to be used in places that are run `a lot'. - * It is wasteful to make predictions in code that is run - * seldom (e.g. at subsystem initialization time) as the - * basic block reordering that this affects can often generate - * larger code. - */ -#if __GNUC_PREREQ__(2, 96) -#define __predict_true(exp) __builtin_expect((exp), 1) -#define __predict_false(exp) __builtin_expect((exp), 0) -#else -#define __predict_true(exp) (exp) -#define __predict_false(exp) (exp) -#endif - -#if __GNUC_PREREQ__(4, 0) -#define __sentinel __attribute__((__sentinel__)) -#define __exported __attribute__((__visibility__("default"))) -#define __hidden __attribute__((__visibility__("hidden"))) -#else -#define __sentinel -#define __exported -#define __hidden -#endif - -#define __offsetof(type, field) offsetof(type, field) -#define __rangeof(type, start, end) \ - (__offsetof(type, end) - __offsetof(type, start)) - -/* - * Given the pointer x to the member m of the struct s, return - * a pointer to the containing structure. When using GCC, we first - * assign pointer x to a local variable, to check that its type is - * compatible with member m. - */ -#if __GNUC_PREREQ__(3, 1) -#define __containerof(x, s, m) ({ \ - const volatile __typeof(((s *)0)->m) *__x = (x); \ - __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\ -}) -#else -#define __containerof(x, s, m) \ - __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) -#endif - -/* - * Compiler-dependent macros to declare that functions take printf-like - * or scanf-like arguments. They are null except for versions of gcc - * that are known to support the features properly (old versions of gcc-2 - * didn't permit keeping the keywords out of the application namespace). - */ -#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) -#define __printflike(fmtarg, firstvararg) -#define __scanflike(fmtarg, firstvararg) -#define __format_arg(fmtarg) -#define __strfmonlike(fmtarg, firstvararg) -#define __strftimelike(fmtarg, firstvararg) -#else -#define __printflike(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf__, fmtarg, firstvararg))) -#define __scanflike(fmtarg, firstvararg) \ - __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) -#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg))) -#define __strfmonlike(fmtarg, firstvararg) \ - __attribute__((__format__ (__strfmon__, fmtarg, firstvararg))) -#define __strftimelike(fmtarg, firstvararg) \ - __attribute__((__format__ (__strftime__, fmtarg, firstvararg))) -#endif - -/* - * FORTIFY_SOURCE, and perhaps other compiler-specific features, require - * the use of non-standard inlining. In general we should try to avoid - * using these but GCC-compatible compilers tend to support the extensions - * well enough to use them in limited cases. - */ -#if defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__) -#if __GNUC_PREREQ__(4, 3) || __has_attribute(__artificial__) -#define __gnu_inline __attribute__((__gnu_inline__, __artificial__)) -#else -#define __gnu_inline __attribute__((__gnu_inline__)) -#endif /* artificial */ -#else -#define __gnu_inline -#endif - -/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ -#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ - defined(__GNUC__) && !defined(__INTEL_COMPILER) -#define __printf0like(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) -#else -#define __printf0like(fmtarg, firstvararg) -#endif - -#if defined(__GNUC__) || defined(__INTEL_COMPILER) -#ifndef __INTEL_COMPILER -#define __strong_reference(sym,aliassym) \ - extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) -#endif -#ifdef __ELF__ -#ifdef __STDC__ -#define __weak_reference(sym,alias) \ - __asm__(".weak " #alias); \ - __asm__(".equ " #alias ", " #sym) -#define __warn_references(sym,msg) \ - __asm__(".section .gnu.warning." #sym); \ - __asm__(".asciz \"" msg "\""); \ - __asm__(".previous") -#define __sym_compat(sym,impl,verid) \ - __asm__(".symver " #impl ", " #sym "@" #verid) -#define __sym_default(sym,impl,verid) \ - __asm__(".symver " #impl ", " #sym "@@" #verid) -#else -#define __weak_reference(sym,alias) \ - __asm__(".weak alias"); \ - __asm__(".equ alias, sym") -#define __warn_references(sym,msg) \ - __asm__(".section .gnu.warning.sym"); \ - __asm__(".asciz \"msg\""); \ - __asm__(".previous") -#define __sym_compat(sym,impl,verid) \ - __asm__(".symver impl, sym@verid") -#define __sym_default(impl,sym,verid) \ - __asm__(".symver impl, sym@@verid") -#endif /* __STDC__ */ -#else /* !__ELF__ */ -#ifdef __STDC__ -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs \"" msg "\",30,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#else -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs msg,30,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#endif /* __STDC__ */ -#endif /* __ELF__ */ -#endif /* __GNUC__ || __INTEL_COMPILER */ - -#ifndef __FBSDID -#define __FBSDID(s) struct __hack -#endif - -#ifndef __RCSID -#define __RCSID(s) struct __hack -#endif - -#ifndef __RCSID_SOURCE -#define __RCSID_SOURCE(s) struct __hack -#endif - -#ifndef __SCCSID -#define __SCCSID(s) struct __hack -#endif - -#ifndef __COPYRIGHT -#define __COPYRIGHT(s) struct __hack -#endif - -#ifndef __DECONST -#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) -#endif - -#ifndef __DEVOLATILE -#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) -#endif - -#ifndef __DEQUALIFY -#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) -#endif - -/* - * Type Safety Checking - * - * Clang provides additional attributes to enable checking type safety - * properties that cannot be enforced by the C type system. - */ - -#if __has_attribute(__argument_with_type_tag__) && \ - __has_attribute(__type_tag_for_datatype__) && !defined(lint) -#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \ - __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx))) -#define __datatype_type_tag(kind, type) \ - __attribute__((__type_tag_for_datatype__(kind, type))) -#else -#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) -#define __datatype_type_tag(kind, type) -#endif - -/* - * Lock annotations. - * - * Clang provides support for doing basic thread-safety tests at - * compile-time, by marking which locks will/should be held when - * entering/leaving a functions. - * - * Furthermore, it is also possible to annotate variables and structure - * members to enforce that they are only accessed when certain locks are - * held. - */ - -#if __has_extension(c_thread_safety_attributes) -#define __lock_annotate(x) __attribute__((x)) -#else -#define __lock_annotate(x) -#endif - -/* Structure implements a lock. */ -#define __lockable __lock_annotate(lockable) - -/* Function acquires an exclusive or shared lock. */ -#define __locks_exclusive(...) \ - __lock_annotate(exclusive_lock_function(__VA_ARGS__)) -#define __locks_shared(...) \ - __lock_annotate(shared_lock_function(__VA_ARGS__)) - -/* Function attempts to acquire an exclusive or shared lock. */ -#define __trylocks_exclusive(...) \ - __lock_annotate(exclusive_trylock_function(__VA_ARGS__)) -#define __trylocks_shared(...) \ - __lock_annotate(shared_trylock_function(__VA_ARGS__)) - -/* Function releases a lock. */ -#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__)) - -/* Function asserts that an exclusive or shared lock is held. */ -#define __asserts_exclusive(...) \ - __lock_annotate(assert_exclusive_lock(__VA_ARGS__)) -#define __asserts_shared(...) \ - __lock_annotate(assert_shared_lock(__VA_ARGS__)) - -/* Function requires that an exclusive or shared lock is or is not held. */ -#define __requires_exclusive(...) \ - __lock_annotate(exclusive_locks_required(__VA_ARGS__)) -#define __requires_shared(...) \ - __lock_annotate(shared_locks_required(__VA_ARGS__)) -#define __requires_unlocked(...) \ - __lock_annotate(locks_excluded(__VA_ARGS__)) - -/* Function should not be analyzed. */ -#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) - -/* Guard variables and structure members by lock. */ -#define __guarded_by(x) __lock_annotate(guarded_by(x)) -#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) - -#ifdef __cplusplus -} -#endif - -#endif /* SYS_CDEFS_H */ diff --git a/cpu/msp430_common/include/sys/features.h b/cpu/msp430_common/include/sys/features.h deleted file mode 100644 index fc534079d7..0000000000 --- a/cpu/msp430_common/include/sys/features.h +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Written by Joel Sherrill . - * - * COPYRIGHT (c) 1989-2014. - * - * On-Line Applications Research Corporation (OAR). - * - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software. - * - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION - * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS - * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - * - * $Id$ - */ - -/* This file was imported into RIOT from newlib 2.3.0 */ - -#ifndef SYS_FEATURES_H -#define SYS_FEATURES_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* Macro to test version of GCC. Returns 0 for non-GCC or too old GCC. */ -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif /* __GNUC_PREREQ */ -/* Version with trailing underscores for BSD compatibility. */ -#define __GNUC_PREREQ__(ma, mi) __GNUC_PREREQ(ma, mi) - - -/* - * Feature test macros control which symbols are exposed by the system - * headers. Any of these must be defined before including any headers. - * - * __STRICT_ANSI__ (defined by gcc -ansi, -std=c90, -std=c99, or -std=c11) - * ISO C - * - * _POSIX_SOURCE (deprecated by _POSIX_C_SOURCE=1) - * _POSIX_C_SOURCE >= 1 - * POSIX.1-1990 - * - * _POSIX_C_SOURCE >= 2 - * POSIX.2-1992 - * - * _POSIX_C_SOURCE >= 199309L - * POSIX.1b-1993 Real-time extensions - * - * _POSIX_C_SOURCE >= 199506L - * POSIX.1c-1995 Threads extensions - * - * _POSIX_C_SOURCE >= 200112L - * POSIX.1-2001 and C99 - * - * _POSIX_C_SOURCE >= 200809L - * POSIX.1-2008 - * - * _XOPEN_SOURCE - * POSIX.1-1990 and XPG4 - * - * _XOPEN_SOURCE_EXTENDED - * SUSv1 (POSIX.2-1992 plus XPG4v2) - * - * _XOPEN_SOURCE >= 500 - * SUSv2 (POSIX.1c-1995 plus XSI) - * - * _XOPEN_SOURCE >= 600 - * SUSv3 (POSIX.1-2001 plus XSI) and C99 - * - * _XOPEN_SOURCE >= 700 - * SUSv4 (POSIX.1-2008 plus XSI) - * - * _ISOC99_SOURCE or gcc -std=c99 or g++ - * ISO C99 - * - * _ISOC11_SOURCE or gcc -std=c11 or g++ -std=c++11 - * ISO C11 - * - * _ATFILE_SOURCE (implied by _POSIX_C_SOURCE >= 200809L) - * "at" functions - * - * _LARGEFILE_SOURCE (deprecated by _XOPEN_SOURCE >= 500) - * fseeko, ftello - * - * _GNU_SOURCE - * All of the above plus GNU extensions - * - * _BSD_SOURCE (deprecated by _DEFAULT_SOURCE) - * _SVID_SOURCE (deprecated by _DEFAULT_SOURCE) - * _DEFAULT_SOURCE (or none of the above) - * POSIX-1.2008 with BSD and SVr4 extensions - */ - -#ifdef _GNU_SOURCE -#undef _ATFILE_SOURCE -#define _ATFILE_SOURCE 1 -#undef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE 1 -#undef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#undef _ISOC11_SOURCE -#define _ISOC11_SOURCE 1 -#undef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#undef _XOPEN_SOURCE -#define _XOPEN_SOURCE 700 -#undef _XOPEN_SOURCE_EXTENDED -#define _XOPEN_SOURCE_EXTENDED 1 -#endif /* _GNU_SOURCE */ - -#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || \ - (!defined(__STRICT_ANSI__) && !defined(_ANSI_SOURCE) && \ - !defined(_ISOC99_SOURCE) && !defined(_POSIX_SOURCE) && \ - !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) -#undef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE 1 -#endif - -#if defined(_DEFAULT_SOURCE) -#undef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - -#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \ - ((!defined(__STRICT_ANSI__) && !defined(_ANSI_SOURCE)) || \ - (_XOPEN_SOURCE - 0) >= 500) -#define _POSIX_SOURCE 1 -#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 700 -#define _POSIX_C_SOURCE 200809L -#elif (_XOPEN_SOURCE - 0) >= 600 -#define _POSIX_C_SOURCE 200112L -#elif (_XOPEN_SOURCE - 0) >= 500 -#define _POSIX_C_SOURCE 199506L -#elif (_XOPEN_SOURCE - 0) < 500 -#define _POSIX_C_SOURCE 2 -#endif -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809 -#undef _ATFILE_SOURCE -#define _ATFILE_SOURCE 1 -#endif - -/* - * The following private macros are used throughout the headers to control - * which symbols should be exposed. They are for internal use only, as - * indicated by the leading double underscore, and must never be used outside - * of these headers. - * - * __POSIX_VISIBLE - * any version of POSIX.1; enabled by default, or with _POSIX_SOURCE, - * any value of _POSIX_C_SOURCE, or _XOPEN_SOURCE >= 500. - * - * __POSIX_VISIBLE >= 2 - * POSIX.2-1992; enabled by default, with _POSIX_C_SOURCE >= 2, - * or _XOPEN_SOURCE >= 500. - * - * __POSIX_VISIBLE >= 199309 - * POSIX.1b-1993; enabled by default, with _POSIX_C_SOURCE >= 199309L, - * or _XOPEN_SOURCE >= 500. - * - * __POSIX_VISIBLE >= 199506 - * POSIX.1c-1995; enabled by default, with _POSIX_C_SOURCE >= 199506L, - * or _XOPEN_SOURCE >= 500. - * - * __POSIX_VISIBLE >= 200112 - * POSIX.1-2001; enabled by default, with _POSIX_C_SOURCE >= 200112L, - * or _XOPEN_SOURCE >= 600. - * - * __POSIX_VISIBLE >= 200809 - * POSIX.1-2008; enabled by default, with _POSIX_C_SOURCE >= 200809L, - * or _XOPEN_SOURCE >= 700. - * - * __XSI_VISIBLE - * XPG4 XSI extensions; enabled with any version of _XOPEN_SOURCE. - * - * __XSI_VISIBLE >= 4 - * SUSv1 XSI extensions; enabled with both _XOPEN_SOURCE and - * _XOPEN_SOURCE_EXTENDED together. - * - * __XSI_VISIBLE >= 500 - * SUSv2 XSI extensions; enabled with _XOPEN_SOURCE >= 500. - * - * __XSI_VISIBLE >= 600 - * SUSv3 XSI extensions; enabled with _XOPEN_SOURCE >= 600. - * - * __XSI_VISIBLE >= 700 - * SUSv4 XSI extensions; enabled with _XOPEN_SOURCE >= 700. - * - * __ISO_C_VISIBLE >= 1999 - * ISO C99; enabled with gcc -std=c99 or newer (on by default since GCC 5), - * any version of C++, or with _ISOC99_SOURCE, _POSIX_C_SOURCE >= 200112L, - * or _XOPEN_SOURCE >= 600. - * - * __ISO_C_VISIBLE >= 2011 - * ISO C11; enabled with gcc -std=c11 or newer (on by default since GCC 5), - * g++ -std=c++11 or newer (on by default since GCC 6), or with - * _ISOC11_SOURCE. - * - * __ATFILE_VISIBLE - * "at" functions; enabled by default, with _ATFILE_SOURCE, - * _POSIX_C_SOURCE >= 200809L, or _XOPEN_SOURCE >= 700. - * - * __LARGEFILE_VISIBLE - * fseeko, ftello; enabled with _LARGEFILE_SOURCE or _XOPEN_SOURCE >= 500. - * - * __BSD_VISIBLE - * BSD extensions; enabled by default, or with _BSD_SOURCE. - * - * __SVID_VISIBLE - * SVr4 extensions; enabled by default, or with _SVID_SOURCE. - * - * __MISC_VISIBLE - * Extensions found in both BSD and SVr4 (shorthand for - * (__BSD_VISIBLE || __SVID_VISIBLE)), or newlib-specific - * extensions; enabled by default. - * - * __GNU_VISIBLE - * GNU extensions; enabled with _GNU_SOURCE. - * - * In all cases above, "enabled by default" means either by defining - * _DEFAULT_SOURCE, or by not defining any of the public feature test macros. - * Defining _GNU_SOURCE makes all of the above available. - */ - -#ifdef _ATFILE_SOURCE -#define __ATFILE_VISIBLE 1 -#else -#define __ATFILE_VISIBLE 0 -#endif - -#ifdef _DEFAULT_SOURCE -#define __BSD_VISIBLE 1 -#else -#define __BSD_VISIBLE 0 -#endif - -#ifdef _GNU_SOURCE -#define __GNU_VISIBLE 1 -#else -#define __GNU_VISIBLE 0 -#endif - -#if defined(_ISOC11_SOURCE) || \ - (__STDC_VERSION__ - 0) >= 201112L || (__cplusplus - 0) >= 201103L -#define __ISO_C_VISIBLE 2011 -#elif defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) >= 200112L || \ - (__STDC_VERSION__ - 0) >= 199901L || defined(__cplusplus) -#define __ISO_C_VISIBLE 1999 -#else -#define __ISO_C_VISIBLE 1990 -#endif - -#if defined(_LARGEFILE_SOURCE) || (_XOPEN_SOURCE - 0) >= 500 -#define __LARGEFILE_VISIBLE 1 -#else -#define __LARGEFILE_VISIBLE 0 -#endif - -#ifdef _DEFAULT_SOURCE -#define __MISC_VISIBLE 1 -#else -#define __MISC_VISIBLE 0 -#endif - -#if (_POSIX_C_SOURCE - 0) >= 200809L -#define __POSIX_VISIBLE 200809 -#elif (_POSIX_C_SOURCE - 0) >= 200112L -#define __POSIX_VISIBLE 200112 -#elif (_POSIX_C_SOURCE - 0) >= 199506L -#define __POSIX_VISIBLE 199506 -#elif (_POSIX_C_SOURCE - 0) >= 199309L -#define __POSIX_VISIBLE 199309 -#elif (_POSIX_C_SOURCE - 0) >= 2 || defined(_XOPEN_SOURCE) -#define __POSIX_VISIBLE 199209 -#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) -#define __POSIX_VISIBLE 199009 -#else -#define __POSIX_VISIBLE 0 -#endif - -#ifdef _DEFAULT_SOURCE -#define __SVID_VISIBLE 1 -#else -#define __SVID_VISIBLE 0 -#endif - -#if (_XOPEN_SOURCE - 0) >= 700 -#define __XSI_VISIBLE 700 -#elif (_XOPEN_SOURCE - 0) >= 600 -#define __XSI_VISIBLE 600 -#elif (_XOPEN_SOURCE - 0) >= 500 -#define __XSI_VISIBLE 500 -#elif defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED) -#define __XSI_VISIBLE 4 -#elif defined(_XOPEN_SOURCE) -#define __XSI_VISIBLE 1 -#else -#define __XSI_VISIBLE 0 -#endif - -/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */ - -#ifdef __rtems__ -#define _POSIX_JOB_CONTROL 1 -#define _POSIX_SAVED_IDS 1 -#define _POSIX_VERSION 199309L -#define _POSIX_ASYNCHRONOUS_IO 1 -#define _POSIX_FSYNC 1 -#define _POSIX_MAPPED_FILES 1 -#define _POSIX_MEMLOCK 1 -#define _POSIX_MEMLOCK_RANGE 1 -#define _POSIX_MEMORY_PROTECTION 1 -#define _POSIX_MESSAGE_PASSING 1 -#define _POSIX_MONOTONIC_CLOCK 200112L -#define _POSIX_PRIORITIZED_IO 1 -#define _POSIX_PRIORITY_SCHEDULING 1 -#define _POSIX_REALTIME_SIGNALS 1 -#define _POSIX_SEMAPHORES 1 -/* #define _POSIX_SHARED_MEMORY_OBJECTS 1 */ -#define _POSIX_SYNCHRONIZED_IO 1 -#define _POSIX_TIMERS 1 -#define _POSIX_BARRIERS 200112L -#define _POSIX_READER_WRITER_LOCKS 200112L -#define _POSIX_SPIN_LOCKS 200112L - - -/* In P1003.1b but defined by drafts at least as early as P1003.1c/D10 */ -#define _POSIX_THREADS 1 -#define _POSIX_THREAD_ATTR_STACKADDR 1 -#define _POSIX_THREAD_ATTR_STACKSIZE 1 -#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 -#define _POSIX_THREAD_PRIO_INHERIT 1 -#define _POSIX_THREAD_PRIO_PROTECT 1 -#define _POSIX_THREAD_PROCESS_SHARED 1 -#define _POSIX_THREAD_SAFE_FUNCTIONS 1 - -/* P1003.4b/D8 defines the constants below this comment. */ -#define _POSIX_SPAWN 1 -#define _POSIX_TIMEOUTS 1 -#define _POSIX_CPUTIME 1 -#define _POSIX_THREAD_CPUTIME 1 -#define _POSIX_SPORADIC_SERVER 1 -#define _POSIX_THREAD_SPORADIC_SERVER 1 -#define _POSIX_DEVICE_CONTROL 1 -#define _POSIX_DEVCTL_DIRECTION 1 -#define _POSIX_INTERRUPT_CONTROL 1 -#define _POSIX_ADVISORY_INFO 1 - -/* UNIX98 added some new pthread mutex attributes */ -#define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1 - -#endif - -/* XMK loosely adheres to POSIX -- 1003.1 */ -#ifdef __XMK__ -#define _POSIX_THREADS 1 -#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 -#endif - - -#ifdef __svr4__ -# define _POSIX_JOB_CONTROL 1 -# define _POSIX_SAVED_IDS 1 -# define _POSIX_VERSION 199009L -#endif - -#ifdef __CYGWIN__ - -#if __POSIX_VISIBLE >= 200809 -#define _POSIX_VERSION 200809L -#define _POSIX2_VERSION 200809L -#elif __POSIX_VISIBLE >= 200112 -#define _POSIX_VERSION 200112L -#define _POSIX2_VERSION 200112L -#elif __POSIX_VISIBLE >= 199506 -#define _POSIX_VERSION 199506L -#define _POSIX2_VERSION 199506L -#elif __POSIX_VISIBLE >= 199309 -#define _POSIX_VERSION 199309L -#define _POSIX2_VERSION 199209L -#elif __POSIX_VISIBLE >= 199209 -#define _POSIX_VERSION 199009L -#define _POSIX2_VERSION 199209L -#elif __POSIX_VISIBLE -#define _POSIX_VERSION 199009L -#endif -#if __XSI_VISIBLE >= 4 -#define _XOPEN_VERSION __XSI_VISIBLE -#endif - -#define _POSIX_ADVISORY_INFO 200809L -/* #define _POSIX_ASYNCHRONOUS_IO -1 */ -#define _POSIX_BARRIERS 200809L -#define _POSIX_CHOWN_RESTRICTED 1 -#define _POSIX_CLOCK_SELECTION 200809L -#define _POSIX_CPUTIME 200809L -#define _POSIX_FSYNC 200809L -#define _POSIX_IPV6 200809L -#define _POSIX_JOB_CONTROL 1 -#define _POSIX_MAPPED_FILES 200809L -/* #define _POSIX_MEMLOCK -1 */ -#define _POSIX_MEMLOCK_RANGE 200809L -#define _POSIX_MEMORY_PROTECTION 200809L -#define _POSIX_MESSAGE_PASSING 200809L -#define _POSIX_MONOTONIC_CLOCK 200809L -#define _POSIX_NO_TRUNC 1 -/* #define _POSIX_PRIORITIZED_IO -1 */ -#define _POSIX_PRIORITY_SCHEDULING 200809L -#define _POSIX_RAW_SOCKETS 200809L -#define _POSIX_READER_WRITER_LOCKS 200809L -#define _POSIX_REALTIME_SIGNALS 200809L -#define _POSIX_REGEXP 1 -#define _POSIX_SAVED_IDS 1 -#define _POSIX_SEMAPHORES 200809L -#define _POSIX_SHARED_MEMORY_OBJECTS 200809L -#define _POSIX_SHELL 1 -#define _POSIX_SPAWN 200809L -#define _POSIX_SPIN_LOCKS 200809L -/* #define _POSIX_SPORADIC_SERVER -1 */ -#define _POSIX_SYNCHRONIZED_IO 200809L -#define _POSIX_THREAD_ATTR_STACKADDR 200809L -#define _POSIX_THREAD_ATTR_STACKSIZE 200809L -#define _POSIX_THREAD_CPUTIME 200809L -/* #define _POSIX_THREAD_PRIO_INHERIT -1 */ -/* #define _POSIX_THREAD_PRIO_PROTECT -1 */ -#define _POSIX_THREAD_PRIORITY_SCHEDULING 200809L -#define _POSIX_THREAD_PROCESS_SHARED 200809L -#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L -/* #define _POSIX_THREAD_SPORADIC_SERVER -1 */ -#define _POSIX_THREADS 200809L -/* #define _POSIX_TIMEOUTS -1 */ -#define _POSIX_TIMERS 200809L -/* #define _POSIX_TRACE -1 */ -/* #define _POSIX_TRACE_EVENT_FILTER -1 */ -/* #define _POSIX_TRACE_INHERIT -1 */ -/* #define _POSIX_TRACE_LOG -1 */ -/* #define _POSIX_TYPED_MEMORY_OBJECTS -1 */ -#define _POSIX_VDISABLE '\0' - -#if __POSIX_VISIBLE >= 2 -#define _POSIX2_C_VERSION _POSIX2_VERSION -#define _POSIX2_C_BIND _POSIX2_VERSION -#define _POSIX2_C_DEV _POSIX2_VERSION -#define _POSIX2_CHAR_TERM _POSIX2_VERSION -/* #define _POSIX2_FORT_DEV -1 */ -/* #define _POSIX2_FORT_RUN -1 */ -/* #define _POSIX2_LOCALEDEF -1 */ -/* #define _POSIX2_PBS -1 */ -/* #define _POSIX2_PBS_ACCOUNTING -1 */ -/* #define _POSIX2_PBS_CHECKPOINT -1 */ -/* #define _POSIX2_PBS_LOCATE -1 */ -/* #define _POSIX2_PBS_MESSAGE -1 */ -/* #define _POSIX2_PBS_TRACK -1 */ -#define _POSIX2_SW_DEV _POSIX2_VERSION -#define _POSIX2_UPE _POSIX2_VERSION -#endif /* __POSIX_VISIBLE >= 2 */ - -#define _POSIX_V6_ILP32_OFF32 -1 -#ifdef __LP64__ -#define _POSIX_V6_ILP32_OFFBIG -1 -#define _POSIX_V6_LP64_OFF64 1 -#define _POSIX_V6_LPBIG_OFFBIG 1 -#else -#define _POSIX_V6_ILP32_OFFBIG 1 -#define _POSIX_V6_LP64_OFF64 -1 -#define _POSIX_V6_LPBIG_OFFBIG -1 -#endif -#define _POSIX_V7_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 -#define _POSIX_V7_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG -#define _POSIX_V7_LP64_OFF64 _POSIX_V6_LP64_OFF64 -#define _POSIX_V7_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG -#define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 -#define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG -#define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64 -#define _XBS5_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG - -#if __XSI_VISIBLE -#define _XOPEN_CRYPT 1 -#define _XOPEN_ENH_I18N 1 -/* #define _XOPEN_LEGACY -1 */ -/* #define _XOPEN_REALTIME -1 */ -/* #define _XOPEN_REALTIME_THREADS -1 */ -#define _XOPEN_SHM 1 -/* #define _XOPEN_STREAMS -1 */ -/* #define _XOPEN_UNIX -1 */ -#endif /* __XSI_VISIBLE */ - -/* The value corresponds to UNICODE version 4.0, which is the version - supported by XP. Newlib supports 5.2 (2011) but so far Cygwin needs - the MS conversions for double-byte charsets. */ -#define __STDC_ISO_10646__ 200305L - -#endif /* __CYGWIN__ */ - -#ifdef __cplusplus -} -#endif -#endif /* SYS_FEATURES_H */ diff --git a/cpu/msp430_common/include/sys/stat.h b/cpu/msp430_common/include/sys/stat.h deleted file mode 100644 index 45843a7be9..0000000000 --- a/cpu/msp430_common/include/sys/stat.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2016 Eistec AB - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_msp430_common - * - * @{ - * @file - * @brief POSIX compatible sys/stat.h definitions - * @author Joakim Nohlgård - */ - -/* If building on native we need to use the system libraries instead */ -#ifdef CPU_NATIVE -#pragma GCC system_header -/* without the GCC pragma above #include_next will trigger a pedantic error */ -#include_next -#else -#ifndef SYS_STAT_H -#define SYS_STAT_H - -#include /* for struct timespec */ -#include /* for fsblkcnt_t, fsfilcnt_t */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief File information - */ -struct stat { - dev_t st_dev; /**< Device ID of device containing file. */ - ino_t st_ino; /**< File serial number. */ - mode_t st_mode; /**< Mode of file (see below). */ - nlink_t st_nlink; /**< Number of hard links to the file. */ - uid_t st_uid; /**< User ID of file. */ - gid_t st_gid; /**< Group ID of file. */ - dev_t st_rdev; /**< Device ID (if file is character or block special). */ - /** - * For regular files, the file size in bytes. - * For symbolic links, the length in bytes of the pathname contained in the - * symbolic link. - * For a shared memory object, the length in bytes. - * For a typed memory object, the length in bytes. - * For other file types, the use of this field is unspecified. - */ - off_t st_size; - struct timespec st_atim; /**< Last data access timestamp. */ - struct timespec st_mtim; /**< Last data modification timestamp. */ - struct timespec st_ctim; /**< Last file status change timestamp. */ - /** - * A file system-specific preferred I/O block size for this object. In some - * file system types, this may vary from file to file. - */ - blksize_t st_blksize; - blkcnt_t st_blocks; /**< Number of blocks allocated for this object. */ -}; - -/* These bitmasks and numbers are the same as in newlib */ -#define S_IFMT 0170000 /* type of file */ -#define S_IFDIR 0040000 /* directory */ -#define S_IFCHR 0020000 /* character special */ -#define S_IFBLK 0060000 /* block special */ -#define S_IFREG 0100000 /* regular */ -#define S_IFLNK 0120000 /* symbolic link */ -#define S_IFSOCK 0140000 /* socket */ -#define S_IFIFO 0010000 /* fifo */ - -/* These numbers are well-known and can be found in the manual page for sys_stat.h */ -#define S_IRWXU 0700 /**< Read, write, execute/search by owner. */ -#define S_IRUSR 0400 /**< Read permission, owner. */ -#define S_IWUSR 0200 /**< Write permission, owner. */ -#define S_IXUSR 0100 /**< Execute/search permission, owner. */ -#define S_IRWXG 070 /**< Read, write, execute/search by group. */ -#define S_IRGRP 040 /**< Read permission, group. */ -#define S_IWGRP 020 /**< Write permission, group. */ -#define S_IXGRP 010 /**< Execute/search permission, group. */ -#define S_IRWXO 07 /**< Read, write, execute/search by others. */ -#define S_IROTH 04 /**< Read permission, others. */ -#define S_IWOTH 02 /**< Write permission, others. */ -#define S_IXOTH 01 /**< Execute/search permission, others. */ -#define S_ISUID 04000 /**< Set-user-ID on execution. */ -#define S_ISGID 02000 /**< Set-group-ID on execution. */ -#define S_ISVTX 01000 /**< On directories, restricted deletion flag */ - -/* File type test macros, taken from newlib */ -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) - -/* These function prototypes are required by the standard */ -int chmod(const char *, mode_t); -int fchmod(int, mode_t); -int fchmodat(int, const char *, mode_t, int); -int fstat(int, struct stat *); -int fstatat(int, const char *restrict, struct stat *restrict, int); -int futimens(int, const struct timespec [2]); -int lstat(const char *restrict, struct stat *restrict); -int mkdir(const char *, mode_t); -int mkdirat(int, const char *, mode_t); -int mkfifo(const char *, mode_t); -int mkfifoat(int, const char *, mode_t); -int mknod(const char *, mode_t, dev_t); -int mknodat(int, const char *, mode_t, dev_t); -int stat(const char *restrict, struct stat *restrict); -mode_t umask(mode_t); -int utimensat(int, const char *, const struct timespec [2], int); - -/* Special tv_nsec values for futimens(2) and utimensat(2). */ -#define UTIME_NOW (-2L) -#define UTIME_OMIT (-1L) - -#ifdef __cplusplus -} -#endif - -#endif /* SYS_STAT_H */ - -#endif /* CPU_NATIVE */ - -/** @} */ diff --git a/cpu/msp430_common/include/sys/time.h b/cpu/msp430_common/include/sys/time.h deleted file mode 100644 index 3a56dc7fdb..0000000000 --- a/cpu/msp430_common/include/sys/time.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2014 INRIA - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -#ifndef SYS_TIME_H -#define SYS_TIME_H - -#include "msp430_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SYS_TIME_H */ diff --git a/cpu/msp430_common/include/sys/types.h b/cpu/msp430_common/include/sys/types.h deleted file mode 100644 index b6ae952372..0000000000 --- a/cpu/msp430_common/include/sys/types.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2014 INRIA - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -#ifndef SYS_TYPES_H -#define SYS_TYPES_H - -#include "msp430_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SYS_TYPES_H */ diff --git a/cpu/msp430_common/include/time.h b/cpu/msp430_common/include/time.h deleted file mode 100644 index 9664d656c8..0000000000 --- a/cpu/msp430_common/include/time.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2014 INRIA - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_msp430_common - * @{ - * - * @file - * @brief time.h for msp430 - * @see http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html - * - * @author Martine Lenders - */ - -#ifndef TIME_H -#define TIME_H - -#include -#include "msp430_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Datatype to represent time. - */ -struct tm { - int tm_sec; /**< Seconds after the minute [0, 60] */ - int tm_min; /**< Minutes after the hour [0, 59] */ - int tm_hour; /**< Hours since midnight [0, 23] */ - int tm_mday; /**< Day of the month [1, 31] */ - int tm_mon; /**< Months since January [0, 11] */ - int tm_year; /**< Years since 1900 */ - int tm_wday; /**< Days since Sunday [0, 6] */ - int tm_yday; /**< Days since January 1st [0, 365] */ - int tm_isdst; /**< Daylight saving time is in effect - * (positive if true, 0 if not, negative if n/a) */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* TIME_H */ -/** @} */ diff --git a/cpu/msp430_common/include/unistd.h b/cpu/msp430_common/include/unistd.h deleted file mode 100644 index 55930fab6b..0000000000 --- a/cpu/msp430_common/include/unistd.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2016 Eistec AB - * Copyright (C) 2015 Kaspar Schleiser - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_msp430_common - * @{ - * - * @file - * @brief unistd.h wrapper for MSP430 - */ - -#ifndef UNISTD_H -#define UNISTD_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define STDIN_FILENO 0 /* standard input file descriptor */ -#define STDOUT_FILENO 1 /* standard output file descriptor */ -#define STDERR_FILENO 2 /* standard error file descriptor */ - -#define F_OK 0 -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -int access(const char *, int); -unsigned alarm(unsigned); -int chdir(const char *); -int chown(const char *, uid_t, gid_t); -int close(int); -size_t confstr(int, char *, size_t); -int dup(int); -int dup2(int, int); -void _exit(int); -int execl(const char *, const char *, ...); -int execle(const char *, const char *, ...); -int execlp(const char *, const char *, ...); -int execv(const char *, char *const []); -int execve(const char *, char *const [], char *const []); -int execvp(const char *, char *const []); -int faccessat(int, const char *, int, int); -int fchdir(int); -int fchown(int, uid_t, gid_t); -int fchownat(int, const char *, uid_t, gid_t, int); -int fexecve(int, char *const [], char *const []); -pid_t fork(void); -long fpathconf(int, int); -int ftruncate(int, off_t); -char *getcwd(char *, size_t); -gid_t getegid(void); -uid_t geteuid(void); -gid_t getgid(void); -int getgroups(int, gid_t []); -int gethostname(char *, size_t); -char *getlogin(void); -int getlogin_r(char *, size_t); -int getopt(int, char * const [], const char *); -pid_t getpgid(pid_t); -pid_t getpgrp(void); -pid_t getpid(void); -pid_t getppid(void); -pid_t getsid(pid_t); -uid_t getuid(void); -int isatty(int); -int lchown(const char *, uid_t, gid_t); -int link(const char *, const char *); -int linkat(int, const char *, int, const char *, int); -off_t lseek(int, off_t, int); -long pathconf(const char *, int); -int pause(void); -int pipe(int [2]); -ssize_t pread(int, void *, size_t, off_t); -ssize_t pwrite(int, const void *, size_t, off_t); -ssize_t read(int, void *, size_t); -ssize_t readlink(const char *restrict, char *restrict, size_t); -ssize_t readlinkat(int, const char *restrict, char *restrict, size_t); -int rmdir(const char *); -int setegid(gid_t); -int seteuid(uid_t); -int setgid(gid_t); -int setpgid(pid_t, pid_t); -pid_t setsid(void); -int setuid(uid_t); -unsigned sleep(unsigned); -int symlink(const char *, const char *); -int symlinkat(const char *, int, const char *); -long sysconf(int); -pid_t tcgetpgrp(int); -int tcsetpgrp(int, pid_t); -int truncate(const char *, off_t); -char *ttyname(int); -int ttyname_r(int, char *, size_t); -int unlink(const char *); -int unlinkat(int, const char *, int); -int usleep(useconds_t); -ssize_t write(int, const void *, size_t); - -#ifdef __cplusplus -} -#endif - -#endif /* UNISTD_H */ -/** @} */ diff --git a/sys/posix/pthread/include/pthread_cond.h b/sys/posix/pthread/include/pthread_cond.h index 9ca502e643..b1ce753abe 100644 --- a/sys/posix/pthread/include/pthread_cond.h +++ b/sys/posix/pthread/include/pthread_cond.h @@ -21,10 +21,6 @@ #include "mutex.h" #include "priority_queue.h" -#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ) -# include "msp430_types.h" -#endif - #if defined(__WITH_AVRLIBC__) /* avr-libc 'time.h' does not include 'sys/types.h' but we need 'clockid_t' */ # include