XWOS API
4.0
XWOS C/C++ API参考手册
|
XWOS通用库:基本类型定义 更多...
#include <cfg/project.h>
#include <xwos/ospl/soc/type.h>
#include <stdarg.h>
结构体 | |
struct | xwos_cblk |
类型为XWOS_LK_CALLBACK时的抽象锁函数 更多... | |
union | xwos_ulock |
所有锁的联合 更多... | |
宏定义 | |
#define | NULL ((void *)0) |
#define | NIL NULL |
#define | BITS_PER_CHAR 8U |
#define | CHAR_SHIFT 3U |
#define | CHAR_MAX ((signed char)(UCHAR_MAX >> (unsigned char)1)) |
#define | CHAR_MIN ((signed char)(-CHAR_MAX - (signed char)1)) |
#define | BITS_PER_UCHAR 8U |
#define | UCHAR_SHIFT 3U |
#define | UCHAR_MAX ((unsigned char)(~((unsigned char)0))) |
#define | UCHAR_MIN ((unsigned char)0) |
#define | BITS_PER_SHRT 16U |
#define | SHRT_SHIFT 4U |
#define | SHRT_MAX ((signed short)(USHRT_MAX >> (unsigned short)1)) |
#define | SHRT_MIN ((signed short)(-SHRT_MAX - (signed short)1)) |
#define | BITS_PER_USHRT 16U |
#define | USHRT_SHIFT 4U |
#define | USHRT_MAX ((unsigned short)(~((unsigned short)0))) |
#define | USHRT_MIN (unsigned short)0) |
#define | BITS_PER_INT 32U |
#define | INT_SHIFT 5U |
#define | INT_MAX ((signed int)(UINT_MAX >> (unsigned int)1)) |
#define | INT_MIN ((signed int)(-INT_MAX - (signed int)1)) |
#define | BITS_PER_UINT 32U |
#define | UINT_SHIFT 5U |
#define | UINT_MAX ((unsigned int)(~((unsigned int)0))) |
#define | UINT_MIN (unsigned int)0) |
#define | BITS_PER_LONG 32U |
#define | LONG_SHIFT 5U |
#define | LONG_MAX ((signed long)(ULONG_MAX >> (unsigned long)1)) |
#define | LONG_MIN ((signed long)(-LONG_MAX - (signed long)1)) |
#define | BITS_PER_ULONG 32U |
#define | ULONG_MAX ((unsigned long)(~((unsigned long)0))) |
#define | ULONG_MIN ((unsigned long)0) |
#define | BITS_PER_LLONG 64U |
#define | LLONG_SHIFT 6U |
#define | LLONG_MAX ((signed long long)(ULLONG_MAX >> (unsigned long long)1)) |
#define | LLONG_MIN ((signed long long)(-LLONG_MAX - (signed long long)1)) |
#define | BITS_PER_ULLONG 64U |
#define | ULLONG_SHIFT 6U |
#define | ULLONG_MAX ((unsigned long long)(~((unsigned long long)0))) |
#define | ULLONG_MIN (unsigned long long)0) |
#define | BITS_PER_FLT 32U |
#define | FLT_SHIFT 5U |
#define | BITS_PER_DBL 64U |
#define | DBL_SHIFT 6U |
#define | BITS_PER_LDBL 128U |
#define | LDBL_SHIFT 7U |
#define | BITS_PER_XWU8_T 8U |
#define | XWU8_T_SHIFT 3U |
#define | XWU8_MAX ((xwu8_t)(~((xwu8_t)0))) |
#define | BITS_PER_XWS8_T 8U |
#define | XWS8_T_SHIFT 3U |
#define | XWS8_MAX ((xws8_t)(XWU8_MAX >> (xwu8_t)1)) |
#define | XWS8_MIN ((xws8_t)(-XWS8_MAX - (xws8_t)1)) |
#define | BITS_PER_XWU16_T 16U |
#define | XWU16_T_SHIFT 4U |
#define | XWU16_MAX ((xwu16_t)(~((xwu16_t)0))) |
#define | BITS_PER_XWS16_T 16U |
#define | XWS16_T_SHIFT 4U |
#define | XWS16_MAX ((xws16_t)(XWU16_MAX >> (xwu16_t)1)) |
#define | XWS16_MIN ((xws16_t)(-XWS16_MAX - (xws16_t)1)) |
#define | BITS_PER_XWU32_T 32U |
#define | XWU32_T_SHIFT 5U |
#define | XWU32_MAX ((xwu32_t)(~((xwu32_t)0))) |
#define | BITS_PER_XWS32_T 32U |
#define | XWS32_T_SHIFT 5U |
#define | XWS32_MAX ((xws32_t)(XWU32_MAX >> (xwu32_t)1)) |
#define | XWS32_MIN ((xws32_t)(-XWS32_MAX - (xws32_t)1)) |
#define | BITS_PER_XWU64_T 64U |
#define | XWU64_T_SHIFT 6U |
#define | XWU64_MAX ((xwu64_t)(~((xwu64_t)0))) |
#define | BITS_PER_XWS64_T 64U |
#define | XWS64_T_SHIFT 6U |
#define | XWS64_MAX ((xws64_t)(XWU64_MAX >> (xwu64_t)1)) |
#define | XWS64_MIN ((xws64_t)(-XWS64_MAX - (xws64_t)1)) |
#define | BITS_PER_XWSZ_T BITS_PER_ULONG |
#define | XWSZ_T_SHIFT ULONG_SHIFT |
#define | XWSZ_MAX ((xwsz_t)(~((xwsz_t)0))) |
#define | BITS_PER_XWSSZ_T BITS_PER_LONG |
#define | XWSSZ_T_SHIFT LONG_SHIFT |
#define | XWSSZ_MAX ((xwssz_t)(XWSZ_MAX >> (xwsz_t)1)) |
#define | XWSSZ_MIN ((xwssz_t)(-XWSSZ_MAX - (xwssz_t)1)) |
#define | BITS_PER_XWPTR_T BITS_PER_ULONG |
#define | XWPTR_T_SHIFT ULONG_SHIFT |
#define | XWPTR_MAX ((xwptr_t)(~(xwptr_t)0)) |
#define | BITS_PER_XWSTK_T BITS_PER_XWPTR_T |
#define | XWSTK_T_SHIFT XWPTR_T_SHIFT |
#define | XWSTK_MAX ((xwstk_t)(~(xwstk_t)0)) |
#define | BITS_PER_XWREG_T BITS_PER_XWPTR_T |
#define | XWREG_T_SHIFT XWPTR_T_SHIFT |
#define | XWREG_MAX ((xwreg_t)(~((xwreg_t)0))) |
#define | BITS_PER_XWSREG_T BITS_PER_XWREG_T |
#define | XWSREG_T_SHIFT XWREG_T_SHIFT |
#define | XWSREG_MAX ((xwsreg_t)(XWREG_MAX >> (xwreg_t)1)) |
#define | XWSREG_MIN ((xwsreg_t)(-XWSREG_MAX - (xwsreg_t)1)) |
#define | BITS_PER_XWSQ_T BITS_PER_ULONG |
#define | XWSQ_T_SHIFT ULONG_SHIFT |
#define | XWSQ_MAX ((xwsq_t)(~((xwsq_t)0))) |
#define | BITS_PER_XWSSQ_T BITS_PER_LONG |
#define | XWSSQ_T_SHIFT LONG_SHIFT |
#define | XWSSQ_MAX ((xwssq_t)(XWSQ_MAX >> (xwsq_t)1)) |
#define | XWSSQ_MIN ((xwssq_t)(-XWSSQ_MAX - (xwssq_t)1)) |
#define | BITS_PER_XWID_T BITS_PER_ULONG |
#define | XWID_T_SHIFT ULONG_SHIFT |
#define | XWID_MAX ((xwid_t)(~((xwid_t)0))) |
#define | BITS_PER_XWSID_T BITS_PER_LONG |
#define | XWSID_T_SHIFT LONG_SHIFT |
#define | XWSID_MAX ((xwsid_t)(XWID_MAX >> (xwid_t)1)) |
#define | XWSID_MIN ((xwsid_t)(-XWSID_MAX - (xwsid_t)1)) |
#define | BITS_PER_XWIRQ_T BITS_PER_INT |
#define | XWIRQ_T_SHIFT INT_SHIFT |
#define | XWIRQ_MAX ((xwirq_t)((~(unsigned int)0) >> (unsigned int)1)) |
#define | XWIRQ_MIN ((xwirq_t)(-XWIRQ_MAX - (xwirq_t)1)) |
#define | BITS_PER_XWPR_T BITS_PER_XWS32_T |
#define | XWPR_T_SHIFT XWS32_T_SHIFT |
#define | XWPR_MAX ((xwpr_t)((~(xwu32_t)0) >> (xwu32_t)1)) |
#define | XWPR_MIN ((xwpr_t)(-XWPR_MAX - (xwpr_t)1)) |
#define | BITS_PER_XWER_T BITS_PER_LONG |
#define | XWER_T_SHIFT LONG_SHIFT |
#define | XWER_MAX ((xwer_t)OK) |
#define | XWER_MIN ((xwer_t)(-MAX_ERRNO)) |
#define | BITS_PER_XWBMP_T BITS_PER_XWU32_T |
#define | XWBMP_T_SHIFT XWU32_T_SHIFT |
#define | XWBMP_MAX ((xwbmp_t)(~((xwbmp_t)0))) |
#define | BITS_PER_XWLFQ_T BITS_PER_XWPTR_T |
#define | XWLFQ_T_SHIFT XWPTR_T_SHIFT |
#define | XWTK_MAX ((xwtk_t)((~(xwu64_t)0))) |
xwtk_t 的最大值 | |
#define | XWTK_MIN ((xwtk_t)0) |
xwtk_t 的最小值 | |
#define | BITS_PER_XWTK_T BITS_PER_XWU64_T |
#define | XWTK_T_SHIFT XWU64_T_SHIFT |
#define | XWTM_MAX ((xwtm_t)((~(xwu64_t)0) >> 1)) |
xwtm_t 的最大值 | |
#define | XWTM_MIN ((xwtm_t)(-XWTM_MAX - (xwtm_t)1)) |
xwtm_t 的最小值 | |
#define | BITS_PER_XWTM_T BITS_PER_XWS64_T |
#define | XWTM_T_SHIFT XWS64_T_SHIFT |
#define | XWTM_NS(ns) (ns) |
系统时间的单位:纳秒 | |
#define | XWTM_US(us) ((us) * 1000LL) |
系统时间的单位:微秒 | |
#define | XWTM_MS(ms) ((ms) * 1000000LL) |
系统时间的单位:毫秒 | |
#define | XWTM_S(s) ((s) * 1000000000LL) |
系统时间的单位:秒 | |
#define | XWTM_M(m) ((m) * XWTM_S(60)) |
系统时间的单位:分 | |
#define | XWTM_H(h) ((h) * XWTM_M(60)) |
系统时间的单位:时 | |
#define | XWTM_D(d) ((d) * XWTM_H(24)) |
系统时间的单位:天 | |
枚举 | |
enum | xwaop_memory_order_em { xwaop_mo_relaxed = 0 , xwaop_mo_consume , xwaop_mo_acquire , xwaop_mo_release , xwaop_mo_acq_rel , xwaop_mo_seq_cst } |
原子操作内存模型 更多... | |
enum | xwos_lock_type_em { XWOS_LK_NONE = 0U , XWOS_LK_MTX = 1U , XWOS_LK_SPLK = 2U , XWOS_LK_SQLK_WR = 3U , XWOS_LK_SQLK_RDEX = 4U , XWOS_LK_CALLBACK = 5U , XWOS_LK_NUM } |
XWOS的锁类型枚举 更多... | |
enum | xwos_lkst_em { XWOS_LKST_UNLOCKED = 0U , XWOS_LKST_LOCKED = 1U } |
XWOS锁状态 更多... | |
函数 | |
static __xwcc_inline xwtm_t | xwtm_add_safely (const xwtm_t a, const xwtm_t b) |
将两个系统时间相加,并检查溢出 | |
static __xwcc_inline xwtm_t | xwtm_add (const xwtm_t a, const xwtm_t b) |
将两个系统时间相加 | |
static __xwcc_inline xwtm_t | xwtm_sub (const xwtm_t a, const xwtm_t b) |
将两个系统时间相减 | |
static __xwcc_inline xwer_t | xwtm_cmp (const xwtm_t a, const xwtm_t b) |
比较两个系统时间 | |
static __xwcc_inline xwtm_t | xwtm_ns (xwtm_t ns) |
返回以 纳秒 为单位的系统时间 | |
static __xwcc_inline xwtm_t | xwtm_us (xwtm_t us) |
返回以 微秒 为单位的系统时间 | |
static __xwcc_inline xwtm_t | xwtm_ms (xwtm_t ms) |
返回以 毫秒 为单位的系统时间 | |
static __xwcc_inline xwtm_t | xwtm_s (xwtm_t s) |
返回以 秒 为单位的系统时间 | |
static __xwcc_inline xwtm_t | xwtm_m (xwtm_t m) |
返回以 分 为单位的系统时间 | |
static __xwcc_inline xwtm_t | xwtm_h (xwtm_t h) |
返回以 时 为单位的系统时间 | |
static __xwcc_inline xwtm_t | xwtm_d (xwtm_t d) |
返回以 天 为单位的系统时间 | |
XWOS通用库:基本类型定义
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
在文件 type.h 中定义.