TwlSDK 3893対応

バッテリ残量チェックの追加

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@531 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yutaka 2008-01-28 12:04:30 +00:00
parent 869eb95aeb
commit 2ade9e70f0
4 changed files with 98 additions and 58 deletions

View File

@ -62,7 +62,8 @@ static char* debugPtr = (char*)PRINT_MEMORY_ADDR;
#endif #endif
#define THREAD_PRIO_FATFS 8 #define THREAD_PRIO_FATFS 8
#define DMA_NO_FATFS 3 #define DMA_FATFS_1 3
#define DMA_FATFS_2 2
extern void* SDNandContext; /* NAND初期化パラメータ */ extern void* SDNandContext; /* NAND初期化パラメータ */
@ -93,6 +94,14 @@ static void CreateIdleThread(void)
***************************************************************/ ***************************************************************/
static void PreInit(void) static void PreInit(void)
{ {
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
/* /*
FromBrom関連 FromBrom関連
*/ */
@ -105,18 +114,6 @@ static void PreInit(void)
*/ */
#define FIRM_AVAILABLE_BIT 0x80000000UL #define FIRM_AVAILABLE_BIT 0x80000000UL
*(u32*)HW_RESET_PARAMETER_BUF = (u32)MCUi_ReadRegister( MCU_REG_TEMP_ADDR ) | FIRM_AVAILABLE_BIT; *(u32*)HW_RESET_PARAMETER_BUF = (u32)MCUi_ReadRegister( MCU_REG_TEMP_ADDR ) | FIRM_AVAILABLE_BIT;
/*
*/
//if ( MCUi_ReadRegister( MCU_REG_BATTELY ) < 0x02 )
//if ( MCUi_ReadRegister( MCU_REG_IRQ ) & MCU_IRQ_NO_BATTELY )
/*
TWLと識別できているかチェック
#ifdef USE_DEBUG_LED
SetDebugLED(OS_IsRunOnTwl() ? 0xC3 : 0xff);
OS_SpinWaitCpuCycles(0x1000000);
#endif
*/
} }
/*************************************************************** /***************************************************************
@ -132,6 +129,14 @@ static void PostInit(void)
AES_Init(); // for encrypted NAND AES_Init(); // for encrypted NAND
// アイドルスレッドの作成 // アイドルスレッドの作成
CreateIdleThread(); CreateIdleThread();
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
} }
/*************************************************************** /***************************************************************
@ -158,13 +163,14 @@ void TwlSpMain( void )
// 0: bootrom // 0: bootrom
profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif #endif
InitDebugLED(); InitDebugLED();
SetDebugLED(++step); // 0x81 SetDebugLED(++step); // 0x81
PreInit(); PreInit();
#ifdef PROFILE_ENABLE
// 1: after PreInit // 1: after PreInit
PUSH_PROFILE(); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif
SetDebugLED(++step); // 0x82 SetDebugLED(++step); // 0x82
OS_InitFIRM(); OS_InitFIRM();
@ -182,7 +188,7 @@ void TwlSpMain( void )
PM_BackLightOn( FALSE ); PM_BackLightOn( FALSE );
SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext; SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext;
if ( !FATFS_Init( DMA_NO_FATFS, THREAD_PRIO_FATFS ) ) if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) )
{ {
OS_TPrintf("Failed to call FATFS_Init().\n"); OS_TPrintf("Failed to call FATFS_Init().\n");
goto end; goto end;

View File

@ -62,7 +62,8 @@ static char* debugPtr = (char*)PRINT_MEMORY_ADDR;
#endif #endif
#define THREAD_PRIO_FATFS 8 #define THREAD_PRIO_FATFS 8
#define DMA_NO_FATFS 3 #define DMA_FATFS_1 3
#define DMA_FATFS_2 2
extern void* SDNandContext; /* NAND初期化パラメータ */ extern void* SDNandContext; /* NAND初期化パラメータ */
@ -93,6 +94,14 @@ static void CreateIdleThread(void)
***************************************************************/ ***************************************************************/
static void PreInit(void) static void PreInit(void)
{ {
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
/* /*
FromBrom関連 FromBrom関連
*/ */
@ -107,15 +116,11 @@ static void PreInit(void)
/* /*
*/ */
//if ( MCUi_ReadRegister( MCU_REG_BATTELY ) < 0x02 ) if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
//if ( MCUi_ReadRegister( MCU_REG_IRQ ) & MCU_IRQ_NO_BATTELY ) {
/* OS_TPrintf("Battery is empty.\n");
TWLと識別できているかチェック OS_Terminate();
#ifdef USE_DEBUG_LED }
SetDebugLED(OS_IsRunOnTwl() ? 0xC3 : 0xff);
OS_SpinWaitCpuCycles(0x1000000);
#endif
*/
} }
/*************************************************************** /***************************************************************
@ -131,6 +136,14 @@ static void PostInit(void)
AES_Init(); // for encrypted NAND AES_Init(); // for encrypted NAND
// アイドルスレッドの作成 // アイドルスレッドの作成
CreateIdleThread(); CreateIdleThread();
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
} }
/*************************************************************** /***************************************************************
@ -157,13 +170,14 @@ void TwlSpMain( void )
// 0: bootrom // 0: bootrom
profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif #endif
InitDebugLED(); InitDebugLED();
SetDebugLED(++step); // 0x81 SetDebugLED(++step); // 0x81
PreInit(); PreInit();
#ifdef PROFILE_ENABLE
// 1: after PreInit // 1: after PreInit
PUSH_PROFILE(); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif
SetDebugLED(++step); // 0x82 SetDebugLED(++step); // 0x82
OS_InitFIRM(); OS_InitFIRM();
@ -181,7 +195,7 @@ void TwlSpMain( void )
PM_BackLightOn( FALSE ); PM_BackLightOn( FALSE );
SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext; SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext;
if ( !FATFS_Init( DMA_NO_FATFS, THREAD_PRIO_FATFS ) ) if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) )
{ {
OS_TPrintf("Failed to call FATFS_Init().\n"); OS_TPrintf("Failed to call FATFS_Init().\n");
goto end; goto end;

View File

@ -62,7 +62,8 @@ static char* debugPtr = (char*)PRINT_MEMORY_ADDR;
#endif #endif
#define THREAD_PRIO_FATFS 8 #define THREAD_PRIO_FATFS 8
#define DMA_NO_FATFS 3 #define DMA_FATFS_1 3
#define DMA_FATFS_2 2
extern void* SDNandContext; /* NAND初期化パラメータ */ extern void* SDNandContext; /* NAND初期化パラメータ */
@ -93,6 +94,14 @@ static void CreateIdleThread(void)
***************************************************************/ ***************************************************************/
static void PreInit(void) static void PreInit(void)
{ {
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
/* /*
FromBrom関連 FromBrom関連
*/ */
@ -104,18 +113,6 @@ static void PreInit(void)
(1)(4) (1)(4)
*/ */
*(u32*)HW_RESET_PARAMETER_BUF = (u32)(MCU_GetFreeRegister( OS_MCU_RESET_VALUE_OFS ) | OS_MCU_RESET_VALUE_BUF_ENABLE_MASK); *(u32*)HW_RESET_PARAMETER_BUF = (u32)(MCU_GetFreeRegister( OS_MCU_RESET_VALUE_OFS ) | OS_MCU_RESET_VALUE_BUF_ENABLE_MASK);
/*
*/
//if ( MCUi_ReadRegister( MCU_REG_BATTELY ) < 0x02 )
//if ( MCUi_ReadRegister( MCU_REG_IRQ ) & MCU_IRQ_NO_BATTELY )
/*
TWLと識別できているかチェック
#ifdef USE_DEBUG_LED
SetDebugLED(OS_IsRunOnTwl() ? 0xC3 : 0xff);
OS_SpinWaitCpuCycles(0x1000000);
#endif
*/
} }
/*************************************************************** /***************************************************************
@ -131,6 +128,14 @@ static void PostInit(void)
AES_Init(); // for encrypted NAND AES_Init(); // for encrypted NAND
// アイドルスレッドの作成 // アイドルスレッドの作成
CreateIdleThread(); CreateIdleThread();
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
} }
/*************************************************************** /***************************************************************
@ -155,13 +160,14 @@ void TwlSpMain( void )
// 0: bootrom // 0: bootrom
profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif #endif
InitDebugLED(); InitDebugLED();
SetDebugLED(++step); // 0x81 SetDebugLED(++step); // 0x81
PreInit(); PreInit();
#ifdef PROFILE_ENABLE
// 1: after PreInit // 1: after PreInit
PUSH_PROFILE(); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif
SetDebugLED(++step); // 0x82 SetDebugLED(++step); // 0x82
OS_InitFIRM(); OS_InitFIRM();
@ -179,7 +185,7 @@ void TwlSpMain( void )
PM_BackLightOn( FALSE ); PM_BackLightOn( FALSE );
SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext; SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext;
if ( !FATFS_Init( DMA_NO_FATFS, THREAD_PRIO_FATFS ) ) if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) )
{ {
OS_TPrintf("Failed to call FATFS_Init().\n"); OS_TPrintf("Failed to call FATFS_Init().\n");
goto end; goto end;

View File

@ -62,7 +62,8 @@ static char* debugPtr = (char*)PRINT_MEMORY_ADDR;
#endif #endif
#define THREAD_PRIO_FATFS 8 #define THREAD_PRIO_FATFS 8
#define DMA_NO_FATFS 3 #define DMA_FATFS_1 3
#define DMA_FATFS_2 2
extern void* SDNandContext; /* NAND初期化パラメータ */ extern void* SDNandContext; /* NAND初期化パラメータ */
@ -93,6 +94,14 @@ static void CreateIdleThread(void)
***************************************************************/ ***************************************************************/
static void PreInit(void) static void PreInit(void)
{ {
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
/* /*
FromBrom関連 FromBrom関連
*/ */
@ -107,15 +116,11 @@ static void PreInit(void)
/* /*
*/ */
//if ( MCUi_ReadRegister( MCU_REG_BATTELY ) < 0x02 ) if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
//if ( MCUi_ReadRegister( MCU_REG_IRQ ) & MCU_IRQ_NO_BATTELY ) {
/* OS_TPrintf("Battery is empty.\n");
TWLと識別できているかチェック OS_Terminate();
#ifdef USE_DEBUG_LED }
SetDebugLED(OS_IsRunOnTwl() ? 0xC3 : 0xff);
OS_SpinWaitCpuCycles(0x1000000);
#endif
*/
} }
/*************************************************************** /***************************************************************
@ -131,6 +136,14 @@ static void PostInit(void)
AES_Init(); // for encrypted NAND AES_Init(); // for encrypted NAND
// アイドルスレッドの作成 // アイドルスレッドの作成
CreateIdleThread(); CreateIdleThread();
/*
*/
if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 )
{
OS_TPrintf("Battery is empty.\n");
OS_Terminate();
}
} }
/*************************************************************** /***************************************************************
@ -157,13 +170,14 @@ void TwlSpMain( void )
// 0: bootrom // 0: bootrom
profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif #endif
InitDebugLED(); InitDebugLED();
SetDebugLED(++step); // 0x81 SetDebugLED(++step); // 0x81
PreInit(); PreInit();
#ifdef PROFILE_ENABLE
// 1: after PreInit // 1: after PreInit
PUSH_PROFILE(); profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick());
#endif
SetDebugLED(++step); // 0x82 SetDebugLED(++step); // 0x82
OS_InitFIRM(); OS_InitFIRM();
@ -181,7 +195,7 @@ void TwlSpMain( void )
PM_BackLightOn( FALSE ); PM_BackLightOn( FALSE );
SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext; SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext;
if ( !FATFS_Init( DMA_NO_FATFS, THREAD_PRIO_FATFS ) ) if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) )
{ {
OS_TPrintf("Failed to call FATFS_Init().\n"); OS_TPrintf("Failed to call FATFS_Init().\n");
goto end; goto end;