diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/assert.h | 12 | ||||
-rw-r--r-- | builtin/stdarg.h | 24 | ||||
-rw-r--r-- | builtin/stddef.h | 30 | ||||
-rw-r--r-- | builtin/stdint.h | 38 | ||||
-rw-r--r-- | builtin/string.h | 16 | ||||
-rw-r--r-- | builtin/time.h | 13 |
6 files changed, 133 insertions, 0 deletions
diff --git a/builtin/assert.h b/builtin/assert.h new file mode 100644 index 0000000000..7e5f04b375 --- /dev/null +++ b/builtin/assert.h @@ -0,0 +1,12 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_ASSERT_H__ +#define __CROS_EC_ASSERT_H__ + +#include "util.h" +#define assert(x...) ASSERT(x) + +#endif /* __CROS_EC_ASSERT_H__ */ diff --git a/builtin/stdarg.h b/builtin/stdarg.h new file mode 100644 index 0000000000..66ab940b16 --- /dev/null +++ b/builtin/stdarg.h @@ -0,0 +1,24 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_STDARG_H__ +#define __CROS_EC_STDARG_H__ + +/* We use -nostdinc -ffreestanding to keep host system include files + * from contaminating our build. + * Unfortunately this also gets us rid of the _compiler_ includes, like + * stdarg.h. To work around the issue, we define varargs directly here. + */ + +#ifdef __GNUC__ +#define va_start(v, l) __builtin_va_start(v, l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v, l) __builtin_va_arg(v, l) +typedef __builtin_va_list va_list; +#else +#include_next <stdarg.h> +#endif + +#endif /* __CROS_EC_STDARG_H__ */ diff --git a/builtin/stddef.h b/builtin/stddef.h new file mode 100644 index 0000000000..505dd9f515 --- /dev/null +++ b/builtin/stddef.h @@ -0,0 +1,30 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_STDDEF_H__ +#define __CROS_EC_STDDEF_H__ + +#ifndef __SIZE_TYPE__ +#define __SIZE_TYPE__ unsigned long +#endif + +typedef __SIZE_TYPE__ size_t; +/* There is a GCC macro for a size_t type, but not for a ssize_t type. + * The following construct convinces GCC to make __SIZE_TYPE__ signed. + */ +#define unsigned signed +typedef __SIZE_TYPE__ ssize_t; +#undef unsigned + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; + +#endif /* __CROS_EC_STDDEF_H__ */ diff --git a/builtin/stdint.h b/builtin/stdint.h new file mode 100644 index 0000000000..75cf8d8ebf --- /dev/null +++ b/builtin/stdint.h @@ -0,0 +1,38 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_STDINT_H__ +#define __CROS_EC_STDINT_H__ + +typedef unsigned char uint8_t; +typedef signed char int8_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned int uint32_t; +typedef signed int int32_t; + +typedef unsigned long long uint64_t; +typedef signed long long int64_t; + +typedef int intptr_t; +typedef unsigned int uintptr_t; + +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767U) +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647U) +#endif + +#endif /* __CROS_EC_STDINT_H__ */ diff --git a/builtin/string.h b/builtin/string.h new file mode 100644 index 0000000000..d30dda8324 --- /dev/null +++ b/builtin/string.h @@ -0,0 +1,16 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This header is only needed for CR50 compatibility */ + +#ifndef __CROS_EC_STRINGS_H__ +#define __CROS_EC_STRINGS_H__ + +#include <stddef.h> + +void *memcpy(void *dest, const void *src, size_t len); +void *memset(void *dest, int c, size_t len); + +#endif /* __CROS_EC_STRINGS_H__ */ diff --git a/builtin/time.h b/builtin/time.h new file mode 100644 index 0000000000..a069ae18c9 --- /dev/null +++ b/builtin/time.h @@ -0,0 +1,13 @@ +/* Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This header is only needed for CR50 compatibility */ + +#ifndef __CROS_EC_TIME_H__ +#define __CROS_EC_TIME_H__ + +#include <timer.h> + +#endif /* __CROS_EC_TIME_H__ */ |