#168474 - Toaster Mage - Thu Apr 30, 2009 1:53 am
When I try and use wifi with the following code, it just sits on Wifi_InitDefault till it fails, but when I comment out the other fifo handling code the wifi works as expected.
I have spent the last few days trying things to see if I can find what the problem is. I failed horribly so here I am.
arm7/main.c:
I have also noticed just having the relevant code in the program breaks it, even if it isn`t called.
I have spent the last few days trying things to see if I can find what the problem is. I failed horribly so here I am.
arm7/main.c:
Code: |
#include <nds.h>
#include <dswifi7.h> #include "as_lib7.h" #include "../common/fifo.h" u8 isOldDS = 0; u8 backlight = 1; void vCountHandler() { u16 pressed = REG_KEYXY; inputGetAndSend(); //Sleep mode if (pressed & BIT(7)) { systemSleep(); } } void vBlankHandler() { AS_SoundVBL(); Wifi_Update(); } int main(int argc, char** argv) { irqInit(); fifoInit(); readUserSettings(); initClockIRQ(); SetYtrigger(80); //Setup FIFO installWifiFIFO(); installSystemFIFO(); //installSoundFIFO(); //mmInstall(FIFO_MAXMOD); //Setup IRQ irqSet(IRQ_VCOUNT, vCountHandler); irqSet(IRQ_VBLANK, vBlankHandler); irqEnable(IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK); //Send backlight state isOldDS = !(readPowerManagement(4) & BIT(6)); backlight = isOldDS ? 3 : readPowerManagement(4); fifoSendValue32(TCOMMON_FIFO_CHANNEL_ARM9, MSG_TOGGLE_BACKLIGHT); fifoSendValue32(TCOMMON_FIFO_CHANNEL_ARM9, backlight); //Enable sound REG_SOUNDCNT = SOUND_ENABLE | SOUND_VOL(0x7F); do { if (fifoCheckValue32(TCOMMON_FIFO_CHANNEL_ARM7)) { u32 value = fifoGetValue32(TCOMMON_FIFO_CHANNEL_ARM7); // ==== comment from here ==== switch (value) { case MSG_TOGGLE_BACKLIGHT: if (isOldDS) { u32 power = readPowerManagement(PM_CONTROL_REG) & ~(PM_BACKLIGHT_TOP|PM_BACKLIGHT_BOTTOM); if (backlight) { backlight = 0; } else { backlight = 3; power = power | PM_BACKLIGHT_TOP | PM_BACKLIGHT_BOTTOM; } writePowerManagement(PM_CONTROL_REG, power); } else { backlight = ((backlight+1) & 0x3); //b should be in range 0..3 writePowerManagement(4, backlight); } fifoSendValue32(TCOMMON_FIFO_CHANNEL_ARM9, MSG_TOGGLE_BACKLIGHT); fifoSendValue32(TCOMMON_FIFO_CHANNEL_ARM9, backlight); break; case MSG_INIT_SOUND_ARM7: while (!fifoCheckValue32(TCOMMON_FIFO_CHANNEL_ARM7)); int v = fifoGetValue32(TCOMMON_FIFO_CHANNEL_ARM7); AS_Init((IPC_SoundSystem*)v); break; } // ==== down to here ==== } swiWaitForVBlank(); AS_MP3Engine(); } while(1); } |
I have also noticed just having the relevant code in the program breaks it, even if it isn`t called.