NANDへの書き込み中は デバッガによる強制中断を実行できなくする処理をいれました。(SystemUpdater 及び NandInitializer)

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1587 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
kamikawa 2008-06-05 10:13:35 +00:00
parent fd9efd87fc
commit bcffbd74dc
8 changed files with 237 additions and 31 deletions

View File

@ -93,14 +93,17 @@ SRCS = main.c \
process_fade.c \
process_font.c \
sd_event.c \
hwi.c
hwi.c \
debugger_hw_reset_control.c
LINCLUDES = ../../NandInitializerRed/common/include \
../../NandInitializerRed/ARM9.TWL/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
../../common/ARM9/include
SRCDIR = ../../NandInitializerRed/ARM9.TWL/src \
../../HWInfoWriter/ARM9/src
../../HWInfoWriter/ARM9/src \
../../common/ARM9/src
#LCFILE = # using default

View File

@ -76,14 +76,17 @@ SRCS = main.c \
process_font.c \
process_wireless_setting.c \
sd_event.c \
hwi.c
hwi.c \
debugger_hw_reset_control.c
LINCLUDES = ../../NandInitializerRed/common/include \
../../NandInitializerRed/ARM9.TWL/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
../../common/ARM9/include
SRCDIR = ../../NandInitializerRed/ARM9.TWL/src \
../../HWInfoWriter/ARM9/src
../../HWInfoWriter/ARM9/src \
../../common/ARM9/src
#LCFILE = # using default

View File

@ -72,13 +72,16 @@ SRCS = main.c \
process_font.c \
process_wireless_setting.c \
sd_event.c \
hwi.c
hwi.c \
debugger_hw_reset_control.c
LINCLUDES = ../common/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
../../common/ARM9/include
SRCDIR = src \
../../HWInfoWriter/ARM9/src
../../HWInfoWriter/ARM9/src \
../../common/ARM9/src
#LCFILE = # using default

View File

@ -29,6 +29,7 @@
#include "process_fade.h"
#include "cursor.h"
#include "keypad.h"
#include "debugger_hw_reset_control.h"
#include <sysmenu/namut.h>
@ -218,8 +219,14 @@ void* FormatProcess2(void)
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " WAIT");
kamiFontLoadScreenData();
// ISデバッガのハードウェアリセットを禁止する
DEBUGGER_HwResetDisable();
result &= NAMUT_Format();
// ISデバッガのハードウェアリセットを許可する
DEBUGGER_HwResetEnable();
if (result)
{
kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK ");
@ -255,29 +262,21 @@ void* FormatProcess2(void)
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " WAIT");
kamiFontLoadScreenData();
// FATFS_UnmountDrive("F:");
// FATFS_UnmountDrive("G:");
// 指定のNANDパーティション0をFドライブにマウント
// if (FATFS_MountDrive("F", FATFS_MEDIA_TYPE_NAND, 0))
// ISデバッガのハードウェアリセットを禁止する
DEBUGGER_HwResetDisable();
// チェックディスク実行
if (FATFS_CheckDisk("nand:", &info, TRUE, TRUE, TRUE))
{
// ƒ`ƒFƒbƒNƒfƒBƒXƒNŽÀ<C5BD>s
if (FATFS_CheckDisk("nand:", &info, TRUE, TRUE, TRUE))
if (FATFS_CheckDisk("nand2:", &info, TRUE, TRUE, TRUE))
{
// 指定のNANDパーティション1をGドライブにマウント
// if (FATFS_MountDrive("G", FATFS_MEDIA_TYPE_NAND, 1))
{
// チェックディスク実行
if (FATFS_CheckDisk("nand2:", &info, TRUE, TRUE, TRUE))
{
result = TRUE;
}
}
result = TRUE;
}
}
// デフォルトマウント状態に戻しておく
// FATFS_UnmountDrive("G:");
// FATFS_MountDrive("G", FATFS_MEDIA_TYPE_SD, 0);
// ISデバッガのハードウェアリセットを許可する
DEBUGGER_HwResetEnable();
if (result == TRUE) { kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK "); }
else { kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG "); }

View File

@ -52,15 +52,18 @@ SRCS = main.c \
kami_write_nandfirm.c \
hw_info.c \
keypad.c \
kami_copy_file.c
kami_copy_file.c \
debugger_hw_reset_control.c
LINCLUDES = include \
../common/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
$(ROOT)/build/libraries/fs/common/include
$(ROOT)/build/libraries/fs/common/include \
../../common/ARM9/include
SRCDIR = src \
../../HWInfoWriter/ARM9/src
../../HWInfoWriter/ARM9/src \
../../common/ARM9/src
#LCFILE = # using default

View File

@ -30,6 +30,7 @@
#include "graphics.h"
#include "hwi.h"
#include "keypad.h"
#include "debugger_hw_reset_control.h"
extern const char *g_strIPLSvnRevision;
extern const char *g_strSDKSvnRevision;
@ -115,6 +116,9 @@ TwlMain()
int i,j;
OS_Init();
OS_InitThread();
OS_InitTick();
OS_InitAlarm();
OS_InitArena();
PXI_Init();
OS_InitLock();
@ -207,9 +211,13 @@ TwlMain()
}
}
// Aボタン待ち
DrawWaitButtonA();
// ISデバッガのハードウェアリセットを禁止する
DEBUGGER_HwResetDisable();
// HWInfo関連の前準備
switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain ))
{
@ -230,7 +238,7 @@ TwlMain()
sIsFormatFinish = FALSE;
ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback);
kamiFontPrintfMain( 7, 11, 8, "Now Format...");
while(!sIsFormatFinish);
while(!sIsFormatFinish){};
if (sFormatResult)
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "NAND Format Success.");
@ -359,6 +367,9 @@ TwlMain()
}
}
// ISデバッガのハードウェアリセットを許可する
DEBUGGER_HwResetEnable();
// 結果表示
while(1)
{

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - NandInitializer
File: debugger_hw_reset_control.h
Copyright 2008 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$
*---------------------------------------------------------------------------*/
#ifndef DEBUGGER_HW_RESET_CONTROL_H_
#define DEBUGGER_HW_RESET_CONTROL_H_
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------*
Name: DEBUGGER_HwResetDisable
Description: IS-TWL-DEBUGGERでのハードウェアリセットを禁止します
SRL
5
IS-TWL-DEBUGGERは
10
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void DEBUGGER_HwResetDisable( void );
/*---------------------------------------------------------------------------*
Name: DEBUGGER_HwResetEnable
Description: IS-TWL-DEBUGGERでのハードウェアリセットを許可します
SRL
10
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void DEBUGGER_HwResetEnable( void );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* DEBUGGER_HW_RESET_CONTROL_H_ */
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*
Project: SystemUpdater
File: debugger_hw_reset_control.c
Copyright 2008 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 <twl.h>
#include "debugger_hw_reset_control.h"
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define OS_THREAD_PRIORITY_IS_TWL_DEBUGGER_HW_RESET_CONTROL 15
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
vu8 sHwResetEnable = TRUE;
OSThread sThread;
u32 sStack[1024];
s32 sLockId;
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static void CardAccessThread(void* arg);
/*---------------------------------------------------------------------------*
Name: CardAccessThread
Description: 5
Arguments: arg - 使
Returns: None.
*---------------------------------------------------------------------------*/
static void CardAccessThread(void* arg)
{
#pragma unused(arg)
while (!sHwResetEnable)
{
CARD_LockRom((u16)sLockId);
(void)CARDi_ReadRomID();
CARD_UnlockRom((u16)sLockId);
// 5秒間スリープ
OS_Sleep(5000);
}
}
/*---------------------------------------------------------------------------*
Name: DEBUGGER_HwResetDisable
Description: IS-TWL-DEBUGGERでのハードウェアリセットを禁止します
SRL
5
IS-TWL-DEBUGGERは
10
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void DEBUGGER_HwResetDisable( void )
{
if (sLockId == 0)
{
sLockId = OS_GetLockID();
}
if (sHwResetEnable)
{
sHwResetEnable = FALSE;
OS_CreateThread(&sThread, CardAccessThread, NULL,
(void*)((u32)sStack + sizeof(sStack)), sizeof(sStack),
OS_THREAD_PRIORITY_IS_TWL_DEBUGGER_HW_RESET_CONTROL);
OS_WakeupThreadDirect(&sThread);
}
}
/*---------------------------------------------------------------------------*
Name: DEBUGGER_HwResetEnable
Description: IS-TWL-DEBUGGERでのハードウェアリセットを許可します
SRL
10
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void DEBUGGER_HwResetEnable( void )
{
if (!sHwResetEnable)
{
sHwResetEnable = TRUE;
OS_WakeupThreadDirect(&sThread);
while (!OS_IsThreadTerminated(&sThread)){}
}
}