for libnds 1.7.1

This commit is contained in:
JimmyZ 2018-02-10 03:58:24 +08:00
parent 33025824de
commit fbe93e25c3
2 changed files with 33 additions and 24 deletions

View File

@ -2,7 +2,7 @@
//---------------------------------------------------------------------------------
void VcountHandler() {
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
inputGetAndSend();
}
@ -10,59 +10,59 @@ volatile bool exitflag = false;
//---------------------------------------------------------------------------------
void powerButtonCB() {
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
exitflag = true;
}
//---------------------------------------------------------------------------------
int main() {
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
readUserSettings();
irqInit();
// Start the RTC tracking IRQ
initClockIRQ();
fifoInit();
touchInit();
// touchInit();
SetYtrigger(80);
installSoundFIFO();
// installSoundFIFO();
installSystemFIFO();
irqSet(IRQ_VCOUNT, VcountHandler);
irqEnable( IRQ_VBLANK | IRQ_VCOUNT);
setPowerButtonCB(powerButtonCB);
irqEnable(IRQ_VBLANK | IRQ_VCOUNT);
setPowerButtonCB(powerButtonCB);
// Keep the ARM7 mostly idle
while (!exitflag) {
swiIntrWait(1,IRQ_FIFO_NOT_EMPTY);
swiIntrWait(1, IRQ_FIFO_NOT_EMPTY);
if (fifoCheckValue32(FIFO_USER_01)) {
int command = fifoGetValue32(FIFO_USER_01);
u64 consoleid;
u32 nand_cid[4];
switch(command) {
case 4:
sdmmc_nand_cid(nand_cid);
fifoSendDatamsg(FIFO_USER_01, 16, (u8*)nand_cid);
break;
case 5:
consoleid = REG_CONSOLEID;
fifoSendDatamsg(FIFO_USER_01, 8, (u8*)&consoleid);
break;
switch (command) {
case 1: {
fifoSendValue32(FIFO_USER_01, sdmmc_nand_init());
} break;
case 4: {
u32 nand_cid[4];
sdmmc_nand_cid(nand_cid);
fifoSendDatamsg(FIFO_USER_01, 16, (u8*)nand_cid);
} break;
case 5: {
u64 consoleid;
consoleid = REG_CONSOLEID;
fifoSendDatamsg(FIFO_USER_01, 8, (u8*)&consoleid);
} break;
}
}
if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) {
if (0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) {
exitflag = true;
}
}

View File

@ -78,6 +78,15 @@ int get_ids() {
prt("not running in DSi mode\n");
return -2;
}
fifoSendValue32(FIFO_USER_01, 1);
while (!fifoCheckValue32(FIFO_USER_01)) swiIntrWait(1, IRQ_FIFO_NOT_EMPTY);
int ret = fifoGetValue32(FIFO_USER_01);
if (ret) {
iprtf("sdmmc_nand_init() returned %d\n", ret);
return -3;
}
nand_size = nand_GetSize();
if (nand_size == 0) {
prt("can't access eMMC\n");