Variants for gmini dma transfers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5852 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3842dc3a72
commit
9c6a549ad2
1 changed files with 29 additions and 1 deletions
|
@ -27,12 +27,15 @@
|
|||
|
||||
void* volatile interrupt_vector[16] __attribute__ ((section(".idata")));
|
||||
|
||||
void ddma_wait_idle(void) __attribute__ ((section (".icode")));
|
||||
void ddma_wait_idle(void)
|
||||
{
|
||||
do {
|
||||
} while ((DDMACOM & 3) != 0);
|
||||
}
|
||||
|
||||
void ddma_transfer(int dir, int mem, long intAddr, long extAddr, int num)
|
||||
__attribute__ ((section (".icode")));
|
||||
void ddma_transfer(int dir, int mem, long intAddr, long extAddr, int num) {
|
||||
int irq = set_irq_level(1);
|
||||
ddma_wait_idle();
|
||||
|
@ -52,6 +55,31 @@ void ddma_transfer(int dir, int mem, long intAddr, long extAddr, int num) {
|
|||
set_irq_level(irq);
|
||||
}
|
||||
|
||||
static void ddma_wait_idle_noicode(void)
|
||||
{
|
||||
do {
|
||||
} while ((DDMACOM & 3) != 0);
|
||||
}
|
||||
|
||||
static void ddma_transfer_noicode(int dir, int mem, long intAddr, long extAddr, int num) {
|
||||
int irq = set_irq_level(1);
|
||||
ddma_wait_idle_noicode();
|
||||
long externalAddress = (long) extAddr;
|
||||
long internalAddress = (long) intAddr;
|
||||
/* HW wants those two in word units. */
|
||||
num /= 2;
|
||||
externalAddress /= 2;
|
||||
|
||||
DDMACFG = (dir << 1) | (mem << 2);
|
||||
DDMAIADR = internalAddress;
|
||||
DDMAEADR = externalAddress;
|
||||
DDMANUM = num;
|
||||
DDMACOM |= 0x4; /* start */
|
||||
|
||||
ddma_wait_idle_noicode(); /* wait for completion */
|
||||
set_irq_level(irq);
|
||||
}
|
||||
|
||||
/* Some linker-defined symbols */
|
||||
extern int icodecopy;
|
||||
extern int icodesize;
|
||||
|
@ -86,7 +114,7 @@ void system_init(void)
|
|||
/************************
|
||||
* Copy .icode section to icram
|
||||
*/
|
||||
ddma_transfer(0, 0, 0x40, (long)&icodecopy, (int)&icodesize);
|
||||
ddma_transfer_noicode(0, 0, 0x40, (long)&icodecopy, (int)&icodesize);
|
||||
|
||||
|
||||
/***************************
|
||||
|
|
Loading…
Reference in a new issue