WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_cpup_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2020. All rights reserved.
3 * Description: Cpup 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_CPUP_PRI_H
30#define _LOS_CPUP_PRI_H
31
32#include "los_cpup.h"
33#include "los_task_pri.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif /* __cplusplus */
38
39#ifndef LOSCFG_CPUP_IRQ_CB_NUM
40#define LOSCFG_CPUP_IRQ_CB_NUM LOSCFG_PLATFORM_HWI_LIMIT
41#endif
42#ifndef LOSCFG_CPUP_SAMPLE_PERIOD
43#define LOSCFG_CPUP_SAMPLE_PERIOD LOSCFG_BASE_CORE_TICK_PER_SECOND
44#endif
45#ifndef LOSCFG_CPUP_HISTORY_RECORD_NUM
46#define LOSCFG_CPUP_HISTORY_RECORD_NUM 10
47#endif
48
49#define LOS_CPUP_PRECISION 1000
50#define LOS_CPUP_PRECISION_MULT (LOS_CPUP_PRECISION / 100)
51
52#define OS_CPUP_TICK_TO_S_PART(ticks) ((ticks) / LOSCFG_BASE_CORE_TICK_PER_SECOND)
53#define OS_CPUP_TICK_TO_MS_PART(ticks) ((LOS_CPUP_PRECISION_MULT * ((ticks) % LOSCFG_BASE_CORE_TICK_PER_SECOND)) \
54 / LOSCFG_BASE_CORE_TICK_PER_SECOND)
55#define OS_CPUP_HISTORY_RECORD_NUM (LOSCFG_CPUP_HISTORY_RECORD_NUM + 1)
56
57#define OS_CPUP_PERIOD_S OS_CPUP_TICK_TO_S_PART(LOSCFG_CPUP_SAMPLE_PERIOD)
58#define OS_CPUP_PERIOD_MS OS_CPUP_TICK_TO_MS_PART(LOSCFG_CPUP_SAMPLE_PERIOD)
59
60#define OS_CPUP_MULTI_PERIOD_S OS_CPUP_TICK_TO_S_PART(LOSCFG_CPUP_SAMPLE_PERIOD * LOSCFG_CPUP_HISTORY_RECORD_NUM)
61#define OS_CPUP_MULTI_PERIOD_MS OS_CPUP_TICK_TO_MS_PART(LOSCFG_CPUP_SAMPLE_PERIOD * LOSCFG_CPUP_HISTORY_RECORD_NUM)
62
63typedef struct {
64 UINT64 allTime; /* Total running time by the end of last task switch */
65 UINT64 curTime; /* Total running time by the end of last soft timer run */
66 UINT32 historyTime[OS_CPUP_HISTORY_RECORD_NUM]; /* Historical running time */
67 UINT16 status; /* Task status */
68} OsCpupCB;
69
72extern VOID OsCpupSetCycle(UINT64 startCycles);
75extern VOID OsTaskCycleEndStart(const LosTaskCB *newTask);
76
77extern VOID OsCpupCBTaskCreate(UINT32 taskId, UINT16 taskStatus);
80
81extern UINT32 OsCpupIrqCBIdGet(UINT32 hwiNum, BOOL isLocal);
82
83#ifdef LOSCFG_CPUP_INCLUDE_IRQ
84VOID OsCpupIrqStart(UINT32, UINT32);
85VOID OsCpupIrqEnd(UINT32, UINT32);
86#endif
87
88#ifdef LOSCFG_SCHED_LOAD_BALANCE_CPUP
89extern BOOL OsCpupCurrAllCpuUsage(UINT32 *cpuUsage);
90#endif
91
92#ifdef __cplusplus
93}
94#endif /* __cplusplus */
95
96#endif /* _LOS_CPUP_PRI_H */
UINT32 HWI_HANDLE_T
Definition los_hwi.h:317
VOID OsCpupCBTaskCreate(UINT32 taskId, UINT16 taskStatus)
VOID OsCpupCBTaskDelete(UINT32 taskId)
VOID OsTaskCycleEndStart(const LosTaskCB *newTask)
UINT32 OsCpupInit(VOID)
VOID OsCpupSetCycle(UINT64 startCycles)
UINT64 OsCpupGetCycle(VOID)
VOID OsCpupStartToRun(UINT32 taskId)
UINT32 OsCpupIrqCBIdGet(UINT32 hwiNum, BOOL isLocal)
#define OS_CPUP_HISTORY_RECORD_NUM
Definition los_cpup_pri.h:55
UINT32 OsCpupCBIrqCreate(HWI_HANDLE_T intNum)
OsCpupCB * OsCpupCBGet(UINT32 index)
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 int UINT32
Definition los_typedef.h:52
size_t BOOL
Definition los_typedef.h:83
Definition los_cpup_pri.h:63
UINT16 status
Definition los_cpup_pri.h:67
UINT64 curTime
Definition los_cpup_pri.h:65
UINT64 allTime
Definition los_cpup_pri.h:64
Definition los_task_base.h:131