1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - OS - include 3 File: application_jump_private.h 4 5 Copyright 2007-2009 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Date:: 2009-06-04#$ 14 $Rev: 10698 $ 15 $Author: okubata_ryoma $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef _APPLICATION_JUMP_PRIVATE_H_ 19 #define _APPLICATION_JUMP_PRIVATE_H_ 20 21 #include <twl.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 28 // Define data------------------------------------------- 29 30 // Determine between a hot and a cold boot 31 #define OSi_GetMCUFreeRegisterValue() ( *(vu32*)HW_RESET_PARAMETER_BUF ) 32 33 #define OS_MCU_RESET_VALUE_BUF_ENABLE_MASK 0x80000000 34 #define OS_MCU_RESET_VALUE_LEN 1 35 36 // Location to place the ROM header when preloading 37 #define OS_TWL_HEADER_PRELOAD_MMEM 0x23e0000 38 #define OS_TWL_HEADER_PRELOAD_MMEM_END (0x23e0000 + 0x4000) 39 40 // Boot type to set as the launcher parameter 41 typedef enum LauncherBootType { 42 LAUNCHER_BOOTTYPE_ILLEGAL = 0, // Illegal status 43 LAUNCHER_BOOTTYPE_ROM, // Boot from ROM 44 LAUNCHER_BOOTTYPE_TEMP, // Start an application in the TMP folder in NAND 45 LAUNCHER_BOOTTYPE_NAND, // Start an application in NAND 46 LAUNCHER_BOOTTYPE_MEMORY, // Start an application in memory 47 48 LAUNCHER_BOOTTYPE_MAX 49 }LauncherBootType; 50 51 // Launcher parameter flag 52 typedef struct LauncherBootFlags { 53 u16 isValid : 1; // TRUE:valid, FALSE:invalid 54 u16 bootType : 3; // Use the LauncherBootType value 55 u16 isLogoSkip : 1; // Request that the logo demo be skipped 56 u16 isInitialShortcutSkip : 1; // Request that the initial startup sequence be skipped 57 u16 isAppLoadCompleted : 1; // Indicates that the application has been loaded 58 u16 isAppRelocate : 1; // Request that the application be relocated 59 u16 rsv : 8; 60 }LauncherBootFlags; 61 62 63 // Launcher parameter header 64 typedef struct LauncherParamHeader { 65 u32 magicCode; // SYSM_LAUNCHER_PARAM_MAGIC_CODE goes here 66 u8 version; // Determine the body based on the type 67 u8 bodyLength; // Length of the body 68 u16 crc16; // CRC16 checksum for the body 69 }LauncherParamHeader; 70 71 72 // Launcher parameter body 73 typedef union LauncherParamBody { 74 struct { // Note: For the moment, make the TitleProperty match the format at first 75 OSTitleId prevTitleID; // Title ID prior to a reset 76 OSTitleId bootTitleID; // Title ID to boot directly after a reset 77 LauncherBootFlags flags; // Launcher operation flags during a reset 78 u8 rsv[ 6 ]; // Reserved 79 }v1; 80 }LauncherParamBody; 81 82 83 // Launcher parameters 84 typedef struct LauncherParam { 85 LauncherParamHeader header; 86 LauncherParamBody body; 87 }LauncherParam; 88 89 // Function's prototype------------------------------------ 90 91 #ifdef SDK_ARM9 92 void OSi_InitPrevTitleId( void ); 93 void OS_SetLauncherParamAndResetHardware( OSTitleId id, LauncherBootFlags *flag ); 94 95 96 BOOL OSi_IsJumpFromSameMaker(void); 97 u32 OSi_GetInitialCode(void); 98 u32 OSi_GetPrevInitialCode(void); 99 BOOL OSi_CanArbitraryJumpTo(u32 initialCode); 100 BOOL OSi_JumpToArbitraryApplication(u32 initialCode); 101 OSTitleId OSi_GetPrevTitleId(void); 102 103 #else 104 BOOL OS_ReadLauncherParameter( LauncherParam *buf, BOOL *isHotstart ); 105 #endif 106 107 #ifdef __cplusplus 108 } // extern "C" 109 #endif 110 111 #endif // _APPLICATION_JUMP_PRIVATE_H_ 112