auto formatted

This commit is contained in:
Meco Man 2021-03-11 13:26:54 +08:00
parent 849c99d2fa
commit f18dfa0850
27 changed files with 101 additions and 101 deletions

View File

@ -65,16 +65,16 @@ void timer0_isr(int vector, void *param)
void timer0_init(void) void timer0_init(void)
{ {
TMR0CON = BIT(7); //TIE TMR0CON = BIT(7); //TIE
TMR0CNT = 0; TMR0CNT = 0;
rt_hw_interrupt_install(IRQ_TMR0_VECTOR, timer0_isr, RT_NULL, "tick"); rt_hw_interrupt_install(IRQ_TMR0_VECTOR, timer0_isr, RT_NULL, "tick");
} }
void timer0_cfg(uint32_t ticks) void timer0_cfg(uint32_t ticks)
{ {
TMR0PR = (uint32_t)(ticks - 1UL); //1ms interrupt TMR0PR = (uint32_t)(ticks - 1UL); //1ms interrupt
TMR0CON |= BIT(0); // EN TMR0CON |= BIT(0); // EN
} }
void hal_mdelay(uint32_t ms) void hal_mdelay(uint32_t ms)

View File

@ -41,9 +41,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
stk--; stk--;
*stk = (rt_uint32_t)0x10003; /* Start address */ *stk = (rt_uint32_t)0x10003; /* Start address */
stk--; stk--;
*stk = (rt_uint32_t)tentry; /* Start address */ *stk = (rt_uint32_t)tentry; /* Start address */
stk -= 22; stk -= 22;
*stk = (rt_uint32_t)parameter; /* Register a0 parameter*/ *stk = (rt_uint32_t)parameter; /* Register a0 parameter*/
stk -= 6; stk -= 6;
*stk = (rt_uint32_t)tp; /* Register thread pointer */ *stk = (rt_uint32_t)tp; /* Register thread pointer */
stk --; stk --;

View File

@ -24,16 +24,16 @@ void set_cpu_irq_comm(void (*irq_hook)(void))
void cpu_irq_comm_do(void) void cpu_irq_comm_do(void)
{ {
void (*pfnct)(void); void (*pfnct)(void);
uint32_t irq_pend = PICPND & irq_mask; uint32_t irq_pend = PICPND & irq_mask;
for (int i = 0; i < IRQ_TOTAL_NUM; i++) { for (int i = 0; i < IRQ_TOTAL_NUM; i++) {
if (irq_pend & BIT(i)) { if (irq_pend & BIT(i)) {
pfnct = tbl_irq_vector[i]; pfnct = tbl_irq_vector[i];
if (pfnct) { if (pfnct) {
pfnct(); /* call ISR */ pfnct(); /* call ISR */
} }
} }
} }
} }
void rt_hw_irq_enable(int vector) void rt_hw_irq_enable(int vector)

View File

@ -17,18 +17,18 @@ typedef enum
IRQ_SW_VECTOR = 2, IRQ_SW_VECTOR = 2,
IRQ_TMR0_VECTOR = 3, IRQ_TMR0_VECTOR = 3,
IRQ_TMR1_VECTOR = 4, IRQ_TMR1_VECTOR = 4,
IRQ_TMR2_4_5_VECTOR = 5, /*!< Timer 2, 4 and 5 Interrupt */ IRQ_TMR2_4_5_VECTOR = 5, /*!< Timer 2, 4 and 5 Interrupt */
IRQ_IRRX_VECTOR = 6, /*!< Timer 3 and IR receiver Interrupt */ IRQ_IRRX_VECTOR = 6, /*!< Timer 3 and IR receiver Interrupt */
IRQ_USB_VECTOR = 7, IRQ_USB_VECTOR = 7,
IRQ_SD_VECTOR = 8, IRQ_SD_VECTOR = 8,
IRQ_AUBUF0_1_VECTOR = 9, /*!< Audio buffer 0 and 1 Interrupt */ IRQ_AUBUF0_1_VECTOR = 9, /*!< Audio buffer 0 and 1 Interrupt */
IRQ_SDADC_VECTOR = 10, IRQ_SDADC_VECTOR = 10,
IRQ_AUDEC_VECTOR = 11, /*!< Audio codec, SBC encode and AEC FFT Interrupt */ IRQ_AUDEC_VECTOR = 11, /*!< Audio codec, SBC encode and AEC FFT Interrupt */
IRQ_SRC_VECTOR = 12, /*!< SRC, PLC and CVSD Interrupt */ IRQ_SRC_VECTOR = 12, /*!< SRC, PLC and CVSD Interrupt */
IRQ_FM_SPDIF_VECTOR = 13, /*!< FM TX, RX and SPDIF RX Interrupt */ IRQ_FM_SPDIF_VECTOR = 13, /*!< FM TX, RX and SPDIF RX Interrupt */
IRQ_UART0_2_VECTOR = 14, /*!< UART 0 to 2 Interrupt */ IRQ_UART0_2_VECTOR = 14, /*!< UART 0 to 2 Interrupt */
IRQ_HSUART_VECTOR = 15, IRQ_HSUART_VECTOR = 15,
IRQ_RTC_VECTOR = 16, /*!< RTC, LVD and WDT Interrupt */ IRQ_RTC_VECTOR = 16, /*!< RTC, LVD and WDT Interrupt */
IRQ_I2S_VECTOR = 17, IRQ_I2S_VECTOR = 17,
IRQ_TOTAL_NUM = 23, IRQ_TOTAL_NUM = 23,
} irq_type; } irq_type;