(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:
kamikawa 2008-08-18 12:11:41 +00:00
parent 132d0df9b8
commit f81e05fbf3
5 changed files with 36 additions and 198 deletions

View File

@ -71,7 +71,6 @@
#define THREAD_PRIO_SNDEX 14
#define THREAD_PRIO_FS 15
/* OS_THREAD_LAUNCHER_PRIORITY 16 */
#define THREAD_PRIO_IDEL (OS_THREAD_PRIORITY_MAX-1)
#define NWM_DMANO NWMSP_DMA_NOT_USE // NWMのNDMAは使用しない。
#define THREAD_PRIO_NWM_COMMMAND 9
@ -123,10 +122,6 @@ extern BOOL sdmcGetNandLogFatal( void );
void
TwlSpMain(void)
{
// 常駐ダミースレッド作成OS_InitThreadで対応されたら削除
OSThread thread;
u32 stack[18];
OSHeapHandle wramHeapHandle, mainHeapHandle;
u32 spiLockId;
@ -148,14 +143,6 @@ TwlSpMain(void)
OS_Init();
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;
@ -433,31 +420,18 @@ PrintDebugInfo(void)
#include <twl/ltdwram_begin.h>
/*---------------------------------------------------------------------------*
Name: InitializeFatfs
Description: FATFSライブラリを初期化するFATFS初期化関数内でスレッド休止
Description: FATFSライブラリを初期化する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static 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ライブラリの初期化
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
{
// do nothing
}
// ダミースレッド破棄
OS_KillThread(&thread, NULL);
}
#include <twl/ltdwram_end.h>
@ -494,44 +468,16 @@ InitializeNwm(OSArenaId drvArenaId, OSHeapHandle drvHeapHandle,
#include <twl/ltdwram_begin.h>
/*---------------------------------------------------------------------------*
Name: InitializeCdc
Description: CDCライブラリを初期化するCDC初期化関数内でスレッド休止する
Description: CDCライブラリを初期化する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static void
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排他ロック
CDC_InitForFirstBoot(); // ※ランチャー特殊処理。
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>

View File

@ -60,7 +60,6 @@ SRCDIR = src \
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)

View File

@ -78,7 +78,6 @@ static void InitializeFatfs(void);
static void InitializeNwm(OSHeapHandle hh);
static void InitializeCardPower(void);
static void InitializeCdc(void);
static void DummyThread(void* arg);
static void ReadUserInfo(void);
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
@ -225,31 +224,18 @@ InitializeAllocateSystem(void)
/*---------------------------------------------------------------------------*
Name: InitializeFatfs
Description: FATFSライブラリを初期化するFATFS初期化関数内でスレッド休止
Description: FATFSライブラリを初期化する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static 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ライブラリの初期化
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
{
// do nothing
}
// ダミースレッド破棄
OS_KillThread(&thread, NULL);
}
/*---------------------------------------------------------------------------*
@ -289,14 +275,6 @@ InitializeNwm(OSHeapHandle hh)
static 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) |
(CHATTERING_COUNTER << REG_MI_MC1_CC_SHIFT));
@ -306,23 +284,17 @@ InitializeCardPower(void)
// カードスロット電源ON
HOTSWi_TurnCardPowerOn(1);
/* ダミースレッド破棄 */
OS_KillThread(&thread, NULL);
}
/*---------------------------------------------------------------------------*
Name: InitializeCdc
Description: CDCライブラリを初期化するCDC初期化関数内でスレッド休止する
Description: CDCライブラリを初期化する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static void
InitializeCdc(void)
{
OSThread thread;
u32 stack[18];
u32 spiLockId;
spiLockId = (u32)OS_GetLockID();
@ -331,34 +303,10 @@ InitializeCdc(void)
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 初期化 */
SPI_Lock(spiLockId);
CDC_Init();
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

View File

@ -73,7 +73,6 @@
static void PrintDebugInfo(void);
static OSHeapHandle InitializeAllocateSystem(void);
static void InitializeFatfs(void);
static void DummyThread(void* arg);
static void ReadUserInfo(void);
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
@ -125,7 +124,7 @@ TwlSpMain(void)
// InitializeNwm(heapHandle); // TWL 無線
MCU_InitIrq(THREAD_PRIO_MCU); // マイコン
CDC_InitLib(); // CODECライブラリ初期化
CAMERA_Init(); // カメラ
CAMERA_Init(); // カメラ
SND_Init(THREAD_PRIO_SND); // サウンド
SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張
@ -225,39 +224,11 @@ InitializeAllocateSystem(void)
static 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ライブラリの初期化
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
{
// 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

View File

@ -44,15 +44,16 @@ typedef struct FileProperty {
#define ERROR_RETURN() { OS_TPrintf("FATAL ERROR OCCURED %s %s\n", __FILE__, __LINE__); return 0; }
//------- 重要 --------
#define NAND_SIZE 239
#define PARTITION_RAW_SIZE 1
#define PARTITION_0_SIZE 206
#define PARTITION_1_SIZE 32
#define NAND_FAT_PARTITION_NUM 2 // FATパーティション数RAWパーティションを除く
#define PARTITION_RAW_SIZE 1024 // 1*1024
#define PARTITION_0_SIZE 210944 // 206*1024
#define PARTITION_1_SIZE 33536 // 32.75*1024
#define NAND_FAT_PARTITION_NUM 3 // FATパーティション数RAWパーティションを除く
// 実際には PARTITION 0&1 の2つだけですが3を指定します。
// 最終PARTISIONのサイズ指定は無視され残りサイズが適用されるためです。
// PARTISION2 には残りサイズが適用されますが使用しないため
// フォーマットは行いません。
// const data--------------------------------------------------------
//#define NAND_SEPARATE_READ
#define FS_READ_BLOCK_SIZE ( 2 * 1024 )
#define FATFS_CLUSTER_SIZE ( 16 * 1024 )
@ -62,16 +63,22 @@ static const char *s_pDirList0[] = {
(const char *)"nand:/ticket",
(const char *)"nand:/shared1",
(const char *)"nand:/shared2",
(const char *)"nand:/shared2/launcher",
(const char *)"nand:/import",
(const char *)"nand:/tmp",
NULL,
};
};
static const char *s_pDirList1[] = {
(const char *)"nand2:/photo",
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)
{
u32 *init_datbuf;
const int INIT_DATA_BUFFER_SIZE = 512*16;
int nand_fat_partition_num;
init_datbuf = OS_AllocFromSubPrivWram( 512*16 );
init_datbuf = OS_AllocFromSubPrivWram( INIT_DATA_BUFFER_SIZE );
if( init_datbuf == NULL ) {
OS_TPrintf( "memory allocate error.\n" );
ERROR_RETURN();
}
MI_CpuFill8( init_datbuf, 0xFF, 512*16);
MI_CpuFill8( init_datbuf, 0xFF, INIT_DATA_BUFFER_SIZE);
// NANDをフォーマット
{
int i;
u8 drive_nand;
u8 drive_nand2;
char drive_nand_path[4];
@ -158,7 +165,7 @@ ExeFormat(FormatMode format_mode)
// NANDのパーティションを指定
// sizeInMB : パーティションサイズをメガバイト単位で格納した配列
// 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))
@ -174,7 +181,7 @@ ExeFormat(FormatMode format_mode)
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;
}
@ -186,23 +193,17 @@ ExeFormat(FormatMode format_mode)
else
{
// 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;
}
else if (!FATFS_FormatDrive(drive_nand2_path))
{
return FALSE;
}
return FALSE;
}
else if (!FATFS_FormatDrive(drive_nand2_path))
{
return FALSE;
}
}
}
@ -219,8 +220,8 @@ ExeFormat(FormatMode format_mode)
if (!CheckDirectory ( "nand2:", s_pDirList1 )) { return FALSE; }
// ファイル生成&チェック
// if (!CreateFile( &s_fileList[0] )) { return FALSE; }
// if (!CheckFile ( &s_fileList[0] )) { return FALSE; }
if (!CreateFile( &s_fileList[0] )) { return FALSE; }
if (!CheckFile ( &s_fileList[0] )) { return FALSE; }
// 成功
return TRUE;
@ -307,7 +308,7 @@ static BOOL CreateFile( const FileProperty *pFileList )
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" );
ERROR_RETURN();
}
@ -350,7 +351,6 @@ static BOOL CheckFile( const FileProperty *pFileList )
FATFSFileHandle file;
u32 *pBuffer;
int i;
OSTick start;
OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length );
// ファイルオープン
@ -370,20 +370,13 @@ static BOOL CheckFile( const FileProperty *pFileList )
OS_TPrintf( "memory allocate error.\n" );
ERROR_RETURN();
}
start = OS_GetTick();
// ファイル読み込み
if(
#ifdef NAND_SEPARATE_READ
MY_ReadFile( file, pBuffer, (int)pFileList->length )
#else
FATFS_ReadFile( file, pBuffer, (int)pFileList->length )
#endif
!= pFileList->length ) {
OS_TPrintf( "ng.\n" );
ERROR_RETURN();
}
OS_TPrintf( " [ReadTime : %dms] ", OS_TicksToMilliSeconds( OS_GetTick() - start ) );
start = OS_GetTick();
// ファイルベリファイ
for( i = 0; i < pFileList->length / sizeof(u32); i++ ) {
if( pBuffer[ i ] != 0 ) {
@ -391,7 +384,6 @@ static BOOL CheckFile( const FileProperty *pFileList )
ERROR_RETURN();
}
}
OS_TPrintf( " [VerifyTime : %dms] ", OS_TicksToMilliSeconds( OS_GetTick() - start ) );
// メモリ解放
OS_FreeToSubPrivWram( pBuffer );
// ファイルクローズ
@ -402,21 +394,3 @@ static BOOL CheckFile( const FileProperty *pFileList )
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