更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_sys_pri.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _LOS_SYS_PRI_H
33#define _LOS_SYS_PRI_H
34
35#include "los_sys.h"
36#include "los_base_pri.h"
37
38#ifdef __cplusplus
39#if __cplusplus
40extern "C" {
41#endif /* __cplusplus */
42#endif /* __cplusplus */
43
44/**
45 * @ingroup los_sys
46 * Number of milliseconds in one second.
47 */
48#define OS_SYS_MS_PER_SECOND 1000 ///< 一秒多少毫秒
49
50/**
51 * @ingroup los_sys
52 * Number of microseconds in one second.
53 */
54#define OS_SYS_US_PER_SECOND 1000000 ///< 一秒多少微秒
55
56/**
57 * @ingroup los_sys
58 * Number of nanoseconds in one second.
59 */
60#define OS_SYS_NS_PER_SECOND 1000000000 ///< 一秒多少纳秒
61
62/**
63 * @ingroup los_sys
64 * Number of microseconds in one milliseconds.
65 */
66#define OS_SYS_US_PER_MS 1000 ///< 一毫秒的微秒数
67/**
68 * @ingroup los_sys
69 * Number of nanoseconds in one milliseconds.
70 */
71#define OS_SYS_NS_PER_MS 1000000 ///< 一毫秒的纳秒数
72
73/**
74 * @ingroup los_sys
75 * Number of nanoseconds in one microsecond.
76 */
77#define OS_SYS_NS_PER_US 1000 ///< 一微秒的纳秒数
78
79/**
80 * @ingroup los_sys
81 * Number of cycle in one tick.
82 */
83#define OS_CYCLE_PER_TICK (OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND) ///< 一个节拍的周期数
84
85/**
86 * @ingroup los_sys
87 * Number of nanoseconds in one cycle.
88 */
89#define OS_NS_PER_CYCLE (OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK) ///< 一周期的纳秒数
90
91/**
92 * @ingroup los_sys
93 * Number of microseconds in one tick.
94 */
95#define OS_US_PER_TICK (OS_SYS_US_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND) ///< 一个tick的微秒数
96
97/**
98 * @ingroup los_sys
99 * Number of nanoseconds in one tick.
100 */
101#define OS_NS_PER_TICK (OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND) ///< 一个tick的纳秒数
102
103/**
104 * @ingroup los_sys
105 * The maximum length of name.
106 */
107#define OS_SYS_APPVER_NAME_MAX 64 ///< 名字的最大长度
108
109/**
110 * @ingroup los_sys
111 * The magic word.
112 */
113#define OS_SYS_MAGIC_WORD 0xAAAAAAAA ///< 魔法数字,还记得栈顶的魔法数字是多少吗? 0xCCCCCCCC
114
115/**
116 * @ingroup los_sys
117 * The initialization value of stack space.
118 */
119#define OS_SYS_EMPTY_STACK 0xCACACACA ///< 栈的填充内容魔法数字
120
121/**
122 * @ingroup los_sys
123 * Convert nanoseconds to Ticks.
124 */
125extern UINT32 OsNS2Tick(UINT64 nanoseconds);
126
127#ifdef __cplusplus
128#if __cplusplus
129}
130#endif /* __cplusplus */
131#endif /* __cplusplus */
132
133#endif /* _LOS_SYS_PRI_H */
UINT32 OsNS2Tick(UINT64 nanoseconds)
纳秒转化成 tick
Definition: los_sys.c:125
long unsigned int UINT64
Definition: los_typedef.h:66
unsigned int UINT32
Definition: los_typedef.h:57