テスト用にSDLOGの出力に対応したランチャーをビルドする仕組みを作成。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2014 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
sato_masaki 2008-07-29 05:23:30 +00:00
parent 160586b6f5
commit 306762957d
12 changed files with 2334 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# File: Makefile
#
# 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$
#----------------------------------------------------------------------------
export SDLOG ?= ARM9
TARGET_FIRM = SYSTEMMENU
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher
SUBMAKES = sdlog/Makefile scripts/Makefile \
$(LAUNCHER_DIR)/banner/Makefile $(LAUNCHER_DIR)/ARM9/Makefile_sdlog
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,58 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - components - mongoose.TWL
# File: Makefile
#
# 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$
#----------------------------------------------------------------------------
# Definition to override for jackal with sdlog
#
LLIBRARIES += libossdlog_sp$(TWL_LIBSUFFIX).a
LLIBRARY_DIRS += $(call eupath, $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/lib/$(TWL_LIBTYPE))
COMPONENT_DIR += $(SYSMENU_ROOT)/build/components/jackal.TWL
COMPONENT_SRC_DIR += $(COMPONENT_DIR)/../hyena.TWL/src
override SUBDIRS = $(SYSMENU_ROOT)/build/libraries/aes \
$(SYSMENU_ROOT)/build/components/jackal.TWL/wram_regs
override SRCS =$(COMPONENT_SRC_DIR)/crt0.LTD.c $(COMPONENT_SRC_DIR)/main.c $(COMPONENT_SRC_DIR)/initScfg.c
override TARGET_NAME = jackal
# Generate my own lsf from original lsf of mongoose
LSF_ORG = $(COMPONENT_DIR)/$(TARGET_NAME).lsf
MAKE_LSF = make_lsf.pl
AUTOGEN_LSF = $(TARGET_NAME)_sdlog.lsf
LDIRT_CLEAN = $(AUTOGEN_LSF)
override TARGET_NEF = $(TARGET_NAME).tef
override LCFILE_SPEC = $(AUTOGEN_LSF)
override LCFILE_TEMPLATE = $(COMPONENT_DIR)/$(TARGET_NAME).lcf.template
override TWL_INSTALL_COMPONENTSDIR= $(call eupath, $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/components)
override INSTALL_DIR = $(TWL_INSTALL_COMPONENTSDIR)/$(TARGET_NAME)/$(TWL_BUILDTYPE)
#
include $(TWL_IPL_RED_ROOT)/build/components/jackal.TWL/Makefile
$(AUTOGEN_LSF): $(LSF_ORG) $(MAKE_LSF)
@echo " make:" $@
@perl $(MAKE_LSF) $(TARGET_NAME)
#===== End of Makefile =====

View File

@ -0,0 +1,57 @@
#!/bin/perl
#----------------------------------------------------------------------------
# Project: TwlWLAN - components - mongoose_sdlog.TWL
# File: make_lsf.pl
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, 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$
#----------------------------------------------------------------------------
use strict;
my $ROOT;
my $COMPONENT = $ARGV[0];
print $COMPONENT;
# search TWL_IPL_RED_ROOT
foreach ( sort keys ( %ENV ) ){
if ($_ =~ m/TWL_IPL_RED_ROOT/s) {
$ROOT = $ENV{$_};
}
}
my $src = sprintf("$ROOT/build/components/%s.TWL/%s.lsf", $COMPONENT, $COMPONENT);
my $dst = sprintf("%s_sdlog.lsf", $COMPONENT);
my $rn = "\x0D\x0A";
open(F, $src) or die "cant open $src\n";
my @lines = <F>;
close(F);
open(OUT, ">$dst") or die "cant open $dst\n";
foreach my $line ( @lines )
{
if( $line =~ m/libos_sp/ )
{
my $tmp = $line;
$tmp =~ s/libos_sp/libossdlog_sp/;
print OUT $tmp;
next;
}
print OUT $line;
}
close(OUT);

View File

@ -0,0 +1,60 @@
#! make -f
#----------------------------------------------------------------------------
# Project: SystemUpdater
# File: Makefile
#
# 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$
#----------------------------------------------------------------------------
TARGET_FIRM = SYSTEMMENU
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher
SYSMENU_LIBRARIES_DIR = $(SYSMENU_ROOT)/build/libraries_sysmenu
SYSTEMUPDATER_DIR = $(SYSMENU_ROOT)/build/systemMenu_tools/SystemUpdater
SCRIPTS_DIR = .
MAKEFILES_ORG = $(LAUNCHER_DIR)/ARM9/Makefile
MAKE_MAKEFILES = $(SCRIPTS_DIR)/sdlog_makefile.pl
AUTOGEN_MAKEFILES = $(LAUNCHER_DIR)/ARM9/Makefile_sdlog
LDIRT_CLEAN += $(AUTOGEN_MAKEFILES)
MAIN_ORG = $(LAUNCHER_DIR)/ARM9/src/main.c
MAKE_MAIN = $(SCRIPTS_DIR)/sdlog_main_c.pl
AUTOGEN_MAIN = $(LAUNCHER_DIR)/ARM9/src/main_sdlog.c
LDIRT_CLEAN += $(AUTOGEN_MAIN)
TARGETS = $(AUTOGEN_MAKEFILES) $(AUTOGEN_MAIN)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
$(AUTOGEN_MAKEFILES): $(MAKEFILES_ORG) $(MAKE_MAKEFILES)
@echo " make:" $@
@perl $(MAKE_MAKEFILES)
$(AUTOGEN_MAIN): $(MAIN_ORG) $(MAKE_MAIN)
@echo " make:" $@
@perl $(MAKE_MAIN)
#===== End of Makefile =====

View File

@ -0,0 +1,92 @@
#!/bin/perl
#----------------------------------------------------------------------------
# Project: TwlIPL - tests -
# File: sdlog_main_c.pl
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, 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$
#----------------------------------------------------------------------------
use strict;
my $IPLROOT;
# search TWL_IPL_RED_ROOT
foreach ( sort keys ( %ENV ) ){
if ($_ =~ m/TWL_IPL_RED_ROOT/s) {
$IPLROOT = $ENV{$_};
}
}
my $src = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/src/main.c";
my $dst = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/src/main_sdlog.c";
my $rn = "\x0D\x0A";
open(F, $src) or die "cant open $src\n";
my @lines = <F>;
close(F);
open(OUT, ">$dst") or die "cant open $dst\n";
foreach my $line ( @lines )
{
print OUT $line;
if( $line =~ m/^\#include \"scanWDS\.h\"/ )
{
print OUT "//\t[AUTO COMMENT] SDLOGのヘッダをインクルードし、ログ用バッファを定義します。", $rn;
print OUT <<__SDLOG_DEFINE__;
\#ifdef USE_SDLOG
\#include "sd_log_wrapper.h"
\#define BUFFER_SIZE 0x800
char logBuffer[ (BUFFER_SIZE + 1) ];
\#endif
__SDLOG_DEFINE__
}
if( $line =~ m/^[\t ]*RTC_Init\(\);/ )
{
print OUT "//\t[AUTO COMMENT] SDカードにOS_Printfのログを記録するために、SDLOGを初期化します。", $rn;
print OUT <<__SDLOG_INITEX__;
\#ifdef USE_SDLOG
{
RTCDate rDate;
RTCTime rTime;
char filename[FS_ENTRY_LONGNAME_MAX];
(void)RTC_GetDateTime(&rDate, &rTime);
OS_SPrintf(filename, "Launcher_%02d%02d%02d_%02d%02d.txt",
rDate.year, rDate.month, rDate.day,
rTime.hour, rTime.minute);
SDLOG_InitEx("sdmc:/log", filename, logBuffer,
BUFFER_SIZE, 0x80, SDLOG_WRITE_TYPE_CONTINUANCE);
}
\#endif
__SDLOG_INITEX__
}
if( $line =~ m/^[\t ]*OS_SetIrqCheckFlag\(OS_IE_V_BLANK\);/ )
{
print OUT <<__SDLOG_PRINTARM7__;
\#ifdef USE_SDLOG
\#ifdef USE_SDLOG_SUBP
SDLOG_PrintServer();
\#endif
\#endif
__SDLOG_PRINTARM7__
}
}
close(OUT);

View File

@ -0,0 +1,101 @@
#!/bin/perl
#----------------------------------------------------------------------------
# Project: TwlIPL - tests -
# File: sdlog_makefile.pl
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, 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$
#----------------------------------------------------------------------------
use strict;
my $IPLROOT;
# search TWL_IPL_RED_ROOT
foreach ( sort keys ( %ENV ) ){
if ($_ =~ m/TWL_IPL_RED_ROOT/s) {
$IPLROOT = $ENV{$_};
}
}
my $rn = "\x0D\x0A";
my $src = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile";
my $dst = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile_sdlog";
open(F, $src) or die "cant open $src\n";
my @lines = <F>;
close(F);
open(OUT, ">$dst") or die "cant open $dst\n";
foreach my $line ( @lines )
{
if( $line =~ m/main\.c/ )
{
$line =~ s/main\.c/main_sdlog\.c/;
}
if( $line =~ m/^COMPONENT_DIR/ )
{
$line =~ s/\/build\/components/\/build\/tests\/Launcher_sdlog/;
print OUT $line;
print OUT "override COMPONENTSDIR\t=\t\$(call eupath, \$(COMPONENT_DIR)/../components)", $rn;
next;
}
if( $line =~ m/^WRAM_MAP_FILE[\t ]*=[\t ]*\$\(COMPONENT_DIR\)\/wram_regs\/wram_regs.rbin/ )
{
$line =~ s/\$\(COMPONENT_DIR\)/\$\(TWL_IPL_RED_ROOT\)\/build\/components\/\$\(DEFAULT_COMP_ARM7\)\.TWL/;
}
if( $line =~ m/^INSTALL_DIR/ )
{
$line =~ s/\$\(SDK_NMENU_DATADIR\)/\$\(TWL_IPL_RED_ROOT\)\/build\/tests\/Launcher_sdlog/;
}
if( $line =~ m/^TARGET_BIN[\t ]*=[\t ]*\$\(TITLEID_LO\)\.tad/ )
{
print OUT <<__SDLOG_DESCRIPTIONS__;
\# --------------------------------------------------------------
\# SDLOG
ifeq (\$(TWL_FINALROM),) \# SDLOG is enabled only on Release and Debug
ifeq (\$(SDLOG), TRUE)
override SDLOG = ARM9
endif
ifneq (\$(filter ARM7,\$(SDLOG)),)
\$(error "Invalid SDLOG option : should be SDLOG=[ARM9/ALL]")
endif
SDLOG_LIST = \$(if \$(filter ALL,\$(SDLOG)),ARM7 ARM9,\$(SDLOG))
ifneq (\$(filter ARM9,\$(SDLOG_LIST)),)
MACRO_FLAGS += -DUSE_SDLOG
ELIBRARIES += libsdlogRed\$(TWL_LIBSUFFIX).a
ELIBRARY_DIRS += \$(SYSMENU_ROOT)/build/tests/Launcher_sdlog/lib/\$(TWL_LIBTYPE)
EINCLUDES += \$(SYSMENU_ROOT)/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/include \\
\$(ROOT)/build/tests/sdlog/sdlog/include
ifneq (\$(filter ARM7,\$(SDLOG_LIST)),)
MACRO_FLAGS += -DUSE_SDLOG_SUBP
endif \# SDLOG [ARM7]
endif \# SDLOG [ARM9]
endif \# FINALROM
__SDLOG_DESCRIPTIONS__
}
print OUT $line;
}
close(OUT);

View File

@ -0,0 +1,100 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK
# File: Makefile
#
# 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$
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
override TARGET_PLATFORM = TWL
TWL_CODEGEN ?= ARM
TWL_ARCHGEN ?= LIMITED
TWL_PROC = ARM7
OS_LIBRARY_SRC_DIR_BASE = $(ROOT)/build/libraries/os
OS_LIBSRC_ARM7 = $(OS_LIBRARY_SRC_DIR_BASE)/ARM7/src
OS_LIBSRC_ARM7TWL = $(OS_LIBRARY_SRC_DIR_BASE)/ARM7.TWL/src
OS_LIBSRC_COMMON = $(OS_LIBRARY_SRC_DIR_BASE)/common/src
SRCDIR = src ../common/src ../ARM7/src
INCDIR = $(OS_LIBSRC_ARM7TWL)/../../common/include
SRCS = $(OS_LIBSRC_ARM7TWL)/os_irqHandler.c \
$(OS_LIBSRC_COMMON)/os_irqTable.c \
$(OS_LIBSRC_COMMON)/os_interrupt.c \
$(OS_LIBSRC_COMMON)/os_pxi.c \
$(OS_LIBSRC_COMMON)/os_spinLock.c \
os_printf.c \
$(OS_LIBSRC_COMMON)/os_thread.c \
$(OS_LIBSRC_COMMON)/os_context.c \
$(OS_LIBSRC_COMMON)/os_emulator.c \
$(OS_LIBSRC_COMMON)/os_message.c \
$(OS_LIBSRC_COMMON)/os_mutex.c \
$(OS_LIBSRC_COMMON)/os_init.c \
$(OS_LIBSRC_COMMON)/os_arena.c \
$(OS_LIBSRC_COMMON)/os_alloc.c \
$(OS_LIBSRC_COMMON)/os_exception.c \
$(OS_LIBSRC_COMMON)/os_timer.c \
$(OS_LIBSRC_COMMON)/os_tick.c \
$(OS_LIBSRC_COMMON)/os_alarm.c \
$(OS_LIBSRC_COMMON)/os_valarm.c \
$(OS_LIBSRC_COMMON)/os_system.c \
$(OS_LIBSRC_COMMON)/os_systemWork.c \
$(OS_LIBSRC_COMMON)/os_profile.c \
$(OS_LIBSRC_COMMON)/os_reset.c \
$(OS_LIBSRC_COMMON)/os_ownerInfo.c \
$(OS_LIBSRC_COMMON)/os_ownerInfoEx.c \
$(OS_LIBSRC_COMMON)/os_entropy.c \
$(OS_LIBSRC_ARM7)/os_terminate_sp.c \
$(OS_LIBSRC_COMMON)/os_event.c \
$(OS_LIBSRC_COMMON)/os_application_jump.c
TARGET_LIB = libossdlog_sp$(TWL_LIBSUFFIX).a
#----------------------------------------------------------------------------
# DEBUG版ビルドの場合、RELEASE版でビルドして
# DEBUG版のライブラリを装います。
ifdef TARGET_DEBUG
TWL_BUILD_TYPE = RELEASE
else
ifdef TWL_DEBUG
TWL_BUILD_TYPE = RELEASE
else
ifdef NITRO_DEBUG
TWL_BUILD_TYPE = RELEASE
endif
endif
endif
#----------------------------------------------------------------------------
# HYBRID / LIMITED 両方のライブラリを作成します
TWL_ARCHGEN ?= ALL
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/lib/$(TWL_LIBTYPE)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TWL WLAN - libraries - os
# File: Makefile
#
# Copyright 2003 - 2008 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.
#
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
TWL_PROC = ARM9
TWL_CODEGEN ?= ARM
TWL_ARCHGEN ?= LIMITED
SRCDIR = ./src
INCDIR = ./include $(ROOT)/build/tests/sdlog/sdlog/include \
$(ROOT)/build/tests/sdlog/sdlog/src
SRCS = sd_log_wrapper.c
SRCS += $(ROOT)/build/tests/sdlog/sdlog/src/os_log.c
#----------------------------------------------------------------------------
TARGET_LIB = libsdlogRed$(TWL_LIBSUFFIX).a
include $(TWLSDK_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/lib/$(TWL_LIBTYPE)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - SDLOG - include
File: sd_log_wrapper.h
Copyright 2008 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$
*---------------------------------------------------------------------------*/
#ifndef TWL_SD_LOG_WRAPPER_H_
#define TWL_SD_LOG_WRAPPER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <twl.h>
#include "log.h"
#include "sd_log.h"
BOOL SDLOG_InitEx(const char* path, const char* filename, char* buffer, u16 bufferSize, u16 partitionSize, SDLOGWriteType writeType);
void SDLOG_FinishEx(void);
inline
void SDLOG_PrintServer(void)
{
OS_PrintServer();
}
#ifdef __cplusplus
} /* extern "C" */
#endif
/* TWL_SD_LOG_WRAPPER_H_ */
#endif

View File

@ -0,0 +1,179 @@
#include <twl.h>
#include <nitro/std.h>
#include "sd_log_wrapper.h"
#include "sd_log.c"
/* Function Prototype */
static void OS_FPutStringSD(int console, const char *str);
static void SDLOGi_WriteThreadEx(void* arg);
/* Static */
static void (*HookedFPutString)(int console, const char *string);
void TwlStartUp(void)
{
OS_InitPrintServer(); // Should be called before PXI_Init()
}
/*---------------------------------------------------------------------------*
Name: SDLOG_Init
Description: Initialize
Arguments: None
Returns: FALSE
*---------------------------------------------------------------------------*/
BOOL SDLOG_InitEx(const char* path, const char* filename, char* buffer, u16 bufferSize, u16 partitionSize, SDLOGWriteType writeType)
{
if( isInitialized )
{
return FALSE;
}
if( !FS_IsAvailable() )
{
FS_Init(FS_DMA_NOT_USE);
}
OS_InitLog();
{
int i = 0;
FS_InitFile(&work.logInfo[i].file);
/* ファイルシステムの初期化 */
{
char tmpPath[256];
STD_TSPrintf(tmpPath, "%s/%s", path, filename);
if( writeType == SDLOG_WRITE_TYPE_OVERWRITE )
{
/* 上書き設定の場合はファイルを削除 */
(void)FS_DeleteFileAuto(tmpPath);
}
if( !FS_CreateDirectoryAuto( path, FS_PERMIT_W | FS_PERMIT_R ) )
{
//OS_TPrintf("%s L:%04d Error(%d)\n", __FILE__, __LINE__, FS_GetArchiveResultCode(tmpPath) );
}
if( !FS_CreateFile( tmpPath, FS_PERMIT_W | FS_PERMIT_R ) )
{
//OS_TPrintf("%s L:%04d Error(%d)\n", __FILE__, __LINE__, FS_GetArchiveResultCode(tmpPath) );
}
if(!FS_OpenFileEx(&work.logInfo[i].file, tmpPath, FS_PERMIT_R | FS_PERMIT_W))
{
//OS_TPrintf("%s L:%04d Error(%d)\n", __FILE__, __LINE__, FS_GetArchiveResultCode(tmpPath) );
goto file_error;
}
if( writeType == SDLOG_WRITE_TYPE_CONTINUANCE )
{
/* 追記設定の場合はファイル端までシーク */
FS_SeekFileToEnd(&work.logInfo[i].file);
}
}
/* OS_Log の諸設定 */
work.logInfo[i].buffer = buffer;
work.logInfo[i].current = 0;
work.logInfo[i].bufferSize = bufferSize;
work.logInfo[i].partitionSize = partitionSize;
work.logInfo[i].writeType = writeType;
OS_InitLogBuffer(&work.logInfo[i].info, buffer, partitionSize);
OS_SetLogWarningOffset(&work.logInfo[i].info, OS_LOG_WARNING_OFFSET_FULL );
OS_SetLogAnnounceType(&work.logInfo[i].info, OS_LOG_ANNOUNCE_IMM);
OS_SetLogCallback(&work.logInfo[i].info, SDlogCallback, (void *)i );
}
/* カレントは IS_TWL_DEBBUGER と同じく出力ゼロ */
OS_SetLogCurrentInfo(&work.logInfo[0].info);
/* Thread */
if( OS_IsThreadAvailable() == FALSE )
{
/*スレッドシステムが立ち上がっていない場合は立ち上げる*/
OS_InitThread();
}
OS_InitMessageQueue(&work.writeQueue, work.writeMsg, WRITE_MESSAGE_COUNT );
OS_CreateThread(&work.writeThread, SDLOGi_WriteThreadEx, NULL,
work.writeThreadStack+SDLOG_THREAD_STACK_SIZE/sizeof(u32), SDLOG_THREAD_STACK_SIZE, 15);
OS_WakeupThreadDirect(&work.writeThread);
HookedFPutString = OS_FPutString;
OS_FPutString = OS_FPutStringSD;
SDLOG_Printf("------------ START ------------\n");
isInitialized =TRUE;
return TRUE;
file_error:
return FALSE;
}
void OS_FPutStringSD(int console, const char *str)
{
#pragma unused (console)
OS_LockMutex( &work.logInfo[0].info.mutex );
OS_LogFPutString( &work.logInfo[0].info, str );
OS_UnlockMutex( &work.logInfo[0].info.mutex );
}
void SDLOG_FinishEx(void)
{
SDLOG_Finish();
if (OS_FPutString == OS_FPutStringSD) {
OS_FPutString = HookedFPutString;
}
}
static void SDLOGi_WriteThreadEx(void* arg)
{
#pragma unused(arg)
u32 num;
const char* buffer;
u32 dataSize;
OSMessage msg;
while(TRUE)
{
(void)OS_ReceiveMessage(&work.writeQueue, &msg, OS_MESSAGE_BLOCK);
num =(u32) msg;
(void)OS_ReceiveMessage(&work.writeQueue, &msg, OS_MESSAGE_BLOCK);
buffer =(const char*) msg;
(void)OS_ReceiveMessage(&work.writeQueue, &msg, OS_MESSAGE_BLOCK);
dataSize =(u32) msg;
if(FS_WriteFile(&work.logInfo[num].file, buffer, (u16)dataSize) < 0)
{
if (OS_FPutString == OS_FPutStringSD) {
OS_FPutString = HookedFPutString;
OS_TPrintf("%s L:%d SD Write Error\n",__FILE__, __LINE__);
}
} else {
if (OS_FPutString == HookedFPutString) {
OS_FPutString = OS_FPutStringSD;
}
}
FS_FlushFile(&work.logInfo[num].file);
}
}

View File

@ -0,0 +1,24 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TWL WLAN - libraries - os
# File: Makefile
#
# Copyright 2003 - 2008 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.
#
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
include $(TWLSDK_ROOT)/build/buildtools/commondefs
SUBDIRS := $(GSUBDIRS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====