mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-27 23:47:05 +08:00
[libcpu/riscv]迁移libcpu/riscv/ch32中文件至bsp (#7004)
This commit is contained in:
parent
fc2e122ee2
commit
95540854a6
@ -11,6 +11,7 @@ src = Split('''
|
|||||||
board.c
|
board.c
|
||||||
debug.c
|
debug.c
|
||||||
ch32v10x_it.c
|
ch32v10x_it.c
|
||||||
|
software_irq.c
|
||||||
''')
|
''')
|
||||||
|
|
||||||
path = [cwd]
|
path = [cwd]
|
||||||
|
@ -9,6 +9,7 @@ cwd = GetCurrentDir()
|
|||||||
# add general drivers
|
# add general drivers
|
||||||
src = Split('''
|
src = Split('''
|
||||||
board.c
|
board.c
|
||||||
|
software_irq.c
|
||||||
''')
|
''')
|
||||||
|
|
||||||
path = [cwd]
|
path = [cwd]
|
||||||
|
41
bsp/wch/risc-v/ch32v208w-r0/board/software_irq.c
Normal file
41
bsp/wch/risc-v/ch32v208w-r0/board/software_irq.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2021-09-09 WCH the first version
|
||||||
|
* 2023-01-04 WangShun Remove redundant files
|
||||||
|
*/
|
||||||
|
#include "rtconfig.h"
|
||||||
|
#if defined (SOC_RISCV_SERIES_CH32V1)
|
||||||
|
#include "ch32v10x.h"
|
||||||
|
#elif defined (SOC_RISCV_SERIES_CH32V2)
|
||||||
|
#include "ch32v20x.h"
|
||||||
|
#elif defined (SOC_RISCV_SERIES_CH32V3)
|
||||||
|
#include "ch32v30x.h"
|
||||||
|
#else
|
||||||
|
#error "CH32 architecture doesn't support!"
|
||||||
|
#endif
|
||||||
|
void rt_trigger_software_interrupt(void)
|
||||||
|
{
|
||||||
|
/*CH32V103 does not support systick software interrupt*/
|
||||||
|
#if defined(SOC_RISCV_SERIES_CH32V1)
|
||||||
|
NVIC_SetPendingIRQ(Software_IRQn);
|
||||||
|
#else
|
||||||
|
SysTick->CTLR |= (1 << 31);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void rt_hw_do_after_save_above(void)
|
||||||
|
{
|
||||||
|
__asm volatile ("li t0,0x20" );
|
||||||
|
__asm volatile ("csrs 0x804, t0");
|
||||||
|
/*CH32V103 does not support systick software interrupt*/
|
||||||
|
#if defined(SOC_RISCV_SERIES_CH32V1)
|
||||||
|
NVIC_ClearPendingIRQ(Software_IRQn);
|
||||||
|
#else
|
||||||
|
SysTick->CTLR &= ~(1 << 31);
|
||||||
|
#endif
|
||||||
|
}
|
@ -9,6 +9,7 @@ cwd = GetCurrentDir()
|
|||||||
# add general drivers
|
# add general drivers
|
||||||
src = Split('''
|
src = Split('''
|
||||||
board.c
|
board.c
|
||||||
|
software_irq.c
|
||||||
''')
|
''')
|
||||||
|
|
||||||
path = [cwd]
|
path = [cwd]
|
||||||
|
41
bsp/wch/risc-v/ch32v307v-r1/board/software_irq.c
Normal file
41
bsp/wch/risc-v/ch32v307v-r1/board/software_irq.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2021-09-09 WCH the first version
|
||||||
|
* 2023-01-04 WangShun Remove redundant files
|
||||||
|
*/
|
||||||
|
#include "rtconfig.h"
|
||||||
|
#if defined (SOC_RISCV_SERIES_CH32V1)
|
||||||
|
#include "ch32v10x.h"
|
||||||
|
#elif defined (SOC_RISCV_SERIES_CH32V2)
|
||||||
|
#include "ch32v20x.h"
|
||||||
|
#elif defined (SOC_RISCV_SERIES_CH32V3)
|
||||||
|
#include "ch32v30x.h"
|
||||||
|
#else
|
||||||
|
#error "CH32 architecture doesn't support!"
|
||||||
|
#endif
|
||||||
|
void rt_trigger_software_interrupt(void)
|
||||||
|
{
|
||||||
|
/*CH32V103 does not support systick software interrupt*/
|
||||||
|
#if defined(SOC_RISCV_SERIES_CH32V1)
|
||||||
|
NVIC_SetPendingIRQ(Software_IRQn);
|
||||||
|
#else
|
||||||
|
SysTick->CTLR |= (1 << 31);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void rt_hw_do_after_save_above(void)
|
||||||
|
{
|
||||||
|
__asm volatile ("li t0,0x20" );
|
||||||
|
__asm volatile ("csrs 0x804, t0");
|
||||||
|
/*CH32V103 does not support systick software interrupt*/
|
||||||
|
#if defined(SOC_RISCV_SERIES_CH32V1)
|
||||||
|
NVIC_ClearPendingIRQ(Software_IRQn);
|
||||||
|
#else
|
||||||
|
SysTick->CTLR &= ~(1 << 31);
|
||||||
|
#endif
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
# RT-Thread building script for component
|
|
||||||
|
|
||||||
from building import *
|
|
||||||
|
|
||||||
cwd = GetCurrentDir()
|
|
||||||
src = Glob('*.c') + Glob('*.cpp') + Glob('*_gcc.S')
|
|
||||||
CPPPATH = [cwd]
|
|
||||||
ASFLAGS = ' -I ' + cwd
|
|
||||||
|
|
||||||
group = DefineGroup('CPU', src, depend = [''], CPPPATH = CPPPATH, ASFLAGS = ASFLAGS)
|
|
||||||
|
|
||||||
Return('group')
|
|
Loading…
x
Reference in New Issue
Block a user