void DMA_IRQHandler() {
uint32_t* free_dac_buffer;
if (LPC_GPDMA->DMACIntTCStat & (1<<0)) {
// Linked list has already advanced, e.g. if DMACCLLI points at
// dac_transfer_a, it is performing dac_transfer_b, and dac_buffer_a
// is free.
if ((dma_linked_list_t *)LPC_GPDMACH0->DMACCLLI == &dac_transfer_a) {
free_dac_buffer = dac_buffer_a;
debug_set_tp1();
} else {
free_dac_buffer = dac_buffer_b;
debug_clear_tp1();
}
load_dac_buffer(free_dac_buffer, DAC_BUFFER_LEN);
LPC_GPDMA->DMACIntTCClear = 1 << 0;
}
}
|