#include #include #include "scheduler.h" #include #include "mp3.h" #define false 0 #define true 1 #define ITERSTEP 50000 extern unsigned char freesd[]; extern unsigned int size_freesd; extern unsigned char SJPCM[]; extern unsigned int size_SJPCM; // for screen debug, comment next line //#define scr_printf printf int _doKillThreads; void test_Run( void *pThreadArgs ); void other_test_Run( void *pThreadArgs ); void start_MP3( void *pThreadArgs ); int main(int argc, char *argv[]) { _doKillThreads = false; //// fileXio driver (embedded in ELF) // fileXio support confirm if it needs same for IOMANX driver //ret = SifExecModuleBuffer( &filexio_irx, size_filexio_irx, 0, NULL, &irx_ret ); //if( ret < 0 ) { // printf("SifExecModuleBuffer filexio failed: %d\n", ret); // SleepThread(); //} printf("\n\n"); // freesd int ret = 0; ret = SifExecModuleBuffer(freesd, size_freesd, 0, NULL, &ret); printf("freesd loadmodule %d\n", ret); // SJPCM (requires freesd or libsd) printf("SifExecModuleBuffer...\n"); SifExecModuleBuffer(SJPCM, size_SJPCM, 0, NULL, &ret); printf("SifExecModuleBuffer...done\n"); init_scr(); Scheduler_Init(); // Start the two example threads Scheduler_BeginThread( test_Run, NULL ); Scheduler_BeginThread( other_test_Run, NULL ); Scheduler_BeginThread( start_MP3, NULL ); Scheduler_Run(); scr_printf("> never gests here\n"); return 0; } void test_Run( void *pThreadArgs ) { unsigned int iter2 = ITERSTEP; while(_doKillThreads == false) { iter2--; if(iter2 == 0) { //printf(" > test_Run\n"); scr_printf("."); iter2 = ITERSTEP; } Scheduler_YieldThread(); } //scr_printf("#"); scr_printf(" end test_Run."); Scheduler_EndThread(); } void other_test_Run( void *pThreadArgs ) { unsigned int iter2 = 4000; int countDown = iter2 * 500; while(_doKillThreads == false) { iter2--; if(iter2 == 0) { //printf(" * other_test_Run\n"); scr_printf("*"); iter2 = 2000; } Scheduler_YieldThread(); // killer condition if(--countDown < 0) _doKillThreads = true; } //scr_printf("&"); scr_printf(" end other_test_Run."); Scheduler_EndThread(); } void start_MP3( void *pThreadArgs ) { printf("start_MP3 started\n"); myMP3_Play( NULL ); }