ErrorLogライブラリ周りの関数名変更

WriteErrorLog -> Writeなど冗長な名前を排除

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1972 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
aoki_ryoma 2008-07-24 02:51:54 +00:00
parent ba33d15e41
commit 6d35916d4b
4 changed files with 55 additions and 55 deletions

View File

@ -51,14 +51,14 @@ typedef enum CheckStatus {
ErrorLogWork elWork;
/*-- function prototype ----------------------*/
CheckStatus ErrorLogi_CheckAndCreateDirectory( const char *path );
CheckStatus ErrorLogi_CheckAndCreateFile( const char *path );
int ErrorLogi_ReadEntry( void );
BOOL ErrorLogi_SetString( char *buf, ErrorLogEntry *entry );
BOOL ErrorLogi_addNewEntry( int idx, int errorCode, RTCDate *date, RTCTime *time );
void ErrorLogi_WriteLogToBuf( char *buf );
BOOL ErrorLogi_WriteLogToFile( char *buf );
void ErrorLogi_fillSpace( char *buf, int bufsize );
CheckStatus ERRORLOGi_CheckAndCreateDirectory( const char *path );
CheckStatus ERRORLOGi_CheckAndCreateFile( const char *path );
int ERRORLOGi_ReadEntry( void );
BOOL ERRORLOGi_SetString( char *buf, ErrorLogEntry *entry );
BOOL ERRORLOGi_addNewEntry( int idx, int errorCode, RTCDate *date, RTCTime *time );
void ERRORLOGi_WriteLogToBuf( char *buf );
BOOL ERRORLOGi_WriteLogToFile( char *buf );
void ERRORLOGi_fillSpace( char *buf, int bufsize );
static char *s_strWeek[7];
static char *s_strError[FATAL_ERROR_MAX];
@ -66,7 +66,7 @@ static char *s_strError[FATAL_ERROR_MAX];
/*---------------------------------------------------------------------------*
Name: ErrorLog_Init
Name: ERRORLOG_Init
Description: Errorlogライブラリ用の初期化関数です
@ -76,7 +76,7 @@ static char *s_strError[FATAL_ERROR_MAX];
Returns: TRUEをFALSEを返します
*---------------------------------------------------------------------------*/
BOOL ErrorLog_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) )
BOOL ERRORLOG_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) )
{
SDK_POINTER_ASSERT(AllocFunc);
SDK_POINTER_ASSERT(FreeFunc);
@ -96,12 +96,12 @@ BOOL ErrorLog_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) )
FS_InitFile( &elWork.file );
// ファイルの存在確認
if( ErrorLogi_CheckAndCreateDirectory( ERRORLOG_DIRECTORYPATH ) == CHECK_FAILED )
if( ERRORLOGi_CheckAndCreateDirectory( ERRORLOG_DIRECTORYPATH ) == CHECK_FAILED )
{
return FALSE;
}
switch ( ErrorLogi_CheckAndCreateFile( ERRORLOG_FILEPATH ) )
switch ( ERRORLOGi_CheckAndCreateFile( ERRORLOG_FILEPATH ) )
{
case CHECK_FAILED:
return FALSE;
@ -109,7 +109,7 @@ BOOL ErrorLog_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) )
case CHECK_EXIST:
// 既にログファイルが存在していたら、そこからログを読み出す
elWork.numEntry = ErrorLogi_ReadEntry();
elWork.numEntry = ERRORLOGi_ReadEntry();
break;
case CHECK_CREATE:
@ -121,7 +121,7 @@ BOOL ErrorLog_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) )
}
/*---------------------------------------------------------------------------*
Name: ErrorLog_End
Name: ERRORLOG_End
Description: Errorlogライブラリの終了処理を行います
ELライブラリを利用するためにはErrorLog_Initを呼ぶ必要があります
@ -130,7 +130,7 @@ BOOL ErrorLog_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) )
Returns:
*---------------------------------------------------------------------------*/
void ErrorLog_End( void )
void ERRORLOG_End( void )
{
elWork.Free( elWork.entry );
@ -141,7 +141,7 @@ void ErrorLog_End( void )
}
/*---------------------------------------------------------------------------*
Name: ErrorLog_WriteErrorLog
Name: ERRORLOG_Write
Description: nand:/sys/log/sysmenu.logにエラーログを出力します
@ -150,7 +150,7 @@ void ErrorLog_End( void )
Returns: TRUEをFALSEを返します
*---------------------------------------------------------------------------*/
BOOL ErrorLog_WriteErrorLog( u64 errorCode )
BOOL ERRORLOG_Write( u64 errorCode )
{
int bufBeginPoint = 0; // リングバッファの開始点
int numEntry = 0;
@ -177,17 +177,17 @@ BOOL ErrorLog_WriteErrorLog( u64 errorCode )
if( ( errorCode >> counter ) & 0x1LL )
{
// 末尾のビットが立っていたらエントリに入れてバッファ開始点を進める
ErrorLogi_addNewEntry( elWork.numEntry % ERRORLOG_NUM_ENTRY , counter , &date, &time );
ERRORLOGi_addNewEntry( elWork.numEntry % ERRORLOG_NUM_ENTRY , counter , &date, &time );
elWork.numEntry++;
}
}
// まずエントリをもとにバッファに書き込む
ErrorLogi_WriteLogToBuf( writeBuf );
ERRORLOGi_WriteLogToBuf( writeBuf );
// 最終的にファイルを書き込む
if( !ErrorLogi_WriteLogToFile( writeBuf ) )
if( !ERRORLOGi_WriteLogToFile( writeBuf ) )
{
return FALSE;
}
@ -198,7 +198,7 @@ BOOL ErrorLog_WriteErrorLog( u64 errorCode )
}
/*---------------------------------------------------------------------------*
Name: ErrorLog_getErrorLogNum
Name: ERRORlOG_getNum
Description:
@ -207,14 +207,14 @@ BOOL ErrorLog_WriteErrorLog( u64 errorCode )
Returns:
*---------------------------------------------------------------------------*/
int ErrorLog_getErrorLogNum()
int ERRORLOG_getNum()
{
return elWork.numEntry < ERRORLOG_NUM_ENTRY ? elWork.numEntry : ERRORLOG_NUM_ENTRY;
}
/*---------------------------------------------------------------------------*
Name: ErrorLog_getErrorLog
Name: ERRORLOG_Read
Description:
@ -223,7 +223,7 @@ int ErrorLog_getErrorLogNum()
Returns: idx番目のエントリへのポインタです
*---------------------------------------------------------------------------*/
const ErrorLogEntry* ErrorLog_getErrorLog( int idx )
const ErrorLogEntry* ERRORLOG_Read( int idx )
{
if( idx >= 0 && idx < ERRORLOG_NUM_ENTRY )
{
@ -236,7 +236,7 @@ const ErrorLogEntry* ErrorLog_getErrorLog( int idx )
}
/*---------------------------------------------------------------------------*
Name: ErrorLogi_addNewEntry
Name: ERRORLOGi_addNewEntry
Description: RTCデータをエラーログのエントリに追加します
@ -250,7 +250,7 @@ const ErrorLogEntry* ErrorLog_getErrorLog( int idx )
*---------------------------------------------------------------------------*/
BOOL ErrorLogi_addNewEntry( int idx, int errorCode, RTCDate *date, RTCTime *time )
BOOL ERRORLOGi_addNewEntry( int idx, int errorCode, RTCDate *date, RTCTime *time )
{
if( errorCode >= FATAL_ERROR_MAX )
@ -274,7 +274,7 @@ BOOL ErrorLogi_addNewEntry( int idx, int errorCode, RTCDate *date, RTCTime *time
/*---------------------------------------------------------------------------*
Name: ErrorLogi_CheckAndCreateDirectory
Name: ERRORLOGi_CheckAndCreateDirectory
Description:
@ -287,7 +287,7 @@ BOOL ErrorLogi_addNewEntry( int idx, int errorCode, RTCDate *date, RTCTime *time
CHECK_FAILEDを返します
*---------------------------------------------------------------------------*/
CheckStatus ErrorLogi_CheckAndCreateDirectory( const char *path )
CheckStatus ERRORLOGi_CheckAndCreateDirectory( const char *path )
{
FSFile dir;
@ -313,7 +313,7 @@ CheckStatus ErrorLogi_CheckAndCreateDirectory( const char *path )
}
/*---------------------------------------------------------------------------*
Name: ErrorLogi_CheckAndCreateFile
Name: ERRORLOGi_CheckAndCreateFile
Description:
@ -325,7 +325,7 @@ CheckStatus ErrorLogi_CheckAndCreateDirectory( const char *path )
CHECK_FAILEDを返します
*---------------------------------------------------------------------------*/
CheckStatus ErrorLogi_CheckAndCreateFile( const char *path )
CheckStatus ERRORLOGi_CheckAndCreateFile( const char *path )
{
if( FS_OpenFileEx( &elWork.file, path, FS_FILEMODE_RWL ) )
@ -387,7 +387,7 @@ CheckStatus ErrorLogi_CheckAndCreateFile( const char *path )
/*---------------------------------------------------------------------------*
Name: ErrorLogi_ReadEntry
Name: ERRORLOGi_ReadEntry
Description:
@ -396,7 +396,7 @@ CheckStatus ErrorLogi_CheckAndCreateFile( const char *path )
Returns:
*---------------------------------------------------------------------------*/
int ErrorLogi_ReadEntry( void )
int ERRORLOGi_ReadEntry( void )
{
char buf[ERRORLOG_BUFSIZE+1];
int numEntry = 0;
@ -431,7 +431,7 @@ int ErrorLogi_ReadEntry( void )
/*---------------------------------------------------------------------------*
Name: ErrorLogi_SetString
Name: ERRORLOGi_SetString
Description:
@ -441,7 +441,7 @@ int ErrorLogi_ReadEntry( void )
Returns: TRUEFALSEが返ります
*---------------------------------------------------------------------------*/
BOOL ErrorLogi_SetString( char *buf, ErrorLogEntry *entry )
BOOL ERRORLOGi_SetString( char *buf, ErrorLogEntry *entry )
{
STD_TSNPrintf(buf, ERRORLOG_BUFSIZE, ERRORLOG_WRITE_FORMAT,
entry->year, entry->month, entry->day, entry->week,
@ -449,14 +449,14 @@ BOOL ErrorLogi_SetString( char *buf, ErrorLogEntry *entry )
entry->errorCode, s_strError[entry->errorCode] ? s_strError[entry->errorCode] : "" );
// 余りをスペースで埋めて、改行で終端する
ErrorLogi_fillSpace( buf, ERRORLOG_BUFSIZE );
ERRORLOGi_fillSpace( buf, ERRORLOG_BUFSIZE );
buf[ ERRORLOG_BUFSIZE-1 ] = '\n';
return TRUE;
}
/*---------------------------------------------------------------------------*
Name: ErrorLogi_WriteLogToBuf
Name: ERRORLOGi_WriteLogToBuf
Description:
@ -466,7 +466,7 @@ BOOL ErrorLogi_SetString( char *buf, ErrorLogEntry *entry )
Returns:
*---------------------------------------------------------------------------*/
void ErrorLogi_WriteLogToBuf( char *buf )
void ERRORLOGi_WriteLogToBuf( char *buf )
{
// エントリを書き出す開始点
int entryIdx = elWork.numEntry <= ERRORLOG_NUM_ENTRY ? 0 : elWork.numEntry % ERRORLOG_NUM_ENTRY ;
@ -479,7 +479,7 @@ void ErrorLogi_WriteLogToBuf( char *buf )
for( counter = 0; counter < counterMax ; counter++ )
{
// bufに一エントリずつ文字列化して詰めていく
ErrorLogi_SetString( &buf[ counter * ERRORLOG_BUFSIZE ], &(elWork.entry[ (entryIdx + counter) % ERRORLOG_NUM_ENTRY ]) );
ERRORLOGi_SetString( &buf[ counter * ERRORLOG_BUFSIZE ], &(elWork.entry[ (entryIdx + counter) % ERRORLOG_NUM_ENTRY ]) );
if( counter == counterMax-1 )
{
@ -493,7 +493,7 @@ void ErrorLogi_WriteLogToBuf( char *buf )
}
/*---------------------------------------------------------------------------*
Name: ErrorLogi_WriteLogToFile
Name: ERRORLOGi_WriteLogToFile
Description:
@ -502,7 +502,7 @@ void ErrorLogi_WriteLogToBuf( char *buf )
Returns: TRUEFALSEが返ります
*---------------------------------------------------------------------------*/
BOOL ErrorLogi_WriteLogToFile( char *buf )
BOOL ERRORLOGi_WriteLogToFile( char *buf )
{
FSResult res;
@ -522,7 +522,7 @@ BOOL ErrorLogi_WriteLogToFile( char *buf )
}
/*---------------------------------------------------------------------------*
Name: ErrorLogi_fillSpace
Name: ERRORLOGi_fillSpace
Description: 0
@ -532,7 +532,7 @@ BOOL ErrorLogi_WriteLogToFile( char *buf )
Returns:
*---------------------------------------------------------------------------*/
void ErrorLogi_fillSpace( char *buf, int bufsize )
void ERRORLOGi_fillSpace( char *buf, int bufsize )
{
u32 length = strlen( buf );
MI_CpuFill8( &buf[length], ' ', bufsize - length );

View File

@ -229,7 +229,7 @@ void TwlMain( void )
// システムの初期化----------------
InitAllocator(); // ※SYSM_Init以外のSYSMライブラリ関数を呼ぶ前に
ErrorLog_Init( Alloc, Free );
ERRORLOG_Init( Alloc, Free );
// end時間計測
MEASURE_RESULT( start, "System Init Time 1: %dms\n" );
@ -661,7 +661,7 @@ static void PrintError( void )
G2_ChangeBlendAlpha( 0, 31 );
error_code = UTL_GetFatalError();
PrintfSJIS( 2, 25, TXT_COLOR_RED,"ERROR! - 0x%0.16x\n", error_code );
ErrorLog_WriteErrorLog(error_code);
ERRORLOG_Write(error_code);
for(l=0;l<64;l++)
{
if( error_code & 0x1 )

View File

@ -44,17 +44,17 @@ void TwlMain( void )
FS_Init( FS_DMA_NOT_USE );
InitAllocator();
ErrorLog_Init( Alloc, Free );
ERRORLOG_Init( Alloc, Free );
numEntry = ErrorLog_getErrorLogNum();
numEntry = ERRORLOG_getNum();
OS_TPrintf("API: before numEntry : %d\n", numEntry );
ErrorLog_WriteErrorLog( (u64)0x077777777777LL );
ERRORLOG_Write( (u64)0x077777777777LL );
if( numEntry > 2 )
{
pEntry = ErrorLog_getErrorLog(1);
pEntry = ERRORLOG_Read(1);
OS_TPrintf("entry[1] : %02d-%02d-%02d %02d:%02d:%02d errorCode: %d\n",
pEntry->year,
pEntry->month,
@ -104,11 +104,11 @@ void TwlMain( void )
OS_TPrintf("total Size : %d\n", totalSize);
}
numEntry = ErrorLog_getErrorLogNum();
numEntry = ERRORLOG_getNum();
OS_TPrintf("API: end numEntry : %d\n", numEntry );
ErrorLog_End();
ERRORLOG_End();
OS_TPrintf( "*** End of demo\n" );
OS_Terminate();
}

View File

@ -57,11 +57,11 @@ typedef struct ErrorLogWork{
/*-- function prototype -------------------------*/
extern BOOL ErrorLog_WriteErrorLog( u64 errorCode );
extern BOOL ErrorLog_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) );
extern void ErrorLog_End( void );
extern int ErrorLog_getErrorLogNum() ;
extern const ErrorLogEntry* ErrorLog_getErrorLog( int idx );
extern BOOL ERRORLOG_Write( u64 errorCode );
extern BOOL ERRORLOG_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) );
extern void ERRORLOG_End( void );
extern int ERRORLOG_getNum() ;
extern const ErrorLogEntry* ERRORLOG_Read( int idx );