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

View file

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

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * 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 #ifndef DMA_H
@ -38,7 +38,7 @@
void dma_init(void); void dma_init(void);
int dma_subscribe(int, struct process *); 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; extern process_event_t dma_event;