1 /*
2  * Copyright (c) 2006-2024, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2021-09-09     WCH        the first version
9  * 2023-01-04     WangShun   Remove redundant files
10  */
11 #include "rtconfig.h"
12 #if defined (SOC_RISCV_SERIES_CH32V1)
13 #include "ch32v10x.h"
14 #elif defined (SOC_RISCV_SERIES_CH32V2)
15 #include "ch32v20x.h"
16 #elif defined (SOC_RISCV_SERIES_CH32V3)
17 #include "ch32v30x.h"
18 #else
19 #error "CH32 architecture doesn't support!"
20 #endif
rt_trigger_software_interrupt(void)21 void rt_trigger_software_interrupt(void)
22 {
23     /*CH32V103 does not support systick software interrupt*/
24 #if defined(SOC_RISCV_SERIES_CH32V1)
25     NVIC_SetPendingIRQ(Software_IRQn);
26 #else
27     SysTick->CTLR |= (1 << 31);
28 #endif
29 }
30 
rt_hw_do_after_save_above(void)31 void rt_hw_do_after_save_above(void)
32 {
33     __asm volatile ("li t0,0x20" );
34     __asm volatile ("csrs 0x804, t0");
35     /*CH32V103 does not support systick software interrupt*/
36 #if defined(SOC_RISCV_SERIES_CH32V1)
37     NVIC_ClearPendingIRQ(Software_IRQn);
38 #else
39     SysTick->CTLR &= ~(1 << 31);
40 #endif
41 }
42