#116157 - relpats_eht - Mon Jan 22, 2007 5:51 pm
I have been attempting to set up a FIFO sound system but have been running into a bit of trouble. As of now, the queue on the ARM9 side merely fills up, and is never received by the ARM7 (as far as I can tell). I have read through these forums looking for some form of answer, but I still haven't found one.
In any event, here is a condensed form of the code, perhaps someone could give me a few pointers.
ARM7:
ARM9:
_________________
- relpats_eht
In any event, here is a condensed form of the code, perhaps someone could give me a few pointers.
ARM7:
Code: |
void recvSoundCommand(NDS_SOUND_COMMAND* command){
while((REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)); command->command = REG_IPC_FIFO_RX; while((REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)); command->voice = REG_IPC_FIFO_RX; while((REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)); command->value = REG_IPC_FIFO_RX; } void sendSoundCommand(NDS_SOUND_COMMAND command){ while(!(REG_IPC_FIFO_CR & IPC_FIFO_SEND_EMPTY)); while((REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL)); REG_IPC_FIFO_TX = command.command; while((REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL)); REG_IPC_FIFO_TX = command.voice; while((REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL)); REG_IPC_FIFO_TX = command.value; } void fifoHandler(void){ NDS_SOUND_COMMAND command; recvSoundCommand(&command); switch(command.command){ // Handle command } u32 extra; while(!(REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)){ extra = REG_IPC_FIFO_RX; } } |
ARM9:
Code: |
void nds_fifo_recv_sound_command(NDS_SOUND_COMMAND* command){
while((REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)); command->command = REG_IPC_FIFO_RX; while((REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)); command->voice = REG_IPC_FIFO_RX; while((REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)); command->value = REG_IPC_FIFO_RX; } void nds_fifo_send_sound_command(NDS_SOUND_COMMAND command){ while(!(REG_IPC_FIFO_CR & IPC_FIFO_SEND_EMPTY)); // Eventually, the code hangs here while((REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL)); REG_IPC_FIFO_TX = command.command; while((REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL)); REG_IPC_FIFO_TX = command.voice; while((REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL)); REG_IPC_FIFO_TX = command.value; } void nds_fifo_handler(void){ NDS_SOUND_COMMAND command; nds_fifo_recv_sound_command(&command); switch(command.command){ // Handle Command } u32 extra; while(!(REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)){ extra = REG_IPC_FIFO_RX; } } |
_________________
- relpats_eht