WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_swtmr_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2019. All rights reserved.
3 * Description: Software Timer Manager Private HeadFile
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
29#ifndef _LOS_SWTMR_PRI_H
30#define _LOS_SWTMR_PRI_H
31
32#include "los_swtmr.h"
33#include "los_spinlock.h"
34#include "los_sortlink_pri.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40#ifdef LOSCFG_BASE_CORE_SWTMR
41
42enum SwtmrState {
43 OS_SWTMR_STATUS_UNUSED, /* The software timer is not used. */
44 OS_SWTMR_STATUS_DELETING, /* The software timer is deleting. */
45 OS_SWTMR_STATUS_CREATED, /* The software timer is created. */
46 OS_SWTMR_STATUS_TICKING /* The software timer is timing. */
47};
48
49/* Structure of the callback function that handles software timer timeout */
50typedef struct {
51 SWTMR_PROC_FUNC handler; /* Callback function that handles software timer timeout */
52 UINTPTR arg; /* Parameter passed in when the callback function
53 that handles software timer timeout is called */
54} SwtmrHandlerItem;
55
56typedef struct {
57 SortLinkList sortList;
58 UINT8 state; /* Software timer state */
59 UINT8 mode; /* Software timer mode */
60 UINT8 overrun; /* Times that a software timer repeats timing */
61 UINT8 inProcess; /* Software timer handler is in process */
62 UINT16 timerId; /* Software timer ID */
63 UINT32 interval; /* Timeout interval of a periodic software timer (unit: tick) */
64 UINT32 expiry; /* Timeout interval of an one-off software timer (unit: tick) */
65#ifdef LOSCFG_KERNEL_SMP
66 UINT32 cpuid; /* The cpu where the timer running on */
67#endif
68 UINTPTR arg; /* Parameter passed in when the callback function
69 that handles software timer timeout is called */
70 SWTMR_PROC_FUNC handler; /* Callback function that handles software timer timeout */
71} LosSwtmrCB;
72
73/* Type of the pointer to the structure of the callback function that handles software timer timeout */
74typedef SwtmrHandlerItem *SwtmrHandlerItemPtr;
75
76extern LosSwtmrCB *g_osSwtmrCBArray;
77extern UINT8 *g_osSwtmrTaskStack[LOSCFG_KERNEL_CORE_NUM];
78
79/* The software timer count list */
80extern SortLinkAttribute g_swtmrSortLink;
81
82#ifdef LOSCFG_BASE_CORE_SYS_RES_CHECK
83#define OS_SWT_FROM_SWTID(swtmrId) ((LosSwtmrCB *)g_osSwtmrCBArray + ((swtmrId) % KERNEL_SWTMR_LIMIT))
84#else
85#define OS_SWT_FROM_SWTID(swtmrId) ((LosSwtmrCB *)g_osSwtmrCBArray + swtmrId)
86#endif
87
88/* This API is used to scan a software timer when a Tick interrupt occurs and determine whether
89 * the software timer expires. */
90extern VOID OsSwtmrScan(VOID);
91extern UINT32 OsSwtmrInit(VOID);
92extern VOID OsSwtmrTask(VOID);
93extern SPIN_LOCK_S g_swtmrSpin;
94#ifdef LOSCFG_EXC_INTERACTION
95extern BOOL IsSwtmrTask(UINT32 taskId);
96#endif
97#ifdef LOSCFG_DEBUG_SWTMR
98#define OS_ALL_SWTMR_MASK 0xffffffff
99extern UINT32 OsDbgSwtmrInfoGet(UINT32 timerId);
100#endif
101#endif /* LOSCFG_BASE_CORE_SWTMR */
102
103#ifdef __cplusplus
104}
105#endif /* __cplusplus */
106
107#endif /* _LOS_SWTMR_PRI_H */
#define LOSCFG_KERNEL_CORE_NUM
Definition los_config.h:258
void(* SWTMR_PROC_FUNC)(UINTPTR arg)
Define the type of a callback function that handles software timer timeout.
Definition los_swtmr.h:267
unsigned short UINT16
Definition los_typedef.h:51
#define VOID
Definition los_typedef.h:88
unsigned char UINT8
Definition los_typedef.h:50
unsigned int UINTPTR
Definition los_typedef.h:74
unsigned int UINT32
Definition los_typedef.h:52
size_t BOOL
Definition los_typedef.h:83
Definition los_sortlink_pri.h:112
Definition los_spinlock.h:78