mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
ChangeModeNormalも共通化(TWLカードはChangeModeNormal2が必要)。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@787 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
d60fd09acf
commit
d95fe86b79
@ -19,12 +19,16 @@ extern "C" {
|
|||||||
// DSカードのノーマルモードのID読み込み
|
// DSカードのノーマルモードのID読み込み
|
||||||
HotSwState ReadIDNormal(CardBootData *cbd);
|
HotSwState ReadIDNormal(CardBootData *cbd);
|
||||||
|
|
||||||
|
// DSカードType1のノーマルモードのモード変更
|
||||||
|
HotSwState ChangeModeNormal(CardBootData *cbd);
|
||||||
|
|
||||||
// カード側のKeyTableをロード
|
// カード側のKeyTableをロード
|
||||||
HotSwState LoadTable(void);
|
HotSwState LoadTable(void);
|
||||||
|
|
||||||
// デバッガのROMエミュレーション情報読み込み
|
// デバッガのROMエミュレーション情報読み込み
|
||||||
HotSwState ReadRomEmulationData(CardBootData *cbd);
|
HotSwState ReadRomEmulationData(CardBootData *cbd);
|
||||||
|
|
||||||
|
|
||||||
// ■ ゲームモードのコマンド ■
|
// ■ ゲームモードのコマンド ■
|
||||||
// DSカードのゲームモードのID読み込み
|
// DSカードのゲームモードのID読み込み
|
||||||
HotSwState ReadIDGame(CardBootData *cbd);
|
HotSwState ReadIDGame(CardBootData *cbd);
|
||||||
|
|||||||
@ -20,9 +20,6 @@ extern "C" {
|
|||||||
// DSカードType1のノーマルモードのBoot Segment(4Kbyte)読み込み
|
// DSカードType1のノーマルモードのBoot Segment(4Kbyte)読み込み
|
||||||
HotSwState ReadBootSegNormal_DSType1(CardBootData *cbd);
|
HotSwState ReadBootSegNormal_DSType1(CardBootData *cbd);
|
||||||
|
|
||||||
// DSカードType1のノーマルモードのモード変更
|
|
||||||
HotSwState ChangeModeNormal_DSType1(CardBootData *cbd);
|
|
||||||
|
|
||||||
|
|
||||||
// ■ セキュアモードのコマンド ■
|
// ■ セキュアモードのコマンド ■
|
||||||
// DSカードType1のセキュアモードのID読み込み
|
// DSカードType1のセキュアモードのID読み込み
|
||||||
|
|||||||
@ -19,9 +19,6 @@ extern "C" {
|
|||||||
// DSカードType2のノーマルモードのBoot Segment(4Kbyte)読み込み
|
// DSカードType2のノーマルモードのBoot Segment(4Kbyte)読み込み
|
||||||
HotSwState ReadBootSegNormal_DSType2(CardBootData *cbd);
|
HotSwState ReadBootSegNormal_DSType2(CardBootData *cbd);
|
||||||
|
|
||||||
// DSカードType2のノーマルモードのモード変更 (Type1と同じ処理)
|
|
||||||
#define ChangeModeNormal_DSType2 ChangeModeNormal_DSType1
|
|
||||||
|
|
||||||
|
|
||||||
// ■ セキュアモードのコマンド ■
|
// ■ セキュアモードのコマンド ■
|
||||||
// DSカードType2のセキュアモードのID読み込み
|
// DSカードType2のセキュアモードのID読み込み
|
||||||
|
|||||||
@ -20,9 +20,6 @@ extern "C" {
|
|||||||
// Rom EmulationのノーマルモードのBoot Segment(4Kbyte)読み込み
|
// Rom EmulationのノーマルモードのBoot Segment(4Kbyte)読み込み
|
||||||
HotSwState ReadBootSegNormal_ROMEMU(CardBootData *cbd);
|
HotSwState ReadBootSegNormal_ROMEMU(CardBootData *cbd);
|
||||||
|
|
||||||
// Rom Emulationのノーマルモードのモード変更
|
|
||||||
HotSwState ChangeModeNormal_ROMEMU(CardBootData *cbd);
|
|
||||||
|
|
||||||
|
|
||||||
// ■ セキュアモードのコマンド ■
|
// ■ セキュアモードのコマンド ■
|
||||||
// Rom EmulationのセキュアモードのID読み込み
|
// Rom EmulationのセキュアモードのID読み込み
|
||||||
|
|||||||
@ -48,6 +48,54 @@ HotSwState ReadIDNormal(CardBootData *cbd)
|
|||||||
return HOTSW_SUCCESS;
|
return HOTSW_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
* Name: ChangeModeNormal
|
||||||
|
*
|
||||||
|
* Description: Type1のノーマルモードのモード変更
|
||||||
|
*
|
||||||
|
* CT=240ns Latency1=0x18 Latency2=0 Pagecount=0page
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
HotSwState ChangeModeNormal(CardBootData *cbd)
|
||||||
|
{
|
||||||
|
GCDCmd64 tempCnd, cnd;
|
||||||
|
u64 vae64 = cbd->vae;
|
||||||
|
|
||||||
|
if(!HOTSW_IsCardAccessible()){
|
||||||
|
return HOTSW_PULLED_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ゼロクリア
|
||||||
|
MI_CpuClear8(&tempCnd, sizeof(GCDCmd64));
|
||||||
|
|
||||||
|
// リトルエンディアンで作って
|
||||||
|
tempCnd.dw = cbd->vbi << 8;
|
||||||
|
tempCnd.dw |= vae64 << 32;
|
||||||
|
tempCnd.dw |= 0x3c00000000000000;
|
||||||
|
|
||||||
|
// ビックエンディアンにする
|
||||||
|
cnd.b[0] = tempCnd.b[7];
|
||||||
|
cnd.b[1] = tempCnd.b[6];
|
||||||
|
cnd.b[2] = tempCnd.b[5];
|
||||||
|
cnd.b[3] = tempCnd.b[4];
|
||||||
|
cnd.b[4] = tempCnd.b[3];
|
||||||
|
cnd.b[5] = tempCnd.b[2];
|
||||||
|
cnd.b[6] = tempCnd.b[1];
|
||||||
|
cnd.b[7] = tempCnd.b[0];
|
||||||
|
|
||||||
|
// MCCMD レジスタ設定
|
||||||
|
reg_HOTSW_MCCMD0 = *(u32 *)cnd.b;
|
||||||
|
reg_HOTSW_MCCMD1 = *(u32 *)&cnd.b[4];
|
||||||
|
|
||||||
|
// MCCNT1 レジスタ設定
|
||||||
|
reg_HOTSW_MCCNT1 = (cbd->gameCommondParam & ~SCRAMBLE_MASK) |
|
||||||
|
START_MASK | (PC_MASK & (0x0 << PC_SHIFT));
|
||||||
|
|
||||||
|
// カードデータ転送終了割り込みが起こるまで寝る(割り込みハンドラの中で起こされる)
|
||||||
|
OS_SleepThread(NULL);
|
||||||
|
|
||||||
|
return HOTSW_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------
|
/* -----------------------------------------------------------------
|
||||||
* LoadTableŠÖ<EFBFBD>”
|
* LoadTableŠÖ<EFBFBD>”
|
||||||
*
|
*
|
||||||
|
|||||||
@ -59,54 +59,6 @@ HotSwState ReadBootSegNormal_DSType1(CardBootData *cbd)
|
|||||||
return HOTSW_SUCCESS;
|
return HOTSW_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
|
||||||
* Name: ChangeModeNormal_DSType1
|
|
||||||
*
|
|
||||||
* Description: Type1のノーマルモードのモード変更
|
|
||||||
*
|
|
||||||
* CT=240ns Latency1=0x18 Latency2=0 Pagecount=0page
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
HotSwState ChangeModeNormal_DSType1(CardBootData *cbd)
|
|
||||||
{
|
|
||||||
GCDCmd64 tempCnd, cnd;
|
|
||||||
u64 vae64 = cbd->vae;
|
|
||||||
|
|
||||||
if(!HOTSW_IsCardAccessible()){
|
|
||||||
return HOTSW_PULLED_OUT_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ゼロクリア
|
|
||||||
MI_CpuClear8(&tempCnd, sizeof(GCDCmd64));
|
|
||||||
|
|
||||||
// リトルエンディアンで作って
|
|
||||||
tempCnd.dw = cbd->vbi << 8;
|
|
||||||
tempCnd.dw |= vae64 << 32;
|
|
||||||
tempCnd.dw |= 0x3c00000000000000;
|
|
||||||
|
|
||||||
// ビックエンディアンにする
|
|
||||||
cnd.b[0] = tempCnd.b[7];
|
|
||||||
cnd.b[1] = tempCnd.b[6];
|
|
||||||
cnd.b[2] = tempCnd.b[5];
|
|
||||||
cnd.b[3] = tempCnd.b[4];
|
|
||||||
cnd.b[4] = tempCnd.b[3];
|
|
||||||
cnd.b[5] = tempCnd.b[2];
|
|
||||||
cnd.b[6] = tempCnd.b[1];
|
|
||||||
cnd.b[7] = tempCnd.b[0];
|
|
||||||
|
|
||||||
// MCCMD レジスタ設定
|
|
||||||
reg_HOTSW_MCCMD0 = *(u32 *)cnd.b;
|
|
||||||
reg_HOTSW_MCCMD1 = *(u32 *)&cnd.b[4];
|
|
||||||
|
|
||||||
// MCCNT1 レジスタ設定
|
|
||||||
reg_HOTSW_MCCNT1 = START_MASK | CT_MASK | LATENCY2_MASK & (0x18 << LATENCY2_SHIFT);
|
|
||||||
|
|
||||||
// カードデータ転送終了割り込みが起こるまで寝る(割り込みハンドラの中で起こされる)
|
|
||||||
OS_SleepThread(NULL);
|
|
||||||
|
|
||||||
return HOTSW_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ■--------------------------------------■
|
// ■--------------------------------------■
|
||||||
// ■ セキュアモードのコマンド ■
|
// ■ セキュアモードのコマンド ■
|
||||||
// ■--------------------------------------■
|
// ■--------------------------------------■
|
||||||
|
|||||||
@ -95,7 +95,7 @@ HotSwState ReadBootSegNormal_DSType2(CardBootData *cbd)
|
|||||||
*
|
*
|
||||||
* CT=240ns Latency1=0x18 Latency2=0 Pagecount=0page
|
* CT=240ns Latency1=0x18 Latency2=0 Pagecount=0page
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
// Type1と同じ
|
// 共通
|
||||||
|
|
||||||
|
|
||||||
// <20>¡--------------------------------------<2D>¡
|
// <20>¡--------------------------------------<2D>¡
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
#include <customNDma.h>
|
#include <customNDma.h>
|
||||||
#include <../build/libraries/mb/common/include/mb_fileinfo.h>
|
#include <../build/libraries/mb/common/include/mb_fileinfo.h>
|
||||||
|
|
||||||
//#define HOTSW_FORCE_CARD_B
|
|
||||||
#define DEBUG_MODE
|
#define DEBUG_MODE
|
||||||
|
|
||||||
// define -------------------------------------------------------------------
|
// define -------------------------------------------------------------------
|
||||||
@ -157,19 +156,19 @@ static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = {
|
|||||||
|
|
||||||
static CardBootFunction s_funcTable[] = {
|
static CardBootFunction s_funcTable[] = {
|
||||||
// DS Card Type 1
|
// DS Card Type 1
|
||||||
{ ReadBootSegNormal_DSType1, ChangeModeNormal_DSType1, // Normalモード関数
|
{ ReadBootSegNormal_DSType1, ChangeModeNormal, // Normalモード関数
|
||||||
ReadIDSecure_DSType1, ReadSegSecure_DSType1, SwitchONPNGSecure_DSType1, ChangeModeSecure_DSType1, // Secureモード関数
|
ReadIDSecure_DSType1, ReadSegSecure_DSType1, SwitchONPNGSecure_DSType1, ChangeModeSecure_DSType1, // Secureモード関数
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
ReadIDGame, ReadPageGame}, // Game モード関数
|
||||||
// DS Card Type 2
|
// DS Card Type 2
|
||||||
{ ReadBootSegNormal_DSType2, ChangeModeNormal_DSType2, // Normalモード関数
|
{ ReadBootSegNormal_DSType2, ChangeModeNormal, // Normalモード関数
|
||||||
ReadIDSecure_DSType2, ReadSegSecure_DSType2, SwitchONPNGSecure_DSType2, ChangeModeSecure_DSType2, // Secureモード関数
|
ReadIDSecure_DSType2, ReadSegSecure_DSType2, SwitchONPNGSecure_DSType2, ChangeModeSecure_DSType2, // Secureモード関数
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
ReadIDGame, ReadPageGame}, // Game モード関数
|
||||||
// TWL Card Type 1
|
// TWL Card Type 1
|
||||||
{ ReadBootSegNormal_DSType2, ChangeModeNormal_DSType2, // Normalモード関数
|
{ ReadBootSegNormal_DSType2, ChangeModeNormal, // Normalモード関数
|
||||||
ReadIDSecure_DSType2, ReadSegSecure_DSType2, SwitchONPNGSecure_DSType2, ChangeModeSecure_DSType2, // Secureモード関数
|
ReadIDSecure_DSType2, ReadSegSecure_DSType2, SwitchONPNGSecure_DSType2, ChangeModeSecure_DSType2, // Secureモード関数
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
ReadIDGame, ReadPageGame}, // Game モード関数
|
||||||
// RomEmulation
|
// RomEmulation
|
||||||
{ ReadBootSegNormal_ROMEMU, ChangeModeNormal_ROMEMU, // Normalモード関数
|
{ ReadBootSegNormal_DSType2, ChangeModeNormal, // Normalモード関数
|
||||||
ReadIDSecure_ROMEMU, ReadSegSecure_ROMEMU, SwitchONPNGSecure_ROMEMU, ChangeModeSecure_ROMEMU, // Secureモード関数
|
ReadIDSecure_ROMEMU, ReadSegSecure_ROMEMU, SwitchONPNGSecure_ROMEMU, ChangeModeSecure_ROMEMU, // Secureモード関数
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
ReadIDGame, ReadPageGame}, // Game モード関数
|
||||||
};
|
};
|
||||||
@ -390,7 +389,7 @@ static HotSwState LoadCardData(void)
|
|||||||
GenVA_VB_VD();
|
GenVA_VB_VD();
|
||||||
|
|
||||||
// セキュアモードに移行
|
// セキュアモードに移行
|
||||||
state = s_funcTable[s_cbData.cardType].ChangeMode_N(&s_cbData);
|
state = ChangeModeNormal(&s_cbData);
|
||||||
retval = (retval == HOTSW_SUCCESS) ? state : retval;
|
retval = (retval == HOTSW_SUCCESS) ? state : retval;
|
||||||
|
|
||||||
// ---------------------- Secure Mode ----------------------
|
// ---------------------- Secure Mode ----------------------
|
||||||
|
|||||||
@ -88,44 +88,7 @@ HotSwState ReadBootSegNormal_ROMEMU(CardBootData *cbd)
|
|||||||
|
|
||||||
Description: DSカードType1のノーマルモードのモード変更
|
Description: DSカードType1のノーマルモードのモード変更
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
HotSwState ChangeModeNormal_ROMEMU(CardBootData *cbd)
|
// 共通
|
||||||
{
|
|
||||||
#pragma unused( cbd )
|
|
||||||
|
|
||||||
GCDCmd64 tempCnd, cnd;
|
|
||||||
|
|
||||||
if(!HOTSW_IsCardAccessible()){
|
|
||||||
return HOTSW_PULLED_OUT_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ゼロクリア
|
|
||||||
MI_CpuClear8(&tempCnd, sizeof(GCDCmd64));
|
|
||||||
|
|
||||||
// リトルエンディアンで作って
|
|
||||||
tempCnd.dw = 0x3c00000000000000;
|
|
||||||
|
|
||||||
// ビックエンディアンにする
|
|
||||||
cnd.b[0] = tempCnd.b[7];
|
|
||||||
cnd.b[1] = tempCnd.b[6];
|
|
||||||
cnd.b[2] = tempCnd.b[5];
|
|
||||||
cnd.b[3] = tempCnd.b[4];
|
|
||||||
cnd.b[4] = tempCnd.b[3];
|
|
||||||
cnd.b[5] = tempCnd.b[2];
|
|
||||||
cnd.b[6] = tempCnd.b[1];
|
|
||||||
cnd.b[7] = tempCnd.b[0];
|
|
||||||
|
|
||||||
// MCCMD レジスタ設定
|
|
||||||
reg_HOTSW_MCCMD0 = *(u32 *)cnd.b;
|
|
||||||
reg_HOTSW_MCCMD1 = *(u32 *)&cnd.b[4];
|
|
||||||
|
|
||||||
// MCCNT1 レジスタ設定 (START = 1 に)
|
|
||||||
reg_HOTSW_MCCNT1 = START_MASK;
|
|
||||||
|
|
||||||
// カードデータ転送終了割り込みが起こるまで寝る(割り込みハンドラの中で起こされる)
|
|
||||||
OS_SleepThread(NULL);
|
|
||||||
|
|
||||||
return HOTSW_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ■--------------------------------------■
|
// ■--------------------------------------■
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user