From 1b8ad74573f37f9b3eea248ae2642ab860a11e13 Mon Sep 17 00:00:00 2001 From: yutaka Date: Wed, 16 Jan 2008 09:48:34 +0000 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@475 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/gcdfirm/sdmc-launcher/ARM7/main.c | 52 ++++++++++++++++++----- build/gcdfirm/sdmc-launcher/ARM9/main.c | 2 - build/nandfirm/menu-launcher/ARM7/main.c | 52 ++++++++++++++++++----- build/nandfirm/menu-launcher/ARM9/main.c | 2 - build/nandfirm/menu-launcher2/ARM7/main.c | 49 ++++++++++++++++++--- build/nandfirm/menu-launcher2/ARM9/main.c | 2 - build/nandfirm/sdmc-launcher/ARM7/main.c | 52 ++++++++++++++++++----- build/nandfirm/sdmc-launcher/ARM9/main.c | 2 - 8 files changed, 168 insertions(+), 45 deletions(-) diff --git a/build/gcdfirm/sdmc-launcher/ARM7/main.c b/build/gcdfirm/sdmc-launcher/ARM7/main.c index 18c02853..3e169125 100644 --- a/build/gcdfirm/sdmc-launcher/ARM7/main.c +++ b/build/gcdfirm/sdmc-launcher/ARM7/main.c @@ -35,6 +35,11 @@ */ #define PRINT_MEMORY_ADDR 0x02000600 +/* + 定義するとアイドルスレッドを作成します。 +*/ +//#define USE_IDLE_THREAD + #ifdef PROFILE_ENABLE #define PROFILE_MAX 16 @@ -68,6 +73,25 @@ extern void* SDNandContext; /* NAND static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; +#ifdef USE_IDLE_THREAD +static OSThread idleThread; +static u64 idleStack[32]; +static void IdleThread(void* arg) +{ +#pragma unused(arg) + OS_EnableInterrupts(); + while (1) + { + OS_Halt(); + } +} +static void CreateIdleThread(void) +{ + OS_CreateThread(&idleThread, IdleThread, NULL, &idleStack[32], sizeof(idleStack), OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&idleThread); +} +#endif + /*************************************************************** PreInit @@ -102,6 +126,23 @@ static void PreInit(void) */ } +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // PMICの設定 for old version + PM_InitFIRM(); + // AESの初期化 + AES_Init(); // for encrypted NAND +#ifdef USE_IDLE_THREAD + // アイドルスレッドの作成 + CreateIdleThread(); +#endif +} + /*************************************************************** EraseAll @@ -139,7 +180,7 @@ void TwlSpMain( void ) PUSH_PROFILE(); SetDebugLED(++step); // 0x83 - PM_InitFIRM(); + PostInit(); // 2: after PM_InitFIRM PUSH_PROFILE(); @@ -160,21 +201,12 @@ void TwlSpMain( void ) PM_BackLightOn( FALSE ); -PXI_RecvID(); -SetDebugLED(0x01); -PXI_RecvID(); -SetDebugLED(0x02); - if ( PXI_RecvID() != FIRM_PXI_ID_SET_PATH ) { OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_SET_PATH).\n"); goto end; } -#ifdef USE_IDLE_THREAD - CreateIdleThread(); -#endif - // 4: after PXI PUSH_PROFILE(); SetDebugLED(++step); // 0x86 diff --git a/build/gcdfirm/sdmc-launcher/ARM9/main.c b/build/gcdfirm/sdmc-launcher/ARM9/main.c index e027baec..246fac2d 100644 --- a/build/gcdfirm/sdmc-launcher/ARM9/main.c +++ b/build/gcdfirm/sdmc-launcher/ARM9/main.c @@ -221,13 +221,11 @@ void TwlMain( void ) #endif // 1: after PXI PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); PostInit(); // 2: after PostInit PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); STD_CopyString((char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, MENU_FILE); diff --git a/build/nandfirm/menu-launcher/ARM7/main.c b/build/nandfirm/menu-launcher/ARM7/main.c index 32e25a8e..01717eee 100644 --- a/build/nandfirm/menu-launcher/ARM7/main.c +++ b/build/nandfirm/menu-launcher/ARM7/main.c @@ -35,6 +35,11 @@ */ #define PRINT_MEMORY_ADDR 0x02000600 +/* + 定義するとアイドルスレッドを作成します。 +*/ +//#define USE_IDLE_THREAD + #ifdef PROFILE_ENABLE #define PROFILE_MAX 16 @@ -68,6 +73,25 @@ extern void* SDNandContext; /* NAND static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; +#ifdef USE_IDLE_THREAD +static OSThread idleThread; +static u64 idleStack[32]; +static void IdleThread(void* arg) +{ +#pragma unused(arg) + OS_EnableInterrupts(); + while (1) + { + OS_Halt(); + } +} +static void CreateIdleThread(void) +{ + OS_CreateThread(&idleThread, IdleThread, NULL, &idleStack[32], sizeof(idleStack), OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&idleThread); +} +#endif + /*************************************************************** PreInit @@ -102,6 +126,23 @@ static void PreInit(void) */ } +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // PMICの設定 for old version + PM_InitFIRM(); + // AESの初期化 + AES_Init(); // for encrypted NAND +#ifdef USE_IDLE_THREAD + // アイドルスレッドの作成 + CreateIdleThread(); +#endif +} + /*************************************************************** EraseAll @@ -139,7 +180,7 @@ void TwlSpMain( void ) PUSH_PROFILE(); SetDebugLED(++step); // 0x83 - PM_InitFIRM(); + PostInit(); // 2: after PM_InitFIRM PUSH_PROFILE(); @@ -160,21 +201,12 @@ void TwlSpMain( void ) PM_BackLightOn( FALSE ); -PXI_RecvID(); -SetDebugLED(0x01); -PXI_RecvID(); -SetDebugLED(0x02); - if ( PXI_RecvID() != FIRM_PXI_ID_SET_PATH ) { OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_SET_PATH).\n"); goto end; } -#ifdef USE_IDLE_THREAD - CreateIdleThread(); -#endif - // 4: after PXI PUSH_PROFILE(); SetDebugLED(++step); // 0x86 diff --git a/build/nandfirm/menu-launcher/ARM9/main.c b/build/nandfirm/menu-launcher/ARM9/main.c index 4b97c49d..07711f1d 100644 --- a/build/nandfirm/menu-launcher/ARM9/main.c +++ b/build/nandfirm/menu-launcher/ARM9/main.c @@ -218,13 +218,11 @@ void TwlMain( void ) #endif // 1: after PXI PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); PostInit(); // 2: after PostInit PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); if ( !FS_ResolveSrl( MENU_TITLE_ID ) ) { diff --git a/build/nandfirm/menu-launcher2/ARM7/main.c b/build/nandfirm/menu-launcher2/ARM7/main.c index 89694e70..f81f8a17 100644 --- a/build/nandfirm/menu-launcher2/ARM7/main.c +++ b/build/nandfirm/menu-launcher2/ARM7/main.c @@ -36,6 +36,11 @@ */ #define PRINT_MEMORY_ADDR 0x02000600 +/* + 定義するとアイドルスレッドを作成します。 +*/ +//#define USE_IDLE_THREAD + #ifdef PROFILE_ENABLE #define PROFILE_MAX 16 @@ -68,6 +73,25 @@ extern void* SDNandContext; /* NAND static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; +#ifdef USE_IDLE_THREAD +static OSThread idleThread; +static u64 idleStack[32]; +static void IdleThread(void* arg) +{ +#pragma unused(arg) + OS_EnableInterrupts(); + while (1) + { + OS_Halt(); + } +} +static void CreateIdleThread(void) +{ + OS_CreateThread(&idleThread, IdleThread, NULL, &idleStack[32], sizeof(idleStack), OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&idleThread); +} +#endif + /*************************************************************** PreInit @@ -102,6 +126,23 @@ static void PreInit(void) */ } +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // PMICの設定 for old version + PM_InitFIRM(); + // AESの初期化 + AES_Init(); // for encrypted NAND +#ifdef USE_IDLE_THREAD + // アイドルスレッドの作成 + CreateIdleThread(); +#endif +} + /*************************************************************** EraseAll @@ -137,8 +178,7 @@ void TwlSpMain( void ) PUSH_PROFILE(); SetDebugLED(++step); // 0x83 - PM_InitFIRM(); - AES_Init(); + PostInit(); // 2: after PM_InitFIRM PUSH_PROFILE(); @@ -159,11 +199,6 @@ void TwlSpMain( void ) PM_BackLightOn( FALSE ); -PXI_RecvID(); -SetDebugLED(0x01); -PXI_RecvID(); -SetDebugLED(0x02); - // 4: PUSH_PROFILE(); SetDebugLED(++step); // 0x86 diff --git a/build/nandfirm/menu-launcher2/ARM9/main.c b/build/nandfirm/menu-launcher2/ARM9/main.c index c636e105..a6495a2d 100644 --- a/build/nandfirm/menu-launcher2/ARM9/main.c +++ b/build/nandfirm/menu-launcher2/ARM9/main.c @@ -221,13 +221,11 @@ void TwlMain( void ) #endif // 1: after PXI PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); PostInit(); // 2: after PostInit PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); if ( !FS_ResolveSrl( MENU_TITLE_ID ) ) { diff --git a/build/nandfirm/sdmc-launcher/ARM7/main.c b/build/nandfirm/sdmc-launcher/ARM7/main.c index c8c06a99..d1212cf5 100644 --- a/build/nandfirm/sdmc-launcher/ARM7/main.c +++ b/build/nandfirm/sdmc-launcher/ARM7/main.c @@ -35,6 +35,11 @@ */ #define PRINT_MEMORY_ADDR 0x02000600 +/* + 定義するとアイドルスレッドを作成します。 +*/ +//#define USE_IDLE_THREAD + #ifdef PROFILE_ENABLE #define PROFILE_MAX 16 @@ -68,6 +73,25 @@ extern void* SDNandContext; /* NAND static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; +#ifdef USE_IDLE_THREAD +static OSThread idleThread; +static u64 idleStack[32]; +static void IdleThread(void* arg) +{ +#pragma unused(arg) + OS_EnableInterrupts(); + while (1) + { + OS_Halt(); + } +} +static void CreateIdleThread(void) +{ + OS_CreateThread(&idleThread, IdleThread, NULL, &idleStack[32], sizeof(idleStack), OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&idleThread); +} +#endif + /*************************************************************** PreInit @@ -102,6 +126,23 @@ static void PreInit(void) */ } +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // PMICの設定 for old version + PM_InitFIRM(); + // AESの初期化 + AES_Init(); // for encrypted NAND +#ifdef USE_IDLE_THREAD + // アイドルスレッドの作成 + CreateIdleThread(); +#endif +} + /*************************************************************** EraseAll @@ -139,7 +180,7 @@ void TwlSpMain( void ) PUSH_PROFILE(); SetDebugLED(++step); // 0x83 - PM_InitFIRM(); + PostInit(); // 2: after PM_InitFIRM PUSH_PROFILE(); @@ -160,21 +201,12 @@ void TwlSpMain( void ) PM_BackLightOn( FALSE ); -PXI_RecvID(); -SetDebugLED(0x01); -PXI_RecvID(); -SetDebugLED(0x02); - if ( PXI_RecvID() != FIRM_PXI_ID_SET_PATH ) { OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_SET_PATH).\n"); goto end; } -#ifdef USE_IDLE_THREAD - CreateIdleThread(); -#endif - // 4: after PXI PUSH_PROFILE(); SetDebugLED(++step); // 0x86 diff --git a/build/nandfirm/sdmc-launcher/ARM9/main.c b/build/nandfirm/sdmc-launcher/ARM9/main.c index 771e6384..e0e7c09b 100644 --- a/build/nandfirm/sdmc-launcher/ARM9/main.c +++ b/build/nandfirm/sdmc-launcher/ARM9/main.c @@ -225,13 +225,11 @@ void TwlMain( void ) #endif // 1: after PXI PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); PostInit(); // 2: after PostInit PUSH_PROFILE(); -PXI_NotifyID( FIRM_PXI_ID_NULL ); switch ( PAD_Read() & PAD_KEYPORT_MASK ) {