• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2009-2022 Huawei Technologies Co., Ltd. All rights reserved.
3  *
4  * UniProton is licensed under Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *          http://license.coscl.org.cn/MulanPSL2
8  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11  * See the Mulan PSL v2 for more details.
12  * Create: 2009-07-24
13  * Description: Macros used in assembly code
14  */
15 #ifndef PRT_CPU_M4_EXTERNAL_H
16 #define PRT_CPU_M4_EXTERNAL_H
17 
18 #include "prt_typedef.h"
19 
20 /*
21  * 模块间typedef声明
22  */
23 typedef void (*HwiPubintFunc)(void);
24 
25 #define OS_MX_IRQ_VECTOR_CNT 150
26 #if defined(OS_OPTION_HWI_MAX_NUM_CONFIG)
27 extern U32 g_hwiMaxNumConfig;
28 #define OS_HWI_MAX_NUM g_hwiMaxNumConfig
29 #else
30 #define OS_HWI_MAX_NUM       87
31 #define OS_HWI_FORMARRAY_NUM OS_HWI_MAX_NUM
32 #endif
33 #define OS_HWI_MAX (OS_HWI_MAX_NUM - 1) /* 最大中断号 */
34 #define OS_HWI_NUM_CHECK(hwiNum) ((hwiNum) > OS_HWI_MAX)
35 extern void g_stackEnd(void);
36 extern U32 g_stackStart;
37 
38 #define MSTACK_VECTOR  g_stackEnd
39 
OsGetSysStackTop(void)40 OS_SEC_ALW_INLINE INLINE uintptr_t OsGetSysStackTop(void)
41 {
42     return (uintptr_t)(&g_stackStart);
43 }
44 
OsGetSysStackBottom(void)45 OS_SEC_ALW_INLINE INLINE uintptr_t OsGetSysStackBottom(void)
46 {
47     return (uintptr_t)g_stackEnd;
48 }
49 
50 /*
51  * 描述:检查配置的最大中断个数是否合法,合法返回TRUE
52  */
OsHwiCheckMaxNum(U32 maxNum)53 OS_SEC_ALW_INLINE INLINE bool OsHwiCheckMaxNum(U32 maxNum)
54 {
55     return ((maxNum > 0) && (maxNum <= OS_MX_IRQ_VECTOR_CNT));
56 }
57 
58 #endif /* PRT_CPU_M4_EXTERNAL_H */
59