TwlIPL/build/libraries_sysmenu/sysmenu/ARM9/src/device.c
yosiokat fb932ac222 FATALエラー処理をUTLライブラリにまとめる。
初回起動シーケンス処理の実装。(デフォルトOFF)
フラッシュ壊れシーケンス処理の実装。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1682 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2008-06-24 13:13:16 +00:00

71 lines
2.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*---------------------------------------------------------------------------*
Project: TwlIPL
File: SYSM_lib.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 <sysmenu.h>
#include <sysmenu/mcu.h>
#include <spi.h>
#include "internal_api.h"
// define data-----------------------------------------------------------------
// extern data-----------------------------------------------------------------
// function's prototype-------------------------------------------------------
// global variable-------------------------------------------------------------
// static variable-------------------------------------------------------------
// const data------------------------------------------------------------------
// ============================================================================
//
// デバイス制御
//
// ============================================================================
// RTCクロック補正値をセット
void SYSMi_WriteAdjustRTC( void )
{
RTCRawAdjust raw;
raw.adjust = LCFG_THW_GetRTCAdjust();
( void )RTCi_SetRegAdjust( &raw );
}
// 起動時のRTCチェック
void SYSMi_CheckRTC( void )
{
RTCDate date;
RTCTime time;
// RTCのリセット or おかしい値を検出した場合は初回起動シーケンスへ。
( void )RTC_GetDateTime( &date, &time );
if( !UTL_CheckRTCDate( &date ) ||
!UTL_CheckRTCTime( &time ) ||
SYSMi_GetWork()->flags.common.isResetRTC
) { // RTCの異常を検出したら、rtc入力フラグrtcOffsetを0にしてNVRAMに書き込み。
OS_TPrintf("\"RTC reset\" or \"Illegal RTC data\" detect!\n");
LCFG_TSD_SetRTCOffset( 0 );
LCFG_TSD_SetRTCLastSetYear( 0 );
{
u8 *pBuffer = SYSM_Alloc( LCFG_WRITE_TEMP );
if( pBuffer != NULL ) {
LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer );
SYSM_Free( pBuffer );
}
}
}
}