From 3eceef43d33f1c122c8d40047bd7fb96688e0a77 Mon Sep 17 00:00:00 2001 From: stac Date: Sun, 4 Jul 2010 02:21:13 +0000 Subject: [PATCH] spi: Connect device specific DMA IRQ handlers Mark the device specific DMA IRQ handlers as strongly linked aliases for the genericly named interrupt vector symbol. Here's how this works... * The address of the symbol DMA1_Channel2_IRQHandler is written into the DMA1/Channel2 interrupt vector by the linker script. * The startup_*.S file specifies Default_Handler() as a weakly linked alias for DMA1_Channel2_IRQHandler. * We now override the weakly linked alias with the strongly linked PIOS_SPI_sdcard_irq_handler(). * This results in the address of PIOS_SPI_sdcard_irq_handler() being written to the vector table for the DMA1/Channel2 interrupt. * The PIOS_SPI_sdcard_irq_handler() function is now called whenever the DMA1/Channel2 interrupt fires. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1003 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/AHRS/pios_board.c | 4 +++- flight/OpenPilot/System/pios_board.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/flight/AHRS/pios_board.c b/flight/AHRS/pios_board.c index bda06add5..5a9f33be5 100644 --- a/flight/AHRS/pios_board.c +++ b/flight/AHRS/pios_board.c @@ -31,10 +31,12 @@ /* OP Interface * - * NOTE: Leave this declared as const static data so that it ends up in the + * NOTE: Leave this declared as const data so that it ends up in the * .rodata section (ie. Flash) rather than in the .bss section (RAM). */ void PIOS_SPI_op_irq_handler(void); +void DMA1_Channel5_IRQHandler() __attribute__ ((alias ("PIOS_SPI_op_irq_handler"))); +void DMA1_Channel4_IRQHandler() __attribute__ ((alias ("PIOS_SPI_op_irq_handler"))); static const struct pios_spi_cfg pios_spi_op_cfg = { .regs = SPI2, .init = { diff --git a/flight/OpenPilot/System/pios_board.c b/flight/OpenPilot/System/pios_board.c index fccbda846..129247d16 100644 --- a/flight/OpenPilot/System/pios_board.c +++ b/flight/OpenPilot/System/pios_board.c @@ -30,10 +30,12 @@ /* MicroSD Interface * - * NOTE: Leave this declared as const static data so that it ends up in the + * NOTE: Leave this declared as const data so that it ends up in the * .rodata section (ie. Flash) rather than in the .bss section (RAM). */ void PIOS_SPI_sdcard_irq_handler(void); +void DMA1_Channel2_IRQHandler() __attribute__ ((alias ("PIOS_SPI_sdcard_irq_handler"))); +void DMA1_Channel3_IRQHandler() __attribute__ ((alias ("PIOS_SPI_sdcard_irq_handler"))); const struct pios_spi_cfg pios_spi_sdcard_cfg = { .regs = SPI1, .init = { @@ -126,10 +128,12 @@ const struct pios_spi_cfg pios_spi_sdcard_cfg = { /* AHRS Interface * - * NOTE: Leave this declared as const static data so that it ends up in the + * NOTE: Leave this declared as const data so that it ends up in the * .rodata section (ie. Flash) rather than in the .bss section (RAM). */ void PIOS_SPI_ahrs_irq_handler(void); +void DMA1_Channel4_IRQHandler() __attribute__ ((alias ("PIOS_SPI_ahrs_irq_handler"))); +void DMA1_Channel5_IRQHandler() __attribute__ ((alias ("PIOS_SPI_ahrs_irq_handler"))); const struct pios_spi_cfg pios_spi_ahrs_cfg = { .regs = SPI2, .init = {