WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_tick.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2019. All rights reserved.
3 * Description: Tick
4 * Author: Huawei LiteOS Team
5 * Create: 2013-01-01
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
34#ifndef _LOS_TICK_H
35#define _LOS_TICK_H
36
37#include "los_err.h"
38#include "los_errno.h"
39#include "hal_timer.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44
49#define OS_SYS_MS_PER_SECOND 1000
50
55#define OS_SYS_US_PER_SECOND 1000000
56
61#define OS_SYS_NS_PER_SECOND 1000000000
62
67#define OS_SYS_US_PER_MS 1000
68
73#define OS_SYS_NS_PER_MS 1000000
74
79#define OS_SYS_NS_PER_US 1000
80
90#define LOS_ERRNO_TICK_CFG_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_TICK, 0x00)
91
99#define LOS_ERRNO_TICK_NO_HWTIMER LOS_ERRNO_OS_ERROR(LOS_MOD_TICK, 0x01)
100
108#define LOS_ERRNO_TICK_PER_SEC_TOO_SMALL LOS_ERRNO_OS_ERROR(LOS_MOD_TICK, 0x02)
109
114extern UINT32 g_sysClock;
115
120#define GET_SYS_CLOCK() (g_sysClock)
121
126#define SET_SYS_CLOCK(clock) (g_sysClock = (clock))
127
133
147
166
184
210
236extern UINT32 LOS_MS2Tick(UINT32 millisec);
237
262extern VOID LOS_GetCpuCycle(UINT32 *puwCntHi, UINT32 *puwCntLo);
263
287
306extern VOID LOS_Udelay(UINT32 usecs);
307
326extern VOID LOS_Mdelay(UINT32 msecs);
327
328#ifdef __cplusplus
329}
330#endif /* __cplusplus */
331
332#endif /* _LOS_TICK_H */
UINT32 g_tickPerSecond
UINT32 g_sysClock
UINT32 LOS_Tick2MS(UINT32 tick)
Convert Ticks to milliseconds.
UINT32 LOS_MS2Tick(UINT32 millisec)
Convert milliseconds to Ticks.
void LOS_GetCpuCycle(UINT32 *puwCntHi, UINT32 *puwCntLo)
Obtain system cycle count.
UINT64 LOS_TickCountGet(void)
Obtain the number of Ticks.
void LOS_Mdelay(UINT32 msecs)
spinning-delay in millisecond (ms).
struct tagSysTime SYS_TIME_S
UINT64 LOS_CurrNanosec(void)
Obtain system time in nanoseconds.
void LOS_Udelay(UINT32 usecs)
spinning-delay in microsecond (us).
UINT32 LOS_CyclePerTickGet(void)
Obtain the number of cycles in one tick.
unsigned short UINT16
Definition los_typedef.h:51
unsigned long long UINT64
Definition los_typedef.h:72
#define VOID
Definition los_typedef.h:88
unsigned char UINT8
Definition los_typedef.h:50
unsigned int UINT32
Definition los_typedef.h:52
Definition los_tick.h:138
UINT8 ucWeek
Definition los_tick.h:145
UINT8 ucSecond
Definition los_tick.h:144
UINT8 ucMonth
Definition los_tick.h:140
UINT16 uwYear
Definition los_tick.h:139
UINT8 ucMinute
Definition los_tick.h:143
UINT8 ucHour
Definition los_tick.h:142
UINT8 ucDay
Definition los_tick.h:141