WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
linglong_ic.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
3 * Description: LingLong Interrupt Controller Driver Header
4 * Author: Huawei LiteOS Team
5 * Create: 2021-11-30
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 _LINGLONG_IC_H
30#define _LINGLONG_IC_H
31
32#include "los_typedef.h"
33#include "arch/barrier.h"
34#include "arch/regs.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40#define LLIC_INT_ID_NMI 0
41#define LLIC_INTERNAL_PI_MIN 1
42#define LLIC_INTERNAL_PI_MAX 31
43
44#define LLIC_INTERNAL_SWI_MIN 32
45#define LLIC_INTERNAL_SWI_MAX 63
46
47#define LLIC_EXTERNAL_PI_MIN 64
48#define LLIC_EXTERNAL_PI_MAX 127
49
50#define LLIC_EXTERNAL_SI_MIN 64
51#define LLIC_EXTERNAL_SI_MAX 191
52
53#ifdef LOSCFG_KERNEL_SMP
54#define LLIC_INT_ID_PRIV_MAX LLIC_INTERNAL_SWI_MAX
55#else
56#define LLIC_INT_ID_PRIV_MAX LLIC_EXTERNAL_PI_MAX
57#endif
58
59/************************** PRIV INT ID **************************/
60#define LLIC_THREAD_SSP_OOR_INT_ID 1
61#define LLIC_THREAD_TIMER0_INT_ID 14
62#define LLIC_OCD_OV_INT_ID 22
63
64/************************** ICU REGS **************************/
65
66#define ICU_BASE (DSS_PRIVATE_REGS_BASE + 0x4000)
67
68#define ICU_SET_BASE (ICU_BASE + 0x00)
69#define ICU_MASK_BASE (ICU_BASE + 0x40)
70#define ICU_STATMASK_BASE (ICU_BASE + 0x80)
71#define ICU_CLEAR_BASE (ICU_BASE + 0xC0)
72#define ICU_PRIOLEVEL_BASE (ICU_BASE + 0x100)
73
74#define ICU_SET(n) (ICU_SET_BASE + ((n) * 4))
75#define ICU_MASK(n) (ICU_MASK_BASE + ((n) * 4))
76#define ICU_STATMASK(n) (ICU_STATMASK_BASE + ((n) * 4))
77#define ICU_CLEAR(n) (ICU_CLEAR_BASE + ((n) * 4))
78#define ICU_PRIOLEVEL(n) (ICU_PRIOLEVEL_BASE + ((n) * 4))
79
80#define ICU_SET_N(id) ((id) >> 5)
81#define ICU_MASK_N(id) ((id) >> 5)
82#define ICU_STATMASK_N(id) ((id) >> 5)
83#define ICU_CLEAR_N(id) ((id) >> 5)
84#define ICU_PRIOLEVEL_N(id) ((id) >> 2)
85
86/************************** ICD REGS **************************/
87
88#ifdef LOSCFG_KERNEL_SMP
89#define ICD_BASE (MPSCU_MP_REG_BASE + 0x54000)
90
91#define ICD_SET_BASE (ICD_BASE + 0x00)
92#define ICD_MASK_BASE (ICD_BASE + 0x80)
93#define ICD_STATMASK_BASE (ICD_BASE + 0x100)
94#define ICD_SW_INT_GEN_BASE (ICD_BASE + 0x280)
95#define ICD_LOCK_CLEAR_BASE (ICD_BASE + 0x300)
96#define ICD_PRIOLEVEL_BASE (ICD_BASE + 0x1300)
97#define ICD_SEMAPHORE_BASE (ICD_BASE + 0x1700)
98#define ICD_TARGET_BASE (ICD_BASE + 0x1780)
99
100
101#define ICD_SET(n) (ICD_SET_BASE + ((n) * 4))
102#define ICD_MASK(n) (ICD_MASK_BASE + ((n) * 4))
103#define ICD_STATMASK(n) (ICD_STATMASK_BASE + ((n) * 4))
104#define ICD_SW_INT_GEN (ICD_SW_INT_GEN_BASE)
105#define ICD_LOCK_CLEAR(n) (ICD_LOCK_CLEAR_BASE + ((n) * 4))
106#define ICD_PRIOLEVEL(n) (ICD_PRIOLEVEL_BASE + ((n) * 4))
107#define ICD_SEMAPHORE(n) (ICD_SEMAPHORE_BASE + ((n) * 4))
108#define ICD_TARGET(n) (ICD_TARGET_BASE + ((n) * 4))
109
110#define ICD_SET_N(id) (((id) >> 5) - 2)
111#define ICD_MASK_N(id) (((id) >> 5) - 2)
112#define ICD_STATMASK_N(id) (((id) >> 5) - 2)
113#define ICD_LOCK_CLEAR_N(id) ((id) - 64)
114#define ICD_PRIOLEVEL_N(id) (((id) >> 2) - 16)
115#define ICD_TARGET_N(id) (((id) >> 1) - 32)
116
117#endif
118
119#define LLIC_REG_WIDTH 32
120#define LLIC_PER_PRIO_WIDTH 8
121#define LLIC_PER_PRIO_MASK ((0x01U << LLIC_PER_PRIO_WIDTH) - 1)
122#define LLIC_PRIO_NUM_PER_REG (LLIC_REG_WIDTH / LLIC_PER_PRIO_WIDTH)
123
124#define ICD_SW_GEN_TARGET_POS 16
125#define ICD_TARGET_OFFSET(id) (((id) % 2) * 16)
126#define ICD_TARGET_MASK 0x0000000F
127#define ICU_CLEAR_ALL_MASK 0xFFFFFFFF
128
129#if (LOSCFG_HWI_PRIO_LIMIT > 15)
130#error "LOSCFG_HWI_PRIO_LIMIT config error!"
131#endif
132
133#ifdef LOSCFG_KERNEL_SMP
134#if (LOSCFG_PLATFORM_HWI_LIMIT > (LLIC_EXTERNAL_SI_MAX + 1))
135#error "LOSCFG_PLATFORM_HWI_LIMIT config error!"
136#endif
137#else
138#if (LOSCFG_PLATFORM_HWI_LIMIT > (LLIC_EXTERNAL_PI_MAX + 1))
139#error "LOSCFG_PLATFORM_HWI_LIMIT config error!"
140#endif
141#endif
142
143#ifdef __cplusplus
144}
145#endif /* __cplusplus */
146
147#endif