diff options
author | Keith Packard <keithp@keithp.com> | 2012-05-18 20:13:05 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-05-18 20:19:18 -0700 |
commit | c1ad8f443d5a9780a9897c79deda61241c0e34c2 (patch) | |
tree | d00b897c91fbccc54e249d2682ed9273cf8986ff /src/stm/ao_dma_stm.c | |
parent | 5d8b9d524d6424ff98dcc4155fe8b8bd892b6d8f (diff) |
altos: Provide ISR-based code paths for SPIserial-at-interrupt
This allows SPI to be entirely interrupt driven, with callbacks for
completion. It's not tested yet...
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_dma_stm.c')
-rw-r--r-- | src/stm/ao_dma_stm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/stm/ao_dma_stm.c b/src/stm/ao_dma_stm.c index 8379a1a5..c44e66f0 100644 --- a/src/stm/ao_dma_stm.c +++ b/src/stm/ao_dma_stm.c @@ -20,7 +20,8 @@ #define NUM_DMA 7 struct ao_dma_config { - void (*isr)(int index); + void (*isr)(int arg); + int arg; }; uint8_t ao_dma_done[NUM_DMA]; @@ -39,7 +40,7 @@ ao_dma_isr(uint8_t index) { /* Ack them */ stm_dma.ifcr = isr; if (ao_dma_config[index].isr) - (*ao_dma_config[index].isr)(index); + (*ao_dma_config[index].isr)(ao_dma_config[index].arg); else { ao_dma_done[index] = 1; ao_wakeup(&ao_dma_done[index]); @@ -79,8 +80,9 @@ ao_dma_set_transfer(uint8_t index, } void -ao_dma_set_isr(uint8_t index, void (*isr)(int)) +ao_dma_set_isr(uint8_t index, void (*isr)(int), int arg) { + ao_dma_config[index].arg = arg; ao_dma_config[index].isr = isr; } |