WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
nvic.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2020. All rights reserved.
3 * Description: NVIC(Nested Vectored Interrupt Controller) for Cortex-M.
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 * This file has been modified in accordance with Misra-C specifications.
30 * ---------------------------------------------------------------------------- */
31
36#ifndef NVIC_H
37#define NVIC_H
38
39#include "los_hwi.h"
40#include "asm/platform.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif /* __cplusplus */
45
46#ifdef LOSCFG_ARCH_CORTEX_M3
47#define CORTEX_M_VERSION 3U
48#elif defined(LOSCFG_ARCH_CORTEX_M4)
49#define CORTEX_M_VERSION 4U
50#elif defined(LOSCFG_ARCH_CORTEX_M7)
51#define CORTEX_M_VERSION 7U
52#elif defined(LOSCFG_ARCH_CORTEX_M55)
53#define CORTEX_M_VERSION 55U
54#else
55#error "Unsupported Arch"
56#endif
57
58#if defined(LOSCFG_ARCH_CORTEX_M3) || defined(LOSCFG_ARCH_CORTEX_M4) || \
59 defined(LOSCFG_ARCH_CORTEX_M7) || defined(LOSCFG_ARCH_CORTEX_M55)
60#ifndef __NVIC_PRIO_BITS
61#define __NVIC_PRIO_BITS 3U /* Compatible With Cmsis */
62#endif
63
64/* (irqNum / 32) * sizeof(int) */
65#define IRQ2OFFSET(irqNum) (((irqNum) >> 5U) << 2U)
66#define NVIC_PRIO_MASK 0xFFU
67#define NVIC_PRIO_BITS 8U
68#define NVIC_CALC_PRIOVALUE(prio) (((prio) << (NVIC_PRIO_BITS - (UINT8)__NVIC_PRIO_BITS)) & NVIC_PRIO_MASK)
69
70/* Interrupt Set-enable Registers */
71#define NVIC_ISERx(irqNum) (0xE000E100U + IRQ2OFFSET(irqNum))
72
73/* Interrupt Priority Registers */
74#define NVIC_IPRx(irqNum) (0xE000E400U + (irqNum))
75
76/* Interrupt Clear-enable Registers */
77#define NVIC_ICERx(irqNum) (0xE000E180U + IRQ2OFFSET(irqNum))
78
79/* Interrupt Set-pending Registers */
80#define NVIC_ISPRx(irqNum) (0xE000E200U + IRQ2OFFSET(irqNum))
81
82/* Interrupt Clear-pending Registers */
83#define NVIC_ICPRx(irqNum) (0xE000E280U + IRQ2OFFSET(irqNum))
84
85/* Interrupt Control and State Register */
86#define SCB_ICSR 0xE000ED04U
87
88/* Vector Table Offset Register */
89#define SCB_VTOR 0xE000ED08U
90
91/*
92 * Application Interrupt and Reset Control Register
93 * | 31 - 16 | 15 | 14 - 11 | 10 - 8 | 7 - 3 | 2 | 1 | 0 |
94 * VECTKEY RES PRIGROUP RES
95 */
96#define SCB_AIRCR 0xE000ED0CU
97#define SCB_AIRCR_VECTKEY_IDX 16U
98#define SCB_AIRCR_PRIGROUP_IDX 8U
99#define SCB_AIRCR_VECTKEY_MASK ((UINT32)0xFFFF << SCB_AIRCR_VECTKEY_IDX)
100#define SCB_AIRCR_PRIGROUP_MASK ((UINT32)0x7 << SCB_AIRCR_PRIGROUP_IDX)
101#define SCB_AIRCR_VECTKEY_KEY (UINT32)0x5FA
102
103/* System Handler Priority Register. Begin Of Irq 4 */
104#define SCB_SHPRx(irqNum) (0xE000ED18U + (irqNum) - 4U)
105#endif
106
111#ifndef OS_HWI_PRIO_HIGHEST
112#define OS_HWI_PRIO_HIGHEST 0
113#endif
114
119#ifndef OS_HWI_PRIO_LOWEST
120#define OS_HWI_PRIO_LOWEST 7
121#endif
122
127#define OS_SYS_VECTOR_CNT 16
128
133#define OS_NVIC_AIRCR_PRIGROUP 7
134
139#define OS_SYSTICK_CONTROL_REG 0xE000E010
140
145#define OS_SYSTICK_CURRENT_REG 0xE000E018
146
151#define OS_NVIC_PRI_BASE 0xE000E400
152
157#define OS_NVIC_SETENA_BASE 0xE000E100
158
163#define OS_NVIC_SETPEND_BASE 0xE000E200
164
169#define OS_NVIC_INT_ACT_BASE 0xE000E300
170
175#define OS_NVIC_CLRENA_BASE 0xE000E180
176
181#define OS_NVIC_INT_CTRL 0xE000ED04
182
187#define OS_NVIC_VTOR 0xE000ED08
188
193#define OS_NVIC_AIRCR 0xE000ED0C
194
199#define OS_NVIC_EXCPRI_BASE 0xE000ED18
200
205#define OS_EXC_RESET 1
206
211#define OS_EXC_NMI 2
212
217#define OS_EXC_HARD_FAULT 3
218
223#define OS_EXC_MPU_FAULT 4
224
229#define OS_EXC_BUS_FAULT 5
230
235#define OS_EXC_USAGE_FAULT 6
236
241#define OS_EXC_SVC_CALL 11
242
247#define OS_EXC_DBG_MONITOR 12
248
253#define OS_EXC_PEND_SV 14
254
255/* Reset handle entry */
257
259
260/* hardware interrupt entry */
262
263#ifdef LOSCFG_ARCH_INTERRUPT_TAKEOVER
264extern HWI_PROC_FUNC g_hwiVec[LOSCFG_PLATFORM_HWI_LIMIT];
265#endif
266
267#ifdef __cplusplus
268}
269#endif /* __cplusplus */
270
271#endif /* NVIC_H */
void(* HWI_PROC_FUNC)(void)
Define the type of a hardware interrupt handling function.
Definition los_hwi.h:356
#define VOID
Definition los_typedef.h:88
VOID IrqEntryV7M(VOID)
VOID Reset_Handler(VOID)
VOID OsPendSV(VOID)