filename | test/dmac.c |
changeset | 815:866c103d72cd |
prev | 812:8cc61d5ea1f8 |
author | nkeynes |
date | Sun Aug 24 02:43:28 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Fix mask correctness of MMU/general IO registers, add unknown/undoced register at FF00002C |
file | annotate | diff | log | raw |
1.1 --- a/test/dmac.c Wed Aug 13 10:32:00 2008 +00001.2 +++ b/test/dmac.c Sun Aug 24 02:43:28 2008 +00001.3 @@ -16,6 +16,7 @@1.4 * GNU General Public License for more details.1.5 */1.7 +#include <assert.h>1.8 #include "dma.h"1.9 #include "asic.h"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.15 -#define G2BASERAM 0x008000001.16 +#define AICA_RAM_BASE 0xA08000001.17 +#define AICA_RAM_SIZE 0x002000001.19 #define G2DMABASE 0xA05F78001.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 +}
.