TwlIPL/build/nandfirm/sdmc-launcher/ARM9/main.c
yutaka 625aefddc0 TwlSDKの最新system callに対応
nand_formatterをLIMITEDを一時的にやめる

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@61 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2007-10-24 02:24:12 +00:00

137 lines
4.0 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*---------------------------------------------------------------------------*
Project: TwlFirm - nandfirm - sdmc-launcher
File: main.c
Copyright 2007 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.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <firm.h>
#define RSA_KEY_ADDR rsa_key
static const u8 rsa_key[128] =
{
0xdf, 0x56, 0x30,
0xc9, 0xae, 0x05, 0x55, 0xe8, 0xdf, 0xbe, 0xe6, 0xb9, 0x30, 0xb9, 0x76, 0x93, 0xb4, 0xc2, 0x20,
0xe7, 0xae, 0x4c, 0x3e, 0xc3, 0xed, 0x27, 0xcf, 0x5d, 0x4f, 0xb5, 0x7d, 0xde, 0x38, 0xbc, 0xfe,
0x25, 0x32, 0xd8, 0x23, 0x98, 0x52, 0xb5, 0xda, 0xf7, 0x39, 0xdc, 0xb3, 0x0a, 0x94, 0x7a, 0x2b,
0x79, 0xe6, 0xe0, 0x4c, 0xbc, 0x21, 0xbd, 0x59, 0xb2, 0xc7, 0xf1, 0xc0, 0xf1, 0xfb, 0x29, 0x75,
0xa1, 0x21, 0x93, 0x01, 0x29, 0x1c, 0x9a, 0xe1, 0x2d, 0x55, 0xfc, 0x7b, 0xb8, 0xcb, 0x07, 0x33,
0xc5, 0x91, 0x0d, 0xc8, 0x45, 0x59, 0xef, 0xbe, 0x58, 0xc7, 0xc1, 0x1d, 0xd5, 0xf2, 0xcf, 0x1f,
0xe0, 0x6d, 0x21, 0x00, 0xcd, 0x42, 0xd8, 0x84, 0x85, 0xe3, 0xb2, 0x02, 0x1a, 0xa5, 0x89, 0x02,
0xa1, 0x96, 0xc6, 0xf7, 0x61, 0x68, 0x66, 0xe6, 0x65, 0x12, 0xb7, 0xf1, 0x49
};
#define RSA_HEAP_SIZE (4*1024) // RSA用ヒープサイズ (サイズ調整必要)
static u8 acHeap[RSA_HEAP_SIZE] __attribute__ ((aligned (32)));
static SVCSignHeapContext acPool;
/*
Profile
*/
#ifndef SDK_FINALROM
#define PRFILE_MAX 128
u32 profile[PRFILE_MAX];
u32 pf_cnt = 0;
#endif
/***************************************************************
PreInit
FromBootの対応をまとめるメインメモリの初期化
OS_Init前なので注意
***************************************************************/
static void PreInit(void)
{
/*
メインメモリ関連
*/
// SHARED領域クリア (IS-TWL-DEBUGGERの更新待ち)
#ifdef SDK_FINALROM
//MIi_CpuClearFast( 0, (void*)HW_MAIN_MEM_SHARED, HW_MAIN_MEM_SHARED_END-HW_MAIN_MEM_SHARED );
#endif
// SHARED領域クリア (ここだけでOK?)
MIi_CpuClearFast( 0, (void*)HW_PXI_SIGNAL_PARAM_ARM9, HW_MAIN_MEM_SHARED_END-HW_PXI_SIGNAL_PARAM_ARM9);
/*
FromBrom関連
*/
MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) );
}
/***************************************************************
CheckHeader
ヘッダがシステムメニューとして問題ないかチェック
先頭32Bは固定値と思われ (リマスターバージョンは違うかな)
***************************************************************/
static BOOL CheckHeader(void)
{
return TRUE;
}
/***************************************************************
EraseAll
不正終了しました
いろいろ消してください
DSモードにして終わるのがよいか
***************************************************************/
static void EraseAll(void)
{
#ifdef SDK_FINALROM
// TODO
#endif
}
void TwlMain( void )
{
PreInit();
#ifndef SDK_FINALROM
// 0: before PXI
profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick());
#endif
OS_InitFIRM();
#ifndef SDK_FINALROM
OS_InitTick();
// 1: after PXI
profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick());
#endif
SVC_InitSignHeap( &acPool, acHeap, sizeof(acHeap) );
// load menu
if ( MI_LoadHeader( &acPool, RSA_KEY_ADDR ) && CheckHeader() && MI_LoadStatic() )
{
#ifndef SDK_FINALROM
// 127: before Boot
pf_cnt = PRFILE_MAX-1;
profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick());
#endif
MI_Boot();
}
EraseAll();
// failed
while (1)
{
PXI_NotifyID( FIRM_PXI_ID_NULL );
}
}