diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2022-08-02 01:20:12 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2022-09-25 02:40:23 +0200 |
| commit | 288727f09a1b3458c268497d111349e608c3f9fa (patch) | |
| tree | d62565249fa3c7127856c65405752572fc41aca9 /src_c/arch.h | |
Diffstat (limited to 'src_c/arch.h')
| -rw-r--r-- | src_c/arch.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src_c/arch.h b/src_c/arch.h new file mode 100644 index 0000000..01ae8d9 --- /dev/null +++ b/src_c/arch.h @@ -0,0 +1,63 @@ +#ifndef LISP16_ARCH_H +#define LISP16_ARCH_H + +#define LSP_ARCH_POSIX 0 +#define LSP_ARCH_AVR8 1 +#define LSP_ARCH_STM32 2 + +#ifndef LSP_ARCH +#error LSP_ARCH not defined +#endif + +#if LSP_ARCH == LSP_ARCH_POSIX + +#include <stdint.h> +typedef _Bool lsp_bool_t; +typedef int8_t lsp_int8_t; +typedef int16_t lsp_int16_t; +typedef int32_t lsp_int32_t; +typedef uint8_t lsp_uint8_t; +typedef uint16_t lsp_uint16_t; +typedef uint32_t lsp_uint32_t; + +#elif LSP_ARCH == LSP_ARCH_AVR8 + +#include <stdint.h> +typedef _Bool lsp_bool_t; +typedef int8_t lsp_int8_t; +typedef int16_t lsp_int16_t; +typedef int32_t lsp_int32_t; +typedef uint8_t lsp_uint8_t; +typedef uint16_t lsp_uint16_t; +typedef uint32_t lsp_uint32_t; + +#elif LSP_ARCH == LSP_ARCH_STM32 + +#include <stdint.h> +typedef _Bool lsp_bool_t; +typedef int8_t lsp_int8_t; +typedef int16_t lsp_int16_t; +typedef int32_t lsp_int32_t; +typedef uint8_t lsp_uint8_t; +typedef uint16_t lsp_uint16_t; +typedef uint32_t lsp_uint32_t; + +#else + +#error unknown LSP_ARCH + +#endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#ifndef true +#define true ((lsp_bool_t)1) +#endif + +#ifndef false +#define false ((lsp_bool_t)0) +#endif + +#endif |
