mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
するよう変更。 git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1681 b08762b0-b915-fc4b-9d8c-17b2551a87ff
129 lines
3.8 KiB
C
129 lines
3.8 KiB
C
/*---------------------------------------------------------------------------*
|
|
Project: TwlIPL
|
|
File: main.c
|
|
|
|
Copyright 2007 Nintendo. All rights reserved.
|
|
|
|
These coded instructions, statements, and computer programs contain
|
|
proprietary information of Nintendo of America Inc. and/or Nintendo
|
|
Company Ltd., and are protected by Federal copyright law. They may
|
|
not be disclosed to third parties or copied or duplicated in any form,
|
|
in whole or in part, without the prior written consent of Nintendo.
|
|
|
|
$Date:: $
|
|
$Rev$
|
|
$Author$
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
#include <twl.h>
|
|
#include <twl/sea.h>
|
|
#include <twl/lcfg.h>
|
|
#include <sysmenu/namut.h>
|
|
#include <sysmenu/util.h>
|
|
#include "misc.h"
|
|
#include "MachineSetting.h"
|
|
|
|
// extern data-----------------------------------------------------------------
|
|
|
|
// define data-----------------------------------------------------------------
|
|
|
|
// function's prototype-------------------------------------------------------
|
|
static void INTR_VBlank( void );
|
|
|
|
// global variable-------------------------------------------------------------
|
|
int (*g_pNowProcess)( void );
|
|
BOOL g_isValidTSD;
|
|
RTCDrawProperty g_rtcDraw = {
|
|
TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y
|
|
};
|
|
|
|
// static variable-------------------------------------------------------------
|
|
|
|
// const data------------------------------------------------------------------
|
|
|
|
|
|
// ============================================================================
|
|
// function's description
|
|
// ============================================================================
|
|
void TwlMain(void)
|
|
{
|
|
|
|
// 初期化----------------------------------
|
|
OS_Init();
|
|
OS_InitTick();
|
|
|
|
(void)OS_EnableIrq();
|
|
(void)OS_EnableInterrupts();
|
|
|
|
SEA_Init();
|
|
|
|
GX_Init();
|
|
GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON
|
|
FS_Init( 3 );
|
|
|
|
// 割り込み許可----------------------------
|
|
(void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank);
|
|
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
|
|
(void)GX_VBlankIntr(TRUE);
|
|
|
|
// デバイス初期化-------------------------------
|
|
TP_Init();
|
|
(void)RTC_Init();
|
|
|
|
// システムの初期化------------------
|
|
InitAllocator();
|
|
|
|
// NAMライブラリ初期化
|
|
NAM_Init( Alloc, Free ); // NAMUTライブラリがNAMライブラリを使用している
|
|
NAMUT_Init( Alloc, Free );
|
|
|
|
// ※本来ならランチャーからのパラメータチェックを行い、
|
|
// 初回起動シーケンスに入るパスがある
|
|
|
|
{
|
|
OS_TPrintf( "LCFGTWLOwnerInfo : 0x%04x\n", sizeof(LCFGTWLOwnerInfo) );
|
|
OS_TPrintf( "LCFGTWLParentalControl : 0x%04x\n", sizeof(LCFGTWLParentalControl) );
|
|
OS_TPrintf( "LCFGTWLSettingsData : 0x%04x\n", sizeof(LCFGTWLSettingsData) );
|
|
}
|
|
|
|
// ::::::::::::::::::::::::::::::::::::::::::::::
|
|
// TWL設定データファイルの読み込み
|
|
// ::::::::::::::::::::::::::::::::::::::::::::::
|
|
{
|
|
u8 *pBuffer = Alloc( LCFG_READ_TEMP );
|
|
g_isValidTSD = FALSE;
|
|
if( pBuffer) {
|
|
g_isValidTSD = LCFG_ReadTWLSettings( (u8 (*)[ LCFG_READ_TEMP ] )pBuffer );
|
|
Free( pBuffer );
|
|
}
|
|
}
|
|
|
|
UTL_CaribrateTP( LCFG_TSD_GetTPCalibrationPtr() );
|
|
|
|
InitBG();
|
|
GetAndDrawRTCData( &g_rtcDraw, TRUE );
|
|
MachineSettingInit();
|
|
// メインループ----------------------------
|
|
while ( 1 ) {
|
|
OS_WaitIrq( 1, OS_IE_V_BLANK ); // Vブランク割り込み待ち
|
|
|
|
ReadKeyPad(); // キー入力の取得
|
|
|
|
(void)g_pNowProcess();
|
|
|
|
GetAndDrawRTCData( &g_rtcDraw, FALSE );
|
|
}
|
|
}
|
|
|
|
|
|
// ============================================================================
|
|
// 割り込み処理
|
|
// ============================================================================
|
|
|
|
// Vブランク割り込み
|
|
static void INTR_VBlank(void)
|
|
{
|
|
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット
|
|
}
|
|
|