1 /*
2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 * Description: WS63 Application Core Vector Table
15 *
16 * Create: 2021-06-16
17 */
18 #if !defined USE_CMSIS_OS
19 #include "vectors.h"
20 #include "debug_print.h"
21 #include "arch_encoding.h"
22
23 #define RESERVED_LEN 1
24
25 void trap_entry(void);
26 void nmi_handler(void);
27 void reserve_handler(void) __attribute__((weak, alias("isr_not_implemented")));
28 void bt_int0_handler(void) __attribute__((weak, alias("isr_not_implemented")));
29 void bt_int1_handler(void) __attribute__((weak, alias("isr_not_implemented")));
30 void mcu_pclr_lock_handler(void) __attribute__((weak, alias("isr_not_implemented")));
31 void irq_gpio_handler(void) __attribute__((weak, alias("isr_not_implemented")));
32 void irq_uartl0_handler(void) __attribute__((weak, alias("isr_not_implemented")));
33 void irq_uarth0_handler(void) __attribute__((weak, alias("isr_not_implemented")));
34 void irq_uartl2_handler(void) __attribute__((weak, alias("isr_not_implemented")));
35 void qspi0_2cs_handler(void) __attribute__((weak, alias("isr_not_implemented")));
36 void qspi1_2cs_handler(void) __attribute__((weak, alias("isr_not_implemented")));
37 void spi4_s_handler(void) __attribute__((weak, alias("isr_not_implemented")));
38 void key_scan_handler(void) __attribute__((weak, alias("isr_not_implemented")));
39 void pmu_wakeup_handler(void) __attribute__((weak, alias("isr_not_implemented")));
40 void pmu_sleep_handler(void) __attribute__((weak, alias("isr_not_implemented")));
41 void hal_rtc_timer_isr(void) __attribute__((weak, alias("isr_not_implemented")));
42 void hal_timer_isr(void) __attribute__((weak, alias("isr_not_implemented")));
43 void irq_sdma_handler(void) __attribute__((weak, alias("isr_not_implemented")));
44 void irq_dma_handler(void) __attribute__((weak, alias("isr_not_implemented")));
45 void spi_m_s_0_handler(void) __attribute__((weak, alias("isr_not_implemented")));
46 void spi_m_s_1_handler(void) __attribute__((weak, alias("isr_not_implemented")));
47 void spi_m_handler(void) __attribute__((weak, alias("isr_not_implemented")));
48 void i2c_0_handler(void) __attribute__((weak, alias("isr_not_implemented")));
49 void i2c_1_handler(void) __attribute__((weak, alias("isr_not_implemented")));
50 void i2c_2_handler(void) __attribute__((weak, alias("isr_not_implemented")));
51 void spi3_m_s_handler(void) __attribute__((weak, alias("isr_not_implemented")));
52 void eflash_handler(void) __attribute__((weak, alias("isr_not_implemented")));
53 void sec_int_handler(void) __attribute__((weak, alias("isr_not_implemented")));
54 void pwm_0_handler(void) __attribute__((weak, alias("isr_not_implemented")));
55 void pwm_1_handler(void) __attribute__((weak, alias("isr_not_implemented")));
56 void pwm_2_handler(void) __attribute__((weak, alias("isr_not_implemented")));
57 void pwm_3_handler(void) __attribute__((weak, alias("isr_not_implemented")));
58 void pwm_4_handler(void) __attribute__((weak, alias("isr_not_implemented")));
59 void pwm_5_handler(void) __attribute__((weak, alias("isr_not_implemented")));
60 void pmu_cmu_interrupt_handler(void) __attribute__((weak, alias("isr_not_implemented")));
61 void mem_sub_monitor_handler(void) __attribute__((weak, alias("isr_not_implemented")));
62 void b_sub_monitor_handler(void) __attribute__((weak, alias("isr_not_implemented")));
63 void irq_shareram_monitor_handler(void) __attribute__((weak, alias("isr_not_implemented")));
64 void eh2h_brg_int_handler(void) __attribute__((weak, alias("isr_not_implemented")));
65 void pmu_32k_cali_handler(void) __attribute__((weak, alias("isr_not_implemented")));
66 void b_wdt_handler(void) __attribute__((weak, alias("isr_not_implemented")));
67 void irq_tsensor_handler(void) __attribute__((weak, alias("isr_not_implemented")));
68 void qdec_handler(void) __attribute__((weak, alias("isr_not_implemented")));
69 void usb_handler(void) __attribute__((weak, alias("isr_not_implemented")));
70 /**
71 * Default interrupt handler, used for when no specific handler has been implemented.
72 * Needed for weak aliasing (an aliased function must have static linkage).
73 */
74 //lint -esym(528, isr_not_implemented)
isr_not_implemented(void)75 static void isr_not_implemented(void)
76 {
77 while (1) { //lint !e716
78 }
79 }
80
81 /**
82 * The interrupt vector table
83 */
84 //lint -esym(714, vector_table) Not unused
85 //lint -esym(785, vector_table) Too few initialises. Other slots are unused
86 static isr_function g_ram_exception_table[ISR_VECTOR_MAX_SUPPORTED + 1 + \
87 RESERVED_LEN] __attribute__((section(".isr_vector"))) = {
88 [USER_SOFTWARE_INT_IRQN] = trap_entry,
89 [SUPERVISOR_SOFTWARE_INT_IRQN] = default_handler,
90 [RESERVED_INT2_IRQN] = default_handler,
91 [MACHINE_SOFTWARE_INT_IRQN] = default_handler,
92 [USER_TIMER_INT_IRQN] = default_handler,
93 [SUPERVISOR_TIMER_INT_IRQN] = default_handler,
94 [RESERVED_INT6_IRQN] = default_handler,
95 [MACHINE_TIMER_INT_IRQN] = default_handler,
96 [USER_EXTERNAL_INT_IRQN] = default_handler,
97 [SUPERVISOR_EXTERNAL_INT_IRQN] = default_handler,
98 [RESERVED_INT10_IRQN] = default_handler,
99 [MACHINE_EXTERNAL_INT_IRQN] = default_handler,
100 [NON_MASKABLE_INT_IRQN] = nmi_handler,
101 [RESERVED_INT13_IRQN] = default_handler,
102 [RESERVED_INT14_IRQN] = default_handler,
103 [RESERVED_INT15_IRQN] = default_handler,
104 [RESERVED_INT16_IRQN] = default_handler,
105 [RESERVED_INT17_IRQN] = default_handler,
106 [RESERVED_INT18_IRQN] = default_handler,
107 [RESERVED_INT19_IRQN] = default_handler,
108 [RESERVED_INT20_IRQN] = default_handler,
109 [RESERVED_INT21_IRQN] = default_handler,
110 [RESERVED_INT22_IRQN] = default_handler,
111 [RESERVED_INT23_IRQN] = default_handler,
112 [RESERVED_INT24_IRQN] = default_handler,
113 [RESERVED_INT25_IRQN] = default_handler,
114
115 [ISR_VECTOR_IRQ_0] = bt_int0_handler,
116 [ISR_VECTOR_IRQ_1] = bt_int1_handler,
117 [ISR_VECTOR_IRQ_2] = reserve_handler,
118 [ISR_VECTOR_IRQ_3] = reserve_handler,
119 [ISR_VECTOR_IRQ_4] = reserve_handler,
120 [ISR_VECTOR_IRQ_5] = reserve_handler,
121
122 [ISR_VECTOR_IRQ_6] = mcu_pclr_lock_handler,
123 [ISR_VECTOR_IRQ_7] = irq_gpio_handler,
124 [ISR_VECTOR_IRQ_8] = irq_gpio_handler,
125 [ISR_VECTOR_IRQ_9] = irq_gpio_handler,
126 [ISR_VECTOR_IRQ_10] = reserve_handler,
127 [ISR_VECTOR_IRQ_11] = reserve_handler,
128 [ISR_VECTOR_IRQ_12] = reserve_handler,
129 [ISR_VECTOR_IRQ_13] = irq_uartl0_handler,
130 [ISR_VECTOR_IRQ_14] = reserve_handler,
131 [ISR_VECTOR_IRQ_15] = irq_uarth0_handler,
132 [ISR_VECTOR_IRQ_16] = irq_uartl2_handler,
133 [ISR_VECTOR_IRQ_17] = qspi0_2cs_handler,
134 [ISR_VECTOR_IRQ_18] = qspi1_2cs_handler,
135 [ISR_VECTOR_IRQ_19] = spi4_s_handler,
136 [ISR_VECTOR_IRQ_20] = key_scan_handler,
137 [ISR_VECTOR_IRQ_21] = pmu_wakeup_handler,
138 [ISR_VECTOR_IRQ_22] = pmu_sleep_handler,
139 [ISR_VECTOR_IRQ_23] = hal_rtc_timer_isr,
140 [ISR_VECTOR_IRQ_24] = hal_rtc_timer_isr,
141 [ISR_VECTOR_IRQ_25] = hal_rtc_timer_isr,
142 [ISR_VECTOR_IRQ_26] = hal_rtc_timer_isr,
143 [ISR_VECTOR_IRQ_27] = hal_timer_isr,
144 [ISR_VECTOR_IRQ_28] = hal_timer_isr,
145 [ISR_VECTOR_IRQ_29] = hal_timer_isr,
146 [ISR_VECTOR_IRQ_30] = hal_timer_isr,
147 [ISR_VECTOR_IRQ_31] = irq_sdma_handler,
148 [ISR_VECTOR_IRQ_32] = irq_dma_handler,
149 [ISR_VECTOR_IRQ_33] = spi_m_s_0_handler,
150 [ISR_VECTOR_IRQ_34] = spi_m_s_1_handler,
151 [ISR_VECTOR_IRQ_35] = spi_m_handler,
152 [ISR_VECTOR_IRQ_36] = i2c_0_handler,
153 [ISR_VECTOR_IRQ_37] = i2c_1_handler,
154 [ISR_VECTOR_IRQ_38] = i2c_2_handler,
155 [ISR_VECTOR_IRQ_39] = spi3_m_s_handler,
156 [ISR_VECTOR_IRQ_40] = eflash_handler,
157 [ISR_VECTOR_IRQ_41] = reserve_handler,
158 [ISR_VECTOR_IRQ_42] = reserve_handler,
159 [ISR_VECTOR_IRQ_43] = reserve_handler,
160 [ISR_VECTOR_IRQ_44] = sec_int_handler,
161 [ISR_VECTOR_IRQ_45] = pwm_0_handler,
162 [ISR_VECTOR_IRQ_46] = pwm_1_handler,
163 [ISR_VECTOR_IRQ_47] = pwm_2_handler,
164 };
165
isr_get_ramexceptiontable_addr(void)166 const isr_function *isr_get_ramexceptiontable_addr(void)
167 {
168 return g_ram_exception_table;
169 }
170 #endif
171