TwlSDK 3029対応

・リセットパラメタの処理及び情報を一部SDKのosライブラリに組み込んだ関係の修正
 ・その他3029対応のため細々と

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@352 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yoshida_teruhisa 2007-12-12 09:41:18 +00:00
parent d082cb325c
commit 0c7e955d55
11 changed files with 10 additions and 200 deletions

View File

@ -253,45 +253,12 @@ static void ResetRTC( void )
}
static BOOL IsEnableJTAG( void )
{
// SCFGレジスタが無効になっていたら、SCFGレジスタの値は"0"になるので、WRAMに退避している値をチェックする。
u8 value = ( reg_SCFG_EXT & REG_SCFG_EXT_CFG_MASK ) ?
(u8)( reg_SCFG_JTAG & REG_SCFG_JTAG_CPUJE_MASK ) :
(u8)( *(u8 *)HWi_WSYS09_ADDR & HWi_WSYS09_JTAG_CPUJE_MASK );
return value ? TRUE : FALSE;
}
// Hot/Coldスタート判定およびリセットパラメータのリード
#define MCU_RESET_VALUE_BUF_ENABLE_MASK 0x80000000
#define MCU_RESET_VALUE_OFS 0
#define MCU_RESET_VALUE_LEN 1
void ReadResetParameter( void )
{
if( ( *(u32 *)HW_RESET_PARAMETER_BUF & MCU_RESET_VALUE_BUF_ENABLE_MASK ) == 0 ) {
(void)MCU_GetFreeRegisters( MCU_RESET_VALUE_OFS, (u8 *)HW_RESET_PARAMETER_BUF, MCU_RESET_VALUE_LEN );
}
// Hot/Coldスタート判定
if( IsEnableJTAG() || // ISデバッガでのデバッグ動作時に常にホットスタート判定されるのを防ぐ
( SYSMi_GetMCUFreeRegisterValue() == 0 ) ) { // "JTAG有効"か"マイコンフリーレジスタ値=0"ならColdスタート
u8 data = 1;
MCU_SetFreeRegisters( MCU_RESET_VALUE_OFS, &data, MCU_RESET_VALUE_LEN ); // マイコンフリーレジスタにホットスタートフラグをセット
SYSMi_GetWork()->isHotStart = FALSE;
}else {
SYSMi_GetWork()->isHotStart = TRUE;
// リセットパラメータ有効判定
if( ( STD_StrNCmp( (const char *)&SYSMi_GetResetParamAddr()->header.magicCode,
SYSM_RESET_PARAM_MAGIC_CODE,
SYSM_RESET_PARAM_MAGIC_CODE_LEN ) == 0 ) &&
( SYSMi_GetResetParamAddr()->header.bodyLength > 0 ) &&
( SYSMi_GetResetParamAddr()->header.crc16 == SVC_GetCRC16( 65535, &SYSMi_GetResetParamAddr()->body, SYSMi_GetResetParamAddr()->header.bodyLength ) )
) {
// リセットパラメータが有効なら、ワークに退避
MI_CpuCopy32 ( SYSMi_GetResetParamAddr(), &SYSMi_GetWork()->resetParam, sizeof(ResetParam) );
SYSMi_GetWork()->isValidResetParam = TRUE;
}
}
BOOL hot;
SYSMi_GetWork()->isValidResetParam = OS_ReadResetParameter( (ResetParam *)&(SYSMi_GetWork()->resetParam), &hot );
SYSMi_GetWork()->isHotStart = hot;
// メインメモリのリセットパラメータをクリアしておく
MI_CpuClear32( SYSMi_GetResetParamAddr(), 0x100 );
}

View File

@ -22,7 +22,7 @@ include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = sysmenu settings mb_loader acsign boot hotsw reset_param
SUBDIRS = sysmenu settings mb_loader acsign boot hotsw
#----------------------------------------------------------------------------

View File

@ -1,49 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# File: Makefile
#
# 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:: 2007-09-27#$
# $Rev: 1203 $
# $Author: yada $
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
TWL_PROC = ARM9
#----------------------------------------------------------------------------
SRCDIR = ./src
SRCS = reset_param.c
TARGET_LIB = libreset_param$(TWL_LIBSUFFIX).a
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,77 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: reset_param.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:: 2007-11-26#$
$Rev: 256 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <sysmenu/reset_param/ARM9/reset_param.h>
// define data-------------------------------------------------------
#define RPi_RESET_PARAM_MAGIC_CODE "TRST"
#define RPi_RESET_PARAM_MAGIC_CODE_LEN 4
// リセットパラメータアドレスの取得(※ライブラリ向け)
#define RPi_GetResetParamAddr() ( (ResetParam *)0x02000100 )
// extern data-------------------------------------------------------
// function's prototype----------------------------------------------
static void RPi_DoHardwareReset( void );
// global variables--------------------------------------------------
// static variables--------------------------------------------------
// const data--------------------------------------------------------
// 安全のため、この関数はitcmに配置
#include <nitro/code32.h>
#include <twl/itcm_begin.h>
static void RPi_DoHardwareReset( void )
{
// リセット命令発行
PM_ForceToResetHardware();
OS_Terminate();
}
#include <twl/itcm_end.h>
#include <nitro/codereset.h>
// ResetParamを指定してリセット
void RP_Reset( u8 type, NAMTitleId id, BootFlags *flag )
{
// メーカーコードとゲームコードをコピー
u32 *maker_code_dest_addr = (u32 *)((u32)(RPi_GetResetParamAddr()) + HW_PARAM_DELIVER_ARG_MAKERCODE_OFS);
u32 *game_code_dest_addr = (u32 *)((u32)(RPi_GetResetParamAddr()) + HW_PARAM_DELIVER_ARG_GAMECODE_OFS);
u16 *maker_code_src_addr = (u16 *)(HW_TWL_ROM_HEADER_BUF + 0x10);
u32 *game_code_src_addr = (u32 *)(HW_TWL_ROM_HEADER_BUF + 0xc);
*maker_code_dest_addr = (u32)*maker_code_src_addr;
*game_code_dest_addr = *game_code_src_addr;
// リセットパラメータの設定
RPi_GetResetParamAddr()->body.v1.bootTitleID = id;
RPi_GetResetParamAddr()->body.v1.flags = *flag;
MI_CpuCopyFast( RPi_RESET_PARAM_MAGIC_CODE, (char *)&RPi_GetResetParamAddr()->header.magicCode, RPi_RESET_PARAM_MAGIC_CODE_LEN);
RPi_GetResetParamAddr()->header.bodyLength = sizeof(ResetParamBody);
RPi_GetResetParamAddr()->header.crc16 = SVC_GetCRC16( 65535, &RPi_GetResetParamAddr()->body, RPi_GetResetParamAddr()->header.bodyLength );
RPi_GetResetParamAddr()->header.type = type;
DC_FlushRange(RPi_GetResetParamAddr(), 0x100 );
DC_WaitWriteBufferEmpty();
RPi_DoHardwareReset();
}

View File

@ -1,30 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# File: Makefile
#
# 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:: 2007-09-27#$
# $Rev: 1203 $
# $Author: yada $
#----------------------------------------------------------------------------
TARGET_FIRM = SYSTEMMENU
SUBDIRS = ARM9
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -21,7 +21,6 @@ SUBDIRS = \
../../../libraries_sysmenu/settings \
../../../libraries_sysmenu/boot \
../../../libraries_sysmenu/hotsw \
../../../libraries_sysmenu/reset_param \
../../../components/hyena.TWL
#----------------------------------------------------------------------------

View File

@ -47,7 +47,7 @@ LINCLUDES = $(MISC_DIR)/include
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)'
LLIBRARIES += libreset_param$(TWL_LIBSUFFIX).a
#LLIBRARIES += libreset_param$(TWL_LIBSUFFIX).a
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs

View File

@ -218,7 +218,7 @@ int MachineSettingMain( void )
DrawMenu( s_csr, &s_settingParam );
if( pad.trg & PAD_BUTTON_START ) {
RP_Reset( 0, NULL, &tempflag );
OS_SetResetParamAndResetHardware( 0, NULL, &tempflag );
}
if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐
@ -250,7 +250,7 @@ int MachineSettingMain( void )
break;
case 6:
//pictochat起動テスト
RP_Reset( 0, 0x0001000154484350, &tempflag );
OS_SetResetParamAndResetHardware( 0, 0x0001000150434854, &tempflag );
}
}
}

View File

@ -32,7 +32,7 @@
#include <twl/cdc.h>
#include <twl/aes.h>
#include <twl/mcu.h>
#include <twl/hw/ARM7/mmap_wramEnv.h>
#include <twl/hw/common/mmap_wramEnv.h>
#include <sysmenu.h>
#include "nvram_sp.h"

View File

@ -20,7 +20,7 @@
#include <nitro/os/common/emulator.h>
#include <twl/init/crt0.h>
#include <twl/memorymap_sp.h>
#include <twl/hw/ARM7/mmap_wramEnv.h>
#include <twl/hw/common/mmap_wramEnv.h>
#include "boot_sync.h"
/*---------------------------------------------------------------------------*/

View File

@ -22,7 +22,7 @@
#include <twl/nam.h>
#include <sysmenu/memorymap.h>
#include <sysmenu/reset_param/ARM9/reset_param.h>
//#include <sysmenu/reset_param/ARM9/reset_param.h>
#ifdef __cplusplus
extern "C" {