altos: stm: pass DMA buffer index to DMA completion callback
authorKeith Packard <keithp@keithp.com>
Tue, 8 May 2012 04:50:26 +0000 (21:50 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 8 May 2012 04:50:26 +0000 (21:50 -0700)
This lets the user know which DMA has finished.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm/ao_adc_stm.c
src/stm/ao_dma_stm.c

index 729551c4b036673512976e451bc6b2b980896098..a256990851f3bfeb5af3c2e2e79b53f7a64a3f4d 100644 (file)
@@ -41,7 +41,7 @@ static uint8_t                        ao_adc_ready;
  *
  * Mark time in ring, shut down DMA engine
  */
-static void ao_adc_done(void)
+static void ao_adc_done(int index)
 {
        ao_adc_ring[ao_adc_head].tick = ao_time();
        ao_adc_head = ao_adc_ring_next(ao_adc_head);
index e76c8e8c936954a99cbbe6d1919311a0a1f23cae..8379a1a533ca0ec5e19321910b1a9975a952f744 100644 (file)
@@ -20,7 +20,7 @@
 #define NUM_DMA        7
 
 struct ao_dma_config {
-       void            (*isr)(void);
+       void            (*isr)(int index);
 };
 
 uint8_t ao_dma_done[NUM_DMA];
@@ -39,7 +39,7 @@ ao_dma_isr(uint8_t index) {
        /* Ack them */
        stm_dma.ifcr = isr;
        if (ao_dma_config[index].isr)
-               (*ao_dma_config[index].isr)();
+               (*ao_dma_config[index].isr)(index);
        else {
                ao_dma_done[index] = 1;
                ao_wakeup(&ao_dma_done[index]);
@@ -79,7 +79,7 @@ ao_dma_set_transfer(uint8_t           index,
 }
 
 void
-ao_dma_set_isr(uint8_t index, void (*isr)(void))
+ao_dma_set_isr(uint8_t index, void (*isr)(int))
 {
        ao_dma_config[index].isr = isr;
 }