DMA destination is now given as a parameter instead of being hardwired.

This commit is contained in:
nvt-se 2007-11-06 15:08:55 +00:00
parent dc8b6e7dcd
commit 366d845336
3 changed files with 12 additions and 6 deletions

View File

@ -196,6 +196,12 @@ cc1020_set_power(uint8_t pa_power)
cc1020_pa_power = pa_power;
}
int
cc1020_sending(void)
{
return !!cc1020_txlen;
}
int
cc1020_send(const void *buf, unsigned short len)
{
@ -413,7 +419,7 @@ PROCESS_THREAD(cc1020_sender_process, ev, data)
cc1020_set_tx();
// Initiate radio transfer.
dma_transfer(cc1020_txbuf, cc1020_txlen);
dma_transfer(&TXBUF0, cc1020_txbuf, cc1020_txlen);
// wait for DMA0 to finish
PROCESS_WAIT_UNTIL(ev == dma_event);

View File

@ -99,7 +99,7 @@ dma_subscribe(int line, struct process *p)
}
void
dma_transfer(unsigned char *buf, unsigned len)
dma_transfer(unsigned char *dst, unsigned char *src, unsigned len)
{
// Configure DMA Channel 0 for UART0 TXIFG.
DMACTL0 = DMA0TSEL_4;
@ -119,8 +119,8 @@ dma_transfer(unsigned char *buf, unsigned len)
*/
DMA0CTL = DMADT_0 | DMADSTINCR_0 | DMASRCINCR_3 | DMASBDB | DMALEVEL;
DMA0SA = (unsigned) buf;
DMA0DA = (unsigned) &TXBUF0;
DMA0SA = (unsigned) src;
DMA0DA = (unsigned) dst;
DMA0SZ = len;
DMA0CTL |= DMAEN | DMAIE; // enable DMA and interrupts

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: dma.h,v 1.4 2007/08/16 13:51:57 nvt-se Exp $
* $Id: dma.h,v 1.5 2007/11/06 15:08:56 nvt-se Exp $
*/
#ifndef DMA_H
@ -38,7 +38,7 @@
void dma_init(void);
int dma_subscribe(int, struct process *);
void dma_transfer(unsigned char *, unsigned);
void dma_transfer(unsigned char *, unsigned char *, unsigned);
extern process_event_t dma_event;