i have a little Problem understanding the new FIFO based arm7<->arm9
communication.
I tried to send a simple message to arm7 (from arm9) and respond back to
arm9 as soon as the message arrives.
This should be very straightforward, especially since the wifi init does
work in the exact same application (and it's almost the same IPC
mechanism)
In my example the message only is sent (by arm9) but never comes back.
Could someone please tell me why?
So here are the code snippets:
Code: Select all
// ************* arm7 main:
int main() {
irqInit();
fifoInit();
readUserSettings();
initClockIRQ();
SetYtrigger(80);
installUserFIFO();
installWifiFIFO();
// ... ... ...
while (1) {
swiWaitForVBlank();
}
// ---
// *********** user_fifo7.c
#include <nds.h>
#include "user_fifo7.h"
static void userValue32Handler(u32 value, void* data) {
fifoSendValue32(FIFO_USER_07, 4);
}
void installUserFIFO() {
fifoSetValue32Handler(FIFO_USER_07, userValue32Handler, 0);
}
// ---
// ************ arm9 main
int main(int argc, const char* argv[]) {
irqInit();
irqEnable(IRQ_VBLANK);
irqSet (IRQ_VBLANK, vidBuf_VblankHandler);
installUserFIFO();
sendMessageToArm7();
// ... ... ...
while(1) {
swiWaitForVBlank();
}
}
// ************* user_fifo9.c
#include <nds.h>
#include <stdio.h>
#include "user_fifo9.h"
static int test;
static void userValue32Handler(u32 value, void* data) {
test = 0;
}
void installUserFIFO() {
fifoSetValue32Handler(FIFO_USER_07, userValue32Handler, 0);
}
void sendMessageToArm7() {
test = 1;
if(fifoSendValue32(FIFO_USER_07, 2))
iprintf("Message on the way... \n");
else
iprintf("Message broadcast failed.\n");
while(test == 1) {
swiWaitForVBlank();
}
iprintf("message is back!!!\n");
}
// ---