cc253x: DMA Changes

- Fixed DMA irq flag clearing
- Added a dma_reset helper

See Pull Request #18
This commit is contained in:
Philippe Rétornaz 2012-08-03 16:08:07 +02:00 committed by George Oikonomou
parent 898bd07810
commit eabaa0c8e4
3 changed files with 31 additions and 4 deletions

View file

@ -67,4 +67,29 @@ dma_associate_process(struct process * p, uint8_t c)
dma_callback[c] = p;
}
/*---------------------------------------------------------------------------*/
/*
* Reset a channel to idle state. As per cc253x datasheet section 8.1,
* we must reconfigure the channel to trigger source 0 between each
* reconfiguration.
*/
void
dma_reset(uint8_t c)
{
static __xdata uint8_t dummy;
if(c >= DMA_CHANNEL_COUNT) {
return;
}
DMA_ABORT(c);
dma_conf[c].src_h = (uint16_t) &dummy >> 8;
dma_conf[c].src_l = (uint16_t) &dummy;
dma_conf[c].dst_h = (uint16_t) &dummy >> 8;
dma_conf[c].dst_l = (uint16_t) &dummy;
dma_conf[c].len_h = 0;
dma_conf[c].len_l = 1;
dma_conf[c].wtt = DMA_BLOCK;
dma_conf[c].inc_prio = DMA_PRIO_GUARANTEED;
DMA_TRIGGER(c); // The operation order is important
DMA_ARM(c);
while(DMAARM & (1 << c));
}
#endif