• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 IT_LOS_CPUP_H
33 #define IT_LOS_CPUP_H
34 
35 #include "los_cpup_pri.h"
36 #include "los_cpup.h"
37 #include "los_sys.h"
38 #include "los_task.h"
39 #include "osTest.h"
40 
41 #ifdef __cplusplus
42 #if __cplusplus
43     extern "C" {
44 #endif /* __cpluscplus */
45 #endif /* __cpluscplus */
46 
47 #define CPU_USE_MODE1 1
48 #define CPU_USE_MODE0 0
49 #define CPU_USE_MIN 0
50 #define TASK_STATUS_UNDETACHED 0
51 
52 #define CPUP_TEST_TOLERANT 50
53 #define CPUP_BACKWARD 2
54 
55 #define ICUNIT_ASSERT_PROCESS_CPUP_USAGE(usage, lable)               \
56     do {                                                             \
57         UINT32 ret_ = LOS_NOK;                                       \
58         if (((usage) > LOS_CPUP_PRECISION) || ((usage) < CPU_USE_MIN)) { \
59             ret_ = LOS_OK;                                           \
60         } else {                                                     \
61             ret_ = usage;                                            \
62         }                                                            \
63         ICUNIT_GOTO_EQUAL(ret_, LOS_OK, ret_, lable);                \
64     } while (0)
65 
66 #define ICUNIT_ASSERT_SINGLE_CPUP_USAGE(usage, lable)                            \
67     do {                                                                         \
68         UINT32 ret_ = LOS_NOK;                                                   \
69         if (((usage) > LOS_CPUP_SINGLE_CORE_PRECISION) || ((usage) < CPU_USE_MIN)) { \
70             ret_ = LOS_OK;                                                       \
71         } else {                                                                 \
72             ret_ = usage;                                                        \
73         }                                                                        \
74         ICUNIT_GOTO_EQUAL(ret_, LOS_OK, ret_, lable);                            \
75     } while (0)
76 
77 extern UINT32 g_cpuTestTaskID;
78 extern UINT32 g_testTaskID01;
79 extern UINT32 g_testTaskID02;
80 extern UINT32 g_testTaskID03;
81 extern UINT32 g_cpupTestCount;
82 extern VOID ItSuiteExtendCpup(VOID);
83 extern UINT32 TimeClkRead(VOID);
84 extern LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdCpup(INT32 argc, CHAR **argv);
85 extern LITE_OS_SEC_TEXT_MINOR VOID OsTaskCycleEnd(VOID);
86 extern LITE_OS_SEC_TEXT_MINOR UINT64 OsGetCpuCycle(VOID);
87 
88 extern UINT32 GetNopCount(void);
89 #ifdef LOSCFG_CPUP_INCLUDE_IRQ
90 extern UINT32 TestGetSingleHwiCpup(UINT32 hwi, UINT32 mode);
91 #endif
92 
93 #if defined(LOSCFG_TEST_SMOKE)
94 VOID ItExtendCpup001(VOID);
95 VOID ItExtendCpup002(VOID);
96 #endif
97 
98 #if defined(LOSCFG_TEST_FULL)
99 VOID ItExtendCpup003(VOID);
100 VOID ItExtendCpup004(VOID);
101 VOID ItExtendCpup005(VOID);
102 VOID ItExtendCpup006(VOID);
103 VOID ItExtendCpup007(VOID);
104 VOID ItExtendCpup008(VOID);
105 VOID ItExtendCpup011(VOID);
106 VOID ItExtendCpup012(VOID);
107 #endif
108 
109 #if defined(LOSCFG_TEST_LLT)
110 VOID LLT_EXTEND_CPUP_001(VOID);
111 VOID LLT_EXTEND_CPUP_002(VOID);
112 VOID LltExtendCpup003(VOID);
113 VOID LLT_EXTEND_CPUP_006(VOID);
114 VOID LLT_EXTEND_CPUP_007(VOID);
115 VOID ItExtendCpup009(VOID);
116 VOID ItExtendCpup010(VOID);
117 #endif
118 
119 #ifdef LOSCFG_KERNEL_SMP
120 VOID ItSmpExtendCpup001(VOID);
121 VOID ItSmpExtendCpup002(VOID);
122 #ifdef LOSCFG_CPUP_INCLUDE_IRQ
123 VOID ItSmpExtendCpup003(VOID);
124 VOID ItSmpExtendCpup004(VOID);
125 #endif
126 VOID ItSmpExtendCpup005(VOID);
127 VOID ItSmpExtendCpup006(VOID);
128 VOID ItSmpExtendCpup007(VOID);
129 VOID ItSmpExtendCpup008(VOID);
130 VOID ItSmpExtendCpup009(VOID);
131 VOID ItSmpExtendCpup010(VOID);
132 VOID ItSmpExtendCpup011(VOID);
133 VOID ItSmpExtendCpup012(VOID);
134 #endif
135 
136 #ifdef __cplusplus
137 #if __cplusplus
138 }
139 #endif /* __cpluscplus */
140 #endif /* __cpluscplus */
141 
142 #endif
143