Example #1
0
int main()
{
	irqInit();
	fifoInit();

	readUserSettings();
	initClockIRQ();

	SetYtrigger(80);

	installSystemFIFO();

	irqSet(IRQ_VCOUNT, VCountHandler);
	irqSet(IRQ_VBLANK, 0);
	irqEnable(IRQ_VBLANK|IRQ_VCOUNT|IRQ_NETWORK);

	powerOn(POWER_SOUND);
	REG_SOUNDCNT = SOUND_ENABLE | SOUND_VOL(127);

	static Player oPlayer;
	Player_Init(& oPlayer);

	while ( 1 )
	{
		swiWaitForVBlank();

		Player_Execute(& oPlayer);
	}

	return 0;
}
Example #2
0
int main()
{
	readUserSettings();
	ledBlink(0);

	irqInit();
	initClockIRQ();
	fifoInit();

	SetYtrigger(80);

	installWifiFIFO();
	//installSoundFIFO();
	installSystemFIFO();
	installFeOSFIFO();

	coopIrqSet(IRQ_VCOUNT, VCountHandler);

	irqEnable(IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);

	setPowerButtonCB(powerButtonCB);

	while (!exitflag)
	{
		coopWaitForVBlank();
		FeOS_VBlankFunc();
		if (!(REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R)))
			break;
		Wifi_Update();
	}
	return 0;
}
Example #3
0
//---------------------------------------------------------------------------------
int main() {
//---------------------------------------------------------------------------------
	irqInit();
	fifoInit();

	// read User Settings from firmware
	readUserSettings();

	// Start the RTC tracking IRQ
	initClockIRQ();

	SetYtrigger(80);

	installWifiFIFO();
	installSoundFIFO();

	mmInstall(FIFO_MAXMOD);

	installSystemFIFO();
	
	irqSet(IRQ_VCOUNT, VcountHandler);
	irqSet(IRQ_VBLANK, VblankHandler);

	irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);   

	// Keep the ARM7 mostly idle
	while (1) swiWaitForVBlank();
}
Example #4
0
File: main.c Project: PH111P/perm2
//---------------------------------------------------------------------------------
int main( ) {
    //---------------------------------------------------------------------------------
    readUserSettings( );

    irqInit( );
    // Start the RTC tracking IRQ
    initClockIRQ( );
    fifoInit( );
    touchInit( );

    mmInstall( FIFO_MAXMOD );

    SetYtrigger( 80 );

    installWifiFIFO( );
    installSoundFIFO( );

    installSystemFIFO( );

    irqSet( IRQ_VCOUNT, VcountHandler );
    irqSet( IRQ_VBLANK, VblankHandler );

    irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK );

    setPowerButtonCB( powerButtonCB );

    // Keep the ARM7 mostly idle
    while( !exitflag ) {
        if( 0 == ( REG_KEYINPUT & ( KEY_SELECT | KEY_START | KEY_L | KEY_R ) ) ) {
            exitflag = true;
        }
        swiWaitForVBlank( );
    }
    return 0;
}
Example #5
0
//---------------------------------------------------------------------------------
int main() {
	u32 i=0;
//---------------------------------------------------------------------------------
	readUserSettings();

	irqInit();
	// Start the RTC tracking IRQ
	initClockIRQ();
	fifoInit();

	//mmInstall(FIFO_MAXMOD);
	InstallSoundSys();

	SetYtrigger(80);

	installWifiFIFO();
	installSoundFIFO();

	installSystemFIFO();

	irqSet(IRQ_VCOUNT, VcountHandler);
	irqSet(IRQ_VBLANK, VblankHandler);

	irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);
	
	setPowerButtonCB(powerButtonCB);   

	// Keep the ARM7 mostly idle
	while (!exitflag) {
		if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) {
			exitflag = true;
		}
		swiWaitForVBlank();
		if(seq_status==STATUS_FADING)
		{
			if(i<24)
			{
				i+=10;
			}
			else
			{
				i-=24;
				ADSR_mastervolume--;
				if(!ADSR_mastervolume)
					StopSeq();
			}
		}
	}
	return 0;
}
Example #6
0
//---------------------------------------------------------------------------------
int main(int argc, char ** argv) {
//---------------------------------------------------------------------------------
    // read User Settings from firmware
    readUserSettings();
    REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; // enable & prepare fifo asap
    rtcReset();

    //enable sound
    powerON(POWER_SOUND);
    writePowerManagement(PM_CONTROL_REG, ( readPowerManagement(PM_CONTROL_REG) & ~PM_SOUND_MUTE ) | PM_SOUND_AMP );
    SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F);

    irqInit();

    // Start the RTC tracking IRQ
    initClockIRQ();

    SetYtrigger(80);
    irqSet(IRQ_VCOUNT, VcountHandler);
    irqSet(IRQ_VBLANK, VblankHandler);
    irqSet(IRQ_WIFI, Wifi_Interrupt); // set up wifi interrupt

    irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_WIFI);

    {   // sync with arm9 and init wifi
        u32 fifo_temp;

        while(1) { // wait for magic number
            while(REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank();
            fifo_temp=REG_IPC_FIFO_RX;
            if(fifo_temp==0x12345678) break;
        }
        while(REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank();
        fifo_temp=REG_IPC_FIFO_RX; // give next value to wifi_init
        Wifi_Init(fifo_temp);

        irqSet(IRQ_FIFO_NOT_EMPTY,arm7_fifo); // set up fifo irq
        irqEnable(IRQ_FIFO_NOT_EMPTY);
        REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ;

        Wifi_SetSyncHandler(arm7_synctoarm9); // allow wifi lib to notify arm9
    } // arm7 wifi init complete


    // Keep the ARM7 mostly idle
    while (1) swiWaitForVBlank();
}
Example #7
0
//---------------------------------------------------------------------------------
int main() {
//---------------------------------------------------------------------------------
	irqInit();
	fifoInit();

	int channel = -1;

	// read User Settings from firmware
	readUserSettings();

	// Start the RTC tracking IRQ
	initClockIRQ();

	SetYtrigger(80);

	installWifiFIFO();
	installSoundFIFO();

	mmInstall(FIFO_MAXMOD);

	installSystemFIFO();
	
	irqSet(IRQ_VCOUNT, VcountHandler);
	irqSet(IRQ_VBLANK, VblankHandler);

	irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);   


	//sound play




	// ARM 7 sweeps up FIFO_USER_01 and plays the notes left there.
	while (1) {
		/* while (fifoGetDatamsg(FIFO_USER_01, int buffersize, u8 * destbuffer) != -1)
		channel = getFreePSGChannel();
		BIT(24);
		BIT(25);
		swiWaitForVBlank(); */


	}
}
Example #8
0
//---------------------------------------------------------------------------------
int main() {
//---------------------------------------------------------------------------------
	// clear sound registers
	dmaFillWords(0, (void*)0x04000400, 0x100);

	REG_SOUNDCNT |= SOUND_ENABLE;
	writePowerManagement(PM_CONTROL_REG, ( readPowerManagement(PM_CONTROL_REG) & ~PM_SOUND_MUTE ) | PM_SOUND_AMP );
	powerOn(POWER_SOUND);

	readUserSettings();
	ledBlink(0);

	irqInit();
	// Start the RTC tracking IRQ
	initClockIRQ();
	fifoInit();

	mmInstall(FIFO_MAXMOD);

	SetYtrigger(80);

	installWifiFIFO();
	installSoundFIFO();

	installSystemFIFO();

	irqSet(IRQ_VCOUNT, VcountHandler);
	irqSet(IRQ_VBLANK, VblankHandler);

	irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);

	setPowerButtonCB(powerButtonCB);

	// Keep the ARM7 mostly idle
	while (!exitflag) {
		if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) {
			exitflag = true;
		}
		swiWaitForVBlank();
	}
	return 0;
}
Example #9
0
int
main()
{
    irqInit();
    fifoInit();
    readUserSettings();
    initClockIRQ();
    SetYtrigger(80);
    installSystemFIFO();

    irqSet(IRQ_VCOUNT, isrVCount);
    irqEnable(IRQ_VCOUNT);

    SoundEngine::init();

    while (1) {
        swiWaitForVBlank();
    }

    return 0;
}
Example #10
0
int ARM7_MAIN(void)
{
    readUserSettings();

    // init irq
    irqInit();
    initClockIRQ();

    // init irq callback
    irqSet(IRQ_VCOUNT, IRQ_VCount);
    irqSet(IRQ_VBLANK, IRQ_VBlank);
    irqEnable(IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);

    // init fifo system
    fifoInit();

    // install fifo subsystems
    installWifiFIFO();
    installSoundFIFO();
    installSystemFIFO();
    mmInstall(FIFO_MAXMOD);

    // init fifo callback for arm9 communication
    fifoSetDatamsgHandler(FIFO_USER_01, I_PollArm9Messages, 0);

    SetYtrigger(80);
    setPowerButtonCB(powerButtonCB);   

    // Keep the ARM7 mostly idle
    while(!exitflag)
    {
        if(0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R)))
            exitflag = true;

	    swiIntrWait(1, IRQ_FIFO_NOT_EMPTY | IRQ_VBLANK);
    }

	return 0;
}
Example #11
0
//---------------------------------------------------------------------------------
int main(int argc, char ** argv) 
{
    //---------------------------------------------------------------------------------
#ifdef WIFI
    REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; // enable & prepare fifo asap
#endif
 
    // Set up the interrupt handler
	irqInit();

    // Start the RTC tracking IRQ
    initClockIRQ();

	irqSet(IRQ_VBLANK, VblankHandler);
	irqEnable(IRQ_VBLANK);
    
    //enable sound
    arm7_initSoundDevice();
#if 0    
    irqSet(IRQ_IPC_SYNC, InterruptHandler_IPC_SYNC);
    REG_IPC_SYNC = IPC_SYNC_IRQ_ENABLE;
#endif    
#ifdef WIFI
    arm7_initWifi();
#endif

 
	// Keep the ARM7 out of main RAM
	while (1) 
    {
        swiWaitForVBlank(); // FIXME: réveiller sur d'autres interruptions ?
        arm7_microProcess();

        commandControl();
    }

    return 0;
}
Example #12
0
//---------------------------------------------------------------------------------
int main(int argc, char ** argv) {
//---------------------------------------------------------------------------------
	readUserSettings();
	
	irqInit();
	initClockIRQ();
	fifoInit();
	
	SetYtrigger(80);
#ifdef USE_WIFI
	installWifiFIFO();
#endif
	//installSoundFIFO();
	installSystemFIFO();

 	//TIMER_CR(0) = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_DIV_1;

	vcount = 80;
	irqSet(IRQ_VBLANK, VblankHandler);
	irqSet(IRQ_VCOUNT, VcountHandler);
	irqSet(IRQ_HBLANK, hblank_handler);

	irqEnable(IRQ_VBLANK | IRQ_VCOUNT | IRQ_HBLANK);
	
	setPowerButtonCB(powerButtonCB);   
	
	fifoSetDatamsgHandler(FIFO_9to7, fifo_DataHandler, 0);

//	irqSet(IRQ_LID, lid);
//	irqEnable(IRQ_LID);
	
#ifdef IPC_IN_TIMER
	irqSet(IRQ_TIMER0, handle_ipc);
	TIMER_DATA(0) = TIMER_FREQ_256(20 * 60);
 	TIMER_CR(0) = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_DIV_256;
#endif
	
#ifdef USE_WIFI
#ifndef WIFI_ON_DEMAND
	wifi_go();
#endif
#endif

#ifdef USE_ADHOC
	IPC_Init() ;
	LWIFI_Init() ;
#endif
	
	// Keep the ARM7 idle
	while (!exitflag)
	{
		//ARM7_PRINT("arm7 ");
		if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) {
			exitflag = true;
		}
#ifdef USE_ADHOC
		LWIFI_IPC_UpdateNOIRQ() ;
#endif
		if (do_mp3 != 0)
		{
#ifdef USE_MP3
			ds_enable_interrupts(0);
			if (helix_initialised == 0)
			{
				ARM7_PRINT("beginning helix init\n");
				helix_init();
				ARM7_PRINT("helix init done\n");
				
				helix_initialised = 1;
			}
			
			char helix_argv1[100];
			char helix_argv2[100];
			memset(helix_argv1, 0, 100);
			memset(helix_argv2, 0, 100);
			strcpy(helix_argv1, "/jones.mp3");
//			sprintf(helix_argv1, "/quake soundtrack/0%d-AudioTrack 0%d.mp3", mp3_track_no, mp3_track_no);
//			strcpy(helix_argv2, "/jones.pcm");
			
			char *proper_helix_argv[3];
			proper_helix_argv[0] = NULL;
			proper_helix_argv[1] = helix_argv1;
//			proper_helix_argv[1] = (char *)track_name;
			proper_helix_argv[2] = helix_argv2;
			
			ARM7_PRINT("Starting Helix...\n");
			decoder_stopped = 0;
			
			ds_enable_interrupts(1);		
			helix_main(3, proper_helix_argv);
			ds_enable_interrupts(0);
			
			decoder_stopped = 1;
			ARM7_PRINT("out of helix\n");
//			ARM7_HALT();
			send_mp3_stop_message();
			
			ds_enable_interrupts(1);
#endif
		}

//		if (REG_KEYXY & (1 << 7))
//		{
//			while (quake_ipc_7to9->message == 0xffffffff);
//			
//			quake_ipc_7to9->message_type = kLidHasClosed;
//			quake_ipc_7to9->message = 0xffffffff;
//			
//			while (quake_ipc_7to9->message == 0xffffffff);
//			
//			ARM7_PRINT("ARM7: waiting...\n");
//			while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY);
//			ARM7_PRINT("ARM7: disabling interrupts\n");
//			
//			irqDisable(IRQ_HBLANK);
//			irqDisable(IRQ_VBLANK);
//			irqDisable(IRQ_VCOUNT);
//			
////			irqEnable(IRQ_LID);
//			
//			powerOFF(POWER_SOUND);
//			
//			swiWaitForVBlank();			//wake up when the lid re-enables the interrupt
//		}
		
		if (arm7_initialised && ((hblanks & 0x3f) == 0))
		{
			arm7_initialised = 1;
			//ARM7_PRINT("ping");
			//while (quake_ipc_7to9->message == 0xffffffff);
			
			//quake_ipc_7to9->message_type = kPing;
			//quake_ipc_7to9->message = 0xffffffff;
			//while (quake_ipc_7to9->message == 0xffffffff);
		}
			
//		int total = 0;
//		for (int count = 0 ; count < 16; count++)
//			if (!is_channel_enabled(count))
//				total++;
//		if (free_time == kFreeTime)
//			ARM7_PRINTF("%d channels free\n", total);
		
//		if (free_time == kFreeTime)
//			if (needs_defrag())
//			{
//				ARM7_PRINT("NEEDS DEFRAG\n");
//				defrag(&free_time);
//			}
		
//		swiWaitForVBlank();

#ifdef IPC_IN_MAIN_THREAD
		//handle_ipc();
#endif
//		if (arm7_initialised == true)
//		{
////			temp_test();
//			
//			arm7_initialised = false;
//			ARM7_PRINT("installing exception handler\n");
//			install();
//			register unsigned int sp asm ("13");
//			ARM7_PRINT("done\nlet\'s try and crash it\n");
//			/*ARM7_PRINT_NUMBER(sp);*/
//			
////			asm("LDR r12,=MyReg2\n"
////				"STMIA r12,{r0-r15}\n"
////					:
////					:
////					: "r12");
//			
////			ARM7_PRINT_NUMBER(MyReg2[12]);
//			
////			for (int count = 0; count < 16; count++)
////				ARM7_PRINT_NUMBER(MyReg2[count]);
////			ARM7_PRINT("\n");
////			while(1);
////			asm (".word 0xffffffff");
////			asm (".word 0x0");
//			
//			
////			Exception();
//	
////			asm (".word 0xe6000010");
//			
////			asm("LDR r12,=MyReg2\n"
////				"STMIA r12,{r0-r15}\n"
////					:
////					:
////					: "r12");
////			
////			for (int count = 0; count < 8; count++)
////			{
////				ARM7_PRINT_NUMBER(MyReg[count + 8]);
////				ARM7_PRINT_NUMBER(MyReg2[count + 8]);
////			}
//			
//			
////			asm ("mcr 15,0,r0,c0,c0,0");
////			asm ("bkpt");
////			*(int *)0 = 0;
////			asm ("b debugger_hit");
////			debugger_hit();
////			debugger_handle_breakpoint(0,0,0);
//			
////			asm (".word 0xe6000010");
////			asm (".short 0xe801");
//			ARM7_PRINT("shouldn\'t make it here\n");
//			ARM7_PRINT_NUMBER(ProperCPSR);
//			while(1);
//		}
		swiIntrWait(1, 1);
	}
}