This commit is contained in:
2026-05-19 11:49:22 +08:00
commit add7af4222
96 changed files with 8635 additions and 0 deletions
+107
View File
@@ -0,0 +1,107 @@
#ifndef INCLUDED_OS_TYPES_H
#define INCLUDED_OS_TYPES_H
#ifndef INCLUDED_OS_CONFIG_H
#include <os_config.h>
#endif /*INCLUDED_OS_CONFIG_H*/
#ifndef INCLUDED_STDINT_H
#define INCLUDED_STDINT_H
#include <stdint.h>
#endif /*INCLUDED_STDINT_H*/
#ifndef INCLUDED_STDBOOL_H
#define INCLUDED_STDBOOL_H
#include <stdbool.h>
#endif /*INCLUDED_STDBOOL_H*/
#ifndef INCLUDED_STRING_H
#define INCLUDED_STRING_H
#include <string.h>
#endif /*INCLUDED_STRING_H*/
#ifndef INCLUDED_STDDEF_H
#define INCLUDED_STDDEF_H
#include <stddef.h>
#endif /*INCLUDED_STDDEF_H*/
#ifndef INCLUDED_INTTYPES_H
#define INCLUDED_INTTYPES_H
#include <inttypes.h>
#endif /*INCLUDED_INTTYPES_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
#if defined(OS_CFG_CPU_INT_NBITS)
#if (OS_CFG_CPU_INT_NBITS==32)
typedef int32_t os_int_t;
typedef uint32_t os_uint_t;
typedef uint32_t os_size_t;
typedef int32_t os_intptr_t;
typedef uint32_t os_uintptr_t;
#define OS_INT_MIN INT32_MIN
#define OS_INT_MAX INT32_MAX
#define OS_UINT_MAX UINT32_MAX
#define OS_SIZE_MAX UINT32_MAX
#define OS_PRId PRId32
#define OS_PRIi PRIi32
#define OS_PRIo PRIo32
#define OS_PRIu PRIu32
#define OS_PRIx PRIx32
#define OS_PRIX PRIX32
#define OS_SCNd SCNd32
#define OS_SCNi SCNi32
#define OS_SCNo SCNo32
#define OS_SCNu SCNu32
#define OS_SCNx SCNx32
#endif /*(OS_CFG_CPU_INT_NBITS==32)*/
#if (OS_CFG_CPU_INT_NBITS==64)
typedef int64_t os_int_t;
typedef uint64_t os_uint_t;
typedef uint64_t os_size_t;
typedef int64_t os_intptr_t;
typedef uint64_t os_uintptr_t;
#define OS_INT_MIN INT64_MIN
#define OS_INT_MAX INT64_MAX
#define OS_UINT_MAX UINT64_MAX
#define OS_SIZE_MAX UINT64_MAX
#define OS_PRId PRId64
#define OS_PRIi PRIi64
#define OS_PRIo PRIo64
#define OS_PRIu PRIu64
#define OS_PRIx PRIx64
#define OS_PRIX PRIX64
#define OS_SCNd SCNd64
#define OS_SCNi SCNi64
#define OS_SCNo SCNo64
#define OS_SCNu SCNu64
#define OS_SCNx SCNx64
#endif /* (OS_CFG_CPU_INT_NBITS==64) */
#else
#error "Missing OS_CFG_CPU_INT_NBITS in os_config.h"
#endif /*OS_CFG_CPU_INT_NBITS*/
#define os_bool_t bool
#define OS_TRUE true
#define OS_FALSE false
typedef os_int_t os_err_t;
typedef os_uint_t os_tick_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
#define OS_ERR_OK (0)
#define OS_ERR_FAIL (-1)
#define OS_ERR_TIMEOUT (-2)
#define OS_ERR_ARGS (-3)
#define OS_ERR_BUSY (-4)
#define OS_ERR_FULL (-5)
#define OS_ERR_EMPTY (-6)
#define OS_ERR_EXIST (-7)
#define OS_WAIT_INFINITY ((os_tick_t)(-1))
#endif /*INCLUDED_OS_TYPES_H*/