Use functions provided by the nuclei-sdk hal
This commit is contained in:
parent
60d03110f7
commit
66d566f8c0
|
@ -46,26 +46,12 @@ void USBFS_IRQHandler(void) { tud_int_handler(0); }
|
||||||
#define UART_DEV SOC_DEBUG_UART
|
#define UART_DEV SOC_DEBUG_UART
|
||||||
|
|
||||||
#define LED_PIN LED_R
|
#define LED_PIN LED_R
|
||||||
|
#define TIMER_TICKS (SystemCoreClock / 1000)
|
||||||
|
|
||||||
void board_init(void) {
|
void board_init(void) {
|
||||||
/* Disable interrupts during init */
|
/* Disable interrupts during init */
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
|
|
||||||
ECLIC_Init();
|
|
||||||
|
|
||||||
/* Reset eclic interrupt registers */
|
|
||||||
for (int32_t i = 0; i < SOC_INT_MAX; i++) {
|
|
||||||
ECLIC->CTRL[0].INTIP = 0;
|
|
||||||
ECLIC->CTRL[0].INTIE = 0;
|
|
||||||
ECLIC->CTRL[0].INTATTR = 0;
|
|
||||||
ECLIC->CTRL[0].INTCTRL = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set 4 bits for interrupt level and 0 bits for priority */
|
|
||||||
__ECLIC_SetCfgNlbits(4);
|
|
||||||
|
|
||||||
SystemCoreClockUpdate();
|
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
SysTick_Config(TIMER_TICKS);
|
SysTick_Config(TIMER_TICKS);
|
||||||
#endif
|
#endif
|
||||||
|
@ -104,9 +90,9 @@ void board_init(void) {
|
||||||
rcu_periph_reset_enable(RCU_USBFSRST);
|
rcu_periph_reset_enable(RCU_USBFSRST);
|
||||||
rcu_periph_reset_disable(RCU_USBFSRST);
|
rcu_periph_reset_disable(RCU_USBFSRST);
|
||||||
|
|
||||||
/* Set IRQ priority and trigger */
|
/* Configure USBFS IRQ */
|
||||||
ECLIC_SetLevelIRQ(USBFS_IRQn, 3);
|
ECLIC_Register_IRQ(USBFS_IRQn, ECLIC_NON_VECTOR_INTERRUPT,
|
||||||
ECLIC_SetTrigIRQ(USBFS_IRQn, ECLIC_POSTIVE_EDGE_TRIGGER);
|
ECLIC_POSTIVE_EDGE_TRIGGER, 3, 0, NULL);
|
||||||
|
|
||||||
/* Retrieve otg core registers */
|
/* Retrieve otg core registers */
|
||||||
usb_gr* otg_core_regs = (usb_gr*)(USBFS_REG_BASE + USB_REG_OFFSET_CORE);
|
usb_gr* otg_core_regs = (usb_gr*)(USBFS_REG_BASE + USB_REG_OFFSET_CORE);
|
||||||
|
|
Loading…
Reference in New Issue