書き込むマイコンファームをSDカードのルートから選択できるようにしました。

その他コード整理。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1633 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
kamikawa 2008-06-16 07:07:43 +00:00
parent 633e5602b3
commit df75b3245b
10 changed files with 259 additions and 105 deletions

View File

@ -31,7 +31,7 @@ MACRO_FLAGS += -DUSE_WIRELESS_FORCE_DISABLE_SETTING
#============================================================================ #============================================================================
#============================================================================ #============================================================================
# フォントデータを書き込み可能にする場合定義します。(要:Make Clean # フォントデータを書き込み可能にする場合定義します。(要:Make Clean
#MACRO_FLAGS += -DUSE_WRITE_FONT_DATA MACRO_FLAGS += -DUSE_WRITE_FONT_DATA
#============================================================================ #============================================================================
#============================================================================ #============================================================================
# マリクラデバッグ用に製品本体での起動を抑制する場合定義します。(要:Make Clean # マリクラデバッグ用に製品本体での起動を抑制する場合定義します。(要:Make Clean

View File

@ -30,14 +30,32 @@ extern "C" {
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
//typedef void* (*TpProcess)(void); enum {
AUTO_PROCESS_MENU_FORMAT = 0,
AUTO_PROCESS_MENU_HARDWARE_INFO,
#ifdef USE_WRITE_FONT_DATA
AUTO_PROCESS_MENU_FONT_DATA,
#endif // USE_WRITE_FONT_DATA
AUTO_PROCESS_MENU_IMPORT_TAD,
AUTO_PROCESS_MENU_IMPORT_NANDFIRM,
AUTO_PROCESS_MENU_MCU,
AUTO_PROCESS_MENU_NUM
};
typedef enum _AutoProcessResult
{
AUTO_PROCESS_RESULT_SUCCESS,
AUTO_PROCESS_RESULT_FAILURE,
AUTO_PROCESS_RESULT_SKIP
}
AutoProcessResult;
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
extern BOOL gAutoFlag; extern BOOL gAutoFlag;
extern AutoProcessResult gAutoProcessResult[AUTO_PROCESS_MENU_NUM];
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*

View File

@ -29,7 +29,6 @@ extern "C" {
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
иђи` иђи`
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
#define MCU_DATA_FILE_PATH_IN_ROM "rom:/data/mcu_twl.hex"
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
ЉЦђи` ЉЦђи`

View File

@ -26,6 +26,7 @@
#include "process_norfirm.h" #include "process_norfirm.h"
#include "process_auto.h" #include "process_auto.h"
#include "process_fade.h" #include "process_fade.h"
#include "process_mcu.h"
#include "cursor.h" #include "cursor.h"
#include "keypad.h" #include "keypad.h"
@ -33,19 +34,6 @@
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
enum {
MENU_FORMAT = 0,
MENU_HARDWARE_INFO,
#ifdef USE_WRITE_FONT_DATA
MENU_FONT_DATA,
#endif // USE_WRITE_FONT_DATA
MENU_IMPORT_TAD,
#ifndef MARIOCLUB_VERSION
MENU_IMPORT_NANDFIRM,
#endif // MARIOCLUB_VERSION
MENU_END
};
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
@ -55,6 +43,7 @@ enum {
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
BOOL gAutoFlag = FALSE; BOOL gAutoFlag = FALSE;
AutoProcessResult gAutoProcessResult[AUTO_PROCESS_MENU_NUM];
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
@ -82,9 +71,17 @@ static s8 sMenuSelectNo;
void* AutoProcess0(void) void* AutoProcess0(void)
{ {
s32 i;
// オートフラグセット // オートフラグセット
gAutoFlag = TRUE; gAutoFlag = TRUE;
// 処理結果初期化
for (i=0;i<AUTO_PROCESS_MENU_NUM; i++)
{
gAutoProcessResult[i] = AUTO_PROCESS_RESULT_SKIP;
}
// メニュー初期化 // メニュー初期化
sMenuSelectNo = 0; sMenuSelectNo = 0;
@ -108,25 +105,26 @@ void* AutoProcess1(void)
{ {
switch ( sMenuSelectNo++ ) switch ( sMenuSelectNo++ )
{ {
case MENU_FORMAT: case AUTO_PROCESS_MENU_FORMAT:
return FormatProcess0; return FormatProcess0;
case MENU_HARDWARE_INFO: case AUTO_PROCESS_MENU_HARDWARE_INFO:
return HWInfoProcess0; return HWInfoProcess0;
#ifdef USE_WRITE_FONT_DATA #ifdef USE_WRITE_FONT_DATA
case MENU_FONT_DATA: case AUTO_PROCESS_MENU_FONT_DATA:
return fontProcess0; return fontProcess0;
#endif // USE_WRITE_FONT_DATA #endif // USE_WRITE_FONT_DATA
case MENU_IMPORT_TAD: case AUTO_PROCESS_MENU_IMPORT_TAD:
return ImportProcess0; return ImportProcess0;
#ifndef MARIOCLUB_VERSION case AUTO_PROCESS_MENU_IMPORT_NANDFIRM:
case MENU_IMPORT_NANDFIRM:
return NandfirmProcess0; return NandfirmProcess0;
#endif // MARIOCLUB_VERSION
case MENU_END: case AUTO_PROCESS_MENU_MCU:
return mcuProcess0;
case AUTO_PROCESS_MENU_NUM:
return AutoProcess2; return AutoProcess2;
} }
@ -149,6 +147,7 @@ void* AutoProcess2(void)
int i; int i;
s8 line = 5; s8 line = 5;
u8 bg_color; u8 bg_color;
BOOL totalResult = TRUE;
// 文字列全クリア // 文字列全クリア
kamiFontClear(); kamiFontClear();
@ -170,31 +169,55 @@ void* AutoProcess2(void)
kamiFontPrintf(3, line += 2, FONT_COLOR_BLACK, " WRITE FONT DATA "); kamiFontPrintf(3, line += 2, FONT_COLOR_BLACK, " WRITE FONT DATA ");
#endif // USE_WRITE_FONT_DATA #endif // USE_WRITE_FONT_DATA
kamiFontPrintf(3, line += 2, FONT_COLOR_BLACK, " INPORT TAD FROM SD "); kamiFontPrintf(3, line += 2, FONT_COLOR_BLACK, " INPORT TAD FROM SD ");
#ifndef MARIOCLUB_VERSION
kamiFontPrintf(3, line += 2, FONT_COLOR_BLACK, " INPORT NANDFIRM FROM SD"); kamiFontPrintf(3, line += 2, FONT_COLOR_BLACK, " INPORT NANDFIRM FROM SD");
#endif //MARIOCLUB_VERSION kamiFontPrintf(3, line += 2, FONT_COLOR_BLACK, " WRITE MCU FIRM ");
#ifndef AUTO_FORMAT_MODE #ifndef AUTO_FORMAT_MODE
if (gAutoProcessResult[AUTO_PROCESS_MENU_MCU] == AUTO_PROCESS_RESULT_SKIP)
{
kamiFontPrintf(3, 22, FONT_COLOR_BLACK, " Button B : return to menu"); kamiFontPrintf(3, 22, FONT_COLOR_BLACK, " Button B : return to menu");
}
else
{
kamiFontPrintf(3, 22, FONT_COLOR_BLACK, " Please Shut Down");
}
#endif //AUTO_FORMAT_MODE #endif //AUTO_FORMAT_MODE
/*
for (i=0;i<sMenuSelectNo-1;i++) for (i=0;i<sMenuSelectNo-1;i++)
{ {
kamiFontPrintf(3, (s16)(7+2*i), FONT_COLOR_GREEN, "OK"); kamiFontPrintf(3, (s16)(7+2*i), FONT_COLOR_GREEN, "OK");
} }
*/
// ޏ”s è for (i=0;i<AUTO_PROCESS_MENU_NUM;i++)
if (i<MENU_END)
{ {
switch (gAutoProcessResult[i])
{
case AUTO_PROCESS_RESULT_SUCCESS:
kamiFontPrintf(3, (s16)(7+2*i), FONT_COLOR_GREEN, "OK");
break;
case AUTO_PROCESS_RESULT_FAILURE:
totalResult = FALSE;
kamiFontPrintf(3, (s16)(7+2*i), FONT_COLOR_RED, "NG"); kamiFontPrintf(3, (s16)(7+2*i), FONT_COLOR_RED, "NG");
kamiFontPrintf(3, 19, FONT_COLOR_BLACK, " Error Occured!"); break;
bg_color = BG_COLOR_RED; case AUTO_PROCESS_RESULT_SKIP:
kamiFontPrintf(2, (s16)(7+2*i), FONT_COLOR_PURPLE, "SKIP");
break;
} }
}
// 失敗なし // 失敗なし
else if (totalResult)
{ {
kamiFontPrintf(3, 19, FONT_COLOR_BLACK, " Finished Successfully!"); kamiFontPrintf(3, 19, FONT_COLOR_BLACK, " Finished Successfully!");
bg_color = BG_COLOR_GREEN; bg_color = BG_COLOR_GREEN;
} }
// 失敗あり
else
{
kamiFontPrintf(3, 19, FONT_COLOR_BLACK, " Error Occured!");
bg_color = BG_COLOR_RED;
}
// 背景上部 // 背景上部
kamiFontFillChar( 0, bg_color, bg_color ); kamiFontFillChar( 0, bg_color, bg_color );
@ -229,16 +252,18 @@ void* AutoProcess3(void)
{ {
// NandInitializerProdectはオート処理が完了した段階で終了です。 // NandInitializerProdectはオート処理が完了した段階で終了です。
#ifndef AUTO_FORMAT_MODE #ifndef AUTO_FORMAT_MODE
if (gAutoProcessResult[AUTO_PROCESS_MENU_MCU] == AUTO_PROCESS_RESULT_SKIP)
{
if (kamiPadIsTrigger(PAD_BUTTON_B)) if (kamiPadIsTrigger(PAD_BUTTON_B))
{ {
FADE_OUT_RETURN( TopmenuProcess0 ); FADE_OUT_RETURN( TopmenuProcess0 );
} }
}
#endif #endif
return AutoProcess3; return AutoProcess3;
} }
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/

View File

@ -15,6 +15,8 @@
$Author$ $Author$
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
#ifdef USE_WRITE_FONT_DATA
#include <twl.h> #include <twl.h>
#include <nitro/snd.h> #include <nitro/snd.h>
#include <twl/fatfs.h> #include <twl/fatfs.h>
@ -188,8 +190,16 @@ void* fontProcess2(void)
// Auto—p // Auto—p
if (gAutoFlag) if (gAutoFlag)
{ {
if (result) { FADE_OUT_RETURN( AutoProcess1 ); } if (result)
else { FADE_OUT_RETURN( AutoProcess2); } {
gAutoProcessResult[AUTO_PROCESS_MENU_FONT_DATA] = AUTO_PROCESS_RESULT_SUCCESS;
FADE_OUT_RETURN( AutoProcess1 );
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_FONT_DATA] = AUTO_PROCESS_RESULT_FAILURE;
FADE_OUT_RETURN( AutoProcess2);
}
} }
#endif #endif
@ -270,3 +280,4 @@ static BOOL WriteFontData(void)
return result; return result;
} }
#endif // USE_WRITE_FONT_DATA

View File

@ -355,8 +355,16 @@ void* FormatProcess3(void)
// Auto—p // Auto—p
if (gAutoFlag) if (gAutoFlag)
{ {
if (sFormatResult) { FADE_OUT_RETURN( AutoProcess1 ); } if (sFormatResult)
else { FADE_OUT_RETURN( AutoProcess2 ); } {
gAutoProcessResult[AUTO_PROCESS_MENU_FORMAT] = AUTO_PROCESS_RESULT_SUCCESS;
FADE_OUT_RETURN( AutoProcess1 );
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_FORMAT] = AUTO_PROCESS_RESULT_FAILURE;
FADE_OUT_RETURN( AutoProcess2 );
}
} }
#endif #endif

View File

@ -260,8 +260,16 @@ void* HWInfoProcess2(void)
// Auto—p // Auto—p
if (gAutoFlag) if (gAutoFlag)
{ {
if (result) { FADE_OUT_RETURN( AutoProcess1 ); } if (result)
else { FADE_OUT_RETURN( AutoProcess2 ); } {
gAutoProcessResult[AUTO_PROCESS_MENU_HARDWARE_INFO] = AUTO_PROCESS_RESULT_SUCCESS;
FADE_OUT_RETURN( AutoProcess1 );
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_HARDWARE_INFO] = AUTO_PROCESS_RESULT_FAILURE;
FADE_OUT_RETURN( AutoProcess2 );
}
} }
#endif #endif

View File

@ -370,8 +370,16 @@ static void* ImportAllOverwriteProcess0(void)
// Auto—p // Auto—p
if (gAutoFlag) if (gAutoFlag)
{ {
if (result && sFileNum > 0) { FADE_OUT_RETURN( AutoProcess1 ); } if (result && sFileNum > 0)
else { FADE_OUT_RETURN( AutoProcess2 ); } {
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_TAD] = AUTO_PROCESS_RESULT_SUCCESS;
FADE_OUT_RETURN( AutoProcess1 );
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_TAD] = AUTO_PROCESS_RESULT_FAILURE;
FADE_OUT_RETURN( AutoProcess2 );
}
} }
return ImportProcess1; return ImportProcess1;

View File

@ -28,33 +28,39 @@
#include "cursor.h" #include "cursor.h"
#include "keypad.h" #include "keypad.h"
extern void MakeFullPathForSD(char* file_name, char* full_path);
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
Œ^è`
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
#define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1))
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
#define NUM_OF_MENU_SELECT 2 #define DOT_OF_MENU_SPACE 8
#define DOT_OF_MENU_SPACE 16 #define CHAR_OF_MENU_SPACE 1
#define CURSOR_ORIGIN_X 32 #define CURSOR_ORIGIN_X 32
#define CURSOR_ORIGIN_Y 56 #define CURSOR_ORIGIN_Y 40
#define ROUND_UP(value, alignment) \ #define FILE_NUM_MAX 16
(((u32)(value) + (alignment-1)) & ~(alignment-1))
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
static s8 sMenuSelectNo; static s8 sMenuSelectNo;
static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX];
static u8 sFileNum;
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
static BOOL WriteMcuData(void); static BOOL WriteMcuData(char* full_path);
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
@ -72,6 +78,7 @@ static BOOL WriteMcuData(void);
void* mcuProcess0(void) void* mcuProcess0(void)
{ {
FSFile dir;
int i; int i;
// 文字列全クリア // 文字列全クリア
@ -81,12 +88,11 @@ void* mcuProcess0(void)
kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write MCU Data"); kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write MCU Data");
kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------");
// ƒ<>ƒjƒ…<C692>[ˆê—— // 配列クリア
kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+"); MI_CpuClear8( sFilePath, sizeof(sFilePath) );
kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l WRITE MCU DATA l l");
kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+"); // ファイル数初期化
kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l RETURN l l"); sFileNum = 0;
kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+-------------------+-----+");
// 背景全クリア // 背景全クリア
for (i=0;i<24;i++) for (i=0;i<24;i++)
@ -99,6 +105,69 @@ void* mcuProcess0(void)
kamiFontFillChar( 1, BG_COLOR_GRAY, BG_COLOR_GRAY ); kamiFontFillChar( 1, BG_COLOR_GRAY, BG_COLOR_GRAY );
kamiFontFillChar( 2, BG_COLOR_GRAY, BG_COLOR_TRANS ); kamiFontFillChar( 2, BG_COLOR_GRAY, BG_COLOR_TRANS );
// SDカードのルートディレクトリを検索
if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) )
{
OS_Printf("Error FS_OpenDirectory(sdmc:/)\n");
kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "Error FS_OpenDirectory(sdmc:/)");
}
else
{
FSDirectoryEntryInfo info[1];
OS_Printf("[%s]:\n", "sdmc:/");
kamiFontPrintfConsole(CONSOLE_ORANGE, "------ hex file list -----\n");
// .hex を探してファイル名を保存しておく
while (FS_ReadDirectory(&dir, info))
{
OS_Printf(" %s", info->longname);
if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0)
{
OS_Printf("/\n");
}
else
{
char* pExtension;
OS_Printf(" (%d BYTEs)\n", info->filesize);
// 拡張子のチェック
pExtension = STD_SearchCharReverse( info->longname, '.');
if (pExtension)
{
if (!STD_CompareString( pExtension, ".hex") || !STD_CompareString( pExtension, ".HEX"))
{
STD_CopyString( sFilePath[sFileNum], info->longname );
kamiFontPrintfConsole(CONSOLE_ORANGE, "%d:%s\n", sFileNum, info->longname);
// 最大16個で終了
if (++sFileNum >= FILE_NUM_MAX)
{
break;
}
}
}
}
}
(void)FS_CloseDirectory(&dir);
kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n");
}
// メニュー一覧
kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+");
kamiFontPrintf((s16)3, (s16)(5+sFileNum+1), FONT_COLOR_BLACK, "+--------------------+----+");
// tad ファイルリストを表示
for (i=0;i<sFileNum; i++)
{
// ファイル名追加
kamiFontPrintf((s16)3, (s16)(5+CHAR_OF_MENU_SPACE*i), FONT_COLOR_BLACK, "l %-16.16s l l", sFilePath[i]);
}
// 最後にリターンを追加
kamiFontPrintf((s16)3, (s16)(5+CHAR_OF_MENU_SPACE*sFileNum), FONT_COLOR_BLACK, "l RETURN l l");
// カーソル消去 // カーソル消去
SetCursorPos((u16)200, (u16)200); SetCursorPos((u16)200, (u16)200);
@ -117,7 +186,6 @@ void* mcuProcess0(void)
void* mcuProcess1(void) void* mcuProcess1(void)
{ {
/*
#ifndef NAND_INITIALIZER_LIMITED_MODE #ifndef NAND_INITIALIZER_LIMITED_MODE
// オート実行用 // オート実行用
if (gAutoFlag) if (gAutoFlag)
@ -126,16 +194,15 @@ void* mcuProcess1(void)
return mcuProcess2; return mcuProcess2;
} }
#endif #endif
*/
// 選択メニューの変更 // 選択メニューの変更
if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) )
{ {
if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; if (--sMenuSelectNo < 0) sMenuSelectNo = (s8)sFileNum;
} }
else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) )
{ {
if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; if (++sMenuSelectNo > sFileNum) sMenuSelectNo = 0;
} }
// カーソル配置 // カーソル配置
@ -168,33 +235,50 @@ void* mcuProcess1(void)
void* mcuProcess2(void) void* mcuProcess2(void)
{ {
BOOL result; BOOL result;
char full_path[FS_ENTRY_LONGNAME_MAX+6];
switch( sMenuSelectNo ) if (STD_GetStringLength(sFilePath[sMenuSelectNo]))
{ {
case 0: kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_BLACK, "WAIT");
result = WriteMcuData(); kamiFontLoadScreenData();
if (result)
{ // .hexのフルパスを作成
kamiFontPrintf(25, 7, FONT_COLOR_GREEN, "OK"); MakeFullPathForSD(sFilePath[sMenuSelectNo], full_path);
result = WriteMcuData(full_path);
} }
else else
{ {
kamiFontPrintf(25, 7, FONT_COLOR_RED, "NG"); if (gAutoFlag) { FADE_OUT_RETURN( AutoProcess2 ); }
else { FADE_OUT_RETURN( TopmenuProcess0 ); }
} }
break;
case 1: // 今回の結果を表示
FADE_OUT_RETURN( TopmenuProcess0 ); if ( result == TRUE )
{
kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "OK");
} }
/* else
{
kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_RED, "NG");
}
#ifndef NAND_INITIALIZER_LIMITED_MODE #ifndef NAND_INITIALIZER_LIMITED_MODE
// Auto用 // Auto用
if (gAutoFlag) if (gAutoFlag)
{ {
if (result) { FADE_OUT_RETURN( AutoProcess1 ); } if (result)
else { FADE_OUT_RETURN( AutoProcess2); } {
gAutoProcessResult[AUTO_PROCESS_MENU_MCU] = AUTO_PROCESS_RESULT_SUCCESS;
FADE_OUT_RETURN( AutoProcess1 );
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_MCU] = AUTO_PROCESS_RESULT_FAILURE;
FADE_OUT_RETURN( AutoProcess2);
}
} }
#endif #endif
*/
return mcuProcess1; return mcuProcess1;
} }
@ -202,7 +286,7 @@ void* mcuProcess2(void)
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
static BOOL WriteMcuData(void) static BOOL WriteMcuData(char* full_path)
{ {
FSFile file; FSFile file;
BOOL open_is_ok; BOOL open_is_ok;
@ -214,10 +298,10 @@ static BOOL WriteMcuData(void)
// ROMファイルオープン // ROMファイルオープン
FS_InitFile(&file); FS_InitFile(&file);
open_is_ok = FS_OpenFile(&file, MCU_DATA_FILE_PATH_IN_ROM); open_is_ok = FS_OpenFile(&file, full_path);
if (!open_is_ok) if (!open_is_ok)
{ {
OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", MCU_DATA_FILE_PATH_IN_ROM); OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", full_path);
return FALSE; return FALSE;
} }
@ -230,7 +314,7 @@ static BOOL WriteMcuData(void)
read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size );
if (!read_is_ok) if (!read_is_ok)
{ {
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", MCU_DATA_FILE_PATH_IN_ROM); kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", full_path);
FS_CloseFile(&file); FS_CloseFile(&file);
OS_Free(pTempBuf); OS_Free(pTempBuf);
return FALSE; return FALSE;

View File

@ -39,9 +39,6 @@
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
// NANDファーム書き込みの際にNVRAMの未割り当て領域予約領域をクリアする場合は定義します開発用
//#define CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL
#define ROUND_UP(value, alignment) \ #define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1)) (((u32)(value) + (alignment-1)) & ~(alignment-1))
@ -56,16 +53,6 @@
#define FILE_NUM_MAX 16 #define FILE_NUM_MAX 16
#define NAND_BLOCK_BYTE 0x200
#define NAND_FIRM_START_OFFSET 0x200
#define NVRAM_PAGE_SIZE 0x100
#define NVRAM_NORFIRM_RESERVED_ADDRESS 0x200
#define NVRAM_NORFIRM_NANDBOOT_FLAG_OFFSET 0xff
#define NVRAM_NORFIRM_NANDBOOT_FLAG 0x80
#define NVRAM_NON_ASIGNED_AREA_ADDRESS 0x300
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
@ -73,14 +60,12 @@
static s32 sMenuSelectNo; static s32 sMenuSelectNo;
static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX];
static u8 sFileNum; static u8 sFileNum;
static u8 sNvramPageSizeBuffer[NVRAM_PAGE_SIZE] ATTRIBUTE_ALIGN(32); // ARM7からアクセスするためスタックでは駄目
static u32 sReservedAreaEndAddress;
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
ŠÖ<EFBFBD><EFBFBD>錾
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
static void MakeFullPathForSD(char* file_name, char* full_path); void MakeFullPathForSD(char* file_name, char* full_path);
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
@ -280,8 +265,16 @@ void* NandfirmProcess2(void)
// Auto用 // Auto用
if (gAutoFlag) if (gAutoFlag)
{ {
if (ret) { FADE_OUT_RETURN( AutoProcess1 ); } if (ret)
else { FADE_OUT_RETURN( AutoProcess2 ); } {
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_SUCCESS;
FADE_OUT_RETURN( AutoProcess1 );
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_FAILURE;
FADE_OUT_RETURN( AutoProcess2 );
}
} }
return NandfirmProcess1; return NandfirmProcess1;
@ -300,7 +293,7 @@ void* NandfirmProcess2(void)
Returns: None. Returns: None.
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
static void MakeFullPathForSD(char* file_name, char* full_path) void MakeFullPathForSD(char* file_name, char* full_path)
{ {
// フルパスを作成 // フルパスを作成
STD_CopyString( full_path, "sdmc:/" ); STD_CopyString( full_path, "sdmc:/" );