From 052423b82d077a0985f8e3a949295e760e0507f6 Mon Sep 17 00:00:00 2001 From: bkleiner Date: Fri, 11 Aug 2023 16:28:53 +0200 Subject: [PATCH] move interrupt handlers to ram --- src/driver/at32/dma.c | 8 ++++---- src/driver/at32/serial.c | 16 +++++++-------- src/driver/at32/timer.c | 26 ++++++++++++------------ src/driver/stm32/dma.c | 8 ++++---- src/driver/stm32/exti.c | 16 +++++++-------- src/driver/stm32/serial.c | 16 +++++++-------- src/driver/stm32/time.c | 2 +- src/driver/stm32/timer.c | 42 +++++++++++++++++++-------------------- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/driver/at32/dma.c b/src/driver/at32/dma.c index e551d9719..3d5a73f06 100644 --- a/src/driver/at32/dma.c +++ b/src/driver/at32/dma.c @@ -84,7 +84,7 @@ void dma_clear_flag_tc(dma_device_t dev) { extern void dshot_dma_isr(dma_device_t dev); extern void spi_dma_isr(dma_device_t dev); -static void handle_dma_stream_isr(dma_device_t dev) { +RAM_FUNC static void handle_dma_stream_isr(dma_device_t dev) { switch (dev) { case DMA_DEVICE_SPI1_RX: case DMA_DEVICE_SPI2_RX: @@ -108,9 +108,9 @@ static void handle_dma_stream_isr(dma_device_t dev) { } } -#define DMA_STREAM(_port, _chan, _dev) \ - void DMA##_port##_Channel##_chan##_IRQHandler() { \ - handle_dma_stream_isr(DMA_DEVICE_##_dev); \ +#define DMA_STREAM(_port, _chan, _dev) \ + RAM_FUNC void DMA##_port##_Channel##_chan##_IRQHandler() { \ + handle_dma_stream_isr(DMA_DEVICE_##_dev); \ } DMA_STREAMS diff --git a/src/driver/at32/serial.c b/src/driver/at32/serial.c index 03de5d707..0d925fdc5 100644 --- a/src/driver/at32/serial.c +++ b/src/driver/at32/serial.c @@ -140,7 +140,7 @@ bool serial_write_bytes(serial_port_t *serial, const uint8_t *data, const uint32 return true; } -static void handle_serial_isr(serial_port_t *serial) { +RAM_FUNC static void handle_serial_isr(serial_port_t *serial) { const usart_port_def_t *port = &usart_port_defs[serial->config.port]; if (usart_flag_get(port->channel, USART_TDC_FLAG)) { @@ -171,7 +171,7 @@ static void handle_serial_isr(serial_port_t *serial) { } } -static void handle_usart_isr(serial_ports_t index) { +RAM_FUNC static void handle_usart_isr(serial_ports_t index) { if (serial_ports[index]) { handle_serial_isr(serial_ports[index]); return; @@ -187,12 +187,12 @@ static void handle_usart_isr(serial_ports_t index) { // we need handlers for both U_S_ART and UART. // simply define both for every enabled port. -#define USART_IRQ_HANDLER(channel) \ - void USART##channel##_IRQHandler() { \ - handle_usart_isr(SERIAL_PORT##channel); \ - } \ - void UART##channel##_IRQHandler() { \ - handle_usart_isr(SERIAL_PORT##channel); \ +#define USART_IRQ_HANDLER(channel) \ + RAM_FUNC void USART##channel##_IRQHandler() { \ + handle_usart_isr(SERIAL_PORT##channel); \ + } \ + RAM_FUNC void UART##channel##_IRQHandler() { \ + handle_usart_isr(SERIAL_PORT##channel); \ } USART_IRQ_HANDLER(1) diff --git a/src/driver/at32/timer.c b/src/driver/at32/timer.c index 14bb24729..2c1f86c54 100644 --- a/src/driver/at32/timer.c +++ b/src/driver/at32/timer.c @@ -108,7 +108,7 @@ uint32_t timer_channel_val(timer_channel_t chan) { } } -static void timer_irq_handler() { +RAM_FUNC static void timer_irq_handler() { extern void soft_serial_timer_irq_handler(); soft_serial_timer_irq_handler(); @@ -118,39 +118,39 @@ static void timer_irq_handler() { #endif } -void TMR1_OVF_TMR10_IRQHandler() { +RAM_FUNC void TMR1_OVF_TMR10_IRQHandler() { timer_irq_handler(); } -void TMR2_GLOBAL_IRQHandler() { +RAM_FUNC void TMR2_GLOBAL_IRQHandler() { timer_irq_handler(); } -void TMR3_GLOBAL_IRQHandler() { +RAM_FUNC void TMR3_GLOBAL_IRQHandler() { timer_irq_handler(); } -void TMR4_GLOBAL_IRQHandler() { +RAM_FUNC void TMR4_GLOBAL_IRQHandler() { timer_irq_handler(); } -void TMR5_GLOBAL_IRQHandler() { +RAM_FUNC void TMR5_GLOBAL_IRQHandler() { timer_irq_handler(); } -void TMR6_DAC_GLOBAL_IRQHandler() { +RAM_FUNC void TMR6_DAC_GLOBAL_IRQHandler() { timer_irq_handler(); } -void TMR7_GLOBAL_IRQHandler() { +RAM_FUNC void TMR7_GLOBAL_IRQHandler() { timer_irq_handler(); } -void TMR8_OVF_TMR13_IRQHandler() { +RAM_FUNC void TMR8_OVF_TMR13_IRQHandler() { timer_irq_handler(); } -void TMR1_BRK_TMR9_IRQHandler() { +RAM_FUNC void TMR1_BRK_TMR9_IRQHandler() { timer_irq_handler(); } -void TMR1_TRG_HALL_TMR11_IRQHandler() { +RAM_FUNC void TMR1_TRG_HALL_TMR11_IRQHandler() { timer_irq_handler(); } -void TMR8_BRK_TMR12_IRQHandler() { +RAM_FUNC void TMR8_BRK_TMR12_IRQHandler() { timer_irq_handler(); } -void TMR8_TRG_HALL_TMR14_IRQHandler() { +RAM_FUNC void TMR8_TRG_HALL_TMR14_IRQHandler() { timer_irq_handler(); } \ No newline at end of file diff --git a/src/driver/stm32/dma.c b/src/driver/stm32/dma.c index 8dcc3b0a2..708e441ba 100644 --- a/src/driver/stm32/dma.c +++ b/src/driver/stm32/dma.c @@ -180,7 +180,7 @@ void dma_clear_flag_tc(dma_device_t dev) { extern void dshot_dma_isr(dma_device_t dev); extern void spi_dma_isr(dma_device_t dev); -static void handle_dma_stream_isr(dma_device_t dev) { +RAM_FUNC static void handle_dma_stream_isr(dma_device_t dev) { switch (dev) { case DMA_DEVICE_SPI1_RX: case DMA_DEVICE_SPI2_RX: @@ -204,9 +204,9 @@ static void handle_dma_stream_isr(dma_device_t dev) { } } -#define DMA_STREAM(_port, _chan, _stream, _dev) \ - void DMA##_port##_Stream##_stream##_IRQHandler() { \ - handle_dma_stream_isr(DMA_DEVICE_##_dev); \ +#define DMA_STREAM(_port, _chan, _stream, _dev) \ + RAM_FUNC void DMA##_port##_Stream##_stream##_IRQHandler() { \ + handle_dma_stream_isr(DMA_DEVICE_##_dev); \ } DMA_STREAMS diff --git a/src/driver/stm32/exti.c b/src/driver/stm32/exti.c index 6beb94945..b43ba8f17 100644 --- a/src/driver/stm32/exti.c +++ b/src/driver/stm32/exti.c @@ -138,7 +138,7 @@ bool exti_line_active(gpio_pins_t pin) { return true; } -static void handle_exit_isr() { +RAM_FUNC static void handle_exit_isr() { if (exti_line_active(target.rx_spi.exti)) { extern void rx_spi_handle_exti(bool); rx_spi_handle_exti(gpio_pin_read(target.rx_spi.exti)); @@ -150,25 +150,25 @@ static void handle_exit_isr() { } } -void EXTI0_IRQHandler() { +RAM_FUNC void EXTI0_IRQHandler() { handle_exit_isr(); } -void EXTI1_IRQHandler() { +RAM_FUNC void EXTI1_IRQHandler() { handle_exit_isr(); } -void EXTI2_IRQHandler() { +RAM_FUNC void EXTI2_IRQHandler() { handle_exit_isr(); } -void EXTI3_IRQHandler() { +RAM_FUNC void EXTI3_IRQHandler() { handle_exit_isr(); } -void EXTI4_IRQHandler() { +RAM_FUNC void EXTI4_IRQHandler() { handle_exit_isr(); } -void EXTI9_5_IRQHandler() { +RAM_FUNC void EXTI9_5_IRQHandler() { handle_exit_isr(); } -void EXTI15_10_IRQHandler() { +RAM_FUNC void EXTI15_10_IRQHandler() { handle_exit_isr(); } diff --git a/src/driver/stm32/serial.c b/src/driver/stm32/serial.c index 73c6d6dde..cde25b223 100644 --- a/src/driver/stm32/serial.c +++ b/src/driver/stm32/serial.c @@ -203,7 +203,7 @@ bool serial_write_bytes(serial_port_t *serial, const uint8_t *data, const uint32 return true; } -static void handle_serial_isr(serial_port_t *serial) { +RAM_FUNC static void handle_serial_isr(serial_port_t *serial) { const usart_port_def_t *port = &usart_port_defs[serial->config.port]; if (LL_USART_IsEnabledIT_TC(port->channel) && LL_USART_IsActiveFlag_TC(port->channel)) { @@ -234,7 +234,7 @@ static void handle_serial_isr(serial_port_t *serial) { } } -static void handle_usart_isr(serial_ports_t index) { +RAM_FUNC static void handle_usart_isr(serial_ports_t index) { if (serial_ports[index]) { handle_serial_isr(serial_ports[index]); return; @@ -250,12 +250,12 @@ static void handle_usart_isr(serial_ports_t index) { // we need handlers for both U_S_ART and UART. // simply define both for every enabled port. -#define USART_IRQ_HANDLER(channel) \ - void USART##channel##_IRQHandler() { \ - handle_usart_isr(SERIAL_PORT##channel); \ - } \ - void UART##channel##_IRQHandler() { \ - handle_usart_isr(SERIAL_PORT##channel); \ +#define USART_IRQ_HANDLER(channel) \ + RAM_FUNC void USART##channel##_IRQHandler() { \ + handle_usart_isr(SERIAL_PORT##channel); \ + } \ + RAM_FUNC void UART##channel##_IRQHandler() { \ + handle_usart_isr(SERIAL_PORT##channel); \ } USART_IRQ_HANDLER(1) diff --git a/src/driver/stm32/time.c b/src/driver/stm32/time.c index bda7a3aee..8ed80f0fc 100644 --- a/src/driver/stm32/time.c +++ b/src/driver/stm32/time.c @@ -41,7 +41,7 @@ void time_init() { debug_time_init(); } -void SysTick_Handler() { +RAM_FUNC void SysTick_Handler() { systick_count++; systick_val = SysTick->VAL; systick_pending = 0; diff --git a/src/driver/stm32/timer.c b/src/driver/stm32/timer.c index db8984347..26ff6f0fd 100644 --- a/src/driver/stm32/timer.c +++ b/src/driver/stm32/timer.c @@ -134,7 +134,7 @@ uint32_t timer_channel_val(timer_channel_t chan) { } } -static void timer_irq_handler() { +RAM_FUNC static void timer_irq_handler() { extern void soft_serial_timer_irq_handler(); soft_serial_timer_irq_handler(); @@ -149,63 +149,63 @@ static void timer_irq_handler() { #undef TIM1_TRG_COM_TIM11_IRQHandler #endif -void TIM15_IRQHandler() { +RAM_FUNC void TIM15_IRQHandler() { timer_irq_handler(); } -void TIM16_IRQHandler() { +RAM_FUNC void TIM16_IRQHandler() { timer_irq_handler(); } -void TIM17_IRQHandler() { +RAM_FUNC void TIM17_IRQHandler() { timer_irq_handler(); } -void TIM1_BRK_IRQHandler() { +RAM_FUNC void TIM1_BRK_IRQHandler() { timer_irq_handler(); } -void TIM1_BRK_TIM9_IRQHandler() { +RAM_FUNC void TIM1_BRK_TIM9_IRQHandler() { timer_irq_handler(); } -void TIM1_CC_IRQHandler() { +RAM_FUNC void TIM1_CC_IRQHandler() { timer_irq_handler(); } -void TIM1_TRG_COM_IRQHandler() { +RAM_FUNC void TIM1_TRG_COM_IRQHandler() { timer_irq_handler(); } -void TIM1_TRG_COM_TIM11_IRQHandler() { +RAM_FUNC void TIM1_TRG_COM_TIM11_IRQHandler() { timer_irq_handler(); } -void TIM1_UP_IRQHandler() { +RAM_FUNC void TIM1_UP_IRQHandler() { timer_irq_handler(); } -void TIM1_UP_TIM10_IRQHandler() { +RAM_FUNC void TIM1_UP_TIM10_IRQHandler() { timer_irq_handler(); } -void TIM2_IRQHandler() { +RAM_FUNC void TIM2_IRQHandler() { timer_irq_handler(); } -void TIM3_IRQHandler() { +RAM_FUNC void TIM3_IRQHandler() { timer_irq_handler(); } -void TIM4_IRQHandler() { +RAM_FUNC void TIM4_IRQHandler() { timer_irq_handler(); } -void TIM5_IRQHandler() { +RAM_FUNC void TIM5_IRQHandler() { timer_irq_handler(); } -void TIM6_DAC_IRQHandler() { +RAM_FUNC void TIM6_DAC_IRQHandler() { timer_irq_handler(); } -void TIM7_IRQHandler() { +RAM_FUNC void TIM7_IRQHandler() { timer_irq_handler(); } -void TIM8_BRK_TIM12_IRQHandler() { +RAM_FUNC void TIM8_BRK_TIM12_IRQHandler() { timer_irq_handler(); } -void TIM8_CC_IRQHandler() { +RAM_FUNC void TIM8_CC_IRQHandler() { timer_irq_handler(); } -void TIM8_TRG_COM_TIM14_IRQHandler() { +RAM_FUNC void TIM8_TRG_COM_TIM14_IRQHandler() { timer_irq_handler(); } -void TIM8_UP_TIM13_IRQHandler() { +RAM_FUNC void TIM8_UP_TIM13_IRQHandler() { timer_irq_handler(); }