Search
lxdream.org :: lxdream/test/dmac.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/dmac.c
changeset 815:866c103d72cd
prev812:8cc61d5ea1f8
author nkeynes
date Mon Aug 18 12:20:28 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Implement memcpy_to_aica, still a work in progress though
file annotate diff log raw
1.1 --- a/test/dmac.c Wed Aug 13 10:32:00 2008 +0000
1.2 +++ b/test/dmac.c Mon Aug 18 12:20:28 2008 +0000
1.3 @@ -16,6 +16,7 @@
1.4 * GNU General Public License for more details.
1.5 */
1.6
1.7 +#include <assert.h>
1.8 #include "dma.h"
1.9 #include "asic.h"
1.10
1.11 @@ -40,7 +41,8 @@
1.12 #define SORT_DMA_CTL (ASIC_BASE+0x820)
1.13 #define SORT_DMA_COUNT (ASIC_BASE+0x860)
1.14
1.15 -#define G2BASERAM 0x00800000
1.16 +#define AICA_RAM_BASE 0xA0800000
1.17 +#define AICA_RAM_SIZE 0x00200000
1.18
1.19 #define G2DMABASE 0xA05F7800
1.20 #define G2DMATIMEOUT (G2DMABASE+0x90)
1.21 @@ -203,3 +205,23 @@
1.22 {
1.23 return aica_dma_transfer( aica_addr, data, size, 0 );
1.24 }
1.25 +
1.26 +int memcpy_to_aica( uint32_t aica_addr, void *data, size_t size )
1.27 +{
1.28 + assert( (aica_addr & 0x03) == 0 );
1.29 + uint32_t *src = (uint32_t *)data;
1.30 + uint32_t *dest = (uint32_t *)aica_addr;
1.31 + while( size > 0 ) {
1.32 + int i;
1.33 + if( g2_fifo_wait() != 0 ) {
1.34 + return -1;
1.35 + }
1.36 + irq_disable();
1.37 + for( i=0; i<8 && size > 0; i++ ) {
1.38 + *dest++ = *src++;
1.39 + size -= 4;
1.40 + }
1.41 + irq_enable();
1.42 + }
1.43 + return 0;
1.44 +}
.