mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
(hyena/その他) OSでARM7側のIdleThreadが作成されるようになったためダミースレッドの作成を廃止。
(NandInitialzer*/SystemUpdater) パーティションサイズ1が32MByte固定で作成されるように変更。 (NandInitialzer*) nand:shared2/launcher/wrap.bin を仮作成するように変更。(ダイレクトブートでのNAMUT_Formatを成功させるため) git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2182 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
132d0df9b8
commit
f81e05fbf3
@ -71,7 +71,6 @@
|
|||||||
#define THREAD_PRIO_SNDEX 14
|
#define THREAD_PRIO_SNDEX 14
|
||||||
#define THREAD_PRIO_FS 15
|
#define THREAD_PRIO_FS 15
|
||||||
/* OS_THREAD_LAUNCHER_PRIORITY 16 */
|
/* OS_THREAD_LAUNCHER_PRIORITY 16 */
|
||||||
#define THREAD_PRIO_IDEL (OS_THREAD_PRIORITY_MAX-1)
|
|
||||||
|
|
||||||
#define NWM_DMANO NWMSP_DMA_NOT_USE // NWMのNDMAは使用しない。
|
#define NWM_DMANO NWMSP_DMA_NOT_USE // NWMのNDMAは使用しない。
|
||||||
#define THREAD_PRIO_NWM_COMMMAND 9
|
#define THREAD_PRIO_NWM_COMMMAND 9
|
||||||
@ -123,10 +122,6 @@ extern BOOL sdmcGetNandLogFatal( void );
|
|||||||
void
|
void
|
||||||
TwlSpMain(void)
|
TwlSpMain(void)
|
||||||
{
|
{
|
||||||
// 常駐ダミースレッド作成(OS_InitThreadで対応されたら削除)
|
|
||||||
OSThread thread;
|
|
||||||
u32 stack[18];
|
|
||||||
|
|
||||||
OSHeapHandle wramHeapHandle, mainHeapHandle;
|
OSHeapHandle wramHeapHandle, mainHeapHandle;
|
||||||
u32 spiLockId;
|
u32 spiLockId;
|
||||||
|
|
||||||
@ -148,14 +143,6 @@ TwlSpMain(void)
|
|||||||
OS_Init();
|
OS_Init();
|
||||||
PrintDebugInfo();
|
PrintDebugInfo();
|
||||||
|
|
||||||
// 常駐ダミーアイドルスレッド作成(OS_InitThreadで対応されたら削除)
|
|
||||||
if (OS_IsRunOnTwl() == TRUE)
|
|
||||||
{
|
|
||||||
OS_CreateThread(&thread, DummyThread, NULL,
|
|
||||||
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, THREAD_PRIO_IDEL);
|
|
||||||
OS_WakeupThreadDirect(&thread);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ランチャーバージョンを格納(今のところ、最低でもマウント情報登録前には格納する必要あり)
|
// ランチャーバージョンを格納(今のところ、最低でもマウント情報登録前には格納する必要あり)
|
||||||
*(u8 *)HW_TWL_RED_LAUNCHER_VER = (u8)SYSM_LAUNCHER_VER;
|
*(u8 *)HW_TWL_RED_LAUNCHER_VER = (u8)SYSM_LAUNCHER_VER;
|
||||||
|
|
||||||
@ -433,31 +420,18 @@ PrintDebugInfo(void)
|
|||||||
#include <twl/ltdwram_begin.h>
|
#include <twl/ltdwram_begin.h>
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: InitializeFatfs
|
Name: InitializeFatfs
|
||||||
Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止
|
Description: FATFSライブラリを初期化する。
|
||||||
する為、休止中動作するダミーのスレッドを立てる。
|
|
||||||
Arguments: None.
|
Arguments: None.
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
InitializeFatfs(void)
|
InitializeFatfs(void)
|
||||||
{
|
{
|
||||||
OSThread thread;
|
|
||||||
u32 stack[18];
|
|
||||||
|
|
||||||
// ダミースレッド作成
|
|
||||||
OS_CreateThread(&thread, DummyThread, NULL,
|
|
||||||
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX);
|
|
||||||
OS_WakeupThreadDirect(&thread);
|
|
||||||
|
|
||||||
|
|
||||||
// FATFSライブラリの初期化
|
// FATFSライブラリの初期化
|
||||||
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
|
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
// ダミースレッド破棄
|
|
||||||
OS_KillThread(&thread, NULL);
|
|
||||||
}
|
}
|
||||||
#include <twl/ltdwram_end.h>
|
#include <twl/ltdwram_end.h>
|
||||||
|
|
||||||
@ -494,44 +468,16 @@ InitializeNwm(OSArenaId drvArenaId, OSHeapHandle drvHeapHandle,
|
|||||||
#include <twl/ltdwram_begin.h>
|
#include <twl/ltdwram_begin.h>
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: InitializeCdc
|
Name: InitializeCdc
|
||||||
Description: CDCライブラリを初期化する。CDC初期化関数内でスレッド休止する
|
Description: CDCライブラリを初期化する。
|
||||||
為、休止中動作するダミーのスレッドを立てる。
|
|
||||||
Arguments: None.
|
Arguments: None.
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
InitializeCdc(u32 lockId)
|
InitializeCdc(u32 lockId)
|
||||||
{
|
{
|
||||||
OSThread thread;
|
|
||||||
u32 stack[18];
|
|
||||||
|
|
||||||
// ダミースレッド作成
|
|
||||||
OS_CreateThread(&thread, DummyThread, NULL,
|
|
||||||
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX);
|
|
||||||
OS_WakeupThreadDirect(&thread);
|
|
||||||
|
|
||||||
SPI_Lock(lockId); // CODEC用SPI排他ロック
|
SPI_Lock(lockId); // CODEC用SPI排他ロック
|
||||||
CDC_InitForFirstBoot(); // ※ランチャー特殊処理。
|
CDC_InitForFirstBoot(); // ※ランチャー特殊処理。
|
||||||
SPI_Unlock(lockId); // CODEC用SPI排他ロック
|
SPI_Unlock(lockId); // CODEC用SPI排他ロック
|
||||||
|
|
||||||
// ダミースレッド破棄
|
|
||||||
OS_KillThread(&thread, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Name: DummyThread
|
|
||||||
Description: FATFSライブラリ、CDCライブラリを初期化する際に立てるダミーの
|
|
||||||
スレッド。
|
|
||||||
Arguments: arg - 使用しない。
|
|
||||||
Returns: None.
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
DummyThread(void* arg)
|
|
||||||
{
|
|
||||||
#pragma unused(arg)
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#include <twl/ltdwram_end.h>
|
#include <twl/ltdwram_end.h>
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,6 @@ SRCDIR = src \
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
||||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
|
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)
|
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)
|
||||||
|
|||||||
@ -78,7 +78,6 @@ static void InitializeFatfs(void);
|
|||||||
static void InitializeNwm(OSHeapHandle hh);
|
static void InitializeNwm(OSHeapHandle hh);
|
||||||
static void InitializeCardPower(void);
|
static void InitializeCardPower(void);
|
||||||
static void InitializeCdc(void);
|
static void InitializeCdc(void);
|
||||||
static void DummyThread(void* arg);
|
|
||||||
|
|
||||||
static void ReadUserInfo(void);
|
static void ReadUserInfo(void);
|
||||||
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
||||||
@ -225,31 +224,18 @@ InitializeAllocateSystem(void)
|
|||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: InitializeFatfs
|
Name: InitializeFatfs
|
||||||
Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止
|
Description: FATFSライブラリを初期化する。
|
||||||
する為、休止中動作するダミーのスレッドを立てる。
|
|
||||||
Arguments: None.
|
Arguments: None.
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
InitializeFatfs(void)
|
InitializeFatfs(void)
|
||||||
{
|
{
|
||||||
OSThread thread;
|
|
||||||
u32 stack[18];
|
|
||||||
|
|
||||||
// ダミースレッド作成
|
|
||||||
OS_CreateThread(&thread, DummyThread, NULL,
|
|
||||||
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX);
|
|
||||||
OS_WakeupThreadDirect(&thread);
|
|
||||||
|
|
||||||
|
|
||||||
// FATFSライブラリの初期化
|
// FATFSライブラリの初期化
|
||||||
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
|
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
// ダミースレッド破棄
|
|
||||||
OS_KillThread(&thread, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
@ -289,14 +275,6 @@ InitializeNwm(OSHeapHandle hh)
|
|||||||
static void
|
static void
|
||||||
InitializeCardPower(void)
|
InitializeCardPower(void)
|
||||||
{
|
{
|
||||||
OSThread thread;
|
|
||||||
u32 stack[18];
|
|
||||||
|
|
||||||
/* ダミースレッド作成 */
|
|
||||||
OS_CreateThread(&thread, DummyThread, NULL,
|
|
||||||
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX);
|
|
||||||
OS_WakeupThreadDirect(&thread);
|
|
||||||
|
|
||||||
// チャッタリングカウンタの値を設定
|
// チャッタリングカウンタの値を設定
|
||||||
reg_MI_MC1 = (u32)((reg_MI_MC1 & ~REG_MI_MC1_CC_MASK) |
|
reg_MI_MC1 = (u32)((reg_MI_MC1 & ~REG_MI_MC1_CC_MASK) |
|
||||||
(CHATTERING_COUNTER << REG_MI_MC1_CC_SHIFT));
|
(CHATTERING_COUNTER << REG_MI_MC1_CC_SHIFT));
|
||||||
@ -306,23 +284,17 @@ InitializeCardPower(void)
|
|||||||
|
|
||||||
// カードスロット1電源ON
|
// カードスロット1電源ON
|
||||||
HOTSWi_TurnCardPowerOn(1);
|
HOTSWi_TurnCardPowerOn(1);
|
||||||
|
|
||||||
/* ダミースレッド破棄 */
|
|
||||||
OS_KillThread(&thread, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: InitializeCdc
|
Name: InitializeCdc
|
||||||
Description: CDCライブラリを初期化する。CDC初期化関数内でスレッド休止する
|
Description: CDCライブラリを初期化する。
|
||||||
為、休止中動作するダミーのスレッドを立てる。
|
|
||||||
Arguments: None.
|
Arguments: None.
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
InitializeCdc(void)
|
InitializeCdc(void)
|
||||||
{
|
{
|
||||||
OSThread thread;
|
|
||||||
u32 stack[18];
|
|
||||||
u32 spiLockId;
|
u32 spiLockId;
|
||||||
|
|
||||||
spiLockId = (u32)OS_GetLockID();
|
spiLockId = (u32)OS_GetLockID();
|
||||||
@ -331,34 +303,10 @@ InitializeCdc(void)
|
|||||||
OS_Warning("OS_GetLockID failed.\n");
|
OS_Warning("OS_GetLockID failed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ダミースレッド作成 */
|
|
||||||
OS_CreateThread(&thread, DummyThread, NULL,
|
|
||||||
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX);
|
|
||||||
OS_WakeupThreadDirect(&thread);
|
|
||||||
|
|
||||||
/* CODEC 初期化 */
|
/* CODEC 初期化 */
|
||||||
SPI_Lock(spiLockId);
|
SPI_Lock(spiLockId);
|
||||||
CDC_Init();
|
CDC_Init();
|
||||||
SPI_Unlock(spiLockId);
|
SPI_Unlock(spiLockId);
|
||||||
|
|
||||||
/* ダミースレッド破棄 */
|
|
||||||
OS_KillThread(&thread, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Name: DummyThread
|
|
||||||
Description: FATFSライブラリ、CDCライブラリを初期化する際に立てるダミーの
|
|
||||||
スレッド。
|
|
||||||
Arguments: arg - 使用しない。
|
|
||||||
Returns: None.
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
DummyThread(void* arg)
|
|
||||||
{
|
|
||||||
#pragma unused(arg)
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef WM_PRECALC_ALLOWEDCHANNEL
|
//#ifdef WM_PRECALC_ALLOWEDCHANNEL
|
||||||
|
|||||||
@ -73,7 +73,6 @@
|
|||||||
static void PrintDebugInfo(void);
|
static void PrintDebugInfo(void);
|
||||||
static OSHeapHandle InitializeAllocateSystem(void);
|
static OSHeapHandle InitializeAllocateSystem(void);
|
||||||
static void InitializeFatfs(void);
|
static void InitializeFatfs(void);
|
||||||
static void DummyThread(void* arg);
|
|
||||||
|
|
||||||
static void ReadUserInfo(void);
|
static void ReadUserInfo(void);
|
||||||
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
||||||
@ -125,7 +124,7 @@ TwlSpMain(void)
|
|||||||
// InitializeNwm(heapHandle); // TWL 無線
|
// InitializeNwm(heapHandle); // TWL 無線
|
||||||
MCU_InitIrq(THREAD_PRIO_MCU); // マイコン
|
MCU_InitIrq(THREAD_PRIO_MCU); // マイコン
|
||||||
CDC_InitLib(); // CODECライブラリ初期化
|
CDC_InitLib(); // CODECライブラリ初期化
|
||||||
CAMERA_Init(); // カメラ
|
CAMERA_Init(); // カメラ
|
||||||
|
|
||||||
SND_Init(THREAD_PRIO_SND); // サウンド
|
SND_Init(THREAD_PRIO_SND); // サウンド
|
||||||
SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張
|
SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張
|
||||||
@ -225,39 +224,11 @@ InitializeAllocateSystem(void)
|
|||||||
static void
|
static void
|
||||||
InitializeFatfs(void)
|
InitializeFatfs(void)
|
||||||
{
|
{
|
||||||
OSThread thread;
|
|
||||||
u32 stack[18];
|
|
||||||
|
|
||||||
// ダミースレッド作成
|
|
||||||
OS_CreateThread(&thread, DummyThread, NULL,
|
|
||||||
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX);
|
|
||||||
OS_WakeupThreadDirect(&thread);
|
|
||||||
|
|
||||||
|
|
||||||
// FATFSライブラリの初期化
|
// FATFSライブラリの初期化
|
||||||
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
|
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
// ダミースレッド破棄
|
|
||||||
OS_KillThread(&thread, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Name: DummyThread
|
|
||||||
Description: FATFSライブラリ、CDCライブラリを初期化する際に立てるダミーの
|
|
||||||
スレッド。
|
|
||||||
Arguments: arg - 使用しない。
|
|
||||||
Returns: None.
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
DummyThread(void* arg)
|
|
||||||
{
|
|
||||||
#pragma unused(arg)
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef WM_PRECALC_ALLOWEDCHANNEL
|
//#ifdef WM_PRECALC_ALLOWEDCHANNEL
|
||||||
|
|||||||
@ -44,15 +44,16 @@ typedef struct FileProperty {
|
|||||||
#define ERROR_RETURN() { OS_TPrintf("FATAL ERROR OCCURED %s %s\n", __FILE__, __LINE__); return 0; }
|
#define ERROR_RETURN() { OS_TPrintf("FATAL ERROR OCCURED %s %s\n", __FILE__, __LINE__); return 0; }
|
||||||
|
|
||||||
//------- 重要 --------
|
//------- 重要 --------
|
||||||
#define NAND_SIZE 239
|
#define PARTITION_RAW_SIZE 1024 // 1*1024
|
||||||
#define PARTITION_RAW_SIZE 1
|
#define PARTITION_0_SIZE 210944 // 206*1024
|
||||||
#define PARTITION_0_SIZE 206
|
#define PARTITION_1_SIZE 33536 // 32.75*1024
|
||||||
#define PARTITION_1_SIZE 32
|
#define NAND_FAT_PARTITION_NUM 3 // FATパーティション数(RAWパーティションを除く)
|
||||||
#define NAND_FAT_PARTITION_NUM 2 // FATパーティション数(RAWパーティションを除く)
|
// 実際には PARTITION 0&1 の2つだけですが3を指定します。
|
||||||
|
// 最終PARTISIONのサイズ指定は無視され残りサイズが適用されるためです。
|
||||||
|
// PARTISION2 には残りサイズが適用されますが使用しないため
|
||||||
|
// フォーマットは行いません。
|
||||||
|
|
||||||
// const data--------------------------------------------------------
|
// const data--------------------------------------------------------
|
||||||
//#define NAND_SEPARATE_READ
|
|
||||||
#define FS_READ_BLOCK_SIZE ( 2 * 1024 )
|
#define FS_READ_BLOCK_SIZE ( 2 * 1024 )
|
||||||
#define FATFS_CLUSTER_SIZE ( 16 * 1024 )
|
#define FATFS_CLUSTER_SIZE ( 16 * 1024 )
|
||||||
|
|
||||||
@ -62,16 +63,22 @@ static const char *s_pDirList0[] = {
|
|||||||
(const char *)"nand:/ticket",
|
(const char *)"nand:/ticket",
|
||||||
(const char *)"nand:/shared1",
|
(const char *)"nand:/shared1",
|
||||||
(const char *)"nand:/shared2",
|
(const char *)"nand:/shared2",
|
||||||
|
(const char *)"nand:/shared2/launcher",
|
||||||
(const char *)"nand:/import",
|
(const char *)"nand:/import",
|
||||||
(const char *)"nand:/tmp",
|
(const char *)"nand:/tmp",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *s_pDirList1[] = {
|
static const char *s_pDirList1[] = {
|
||||||
(const char *)"nand2:/photo",
|
(const char *)"nand2:/photo",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const FileProperty s_fileList[] = {
|
||||||
|
{ FATFS_CLUSTER_SIZE, "nand:/shared2/launcher/wrap.bin" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
内部関数宣言
|
内部関数宣言
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
@ -95,19 +102,19 @@ BOOL
|
|||||||
ExeFormat(FormatMode format_mode)
|
ExeFormat(FormatMode format_mode)
|
||||||
{
|
{
|
||||||
u32 *init_datbuf;
|
u32 *init_datbuf;
|
||||||
|
const int INIT_DATA_BUFFER_SIZE = 512*16;
|
||||||
int nand_fat_partition_num;
|
int nand_fat_partition_num;
|
||||||
|
|
||||||
init_datbuf = OS_AllocFromSubPrivWram( 512*16 );
|
init_datbuf = OS_AllocFromSubPrivWram( INIT_DATA_BUFFER_SIZE );
|
||||||
if( init_datbuf == NULL ) {
|
if( init_datbuf == NULL ) {
|
||||||
OS_TPrintf( "memory allocate error.\n" );
|
OS_TPrintf( "memory allocate error.\n" );
|
||||||
ERROR_RETURN();
|
ERROR_RETURN();
|
||||||
}
|
}
|
||||||
|
|
||||||
MI_CpuFill8( init_datbuf, 0xFF, 512*16);
|
MI_CpuFill8( init_datbuf, 0xFF, INIT_DATA_BUFFER_SIZE);
|
||||||
|
|
||||||
// NANDをフォーマット
|
// NANDをフォーマット
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
u8 drive_nand;
|
u8 drive_nand;
|
||||||
u8 drive_nand2;
|
u8 drive_nand2;
|
||||||
char drive_nand_path[4];
|
char drive_nand_path[4];
|
||||||
@ -158,7 +165,7 @@ ExeFormat(FormatMode format_mode)
|
|||||||
// NANDのパーティションを指定
|
// NANDのパーティションを指定
|
||||||
// sizeInMB : パーティションサイズをメガバイト単位で格納した配列
|
// sizeInMB : パーティションサイズをメガバイト単位で格納した配列
|
||||||
// partitions : パーティション総数
|
// partitions : パーティション総数
|
||||||
if (FATFSi_SetNANDPartitions(partition_MB_size, nand_fat_partition_num))
|
if (FATFSi_SetNANDPartitionsKiroBytes(partition_MB_size, nand_fat_partition_num))
|
||||||
{
|
{
|
||||||
// マウント
|
// マウント
|
||||||
if (FATFS_MountDrive(drive_nand_path, FATFS_MEDIA_TYPE_NAND, 0))
|
if (FATFS_MountDrive(drive_nand_path, FATFS_MEDIA_TYPE_NAND, 0))
|
||||||
@ -174,7 +181,7 @@ ExeFormat(FormatMode format_mode)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// パーティション内を指定バッファの内容でフィルする
|
// パーティション内を指定バッファの内容でフィルする
|
||||||
else if (format_mode == FORMAT_MODE_FULL && !FATFSi_nandFillPartition( 0, init_datbuf, 16))
|
else if (format_mode == FORMAT_MODE_FULL && !FATFSi_nandFillPartition( 0, init_datbuf, INIT_DATA_BUFFER_SIZE))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -186,23 +193,17 @@ ExeFormat(FormatMode format_mode)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// FAT1パーティションの初期化
|
// FAT1パーティションの初期化
|
||||||
for (i = 1; i < nand_fat_partition_num; ++i)
|
if(!FATFS_MountDrive(drive_nand2_path, FATFS_MEDIA_TYPE_NAND, (u32)1))
|
||||||
{
|
{
|
||||||
if(!FATFS_MountDrive(drive_nand2_path, FATFS_MEDIA_TYPE_NAND, (u32)i))
|
return FALSE;
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (i = 1; i < nand_fat_partition_num; ++i)
|
if (format_mode == FORMAT_MODE_FULL && !FATFSi_nandFillPartition( 1, init_datbuf, INIT_DATA_BUFFER_SIZE))
|
||||||
{
|
{
|
||||||
if (format_mode == FORMAT_MODE_FULL && !FATFSi_nandFillPartition( i, init_datbuf, 16))
|
return FALSE;
|
||||||
{
|
}
|
||||||
return FALSE;
|
else if (!FATFS_FormatDrive(drive_nand2_path))
|
||||||
}
|
{
|
||||||
else if (!FATFS_FormatDrive(drive_nand2_path))
|
return FALSE;
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,8 +220,8 @@ ExeFormat(FormatMode format_mode)
|
|||||||
if (!CheckDirectory ( "nand2:", s_pDirList1 )) { return FALSE; }
|
if (!CheckDirectory ( "nand2:", s_pDirList1 )) { return FALSE; }
|
||||||
|
|
||||||
// ファイル生成&チェック
|
// ファイル生成&チェック
|
||||||
// if (!CreateFile( &s_fileList[0] )) { return FALSE; }
|
if (!CreateFile( &s_fileList[0] )) { return FALSE; }
|
||||||
// if (!CheckFile ( &s_fileList[0] )) { return FALSE; }
|
if (!CheckFile ( &s_fileList[0] )) { return FALSE; }
|
||||||
|
|
||||||
// 成功
|
// 成功
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -307,7 +308,7 @@ static BOOL CreateFile( const FileProperty *pFileList )
|
|||||||
|
|
||||||
OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length );
|
OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length );
|
||||||
// ファイル生成
|
// ファイル生成
|
||||||
if( !FATFS_CreateFile( pFileList->path, TRUE, "rwxrwxrwx" ) ) {
|
if( !FATFS_CreateFile( pFileList->path, TRUE, "rw\0rw\0rw\0" ) ) {
|
||||||
OS_TPrintf( "ng.\n" );
|
OS_TPrintf( "ng.\n" );
|
||||||
ERROR_RETURN();
|
ERROR_RETURN();
|
||||||
}
|
}
|
||||||
@ -350,7 +351,6 @@ static BOOL CheckFile( const FileProperty *pFileList )
|
|||||||
FATFSFileHandle file;
|
FATFSFileHandle file;
|
||||||
u32 *pBuffer;
|
u32 *pBuffer;
|
||||||
int i;
|
int i;
|
||||||
OSTick start;
|
|
||||||
|
|
||||||
OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length );
|
OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length );
|
||||||
// ファイルオープン
|
// ファイルオープン
|
||||||
@ -370,20 +370,13 @@ static BOOL CheckFile( const FileProperty *pFileList )
|
|||||||
OS_TPrintf( "memory allocate error.\n" );
|
OS_TPrintf( "memory allocate error.\n" );
|
||||||
ERROR_RETURN();
|
ERROR_RETURN();
|
||||||
}
|
}
|
||||||
start = OS_GetTick();
|
|
||||||
// ファイル読み込み
|
// ファイル読み込み
|
||||||
if(
|
if(
|
||||||
#ifdef NAND_SEPARATE_READ
|
|
||||||
MY_ReadFile( file, pBuffer, (int)pFileList->length )
|
|
||||||
#else
|
|
||||||
FATFS_ReadFile( file, pBuffer, (int)pFileList->length )
|
FATFS_ReadFile( file, pBuffer, (int)pFileList->length )
|
||||||
#endif
|
|
||||||
!= pFileList->length ) {
|
!= pFileList->length ) {
|
||||||
OS_TPrintf( "ng.\n" );
|
OS_TPrintf( "ng.\n" );
|
||||||
ERROR_RETURN();
|
ERROR_RETURN();
|
||||||
}
|
}
|
||||||
OS_TPrintf( " [ReadTime : %dms] ", OS_TicksToMilliSeconds( OS_GetTick() - start ) );
|
|
||||||
start = OS_GetTick();
|
|
||||||
// ファイルベリファイ
|
// ファイルベリファイ
|
||||||
for( i = 0; i < pFileList->length / sizeof(u32); i++ ) {
|
for( i = 0; i < pFileList->length / sizeof(u32); i++ ) {
|
||||||
if( pBuffer[ i ] != 0 ) {
|
if( pBuffer[ i ] != 0 ) {
|
||||||
@ -391,7 +384,6 @@ static BOOL CheckFile( const FileProperty *pFileList )
|
|||||||
ERROR_RETURN();
|
ERROR_RETURN();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OS_TPrintf( " [VerifyTime : %dms] ", OS_TicksToMilliSeconds( OS_GetTick() - start ) );
|
|
||||||
// メモリ解放
|
// メモリ解放
|
||||||
OS_FreeToSubPrivWram( pBuffer );
|
OS_FreeToSubPrivWram( pBuffer );
|
||||||
// ファイルクローズ
|
// ファイルクローズ
|
||||||
@ -402,21 +394,3 @@ static BOOL CheckFile( const FileProperty *pFileList )
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NAND_SEPARATE_READ
|
|
||||||
// NAND不具合をARM7側のFSは吸収しきれいていないので、自前で2KB単位に分割してリード
|
|
||||||
static int MY_ReadFile( FATFSFileHandle file, void *pBuffer, int length )
|
|
||||||
{
|
|
||||||
int length_bak = length;
|
|
||||||
while( length ) {
|
|
||||||
int rdLength = ( length > FS_READ_BLOCK_SIZE ) ? FS_READ_BLOCK_SIZE : length;
|
|
||||||
|
|
||||||
if( FATFS_ReadFile( file, pBuffer, rdLength ) != rdLength ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
pBuffer = (u8 *)pBuffer + rdLength;
|
|
||||||
length -= rdLength;
|
|
||||||
}
|
|
||||||
return length_bak;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user