/*---------------------------------------------------------------------------* Project: WPAD demo program File: sync.c Copyright (C) 2006 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Log: sync.c,v $ Revision 1.8.2.1 2007/12/11 01:18:54 tojo Modified to handle the status code of WPADProbe. Revision 1.8 2007/07/11 11:54:22 tojo Fixed the message handling. Revision 1.7 2007/07/10 12:14:46 tojo (none) Revision 1.6 2007/04/23 09:02:45 tojo (none) Revision 1.5 2006/10/23 01:19:08 tojo Called WPADSetSyncCallback before initialization complete. Revision 1.4 2006/10/02 07:00:21 takano_makoto fix PrintIntro messages. Revision 1.3 2006/09/19 02:16:19 tojo Added fast sync. Revision 1.2 2006/09/08 09:44:18 tojo (none) Revision 1.1 2006/09/06 03:13:43 tojo (none) *---------------------------------------------------------------------------*/ #define DEMO_USE_MEMLIB = 1 #include #include #include #include #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 /*---------------------------------------------------------------------------* * Private function prototypes *---------------------------------------------------------------------------*/ void *myAlloc( u32 size ); u8 myFree ( void *ptr ); /*---------------------------------------------------------------------------* * Globals *---------------------------------------------------------------------------*/ static const s16 LINE = 8; static u8 standard = 0; static u8 simple = 0; static s32 stdNum = 0; static s32 smpNum = 0; /*---------------------------------------------------------------------------* * For WPAD testing *---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------* * Name : myAlloc() * Description : * Arguments : None. * Returns : None. *---------------------------------------------------------------------------*/ void *myAlloc( u32 size ) { void *ptr; ptr = MEMAllocFromAllocator(&DemoAllocator2, size); ASSERTMSG(ptr, "Memory allocation failed\n"); return(ptr); } /*---------------------------------------------------------------------------* * Name : myFree() * Description : * Arguments : None. * Returns : None. *---------------------------------------------------------------------------*/ u8 myFree( void *ptr ) { MEMFreeToAllocator(&DemoAllocator2, ptr); return(1); } /*---------------------------------------------------------------------------* * Name : RenderConsoleStatus() * Description : * Arguments : None. * Returns : None. *---------------------------------------------------------------------------*/ static void RenderConsoleStatus( void ) { s16 y = 16; s32 chan; u8 devAddr[6]; u32 dev_type; u8 sync_type; const char *std[] = {"----", "start", "busy", "done"}; const char *smp[] = {"----", "start", "busy", "stopping", "done"}; DEMOPrintf( 16, y+=LINE, 0, "WPAD Demo -- Sync"); y += LINE; DEMOPrintf( 16, y+=LINE, 0, "Registered Device Number: %d", WPADGetRegisteredDevNum()); DEMOPrintf( 16, y+=LINE, 0, "Temporary Device Number: %d", WPADGetTemporaryDevNum()); y += LINE; for(chan=0; chan