gbasys

diff src/dma.c @ 1:c50064b181c2

stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 04 Mar 2012 07:06:41 +0200
parents 875ef6085efc
children 72c6429ae953
line diff
     1.1 --- a/src/dma.c	Sun Mar 04 04:04:25 2012 +0200
     1.2 +++ b/src/dma.c	Sun Mar 04 07:06:41 2012 +0200
     1.3 @@ -1,7 +1,7 @@
     1.4  /*
     1.5  Copyright 2004 John Tsiombikas <nuclear@siggraph.org>
     1.6  
     1.7 -This file is part of libgba, a library for GameBoy Advance development.
     1.8 +This file is part of gbasys, a library for GameBoy Advance development.
     1.9  
    1.10  This program is free software; you can redistribute it and/or modify
    1.11  it under the terms of the GNU General Public License as published by
    1.12 @@ -18,11 +18,11 @@
    1.13  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.14  */
    1.15  
    1.16 -#include "libgba_config.h"
    1.17 +#include "config.h"
    1.18  #include "dma.h"
    1.19  
    1.20  /* DMA Options */
    1.21 -#define DMA_ENABLE 				0x80000000
    1.22 +#define DMA_ENABLE				0x80000000
    1.23  #define DMA_INT_ENABLE			0x40000000
    1.24  #define DMA_TIMING_IMMED		0x00000000
    1.25  #define DMA_TIMING_VBLANK		0x10000000
    1.26 @@ -48,13 +48,15 @@
    1.27  
    1.28  /* --- perform a copy of words or halfwords using DMA --- */
    1.29  
    1.30 -void dma_copy32(int channel, void *dst, void *src, int words) {
    1.31 +void dma_copy32(int channel, void *dst, void *src, int words)
    1.32 +{
    1.33  	reg_dma[channel][DMA_SRC] = (unsigned long)src;
    1.34  	reg_dma[channel][DMA_DST] = (unsigned long)dst;
    1.35  	reg_dma[channel][DMA_CTRL] = words | DMA_TIMING_IMMED | DMA_32 | DMA_ENABLE;
    1.36  }
    1.37  
    1.38 -void dma_copy16(int channel, void *dst, void *src, int halfwords) {
    1.39 +void dma_copy16(int channel, void *dst, void *src, int halfwords)
    1.40 +{
    1.41  	reg_dma[channel][DMA_SRC] = (unsigned long)src;
    1.42  	reg_dma[channel][DMA_DST] = (unsigned long)dst;
    1.43  	reg_dma[channel][DMA_CTRL] = halfwords | DMA_TIMING_IMMED | DMA_16 | DMA_ENABLE;
    1.44 @@ -62,14 +64,16 @@
    1.45  
    1.46  /* --- fill a buffer with an ammount of words and halfwords using DMA --- */
    1.47  
    1.48 -void dma_fill32(int channel, void *dst, unsigned long val, int words) {
    1.49 +void dma_fill32(int channel, void *dst, unsigned long val, int words)
    1.50 +{
    1.51  	unsigned long valmem = val;
    1.52  	reg_dma[channel][DMA_SRC] = (unsigned long)&valmem;
    1.53  	reg_dma[channel][DMA_DST] = (unsigned long)dst;
    1.54  	reg_dma[channel][DMA_CTRL] = words | DMA_SRC_FIX | DMA_TIMING_IMMED | DMA_32 | DMA_ENABLE;
    1.55  }
    1.56  
    1.57 -void dma_fill16(int channel, void *dst, unsigned short val, int halfwords) {
    1.58 +void dma_fill16(int channel, void *dst, unsigned short val, int halfwords)
    1.59 +{
    1.60  	unsigned short valmem = val;
    1.61  	reg_dma[channel][DMA_SRC] = (unsigned long)&valmem;
    1.62  	reg_dma[channel][DMA_DST] = (unsigned long)dst;