generated from Embedded_Projects/CH32V307_Template
27 lines
617 B
C
27 lines
617 B
C
#include "FreeRTOS.h"
|
|
#include "task.h"
|
|
|
|
#include "ch32v30x.h"
|
|
#include "system_ch32v30x.h"
|
|
|
|
extern void freertos_risc_v_mtimer_interrupt_handler(void);
|
|
|
|
/**
|
|
* @brief Initialize SysTick interrupt.
|
|
*
|
|
*/
|
|
void vPortSetupTimerInterrupt(void) {
|
|
/* Configure SysTick and interrupts. */
|
|
SysTick->SR = 0UL;
|
|
SysTick->CTLR = 0UL;
|
|
SysTick->CNT = 0UL;
|
|
|
|
NVIC_EnableIRQ(SysTicK_IRQn);
|
|
|
|
SysTick->CMP = (uint64_t)((SystemCoreClock / configTICK_RATE_HZ) - 1);
|
|
SysTick->CTLR = 0x1E; /* COUNTDOWN | AUTO RELOAD | HCLK | INT */
|
|
SysTick->CTLR |= 0x20; /* INIT */
|
|
|
|
SysTick->CTLR |= 0x01; /* EN */
|
|
}
|