Skip to content

Commit

Permalink
move interrupt handlers to ram
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Aug 13, 2023
1 parent d7221a5 commit c83e789
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 67 deletions.
8 changes: 4 additions & 4 deletions src/driver/at32/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/driver/at32/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down
26 changes: 13 additions & 13 deletions src/driver/at32/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
}
8 changes: 4 additions & 4 deletions src/driver/stm32/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/driver/stm32/exti.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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();
}

Expand Down
16 changes: 8 additions & 8 deletions src/driver/stm32/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/driver/stm32/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
42 changes: 21 additions & 21 deletions src/driver/stm32/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
}

0 comments on commit c83e789

Please sign in to comment.