/* Functions for the ARM7 to process the commands from the ARM9.Based on code from the MOD player example posted to the GBADEV forums. */ #include #include "command.h" #include "transfer.h" #include "fifo.h" static void CommandFIFOInit() { REG_IPCFIFOCNT = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; } static void CommandFIFOSend() { static int count = 0; REG_IPCFIFOSEND = ++count; } static void CommandFIFORecv() { arm7_fifo->recv = REG_IPCFIFORECV; } void CommandProcessCommands() { static int currentCommand = -1; while(currentCommand != commandControl->currentCommand) { Command* command = &commandControl->command[currentCommand]; switch(command->commandType) { case FIFO_INIT: CommandFIFOInit(); break; case FIFO_SEND: CommandFIFOSend(); break; case FIFO_RECV: CommandFIFORecv(); break; } currentCommand++; currentCommand &= MAX_COMMANDS-1; } }