From b55f76eef8e980b05630cacca56f756876baaa55 Mon Sep 17 00:00:00 2001 From: kamikawa Date: Fri, 25 Jan 2008 06:37:04 +0000 Subject: [PATCH] 1.Nand Format 2.Write HW Info 3.Write eticket 4.Import TAD 5.Import Nandfirm 6.Inport Norfirm git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@517 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../NandInitializer/ARM7.TWL/Makefile | 68 ++ .../ARM7.TWL/include/formatter.h | 49 + .../ARM7.TWL/include/kami_pxi.h | 44 + .../NandInitializer/ARM7.TWL/include/nvram.h | 43 + .../NandInitializer/ARM7.TWL/main.lsf | 157 +++ .../ARM7.TWL/racoon.lcf.template | 930 ++++++++++++++++++ .../ARM7.TWL/racoon.response.template | 40 + .../NandInitializer/ARM7.TWL/src/formatter.c | 420 ++++++++ .../NandInitializer/ARM7.TWL/src/kami_pxi.c | 290 ++++++ .../NandInitializer/ARM7.TWL/src/main.c | 401 ++++++++ .../NandInitializer/ARM7.TWL/src/nvram_misc.c | 181 ++++ .../NandInitializer/ARM9.TWL/ARM9-TS.lsf | 57 ++ .../NandInitializer/ARM9.TWL/Makefile | 93 ++ .../NandInitializer/ARM9.TWL/include/cursor.h | 45 + .../ARM9.TWL/include/graphics.h | 46 + .../ARM9.TWL/include/kami_font.h | 92 ++ .../ARM9.TWL/include/kami_pxi.h | 98 ++ .../NandInitializer/ARM9.TWL/include/keypad.h | 48 + .../ARM9.TWL/include/process_auto.h | 62 ++ .../ARM9.TWL/include/process_eticket.h | 55 ++ .../ARM9.TWL/include/process_format.h | 55 ++ .../ARM9.TWL/include/process_hw_info.h | 55 ++ .../ARM9.TWL/include/process_import.h | 58 ++ .../ARM9.TWL/include/process_nandfirm.h | 55 ++ .../ARM9.TWL/include/process_norfirm.h | 55 ++ .../ARM9.TWL/include/process_topmenu.h | 55 ++ .../NandInitializer/ARM9.TWL/main.rsf | 182 ++++ .../NandInitializer/ARM9.TWL/src/cursor.c | 93 ++ .../NandInitializer/ARM9.TWL/src/font_data.c | 732 ++++++++++++++ .../NandInitializer/ARM9.TWL/src/graphics.c | 160 +++ .../NandInitializer/ARM9.TWL/src/kami_font.c | 392 ++++++++ .../NandInitializer/ARM9.TWL/src/kami_pxi.c | 472 +++++++++ .../NandInitializer/ARM9.TWL/src/keypad.c | 85 ++ .../NandInitializer/ARM9.TWL/src/main.c | 180 ++++ .../ARM9.TWL/src/process_auto.c | 216 ++++ .../ARM9.TWL/src/process_eticket.c | 287 ++++++ .../ARM9.TWL/src/process_format.c | 294 ++++++ .../ARM9.TWL/src/process_hw_info.c | 664 +++++++++++++ .../ARM9.TWL/src/process_import.c | 870 ++++++++++++++++ .../ARM9.TWL/src/process_nandfirm.c | 438 +++++++++ .../ARM9.TWL/src/process_norfirm.c | 423 ++++++++ .../ARM9.TWL/src/process_topmenu.c | 217 ++++ build/systemMenu_RED/NandInitializer/Makefile | 33 + .../NandInitializer/banner/banner.bnr | Bin 0 -> 2624 bytes .../NandInitializer/common/include/fifo.h | 82 ++ .../NandInitializer/data/cert.sys | Bin 0 -> 3136 bytes 46 files changed, 9372 insertions(+) create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/Makefile create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/include/formatter.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/include/kami_pxi.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/include/nvram.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/main.lsf create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.lcf.template create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.response.template create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/src/formatter.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/src/kami_pxi.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/src/main.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM7.TWL/src/nvram_misc.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/ARM9-TS.lsf create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/Makefile create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/cursor.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/graphics.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_font.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_pxi.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/keypad.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_auto.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_eticket.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_format.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_import.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_nandfirm.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_norfirm.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_topmenu.h create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/main.rsf create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/cursor.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/font_data.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/graphics.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_font.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_pxi.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/keypad.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_eticket.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_format.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_nandfirm.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_norfirm.c create mode 100644 build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_topmenu.c create mode 100644 build/systemMenu_RED/NandInitializer/Makefile create mode 100644 build/systemMenu_RED/NandInitializer/banner/banner.bnr create mode 100644 build/systemMenu_RED/NandInitializer/common/include/fifo.h create mode 100644 build/systemMenu_RED/NandInitializer/data/cert.sys diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/Makefile b/build/systemMenu_RED/NandInitializer/ARM7.TWL/Makefile new file mode 100644 index 00000000..cbd06120 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/Makefile @@ -0,0 +1,68 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera-test +# 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:: 2007-12-18#$ +# $Rev: 3150 $ +# $Author: yutaka $ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL +#TWL_CODEGEN = THUMB +TWL_PROC = ARM7 +TWL_ARCHGEN = LIMITED + +TARGET_TEF = main.tef + +SRCS = main.c kami_pxi.c formatter.c nvram_misc.c + +LINCLUDES = ../common/include $(TWLSDK_ROOT)/build/libraries/spi/ARM7/include + + +#SRCDIR = # using default +#LCFILE = # using default + +LCFILE_SPEC = main.lsf +LCFILE_TEMPLATE = racoon.lcf.template +LDRES_TEMPLATE = racoon.response.template + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +ifdef TWLSDK_NOCRYPTO +CCFLAGS += -DSDK_NOCRYPTO +endif + +ifndef TWLSDK_NOCRYPTO +MAKELCF_FLAGS += -DUSE_CRYPTO_LIBS='libaes_sp$(TWL_LIBSUFFIX).a' +endif + + +TWL_LIBS_EX = libcamera_sp$(TWL_LIBSUFFIX).a \ + libfatfs_sp$(TWL_LIBSUFFIX).a \ + libi2c_sp$(TWL_LIBSUFFIX).a \ + libcamera_sp$(TWL_LIBSUFFIX).a \ + libcdc_sp$(TWL_LIBSUFFIX).a \ + libtpex_sp$(TWL_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/formatter.h b/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/formatter.h new file mode 100644 index 00000000..d9d10e4b --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/formatter.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: formatter.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 NAND_INITIALIZER_FORMATTER_H_ +#define NAND_INITIALIZER_FORMATTER_H_ + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +BOOL ExeFormat(FormatMode format_mode); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* NAND_INITIALIZER_FORMATTER_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/kami_pxi.h b/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/kami_pxi.h new file mode 100644 index 00000000..ff2df9b6 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/kami_pxi.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_CAMERA_TEST_CAMERATEST_H_ +#define TWL_CAMERA_TEST_CAMERATEST_H_ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void KamiPxiInit( void ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TEST_CAMERATEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/nvram.h b/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/nvram.h new file mode 100644 index 00000000..bc65d2df --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/include/nvram.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: nvram.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 FIRM_NVRAM_H_ +#define FIRM_NVRAM_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 +#else // SDK_ARM7 + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ +void NVRAMi_Read(u32 address, void *buf, u32 size); +void NVRAMi_Write(u32 address, void *buf, u32 size); + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_NVRAM_H_ */ +#endif diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/main.lsf b/build/systemMenu_RED/NandInitializer/ARM7.TWL/main.lsf new file mode 100644 index 00000000..f3654bf2 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/main.lsf @@ -0,0 +1,157 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: racoon.lsf +# +# 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:: 2007-12-11#$ +# $Rev: 2989 $ +# $Author: terui $ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + Library crt0.LTD.TWL.o + StackSize 1024 1024 +} + +#-------- +Autoload WRAM +{ + Address 0x037c0000 + + Library libsubpsyscall.a \ + libsyscall_sp.twl.a \ + $(CW_LIBS) \ + libos_sp$(LIBSUFFIX).a \ + libmi_sp$(LIBSUFFIX).a \ + libpad_sp$(LIBSUFFIX).a \ + libpxi_sp$(LIBSUFFIX).a \ + libstd_sp$(LIBSUFFIX).a \ + libexi_sp$(LIBSUFFIX).a \ + libsnd_sp$(LIBSUFFIX).a \ + libspi_sp$(LIBSUFFIX).a \ + libpm_sp$(LIBSUFFIX).a \ + libmath_sp$(LIBSUFFIX).a \ + libscfg_sp$(LIBSUFFIX).a \ + libtp_sp$(LIBSUFFIX).a \ + libmic_sp$(LIBSUFFIX).a \ + libfs_sp$(LIBSUFFIX).a \ + libcard_sp$(LIBSUFFIX).a \ + libi2c_sp$(LIBSUFFIX).a \ + libcamera_sp$(LIBSUFFIX).a \ + libcdc_sp$(LIBSUFFIX).a \ + libtpex_sp$(LIBSUFFIX).a \ + libmicex_sp$(LIBSUFFIX).a \ + + Library libsdio_hcd_twl$(LIBSUFFIX).a \ + libsdio_busdriver$(LIBSUFFIX).a \ + libsdio_lib$(LIBSUFFIX).a \ + + Object * (.etable) + Object * (.wram) + Object * (.ltdwram) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/kami_pxi.o + Object $(OBJDIR)/formatter.o + Object $(OBJDIR)/nvram_misc.o + + # caches in fatfs library, that should be on WRAM. + # 2007/12/11 OBJECT() による .bss シンボルのリンクがうまくいかないので、 + # 変数定義箇所に pragma で .ltdwram セクションに含まれるように暫定対策しました。 + #Object OBJECT( FATFSi___mem_drives_structures , libfatfs_sp$(LIBSUFFIX).a) (.bss) + + ##### + # Sub-routines in WL library , that should be on WRAM. + # in TaskMan.o + Object OBJECT( MainTaskRoutine , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( LowestIdleTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ExecuteMessage , libwl_sp$(LIBSUFFIX).a ) (.text) + # in BufMan.o + Object OBJECT( NewHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AllocateHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ReleaseHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MoveHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( GetHeapBufNextAdrs , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlCmdIf.o + Object OBJECT( RequestCmdTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SendMessageToWmDirect , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlNic.o + Object OBJECT( WStart , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WStop , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WSetStaState , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntr.o + Object OBJECT( WlIntr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrPreTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrActEnd , libwl_sp$(LIBSUFFIX).a ) (.text) +# Object OBJECT( WlIntrAckCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxErr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxCntup , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartTx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartRx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxq , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MacBugTxMp , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AdjustRingPointer , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( CheckKeyTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntrTask.o + Object OBJECT( WlIntrTxBeaconTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxqTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( TakeoutRxFrame , libwl_sp$(LIBSUFFIX).a ) (.text) + # in TxCtrl.o + Object OBJECT( InitTxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in RxCtrl.o + Object OBJECT( InitRxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WaitLoop.o + Object OBJECT( WaitLoop_Rxpe , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_Waitus , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_ClrAid , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_BbpAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_RfAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + +} + + + +#-------- +Ltdautoload LTDMAIN +{ + Address 0x02f88000 + + Object * (.ltdmain) + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library librompatch_sp$(LIBSUFFIX).a \ + libwm_sp$(LIBSUFFIX).a \ + libnwm_sp$(LIBSUFFIX).a \ + libARM7athdrv$(LIBSUFFIX).a \ + libwvr_sp$(LIBSUFFIX).a \ + libwl_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a \ + $(USE_CRYPTO_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + Library libstubsistd_sp.TWL.LTD.a \ + libstubsisd_sp.TWL.LTD.a +} diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.lcf.template b/build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.lcf.template new file mode 100644 index 00000000..5e629531 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.lcf.template @@ -0,0 +1,930 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: racoon.lcf.template +# +# 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:: 2007-11-12#$ +# $Rev: 2249 $ +# $Author: terui $ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.WORKRAM (RWX) : ORIGIN = 0x037c0000, LENGTH = 0x50000 > workram.check + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.LTDMAIN (RWX) : ORIGIN = 0x02f88000, LENGTH = 0x74000 > ltdmain.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_STATIC_DATA_END =.; + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.WRAM.START = 0x037c0000; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + + . = ALIGN(4); + SDK_AUTOLOAD..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_AUTOLOAD..SINIT_END =.; + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + . = ALIGN(4); + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..SINIT_START; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + + } > binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + } > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_OVERLAY..DATA_END =.; + . = ALIGN(4); + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + } > F + + ############################ OTHERS ################################# + SDK_WRAM_ARENA_LO = SDK_AUTOLOAD.WRAM.BSS_END; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM: + { + . = . + SDK_AUTOLOAD.WRAM.BSS_END - SDK_AUTOLOAD.WRAM.START + 0x080 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + + } > check.WORKRAM + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = 0x02f88000; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + +#### SDK_LTDAUTOLOAD.LTDWRAM.START の位置は間違っているかも + SDK_LTDAUTOLOAD.LTDWRAM.START = 0x03800000; + SDK_LTDAUTOLOAD.LTDWRAM.END = SDK_LTDAUTOLOAD.LTDWRAM.START; + SDK_LTDAUTOLOAD.LTDWRAM.BSS_END = SDK_LTDAUTOLOAD.LTDWRAM.START; + SDK_LTDAUTOLOAD.LTDWRAM.SIZE = 0; + SDK_LTDAUTOLOAD.LTDWRAM.BSS_SIZE = 0; +#### + + SDK_LTDAUTOLOAD_TOP_START = 0x02e80000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDAUTOLOAD__ID =; + SDK_LTDAUTOLOAD..ID =; + SDK_LTDAUTOLOAD..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDAUTOLOAD..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDAUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + SDK_LTDAUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_LTDAUTOLOAD..DATA_END =.; + . = ALIGN(4); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..TEXT_SIZE = SDK_LTDAUTOLOAD..TEXT_END - SDK_LTDAUTOLOAD..TEXT_START; + SDK_LTDAUTOLOAD..DATA_SIZE = SDK_LTDAUTOLOAD..DATA_END - SDK_LTDAUTOLOAD..DATA_START; + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_LTDAUTOLOAD..BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + SDK_LTDAUTOLOAD_LTDWRAM_START = SDK_LTDAUTOLOAD.LTDWRAM.START; + SDK_LTDAUTOLOAD_LTDWRAM_END = SDK_LTDAUTOLOAD.LTDWRAM.END; + SDK_LTDAUTOLOAD_LTDWRAM_BSS_END = SDK_LTDAUTOLOAD.LTDWRAM.BSS_END; + SDK_LTDAUTOLOAD_LTDWRAM_SIZE = SDK_LTDAUTOLOAD.LTDWRAM.SIZE; + SDK_LTDAUTOLOAD_LTDWRAM_BSS_SIZE = SDK_LTDAUTOLOAD.LTDWRAM.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDOVERLAY__ID =; + SDK_LTDOVERLAY..ID =; + SDK_LTDOVERLAY..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDOVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDOVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDOVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDOVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_LTDOVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_LTDOVERLAY..DATA_END =.; + . = ALIGN(4); + SDK_LTDOVERLAY..END =.; + + SDK_LTDOVERLAY..TEXT_SIZE = SDK_LTDOVERLAY..TEXT_END - SDK_LTDOVERLAY..TEXT_START; + SDK_LTDOVERLAY..DATA_SIZE = SDK_LTDOVERLAY..DATA_END - SDK_LTDOVERLAY..DATA_START; + SDK_LTDOVERLAY..SIZE = SDK_LTDOVERLAY..END - SDK_LTDOVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDOVERLAY..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_LTDOVERLAY..BSS_END =.; + + SDK_LTDOVERLAY..BSS_SIZE = SDK_LTDOVERLAY..BSS_END - SDK_LTDOVERLAY..BSS_START; + + } >> + + + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW 0; # padding + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITES # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW # ROM file ID + WRITEW 0; # Reserved + + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + .check.LTDMAIN: + { + . = SDK_SUBPRIV_ARENA_LO; + + } > check.LTDMAIN + +} diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.response.template b/build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.response.template new file mode 100644 index 00000000..88b18081 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/racoon.response.template @@ -0,0 +1,40 @@ + + + + + -l + + + + + + + -l + + + + -og ,0 -ol + + + + + -l + + + + + + + + -l + + + + -og ,0 -ol + + + + + -l + + diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/formatter.c b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/formatter.c new file mode 100644 index 00000000..e0354465 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/formatter.c @@ -0,0 +1,420 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: formatter.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "formatter.h" + +extern BOOL FATFSi_nandFillPartition( int partition_no, u32* buf, u32 blocks); + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct FileProperty { + u32 length; + const char *path; +}FileProperty; + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define ERROR_RETURN() { OS_TPrintf("FATAL ERROR OCCURED %s %s\n", __FILE__, __LINE__); return 0; } + +// ここを編集したら、SDKのFATFS_Init内の同パラメータも修正する必要がある。 +#define NAND_SIZE 245 // 256MB mobiNANDでの使用可能サイズ(iNANDでは違う値になる。未定。) +#define PARTITION_RAW_SIZE 4 +#define PARTITION_0_SIZE 213 +#define PARTITION_1_SIZE ( NAND_SIZE - PARTITION_RAW_SIZE - PARTITION_0_SIZE ) +#define NAND_FAT_PARTITION_NUM 2 // FATパーティション数(RAWパーティションを除く) + + +// const data-------------------------------------------------------- +//#define NAND_SEPARATE_READ +#define FS_READ_BLOCK_SIZE ( 2 * 1024 ) +#define FATFS_CLUSTER_SIZE ( 16 * 1024 ) +// FATFSのクラスタサイズは16KBなので、データサイズが決まっていないものは、余裕を持たせて16KBにしておく +static const FileProperty s_fileList[] = { + { 128, "F:/sys/ID.sgn" }, // 現状、全部サイズは適当。中身も空。 + { FATFS_CLUSTER_SIZE, "F:/sys/HWINFO.dat" }, + { FATFS_CLUSTER_SIZE, "F:/shared1/TWLCFG0.dat" }, + { FATFS_CLUSTER_SIZE, "F:/shared1/TWLCFG1.dat" }, // ミラー +// { FATFS_CLUSTER_SIZE, "F:/shared1/WIFICFG0.dat" }, +// { FATFS_CLUSTER_SIZE, "F:/shared1/WIFICFG1.dat" }, // ミラー + { 0, NULL }, +}; + +static const char *s_pDirList0[] = { + (const char *)"sys", + (const char *)"title", + (const char *)"ticket", + (const char *)"shared1", + (const char *)"import", + (const char *)"tmp", + NULL, + }; + +static const char *s_pDirList1[] = { + (const char *)"photo", + (const char *)"shared2", + NULL, + }; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static BOOL CreateDirectory( const char *pDrive, const char **ppDirList ); +static BOOL CheckDirectory ( const char *pDrive, const char **ppDirList ); +static BOOL CreateFile( const FileProperty *pFileList ); +static BOOL CheckFile ( const FileProperty *pFileList ); +static int MY_ReadFile( FATFSFileHandle file, void *pBuffer, int length ); + +/*---------------------------------------------------------------------------* + Name: ExeFormat + + Description: Nandのフォーマットを行います + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL +ExeFormat(FormatMode format_mode) +{ + u32 *init_datbuf; + int nand_fat_partition_num; + + init_datbuf = OS_Alloc( 512*16 ); + if( init_datbuf == NULL ) { + OS_TPrintf( "memory allocate error.\n" ); + ERROR_RETURN(); + } + + MI_CpuFill8( init_datbuf, 0xFF, 512*16); + + // NANDをフォーマット + { + int i; + + /* パーティションサイズをプロンプトから設定 */ + u32 partition_MB_size[5]; + partition_MB_size[0] = PARTITION_RAW_SIZE; // RAW領域 + partition_MB_size[1] = PARTITION_0_SIZE; // FAT0領域 + partition_MB_size[2] = PARTITION_1_SIZE; // FAT1領域 + nand_fat_partition_num = NAND_FAT_PARTITION_NUM; + + // F G ドライブアンマウント + for( i=0; ipath ) { + if( length < pTemp->length ) { + length = pTemp->length; + } + pTemp++; + } + pBuffer = OS_Alloc( length ); + if( pBuffer == NULL ) { + OS_TPrintf( "memory allocate error.\n" ); + ERROR_RETURN(); + } + MI_CpuClearFast( pBuffer, length ); + + OS_TPrintf( "\nCreate File :\n" ); + + // 指定されたファイルを作成して、"0"埋め + while( pFileList->path ) { + FATFSFileHandle file; + + OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length ); + // ファイル生成 + if( !FATFS_CreateFile( pFileList->path, TRUE, "rwxrwxrwx" ) ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイルオープン + file = FATFS_OpenFile( pFileList->path, "w" ); + if( !file ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイル長変更 + if( !FATFS_SetFileLength( file, (int)pFileList->length ) ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイル書き込み + if( !FATFS_WriteFile( file, pBuffer, (int)pFileList->length ) ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイルクローズ + (void)FATFS_CloseFile( file ); + OS_TPrintf( "ok.\n" ); + pFileList++; + } + // メモリ解放 + OS_Free( pBuffer ); + + return TRUE; +} + + +// ファイルチェック +static BOOL CheckFile( const FileProperty *pFileList ) +{ + // デフォルトドライブの指定 + OS_TPrintf( "\nCheck File :\n" ); + + // 指定されたディレクトリをルートに作成 + while( pFileList->path ) { + FATFSFileHandle file; + u32 *pBuffer; + int i; + OSTick start; + + OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length ); + // ファイルオープン + file = FATFS_OpenFile( pFileList->path, "r+" ); + if( !file ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイル長チェック + if( FATFS_GetFileLength( file ) != pFileList->length ) { + OS_TPrintf( "ng. length = %d\n", FATFS_GetFileLength( file ) ); + ERROR_RETURN(); + } + // バッファ メモリ確保 + pBuffer = OS_Alloc( pFileList->length ); + if( pBuffer == NULL ) { + OS_TPrintf( "memory allocate error.\n" ); + ERROR_RETURN(); + } + start = OS_GetTick(); + // ファイル読み込み + if( +#ifdef NAND_SEPARATE_READ + MY_ReadFile( file, pBuffer, (int)pFileList->length ) +#else + FATFS_ReadFile( file, pBuffer, (int)pFileList->length ) +#endif + != pFileList->length ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + OS_TPrintf( " [ReadTime : %dms] ", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); + start = OS_GetTick(); + // ファイルベリファイ + for( i = 0; i < pFileList->length / sizeof(u32); i++ ) { + if( pBuffer[ i ] != 0 ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + } + OS_TPrintf( " [VerifyTime : %dms] ", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); + // メモリ解放 + OS_Free( pBuffer ); + // ファイルクローズ + (void)FATFS_CloseFile( file ); + OS_TPrintf( "ok.\n" ); + pFileList++; + } + + return TRUE; +} + +#ifdef NAND_SEPARATE_READ +// NAND不具合をARM7側のFSは吸収しきれいていないので、自前で2KB単位に分割してリード +static int MY_ReadFile( FATFSFileHandle file, void *pBuffer, int length ) +{ + int length_bak = length; + while( length ) { + int rdLength = ( length > FS_READ_BLOCK_SIZE ) ? FS_READ_BLOCK_SIZE : length; + + if( FATFS_ReadFile( file, pBuffer, rdLength ) != rdLength ) { + return -1; + } + pBuffer = (u8 *)pBuffer + rdLength; + length -= rdLength; + } + return length_bak; +} +#endif diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/kami_pxi.c b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/kami_pxi.c new file mode 100644 index 00000000..87515a83 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/kami_pxi.c @@ -0,0 +1,290 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include "kami_pxi.h" +#include "fifo.h" +#include "twl/cdc.h" +#include "formatter.h" +#include "nvram.h" + +#include + +//#include +//#include + + +typedef unsigned char byte; /* Don't change */ +typedef unsigned short word; /* Don't change */ +typedef unsigned long dword; /* Don't change */ +#define BOOLEAN int + +extern BOOL FATFSi_nandRtfsIo( int driveno, dword block, void* buffer, word count, BOOLEAN reading); + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define KAMITEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ +#define KAMITEST_THREAD_STACK_SIZE 2048 // スレッドのスタックサイズ + +#define KAMITEST_THREAD_PRIORITY 6 + +// アライメント調整してコピーする +#define KAMI_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define KAMI_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL result; + u32 total; + u32 current; + KamiCommand command; + u8 data[KAMITEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用 + + OSMessageQueue msgQ; // スレッド同期用メッセージキュー + OSMessage msgArray[KAMITEST_MESSAGE_ARRAY_MAX]; + // メッセージを格納するバッファ + OSThread thread; // KAMI用スレッド + u64 stack[KAMITEST_THREAD_STACK_SIZE / sizeof(u64)]; + // KAMI用スレッドのスタック +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result); +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data); +static void KamiThread(void *arg); + +void KamiPxiInit(void) +{ + if (kamiInitialized) + { + return; + } + kamiInitialized = TRUE; + + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + + OS_InitMessageQueue(&kamiWork.msgQ, kamiWork.msgArray, KAMITEST_MESSAGE_ARRAY_MAX); + OS_CreateThread(&kamiWork.thread, KamiThread, 0, + (void *)(kamiWork.stack + (KAMITEST_THREAD_STACK_SIZE / sizeof(u64))), + KAMITEST_THREAD_STACK_SIZE, KAMITEST_THREAD_PRIORITY); + OS_WakeupThreadDirect(&kamiWork.thread); +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.data[kamiWork.current++] = (u8)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 後続データ + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + if (kamiWork.current >= kamiWork.total) + { + switch (kamiWork.command) + { + case CODEC_READ_REGISTER: + case CODEC_WRITE_REGISTER: + case GPIO333_WRITE: + case EXE_FORMAT: + case KAMI_NAND_IO: + case KAMI_NVRAM_IO: + if (!OS_SendMessage(&kamiWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_FATAL_ERROR); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((1 << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + (((size+1) << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + for (i = 0; i < size; i+= 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + } +} + +static void KamiThread(void *arg) +{ +#pragma unused( arg ) + OSMessage msg; + BOOL result; + + while (TRUE) + { + (void)OS_ReceiveMessage(&kamiWork.msgQ, &msg, OS_MESSAGE_BLOCK); + switch (kamiWork.command) + { +//////////////////////////////////////////////////////// + case CODEC_READ_REGISTER: + { + u8 value; + value = CDC_ReadSpiRegisterEx( kamiWork.data[0], kamiWork.data[1] ); + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(u8), (u8*)&value); + } + break; + + case CODEC_WRITE_REGISTER: + { + CDC_WriteSpiRegisterEx( kamiWork.data[0], kamiWork.data[1], kamiWork.data[2] ); + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + break; + + case GPIO333_WRITE: + { + if (kamiWork.data[0]) + { + // GPIO333 1出力 + EXI2i_SetBitGpio2CntL(0x8080, 0x8080); + } + else + { + // GPIO333 0出力 + EXI2i_SetBitGpio2CntL(0x8080, 0x8000); + } + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + break; + + case EXE_FORMAT: + { + result = ExeFormat((FormatMode)kamiWork.data[0]); // Quick or Full + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_NAND_IO: + { + BOOL is_read; + u32 block; + void* buffer; + u32 count; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&block, &kamiWork.data[1]); + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]); + KAMI_UNPACK_U32(&count, &kamiWork.data[9]); + + result = FATFSi_nandRtfsIo( 0, block, buffer, (u16)count, is_read ); + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_NVRAM_IO: + { + BOOL is_read; + u32 adress; + void* buffer; + u32 size; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&adress, &kamiWork.data[1]); + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]); + KAMI_UNPACK_U32(&size, &kamiWork.data[9]); + + if (is_read) + { + NVRAMi_Read( adress, buffer, size ); + } + else + { + NVRAMi_Write( adress, buffer, size ); + } + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + break; + +//////////////////////////////////////////////////////// + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +#include diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/main.c b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/main.c new file mode 100644 index 00000000..804c6486 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/main.c @@ -0,0 +1,401 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: main.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kami_pxi.h" +#include "formatter.h" + +/* Priorities of each threads */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +extern void PMi_InitShutdownControl(void); + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static OSHeapHandle InitializeAllocateSystem(void); +static void VBlankIntr(void); +static void InitializeFatfs(void); +static void InitializeCdc(void); +static void DummyThread(void* arg); + +/*---------------------------------------------------------------------------* + 外部シンボル参照 + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWLHYB +extern void SDK_LTDAUTOLOAD_LTDWRAM_BSS_END(void); +extern void SDK_LTDAUTOLOAD_LTDMAIN_BSS_END(void); +#endif + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + + Description: Initialize and do main + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void TwlSpMain(void) +{ + OSThread thread; + u32 stack[18]; + + // OS初期化 + OS_Init(); + SPI_Init(2); + OS_InitTick(); + OS_InitAlarm(); + OS_InitThread(); +// (void)PAD_InitXYButton(); + + // ヒープ領域設定 + InitializeAllocateSystem(); + + // ボタン入力サーチ初期化 + (void)PAD_InitXYButton(); + + // 割り込み許可 + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + // ダミースレッド作成(CDC_InitとFS_InitでOS_Sleepが使用されているため) + OS_CreateThread(&thread, DummyThread, NULL, + (void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&thread); + + // ファイルシステム初期化 + FS_Init(FS_DMA_NOT_USE); + FS_CreateReadServerThread(THREAD_PRIO_FS); + + if (OS_IsRunOnTwl() == TRUE) + { + InitializeFatfs(); // FATFS 初期化 + //InitializeNwm(); // NWM 初期化 +#ifndef SDK_NOCRYPTO + AES_Init(); // AES 初期化 +#endif + } + + if (OSi_IsCodecTwlMode() == TRUE) + { + // CODEC 初期化 + InitializeCdc(); + // カメラ初期化 + //CAMERA_Init(); + /* CODEC が TWL モードでないとシャッター音を強制的に鳴らす + 機能が使用できません。この為、CODEC が TWL モードの場合 + にのみカメラライブラリを使用可能な状態にします。 */ + } + + // サウンド初期化 + SND_Init(THREAD_PRIO_SND); + + // RTC 初期化 + RTC_Init(THREAD_PRIO_RTC); + + // 旧無線初期化 + //WVR_Begin(heapHandle); + + // SPI 初期化 + SPI_Init(THREAD_PRIO_SPI); + + + KamiPxiInit(); + + // ダミースレッド破棄 + OS_KillThread(&thread, NULL); + + while (TRUE) + { + OS_Halt(); + //---- check reset + if (OS_IsResetOccurred()) + { + OS_ResetSystem(); + } + } + + +} +#include +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ +#ifndef SDK_NOCRYPTO +#ifdef FATFS_AES_MOUNT_FOR_NAND + if(!FATFS_Init( FATFS_DMA_4, 8)) +#else + if(!FATFS_Init(FATFS_DMA_NOT_USE, 8)) +#endif +#else + if(!FATFS_Init(FATFS_DMA_NOT_USE, 8)) +#endif + { + OS_TPanic("FATFS_Init() failed.\n"); + } +} +#include + +#include +/*---------------------------------------------------------------------------* + Name: InitializeCdc + Description: CDCライブラリを初期化する。CDC初期化関数内でスレッド休止する + 為、休止中動作するダミーのスレッドを立てる。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeCdc(void) +{ +#if 1 + // CODEC 初期化 + CDC_Init(); + CDC_InitMic(); +// CDCi_DumpRegisters(); +#else + /* [Debug] CODEC を DS モードで初期化 */ + *((u8*)(HW_TWL_ROM_HEADER_BUF + 0x01bf)) &= ~(0x01); + CDC_Init(); + CDC_GoDsMode(); + OS_TPrintf("Codec mode changed to DS mode for debug.\n"); +#endif +} + +/*---------------------------------------------------------------------------* + Name: DummyThread + Description: CDCライブラリを初期化する際に立てるダミーのスレッド。 + Arguments: arg - 使用しない。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +DummyThread(void* arg) +{ +#pragma unused(arg) + while (TRUE) + { + } +} +#include + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void){ + OSHeapHandle hh; + +#ifdef SDK_TWLHYB + if (OS_IsRunOnTwl() == TRUE) + { + void* basicLo = (void*)OS_GetSubPrivArenaLo(); + void* basicHi = (void*)OS_GetSubPrivArenaHi(); + void* extraLo = (void*)MATH_ROUNDUP((u32)SDK_LTDAUTOLOAD_LTDMAIN_BSS_END, 32); + void* extraHi = (void*)MATH_ROUNDDOWN(HW_MAIN_MEM_SUB, 32); + +#if SDK_DEBUG + // debug information + OS_TPrintf("ARM7: MAIN arena basicLo = %p\n", basicLo); + OS_TPrintf("ARM7: MAIN arena basicHi = %p\n", basicHi); + OS_TPrintf("ARM7: MAIN arena extraLo = %p\n", extraLo); + OS_TPrintf("ARM7: MAIN arena extraHi = %p\n", extraHi); +#endif + + // アリーナを 0 クリア + MI_CpuClear8(basicLo, (u32)basicHi - (u32)basicLo); + MI_CpuClear8(extraLo, (u32)extraHi - (u32)extraLo); + + // メモリ割り当て初期化 + if ((u32)basicLo < (u32)extraLo) + { + basicLo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, basicLo, extraHi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_MAIN_SUBPRIV, basicLo); + } + else + { + extraLo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, extraLo, basicHi, 1); + } + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_MAIN_SUBPRIV, basicLo, basicHi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to create MAIN heap.\n"); + } + + // ヒープに拡張ブロックを追加 + OS_AddToHeap(OS_ARENA_MAIN_SUBPRIV, hh, extraLo, extraHi); + } + else +#endif + { + void* lo = (void*)OS_GetSubPrivArenaLo(); + void* hi = (void*)OS_GetSubPrivArenaHi(); + + // アリーナを 0 クリア + MI_CpuClear8(lo, (u32)hi - (u32)lo); + + // メモリ割り当て初期化 + lo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, lo, hi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_MAIN_SUBPRIV, lo); + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_MAIN_SUBPRIV, lo, hi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + } + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_MAIN_SUBPRIV, hh); + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_MAIN_SUBPRIV, hh); + OS_TPrintf("ARM7: MAIN heap size is %d\n", heapSize); + } +#ifdef SDK_TWLHYB + if (OS_IsRunOnTwl() == TRUE) + { + void* basicLo = (void*)OS_GetWramSubPrivArenaLo(); + void* basicHi = (void*)OS_GetWramSubPrivArenaHi(); + void* extraLo = (void*)MATH_ROUNDUP((u32)SDK_LTDAUTOLOAD_LTDWRAM_BSS_END, 32); + void* extraHi = (void*)MATH_ROUNDDOWN(HW_WRAM_A_HYB_END, 32); + +#if SDK_DEBUG + // debug information + OS_TPrintf("ARM7: WRAM arena basicLo = %p\n", basicLo); + OS_TPrintf("ARM7: WRAM arena basicHi = %p\n", basicHi); + OS_TPrintf("ARM7: WRAM arena extraLo = %p\n", extraLo); + OS_TPrintf("ARM7: WRAM arena extraHi = %p\n", extraHi); +#endif + + // アリーナを 0 クリア + MI_CpuClear8(basicLo, (u32)basicHi - (u32)basicLo); + MI_CpuClear8(extraLo, (u32)extraHi - (u32)extraLo); + + // メモリ割り当て初期化 + if ((u32)basicLo < (u32)extraLo) + { + basicLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, basicLo, extraHi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, basicLo); + } + else + { + extraLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, extraLo, basicHi, 1); + } + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, basicLo, basicHi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + + // ヒープに拡張ブロックを追加 + OS_AddToHeap(OS_ARENA_WRAM_SUBPRIV, hh, extraLo, extraHi); + } + else +#endif + { + void* lo = (void*)OS_GetWramSubPrivArenaLo(); + void* hi = (void*)OS_GetWramSubPrivArenaHi(); + + // アリーナを 0 クリア + MI_CpuClear8(lo, (u32)hi - (u32)lo); + + // メモリ割り当て初期化 + lo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, lo, hi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, lo); + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, lo, hi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + } + + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + if (WM_WL_HEAP_SIZE > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WM_WL_HEAP_SIZE); + } + OS_TPrintf("ARM7: WRAM heap size is %d\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/nvram_misc.c b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/nvram_misc.c new file mode 100644 index 00000000..ad1d5412 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM7.TWL/src/nvram_misc.c @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: nvram_misc.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include "nvram.h" +#include "spi_sp.h" +#include "nvram_sp.h" + +/*---------------------------------------------------------------------------* + Name: NvramCheckReadyToRead + + Description: NVRAMを読み出し可能な状態かどうか確認する。 + + Arguments: None. + + Returns: BOOL - 読み出し可能な状態の場合にTRUEを返す。 + FALSEの場合は読み出し禁止の状態。 + *---------------------------------------------------------------------------*/ +static BOOL NvramCheckReadyToRead(void) +{ + u16 tempStatus; + + // ステータスレジスタ読み出し + NVRAM_ReadStatusRegister((u8 *)(&tempStatus)); + // 書き込みもしくは消去操作中かを確認 + if (tempStatus & NVRAM_STATUS_REGISTER_WIP) + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: NvramCheckReadyToWrite + + Description: NVRAMを書き込み可能な状態かどうか確認する。 + + Arguments: None. + + Returns: BOOL - 書き込み可能な状態の場合にTRUEを返す。 + FALSEの場合は書き込み禁止の状態。 + *---------------------------------------------------------------------------*/ +static BOOL NvramCheckReadyToWrite(void) +{ + u16 tempStatus; + + // ステータスレジスタ読み出し + NVRAM_ReadStatusRegister((u8 *)(&tempStatus)); + // 書き込みもしくは消去操作中かを確認 + if (tempStatus & NVRAM_STATUS_REGISTER_WIP) + { + return FALSE; + } + // 書き込み許可されているかを確認 + if (!(tempStatus & NVRAM_STATUS_REGISTER_WEL)) + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: NVRAM_WaitOperation + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void NVRAM_WaitOperation(void) +{ + while( NvramCheckReadyToRead() == FALSE ) { + } +} + +/*---------------------------------------------------------------------------* + Name: NVRAM_WaitWriteEnable + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void NVRAM_WaitWriteEnable(void) +{ + while( NvramCheckReadyToWrite() == FALSE ) { + } +} + + +/*---------------------------------------------------------------------------* + Name: NVRAMi_Read + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void NVRAMi_Read(u32 address, void *buf, u32 size) +{ + NVRAM_WaitOperation(); + NVRAM_ReadDataBytes(address, size, buf); + return; +} + + +/*---------------------------------------------------------------------------* + Name: NVRAMi_Write + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void NVRAMi_Write(u32 address, void *buf, u32 size) +{ + u32 i; + u32 page_start; + u32 page_end; + u32 offset_start; + u32 offset_end; + u8 *src_ptr; + u8 temp_buffer[SPI_NVRAM_PAGE_SIZE]; + + src_ptr = (u8 *)buf; + page_start = (address / SPI_NVRAM_PAGE_SIZE) * SPI_NVRAM_PAGE_SIZE; + page_end = ((address+size-1) / SPI_NVRAM_PAGE_SIZE ) * SPI_NVRAM_PAGE_SIZE; + offset_start = address % SPI_NVRAM_PAGE_SIZE; + offset_end = (address+size-1) % SPI_NVRAM_PAGE_SIZE; + + while( page_start <= page_end ) { + if( offset_start != 0 ) { + NVRAMi_Read(page_start, temp_buffer, offset_start); + } + if( page_start != page_end ) { + for( i = offset_start ; i < SPI_NVRAM_PAGE_SIZE ; i++ ) { + temp_buffer[i] = *src_ptr++; + } + } + else { + for( i = offset_start ; i <= offset_end ; i++ ) { + temp_buffer[i] = *src_ptr++; + } + if( offset_end != (SPI_NVRAM_PAGE_SIZE-1) ) { + NVRAMi_Read(page_start+offset_end+1, &(temp_buffer[offset_end+1]), SPI_NVRAM_PAGE_SIZE - (offset_end+1) ); + } + } + + NVRAM_WriteEnable(); + NVRAM_WaitWriteEnable(); + + NVRAM_PageErase((u32)page_start); + + NVRAM_WaitOperation(); + + NVRAM_WriteEnable(); + + NVRAM_PageWrite((u32)page_start, (u16)SPI_NVRAM_PAGE_SIZE, temp_buffer); + NVRAM_WaitOperation(); + + page_start += SPI_NVRAM_PAGE_SIZE; + offset_start = 0; + } +} diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/ARM9-TS.lsf b/build/systemMenu_RED/NandInitializer/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..55706a80 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS.lsf +# +# 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:: 2007-12-05#$ +# $Rev: 2840 $ +# $Author: yosizaki $ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 2048 2048 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/Makefile b/build/systemMenu_RED/NandInitializer/ARM9.TWL/Makefile new file mode 100644 index 00000000..33e0ed9d --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/Makefile @@ -0,0 +1,93 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera-test +# 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:: 2007-11-28#$ +# $Rev: 2683 $ +# $Author: yutaka $ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +USE_PRODUCT_KEY = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TWL_CODEGEN = THUMB + +TITLEID_LO = NNNN + + +TARGET_BIN = main.srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/main +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + kami_pxi.c \ + font_data.c \ + graphics.c \ + keypad.c \ + kami_font.c \ + cursor.c \ + process_format.c \ + process_topmenu.c \ + process_hw_info.c \ + process_eticket.c \ + process_import.c \ + process_nandfirm.c \ + process_norfirm.c \ + process_auto.c + +LINCLUDES = ../common/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include + +SRCDIR = src ../../../../demos.TWL/camera/saveShoot-1/src +#LCFILE = # using default + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DHWINFO_PRIVKEY='private_HWInfo.der' +MAKETAD_FLAGS += -s + +ifdef USE_PRODUCT_KEY +MAKEROM_FLAGS += -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' +MACRO_FLAGS += -DUSE_PRODUCT_KEY +else +MAKEROM_FLAGS += -DPRIVKEY_PATH='../../../../keys/dummy/rsa' +endif + +LLIBRARIES += libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libacsign_enc$(TWL_LIBSUFFIX).a + + +#include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/twl/commondefs.gx.demolib + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/cursor.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/cursor.h new file mode 100644 index 00000000..4765c107 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/cursor.h @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: cursor.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 KAMI_CURSOR_H_ +#define KAMI_CURSOR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void SetCursorPos(u16 x, u16 y); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_CURSOR_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/graphics.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/graphics.h new file mode 100644 index 00000000..bec6dbcc --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/graphics.h @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_font.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_font.h new file mode 100644 index 00000000..1357b563 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_font.h @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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 KAMI_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_pxi.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_pxi.h new file mode 100644 index 00000000..93ac903a --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/kami_pxi.h @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_KAMI_TEST_KAMITEST_H_ +#define TWL_KAMI_TEST_KAMITEST_H_ + +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// 処理結果定義 +typedef enum KAMIResult +{ + KAMI_RESULT_SUCCESS = 0, + KAMI_RESULT_SUCCESS_TRUE = 0, + KAMI_RESULT_SUCCESS_FALSE, + KAMI_RESULT_INVALID_COMMAND, + KAMI_RESULT_INVALID_PARAMETER, + KAMI_RESULT_ILLEGAL_STATUS, + KAMI_RESULT_BUSY, + KAMI_RESULT_FATAL_ERROR, + KAMI_RESULT_SEND_ERROR, + KAMI_RESULT_MAX +} +KAMIResult; + + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + +// コールバック +typedef void (*KAMICallback)(KAMIResult result, void *arg); + + +void KamiPxiInit( void ); + +KAMIResult CDC_ReadRegister(u8 page, u8 reg_no, u8* pData); +KAMIResult CDC_WriteRegister(u8 page, u8 reg_no, u8 value); +KAMIResult GPIO333_Write(BOOL value); +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback); +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read); +KAMIResult kamiNvramIo(u32 address, void* buffer, u32 size, BOOL is_read); + +static KAMIResult kamiNandRead(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, TRUE); +} +static KAMIResult kamiNandWrite(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, FALSE); +} +static KAMIResult kamiNvramRead(u32 adress, void* buffer, u32 size) +{ + return kamiNvramIo(adress, buffer, size, TRUE); +} +static KAMIResult kamiNvramWrite(u32 adress, void* buffer, u32 size) +{ + return kamiNvramIo(adress, buffer, size, FALSE); +} + + + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_KAMITEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/keypad.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..554f4493 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 KAMI_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_auto.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_auto.h new file mode 100644 index 00000000..c0a28718 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_auto.h @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_auto.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 AUTO_TOPMENU_H_ +#define AUTO_TOPMENU_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +//typedef void* (*TpProcess)(void); + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +extern BOOL gAutoFlag; + + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* AutoProcess0(void); +void* AutoProcess1(void); +void* AutoProcess2(void); +void* AutoProcess3(void); +void* AutoProcess4(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* AUTO_TOPMENU_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_eticket.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_eticket.h new file mode 100644 index 00000000..2b24ce98 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_eticket.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_eticket.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 PROCESS_ETICKET_H_ +#define PROCESS_ETICKET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define E_TICKET_FILE_PATH_IN_ROM "data/cert.sys" +#define E_TICKET_FILE_PATH_IN_NAND "F:sys/cert.sys" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* eTicketProcess0(void); +void* eTicketProcess1(void); +void* eTicketProcess2(void); +void* eTicketProcess3(void); +void* eTicketProcess4(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_ETICKET_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_format.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_format.h new file mode 100644 index 00000000..737eee82 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_format.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_format.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 PROCESS_FORMAT_H_ +#define PROCESS_FORMAT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +//typedef void* (*TpProcess)(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* FormatProcess0(void); +void* FormatProcess1(void); +void* FormatProcess2(void); +void* FormatProcess3(void); +void* FormatProcess4(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_FORMAT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h new file mode 100644 index 00000000..0f9ff672 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_hw_info.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 PROCESS_HW_INFO_H_ +#define PROCESS_HW_INFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +//typedef void* (*TpProcess)(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* HWInfoProcess0(void); +void* HWInfoProcess1(void); +void* HWInfoProcess2(void); +void* HWInfoProcess3(void); +void* HWInfoProcess4(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_HW_INFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_import.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_import.h new file mode 100644 index 00000000..acbf4fab --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_import.h @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_import.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 PROCESS_IMPORT_H_ +#define PROCESS_IMPORT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +//typedef void* (*TpProcess)(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* ImportProcess0(void); +void* ImportProcess1(void); +void* ImportProcess2(void); +void* ImportProcess3(void); +void* ImportProcess4(void); + +void ProgressInit(void); +void ProgressDraw(f32 ratio); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_IMPORT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_nandfirm.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_nandfirm.h new file mode 100644 index 00000000..da7b0c02 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_nandfirm.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_nandfirm.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 PROCESS_NANDFIRM_H_ +#define PROCESS_NANDFIRM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +//typedef void* (*TpProcess)(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* NandfirmProcess0(void); +void* NandfirmProcess1(void); +void* NandfirmProcess2(void); +void* NandfirmProcess3(void); +void* NandfirmProcess4(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_NANDFIRM_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_norfirm.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_norfirm.h new file mode 100644 index 00000000..b1dfbe81 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_norfirm.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_norfirm.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 PROCESS_NORFIRM_H_ +#define PROCESS_NORFIRM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +//typedef void* (*TpProcess)(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* NorfirmProcess0(void); +void* NorfirmProcess1(void); +void* NorfirmProcess2(void); +void* NorfirmProcess3(void); +void* NorfirmProcess4(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_NORFIRM_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_topmenu.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_topmenu.h new file mode 100644 index 00000000..709844fb --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_topmenu.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_topmenu.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 PROCESS_TOPMENU_H_ +#define PROCESS_TOPMENU_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +//typedef void* (*TpProcess)(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* TopmenuProcess0(void); +void* TopmenuProcess1(void); +void* TopmenuProcess2(void); +void* TopmenuProcess3(void); +void* TopmenuProcess4(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_TOPMENU_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/main.rsf b/build/systemMenu_RED/NandInitializer/ARM9.TWL/main.rsf new file mode 100644 index 00000000..7cbba9f2 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/main.rsf @@ -0,0 +1,182 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# 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:: 2008-01-07#$ +# $Rev: 436 $ +# $Author: yosiokat $ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + # + # BANNER FILE: + # + BannerTWLFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SaveBannerFile + #SaveBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../data + Root /data + File *.* + HostRoot $(PRIVKEY_PATH) + Root /key + File $(HWINFO_PRIVKEY) +} diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/cursor.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/cursor.c new file mode 100644 index 00000000..f7923eea --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/cursor.c @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: cursor.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include "graphics.h" +#include "cursor.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ +void SetCursorPos(u16 x, u16 y) +{ + GXOamAttr oam; + +/* [] + G2_SetOBJAttr( + &oam, + x, y, + 0, + GX_OAM_MODE_NORMAL, + FALSE, + GX_OAM_EFFECT_FLIP_H, + GX_OAM_SHAPE_8x8, + GX_OAM_COLORMODE_16, + 0xf6, // charNo + 0, + 0 + ); + + DC_FlushRange( &oam, sizeof(GXOamAttr) ); + GXS_LoadOAM( &oam, 8, sizeof(GXOamAttr) ); + + G2_SetOBJAttr( + &oam, + x+31, y, + 0, + GX_OAM_MODE_NORMAL, + FALSE, + GX_OAM_EFFECT_NONE, + GX_OAM_SHAPE_8x8, + GX_OAM_COLORMODE_16, + 0xf6, // charNo + 0, + 0 + ); + + DC_FlushRange( &oam, sizeof(GXOamAttr) ); + GXS_LoadOAM( &oam, 16, sizeof(GXOamAttr) ); +*/ + + G2_SetOBJAttr( + &oam, + x, y, + 0, + GX_OAM_MODE_NORMAL, + FALSE, + GX_OAM_EFFECT_NONE, + GX_OAM_SHAPE_8x8, + GX_OAM_COLORMODE_16, + 0xff, // charNo + 0, + 0 + ); + DC_FlushRange( &oam, sizeof(GXOamAttr) ); + GXS_LoadOAM( &oam, 24, sizeof(GXOamAttr) ); +} + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/font_data.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/font_data.c new file mode 100644 index 00000000..19003304 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/font_data.c @@ -0,0 +1,732 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: font_data.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +const u16 PlttDataSub[16][16] = { + {RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/graphics.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/graphics.c new file mode 100644 index 00000000..9239b235 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/graphics.c @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: praphics.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +//#include +#include +#include "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(0); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード + GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); + GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); + GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); + GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_font.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_font.c new file mode 100644 index 00000000..06f4d19b --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_font.c @@ -0,0 +1,392 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include "kami_font.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ + DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); + GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32); + } +} + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_pxi.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_pxi.c new file mode 100644 index 00000000..925eff25 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/kami_pxi.c @@ -0,0 +1,472 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include "kami_pxi.h" +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +// 詰めてコピーする +#define KAMI_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define KAMI_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL lock; + + KamiCommand command; + KAMIPxiResult result; + KAMICallback callback; + void* arg; + + u32 total; + u32 current; + u8* data; +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data); +static void KamiSendPxiData(u8 *pData); +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiDone(KAMIResult result); +static void KamiWaitBusy(void); + + +void KamiPxiInit( void ) +{ + kamiWork.lock = FALSE; + + PXI_Init(); + while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_KAMITEST, PXI_PROC_ARM7 )) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, 0, 0)) + { + return; + } +} + +/////////////////////////////////////////////////////////////////// + +//typedef void (*KAMICallback)(KAMIResult result, void *arg); +/* +void CDC_ReadCallback(KAMIResult result, void* arg); +void CDC_ReadCallback(KAMIResult result, void* arg) +{ + +} +*/ + +/*---------------------------------------------------------------------------* + Name: CODEC レジスタリード関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult CDC_ReadRegister(u8 page, u8 reg_no, u8* pData) +{ + OSIntrMode enabled; + + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)pData; + + if (KamiSendPxiCommand(CODEC_READ_REGISTER, 2, page)) + { + KamiSendPxiData(®_no); + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CODEC レジスタライト関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult CDC_WriteRegister(u8 page, u8 reg_no, u8 value) +{ + OSIntrMode enabled; + u8 data[2]; + int i; + + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + data[0] = reg_no; + data[1] = value; + + if (KamiSendPxiCommand(CODEC_WRITE_REGISTER, 3, page)) + { + for (i = 0; i < 2; i++) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: GPIO333 アクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult GPIO333_Write(BOOL value) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(GPIO333_WRITE, 1, (u8)value)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: フォーマット実行関数 + + Description: + + Arguments: FormatMode + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = callback; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(EXE_FORMAT, 1, format_mode) == FALSE) + { + return KAMI_RESULT_SEND_ERROR; + } + return KAMI_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: NANDアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &block); + KAMI_PACK_U32(&data[4], &buffer); + KAMI_PACK_U32(&data[8], &count); + + if (KamiSendPxiCommand(KAMI_NAND_IO, 12, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: Nvramアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ +KAMIResult kamiNvramIo(u32 address, void* buffer, u32 size, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &address); + KAMI_PACK_U32(&data[4], &buffer); + KAMI_PACK_U32(&data[8], &size); + + if (KamiSendPxiCommand(KAMI_NVRAM_IO, 12, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} +/////////////////////////////////////////////////////////////////// + + +///////// +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((size << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((data << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +static void KamiSendPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + if (data & KAMITEST_PXI_RESULT_BIT) + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.result = (KAMIPxiResult)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 未知のデータ + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + } + else // 後続データ + { + if (kamiWork.data == NULL) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + if (kamiWork.current == kamiWork.total-1) + { + KAMIResult result; + switch (kamiWork.result) + { + case KAMI_PXI_RESULT_SUCCESS: // alias KAMI_PXI_RESULT_SUCCESS_TRUE + result = KAMI_RESULT_SUCCESS; // alias KAMI_RESULT_SUCCESS_TRUE + break; + case KAMI_PXI_RESULT_SUCCESS_FALSE: + result = KAMI_RESULT_SUCCESS_FALSE; + break; + case KAMI_PXI_RESULT_INVALID_COMMAND: + result = KAMI_RESULT_INVALID_COMMAND; + break; + case KAMI_PXI_RESULT_INVALID_PARAMETER: + result = KAMI_RESULT_INVALID_PARAMETER; + break; + case KAMI_PXI_RESULT_ILLEGAL_STATUS: + result = KAMI_RESULT_ILLEGAL_STATUS; + break; + case KAMI_PXI_RESULT_BUSY: + result = KAMI_RESULT_BUSY; + break; + default: + result = KAMI_RESULT_FATAL_ERROR; + } + KamiDone(result); + return; + } +} + +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void KamiWaitBusy(void) +{ + volatile BOOL *p = &kamiWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} + +static void KamiDone(KAMIResult result) +{ + KAMICallback callback = kamiWork.callback; + void* arg = kamiWork.arg; + kamiWork.callback = NULL; + kamiWork.arg = NULL; + if (kamiWork.lock) + { + kamiWork.lock = FALSE; + } + if (callback) + { + callback(result, arg); + } +} diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/keypad.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..4c2bab13 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c new file mode 100644 index 00000000..fabeb2ac --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: main.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include "kami_font.h" +#include "process_format.h" +#include "process_topmenu.h" +#include "graphics.h" +#include "keypad.h" +#include "kami_pxi.h" +#include +#include +#include + +extern void HWInfoWriterInit( void ); + +typedef void* (*Process)(void); + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static Process sProcess; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + OS_Init(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + TP_Init(); + RTC_Init(); + + InitAllocation(); + + KamiPxiInit(); /* 独自PXI初期化 */ + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + /* initialize file-system */ + FS_Init(FS_DMA_NOT_USE); + + // NAMライブラリ初期化 + NAM_Init( OS_AllocFromMain, OS_FreeToMain); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // 初期シーケンス設定 + sProcess = TopmenuProcess0; + + kamiFontPrintfConsole( CONSOLE_ORANGE, "Thank you for using program.\n"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "+---------------------------+\n"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "l A Button : Select Menu l\n"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "l Up/Down Key : Change Menu l\n"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "l L&R Button : Auto Init * l\n"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "+---------------------------+\n"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "* Note that nand memory is deleted.\n"); + + while (1) + { + kamiPadRead(); + + // 蓋閉じ検出 + if (PAD_DetectFold() == TRUE) + { + PM_GoSleepMode_Twl(PM_TRIGGER_COVER_OPEN, 0, 0); + } + + // コマンドフラッシュ + (void)SND_FlushCommand(SND_COMMAND_NOBLOCK); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // ARM7コマンド応答受信 + while (SND_RecvCommandReply(SND_COMMAND_NOBLOCK) != NULL) + { + } + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + sProcess = sProcess(); + } +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c new file mode 100644 index 00000000..6f21e0c7 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c @@ -0,0 +1,216 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_auto.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include "kami_font.h" +#include "process_topmenu.h" +#include "process_format.h" +#include "process_hw_info.h" +#include "process_import.h" +#include "process_eticket.h" +#include "process_nandfirm.h" +#include "process_norfirm.h" +#include "process_auto.h" +#include "cursor.h" +#include "keypad.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define NUM_OF_MENU_SELECT 6 +#define DOT_OF_MENU_SPACE 16 +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 56 + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +BOOL gAutoFlag = FALSE; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s8 sMenuSelectNo; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: Top Menu プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* AutoProcess0(void) +{ + // オートフラグセット + gAutoFlag = TRUE; + + // メニュー初期化 + sMenuSelectNo = 0; + + // カーソル消去 + SetCursorPos((u16)200, (u16)200); + + return AutoProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Top Menu プロセス1 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* AutoProcess1(void) +{ + switch ( sMenuSelectNo++ ) + { + case 0: + return FormatProcess0; + case 1: + return HWInfoProcess0; + break; + case 2: + return eTicketProcess0; + case 3: + return ImportProcess0; + case 4: + return NandfirmProcess0; + case 5: + return AutoProcess2; + } + + // never reach + return TopmenuProcess0; +} + +/*---------------------------------------------------------------------------* + Name: Top Menu プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* AutoProcess2(void) +{ + int i; + u8 bg_color; + + // 文字列全クリア + kamiFontClear(); + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Auto Nand Initialization"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 7, FONT_COLOR_BLACK, " FORMAT NAND "); + kamiFontPrintf(3, 9, FONT_COLOR_BLACK, " WRITE HARDWARE INFO "); + kamiFontPrintf(3, 11, FONT_COLOR_BLACK, " WRITE ETICKET SIGN "); + kamiFontPrintf(3, 13, FONT_COLOR_BLACK, " INPORT TAD FROM SD "); + kamiFontPrintf(3, 15, FONT_COLOR_BLACK, " INPORT NANDFIRM FROM SD"); + kamiFontPrintf(3, 22, FONT_COLOR_BLACK, " Button B : return to menu"); + + for (i=0;i +#include +#include +#include +#include "kami_font.h" +#include "kami_pxi.h" +#include "process_topmenu.h" +#include "process_eticket.h" +#include "process_auto.h" +#include "cursor.h" +#include "keypad.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define NUM_OF_MENU_SELECT 2 +#define DOT_OF_MENU_SPACE 16 +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 56 + +#define ROUND_UP(value, alignment) \ + (((u32)(value) + (alignment-1)) & ~(alignment-1)) + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s8 sMenuSelectNo; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static BOOL MakeETicketFile(void); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: eTicket プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* eTicketProcess0(void) +{ + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write eTicket Sign"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+"); + kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l WRITE E-TICKET l l"); + kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+"); + kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l RETURN l l"); + kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+-------------------+-----+"); + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景上部 + kamiFontFillChar( 0, BG_COLOR_GRAY, BG_COLOR_GRAY ); + kamiFontFillChar( 1, BG_COLOR_GRAY, BG_COLOR_GRAY ); + kamiFontFillChar( 2, BG_COLOR_GRAY, BG_COLOR_TRANS ); + + return eTicketProcess1; +} + +/*---------------------------------------------------------------------------* + Name: eTicket プロセス1 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* eTicketProcess1(void) +{ + // オート実行用 + if (gAutoFlag) + { + sMenuSelectNo = 0; + return eTicketProcess2; + } + + // 選択メニューの変更 + if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) + { + if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; + } + else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) + { + if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return eTicketProcess2; + } + // トップメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + return TopmenuProcess0; + } + + return eTicketProcess1; +} + +/*---------------------------------------------------------------------------* + Name: eTicket プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* eTicketProcess2(void) +{ + BOOL result; + + switch( sMenuSelectNo ) + { + case 0: + result = MakeETicketFile(); + if (result) + { + kamiFontPrintf(25, 7, FONT_COLOR_GREEN, "OK"); + } + else + { + kamiFontPrintf(25, 7, FONT_COLOR_RED, "NG"); + } + break; + case 1: + return TopmenuProcess0; + } + + // Auto用 + if (gAutoFlag) + { + if (result) return AutoProcess1; + else return AutoProcess2; + } + + return eTicketProcess1; +} + +/*---------------------------------------------------------------------------* + Name: eTicket プロセス3 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* eTicketProcess3(void) +{ + return eTicketProcess3; +} + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +static BOOL MakeETicketFile(void) +{ + FSFile file; + FATFSFileHandle fat_handle; + + BOOL open_is_ok; + BOOL read_is_ok; + void* pTempBuf; + u32 file_size; + u32 alloc_size; + BOOL result = TRUE; + + // F:sys/cert.sysが既に存在するなら何もしない + fat_handle = FATFS_OpenFile(E_TICKET_FILE_PATH_IN_NAND, "r"); + if (fat_handle) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "%s already exist\n", E_TICKET_FILE_PATH_IN_NAND); + kamiFontPrintf(2, 20, FONT_COLOR_RED, "%s already exist", E_TICKET_FILE_PATH_IN_NAND); + FATFS_CloseFile(fat_handle); + return FALSE; + } + + // ROMファイルオープン + FS_InitFile(&file); + open_is_ok = FS_OpenFile(&file, E_TICKET_FILE_PATH_IN_ROM); + if (!open_is_ok) + { + OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", E_TICKET_FILE_PATH_IN_ROM); + return FALSE; + } + + // ROMファイルリード + file_size = FS_GetFileLength(&file) ; + alloc_size = ROUND_UP(file_size, 32) ; + pTempBuf = OS_Alloc( alloc_size ); + SDK_NULL_ASSERT(pTempBuf); + DC_InvalidateRange(pTempBuf, alloc_size); + read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); + if (!read_is_ok) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", E_TICKET_FILE_PATH_IN_ROM); + FS_CloseFile(&file); + OS_Free(pTempBuf); + return FALSE; + } + + // ROMファイルクローズ + FS_CloseFile(&file); + + // F:sys/cert.sys作成 + if (!FATFS_CreateFile(E_TICKET_FILE_PATH_IN_NAND, TRUE, "rwxrwxrwx")) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FATFS_CreateFile(%s) failed.\n", E_TICKET_FILE_PATH_IN_NAND); + result = FALSE; + } + else + { + // F:sys/cert.sysオープン + fat_handle = FATFS_OpenFile(E_TICKET_FILE_PATH_IN_NAND, "w"); + if (!fat_handle) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FATFS_OpenFile(%s) failed.\n", E_TICKET_FILE_PATH_IN_NAND); + result = FALSE; + } + // F:sys/cert.sys書き込み + else if (FATFS_WriteFile(fat_handle, pTempBuf, (s32)file_size) == -1) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FATFS_WritFile() failed.\n"); + result = FALSE; + } + (void)FATFS_CloseFile(fat_handle); + } + + OS_Free(pTempBuf); + + return result; +} + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_format.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_format.c new file mode 100644 index 00000000..c5ac956e --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_format.c @@ -0,0 +1,294 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_format.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "kami_font.h" +#include "kami_pxi.h" +#include "process_topmenu.h" +#include "process_format.h" +#include "process_auto.h" +#include "cursor.h" +#include "keypad.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define NUM_OF_MENU_SELECT 4 +#define DOT_OF_MENU_SPACE 16 +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 56 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s8 sMenuSelectNo; +static u8 sLock; +static u8 sFormatResult; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void FormatCallback(KAMIResult result, void* arg); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: Format プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* FormatProcess0(void) +{ + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Format Nand Flash"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+"); + kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l QUICK FORMAT l l"); + kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+"); + kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l FULL FORMAT l l"); + kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+-------------------+-----+"); + kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l CHECK DISK l l"); + kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+-------------------+-----+"); + kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l RETURN l l"); + kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+-------------------+-----+"); + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景上部 + kamiFontFillChar( 0, BG_COLOR_BLUE, BG_COLOR_BLUE ); + kamiFontFillChar( 1, BG_COLOR_BLUE, BG_COLOR_BLUE ); + kamiFontFillChar( 2, BG_COLOR_BLUE, BG_COLOR_TRANS ); + + return FormatProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Format プロセス1 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* FormatProcess1(void) +{ + // オート実行用 + if (gAutoFlag) + { + sMenuSelectNo = 0; + return FormatProcess2; + } + + // 選択メニューの変更 + if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) + { + if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; + } + else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) + { + if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return FormatProcess2; + } + // トップメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + return TopmenuProcess0; + } + + return FormatProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Format プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* FormatProcess2(void) +{ + if (sLock == FALSE) + { + switch( sMenuSelectNo ) + { + case 0: + sLock = TRUE; + ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback); + kamiFontPrintf(24, 7, FONT_COLOR_BLACK, " "); + return FormatProcess3; + case 1: + sLock = TRUE; + ExeFormatAsync(FORMAT_MODE_FULL, FormatCallback); + kamiFontPrintf(24, 9, FONT_COLOR_BLACK, " "); + return FormatProcess3; + case 2: + { + FATFSDiskInfo info; + BOOL result = FALSE; + + kamiFontPrintf(24, 11, FONT_COLOR_BLACK, " "); + kamiFontLoadScreenData(); + + FATFS_UnmountDrive("F:"); + FATFS_UnmountDrive("G:"); + // 指定のNANDパーティション0をFドライブにマウント + if (FATFS_MountDrive("F", FATFS_MEDIA_TYPE_NAND, 0)) + { + // チェックディスク実行 + if (FATFS_CheckDisk("F:", &info, TRUE, TRUE, TRUE)) + { + // 指定のNANDパーティション1をGドライブにマウント + if (FATFS_MountDrive("G", FATFS_MEDIA_TYPE_NAND, 1)) + { + // チェックディスク実行 + if (FATFS_CheckDisk("G:", &info, TRUE, TRUE, TRUE)) + { + result = TRUE; + } + } + } + } + + // デフォルトマウント状態に戻しておく + FATFS_UnmountDrive("G:"); + FATFS_MountDrive("G", FATFS_MEDIA_TYPE_SD, 0); + + if (result == TRUE) { kamiFontPrintf(24, 11, FONT_COLOR_GREEN, " OK "); } + else { kamiFontPrintf(24, 11, FONT_COLOR_RED, " NG "); } + + return FormatProcess1; + } + case 3: + return TopmenuProcess0; + } + } + + return FormatProcess1; +} + +static void FormatCallback(KAMIResult result, void* /*arg*/) +{ + s16 y_pos; + + if ( sMenuSelectNo == 0 ) y_pos = 7; + else y_pos = 9; + + if ( result == KAMI_RESULT_SUCCESS_TRUE ) + { + kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK "); + sFormatResult = TRUE; + } + else + { + kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG "); + sFormatResult = FALSE; + } + + // ロック解除 + sLock = FALSE; +} + +/*---------------------------------------------------------------------------* + Name: Format プロセス3 + + Description: フォーマット完了待ちプロセス + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* FormatProcess3(void) +{ + static s32 progress; + s16 y_pos; + + // 処理終了判定 + if (sLock == FALSE) + { + progress = 0; + + // Auto用 + if (gAutoFlag) + { + if (sFormatResult == TRUE) return AutoProcess1; + else return AutoProcess2; + } + + return FormatProcess1; + } + + if ( sMenuSelectNo == 0 ) { y_pos = 7; } + else { y_pos = 9; } + + // 進捗表示更新 + if ( ++progress >= 30*5 ) + { + progress = 0; + kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " "); + } + + kamiFontPrintf((s16)(24 + (progress / 30)), y_pos, FONT_COLOR_BLACK, "*"); + + return FormatProcess3; +} + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c new file mode 100644 index 00000000..cd3e82b0 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c @@ -0,0 +1,664 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_hw_info.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "kami_font.h" +#include "kami_pxi.h" +#include "process_topmenu.h" +#include "process_hw_info.h" +#include "process_auto.h" +#include "cursor.h" +#include "keypad.h" + +#include +//#include +//#include + +// +#include "TWLHWInfo_api.h" +#include "TWLSettings_api.h" +// + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define NUM_OF_MENU_SELECT 8 +#define DOT_OF_MENU_SPACE 16 +#define CHAR_OF_MENU_SPACE 2 +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 56 + +static const u32 s_langBitmapList[ LCFG_TWL_REGION_MAX ] = { + LCFG_TWL_LANG_BITMAP_JAPAN, + LCFG_TWL_LANG_BITMAP_AMERICA, + LCFG_TWL_LANG_BITMAP_EUROPE, + LCFG_TWL_LANG_BITMAP_AUSTRALIA, + LCFG_TWL_LANG_BITMAP_CHINA, + LCFG_TWL_LANG_BITMAP_KOREA, +}; + +static char *strLanguage[] = { + (char *)"LANG_JAPANESE", + (char *)"LANG_ENGLISH", + (char *)"LANG_FRENCH", + (char *)"LANG_GERMAN", + (char *)"LANG_ITALIAN", + (char *)"LANG_SPANISH", + (char *)"LANG_CHINESE", + (char *)"LANG_KOREAN", +}; + +static const char *strRegion[] = { + "JAPAN", + "AMERICA", + "EUROPE", + "AUSTRALIA", + "CHINA", + "KOREA", +}; + +static const char *strLauncherGameCode[] = { + "LNCJ", + "LNCE", + "LNCP", + "LNCO", + "LNCC", + "LNCK", +}; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s8 sMenuSelectNo; + +static u8 *s_pPrivKeyBuffer = NULL; +static LCFGReadResult (*s_pReadSecureInfoFunc)( void ); +static BOOL s_isReadTSD; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +void HWInfoWriterInit( void ); +static void ReadTWLSettings( void ); +static void ModifyLanguage( u8 region ); +static void ReadPrivateKey( void ); +static void ReadHWInfoFile( void ); +static void VerifyHWInfo( void ); +static BOOL WriteHWInfoFile( u8 region ); +static BOOL WriteHWNormalInfoFile( void ); +static BOOL WriteHWSecureInfoFile( u8 region ); +static BOOL DeleteHWInfoFile( void ); + +const LCFGTWLHWNormalInfo *LCFG_THW_GetDefaultNormalInfo( void ); +const LCFGTWLHWSecureInfo *LCFG_THW_GetDefaultSecureInfo( void ); +const LCFGTWLHWNormalInfo *LCFG_THW_GetNormalInfo( void ); +const LCFGTWLHWSecureInfo *LCFG_THW_GetSecureInfo( void ); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: HWInfo プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* HWInfoProcess0(void) +{ + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write Hardware Information "); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l REGION JAPAN l l"); + kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l REGION AMERICA l l"); + kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l REGION EUROPE l l"); + kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l REGION AUSTRALIA l l"); + kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 15, FONT_COLOR_BLACK, "l REGION CHINA l l"); + kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 17, FONT_COLOR_BLACK, "l REGION KOREA l l"); + kamiFontPrintf(3, 18, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 19, FONT_COLOR_BLACK, "l DELETE l l"); + kamiFontPrintf(3, 20, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 21, FONT_COLOR_BLACK, "l RETURN l l"); + kamiFontPrintf(3, 22, FONT_COLOR_BLACK, "+--------------------+----+"); + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景上部 + kamiFontFillChar( 0, BG_COLOR_PURPLE, BG_COLOR_PURPLE ); + kamiFontFillChar( 1, BG_COLOR_PURPLE, BG_COLOR_PURPLE ); + kamiFontFillChar( 2, BG_COLOR_PURPLE, BG_COLOR_TRANS ); + + // 前準備 + HWInfoWriterInit(); + + return HWInfoProcess1; +} + +/*---------------------------------------------------------------------------* + Name: HWInfo プロセス1 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* HWInfoProcess1(void) +{ + // オート実行用 + if (gAutoFlag) + { + sMenuSelectNo = 0; + return HWInfoProcess2; + } + + // 選択メニューの変更 + if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) + { + if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; + } + else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) + { + if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return HWInfoProcess2; + } + // トップメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + return TopmenuProcess0; + } + + return HWInfoProcess1; +} + +/*---------------------------------------------------------------------------* + Name: HWInfo プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* HWInfoProcess2(void) +{ + int i; + BOOL result; + + switch( sMenuSelectNo ) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + OS_TPrintf( "Write Start.\n" ); + result = WriteHWInfoFile( (u8)sMenuSelectNo ); + break; + case 6: + OS_TPrintf( "Delete start.\n" ); + result = DeleteHWInfoFile(); + break; + case 7: + return TopmenuProcess0; + } + + // 全結果をクリア + for (i=0;i \"%s\"\n", + strLanguage[ nowLanguage ], strLanguage[ LCFG_TSD_GetLanguage() ] ); + } +} + +/*---------------------------------------------------------------------------* + Name: 秘密鍵のリード + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +static void ReadPrivateKey( void ) +{ + BOOL result = FALSE; + u32 keyLength; + FSFile file; + OSTick start = OS_GetTick(); + + FS_InitFile( &file ); + if( !FS_OpenFileEx( &file, "rom:key/private_HWInfo.der", FS_FILEMODE_R ) ) { + OS_TPrintf( "PrivateKey read failed.\n" ); + }else { + keyLength = FS_GetFileLength( &file ); + if( keyLength > 0 ) { + s_pPrivKeyBuffer = OS_Alloc( keyLength ); + if( FS_ReadFile( &file, s_pPrivKeyBuffer, (s32)keyLength ) == keyLength ) { + OS_TPrintf( "PrivateKey read succeeded.\n" ); + result = TRUE; + }else { + OS_TPrintf( "PrivateKey read failed.\n" ); + } + } + FS_CloseFile( &file ); + } + + if( !result && s_pPrivKeyBuffer ) { + OS_Free( s_pPrivKeyBuffer ); + s_pPrivKeyBuffer = NULL; + } + OS_TPrintf( "PrivKey read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); + +#ifdef USE_PRODUCT_KEY + // 製品用秘密鍵が有効なら、署名ありのアクセス + s_pReadSecureInfoFunc = LCFGi_THW_ReadSecureInfo; +#else + // そうでないなら、署名なしのアクセス + s_pReadSecureInfoFunc = LCFGi_THW_ReadSecureInfo_NoCheck; +// PutStringUTF16( 14 * 8, 0 * 8, TXT_COLOR_RED, (const u16 *)L"[No Signature MODE]" ); +#endif +} + +/*---------------------------------------------------------------------------* + Name: HW情報全体のリード + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +static void ReadHWInfoFile( void ) +{ + LCFGReadResult retval; + OSTick start = OS_GetTick(); + + retval = LCFGi_THW_ReadNormalInfo(); + if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { + OS_TPrintf( "HW Normal Info read succeeded.\n" ); + }else { + OS_TPrintf( "HW Normal Info read failed.\n" ); + } + + OS_TPrintf( "HW Normal Info read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); + + start = OS_GetTick(); + retval = s_pReadSecureInfoFunc(); + if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { + OS_TPrintf( "HW Secure Info read succeeded.\n" ); + }else { + OS_TPrintf( "HW Secure Info read failed.\n" ); + } + OS_TPrintf( "HW Secure Info read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); +} + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +static BOOL WriteHWInfoFile( u8 region ) +{ + static const u16 *pMsgNormalWriting = (const u16 *)L"Writing Normal File..."; + static const u16 *pMsgSecureWriting = (const u16 *)L"Writing Secure File..."; + static const u16 *pMsgSucceeded = (const u16 *)L"Succeeded!"; + static const u16 *pMsgFailed = (const u16 *)L"Failed!"; + BOOL result = TRUE; + + // ノーマルファイルのライト +// (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalWriting ); + + if( WriteHWNormalInfoFile() ) { +// (void)PutStringUTF16( ( MSG_X + 18 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { +// (void)PutStringUTF16( ( MSG_X + 18 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); + result = FALSE; + } + + // セキュアファイルのライト +// (void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLACK, pMsgSecureWriting ); + + if( WriteHWSecureInfoFile( region ) ) { +// (void)PutStringUTF16( ( MSG_X + 18 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { +// (void)PutStringUTF16( ( MSG_X + 18 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed ); + result = FALSE; + } + + ModifyLanguage( region ); + + // メッセージを一定時間表示して消去 +// DispMessage( 0, 0, TXT_COLOR_NULL, NULL ); +// NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE, +// MSG_X * 8 , MSG_Y * 8, ( 32 - MSG_X ) * 8, ( MSG_Y + 4 ) * 8 ); + + return result; +} + +/*---------------------------------------------------------------------------* + Name: HWノーマルInfoファイルのライト + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +static BOOL WriteHWNormalInfoFile( void ) +{ + BOOL isWrite = TRUE; + LCFGReadResult result; + + result = LCFGi_THW_ReadNormalInfo(); + if( result != LCFG_TSF_READ_RESULT_SUCCEEDED ) { + if( !LCFGi_THW_RecoveryNormalInfo( result ) ) { + OS_TPrintf( "HW Normal Info Recovery failed.\n" ); + isWrite = FALSE; + } + } + if( isWrite && + !LCFGi_THW_WriteNormalInfo() ) { + OS_TPrintf( "HW Normal Info Write failed.\n" ); + } + + return isWrite; +} + +/*---------------------------------------------------------------------------* + Name: HWセキュアInfoファイルのライト + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +static BOOL WriteHWSecureInfoFile( u8 region ) +{ + BOOL isWrite = TRUE; + LCFGReadResult result; + + // ファイルのリード + result = s_pReadSecureInfoFunc(); + + // リードに失敗したらリカバリ + if( result != LCFG_TSF_READ_RESULT_SUCCEEDED ) { + if( !LCFGi_THW_RecoverySecureInfo( result ) ) { + OS_TPrintf( "HW Secure Info Recovery failed.\n" ); + isWrite = FALSE; + } + } + + // リージョンのセット + LCFG_THW_SetRegion( region ); + + // 対応言語ビットマップのセット + LCFG_THW_SetValidLanguageBitmap( s_langBitmapList[ region ] ); + + // [TODO:]量産工程でないとシリアルNo.は用意できないので、ここではMACアドレスをもとに適当な値をセットする。 + // シリアルNo.のセット + { + u8 buffer[ 12 ] = "SERIAL"; // 適当な文字列をMACアドレスと結合してSHA1を取り、仮SerialNoとする。 + u8 serialNo[ SVC_SHA1_DIGEST_SIZE ]; + int i; + int len = ( LCFG_THW_GetRegion() == LCFG_TWL_REGION_AMERICA ) ? + LCFG_TWL_HWINFO_SERIALNO_LEN_AMERICA : LCFG_TWL_HWINFO_SERIALNO_LEN_OTHERS; + OS_GetMacAddress( buffer + 6 ); + SVC_CalcSHA1( serialNo, buffer, sizeof(buffer) ); + for( i = 3; i < SVC_SHA1_DIGEST_SIZE; i++ ) { + serialNo[ i ] = (u8)( ( serialNo[ i ] % 10 ) + 0x30 ); + } + MI_CpuCopy8( "SRN", serialNo, 3 ); + MI_CpuClear8( &serialNo[ len ], sizeof(serialNo) - len ); + OS_TPrintf( "serialNo : %s\n", serialNo ); + LCFG_THW_SetSerialNo( serialNo ); + } + + // ランチャーゲームコード + LCFG_THW_SetLauncherGameCode( (const u8 *)strLauncherGameCode[ region ] ); + + // ライト + if( isWrite && + !LCFGi_THW_WriteSecureInfo( s_pPrivKeyBuffer ) ) { + isWrite = FALSE; + OS_TPrintf( "HW Secure Info Write failed.\n" ); + } + + return isWrite; +} + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +static BOOL DeleteHWInfoFile( void ) +{ + static const u16 *pMsgNormalDeleting = (const u16 *)L"Deleting Normal File..."; + static const u16 *pMsgSecureDeleting = (const u16 *)L"Deteting Secure File..."; + static const u16 *pMsgSucceeded = (const u16 *)L"Succeeded!"; + static const u16 *pMsgFailed = (const u16 *)L"Failed!"; + BOOL result = TRUE; + + // ノーマルファイル +// (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalDeleting ); + if( FS_DeleteFile( (char *)LCFG_TWL_HWINFO_NORMAL_PATH ) ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); +// (void)PutStringUTF16( ( MSG_X + 19 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); +// (void)PutStringUTF16( ( MSG_X + 19 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); + result = FALSE; + } + + // セキュアファイル +// (void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLACK, pMsgSecureDeleting ); + if( FS_DeleteFile( (char *)LCFG_TWL_HWINFO_SECURE_PATH ) ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); +// (void)PutStringUTF16( ( MSG_X + 19 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); +// (void)PutStringUTF16( ( MSG_X + 19 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed ); + result = FALSE; + } +// DispMessage( 0, 0, TXT_COLOR_NULL, NULL ); +// NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE, +// MSG_X * 8 , MSG_Y * 8, ( 32 - MSG_X ) * 8, ( MSG_Y + 4 ) * 8 ); + + return result; +} diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c new file mode 100644 index 00000000..66c9447d --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c @@ -0,0 +1,870 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_import.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "kami_font.h" +#include "kami_pxi.h" +#include "process_topmenu.h" +#include "process_import.h" +#include "process_eticket.h" +#include "process_auto.h" +#include "cursor.h" +#include "keypad.h" + +#include "TWLHWInfo_api.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef enum { + TAD_WRITE_OPTION_OVERWRITE, // 強制上書き + TAD_WRITE_OPTION_NONEXISTENT, // NANDに同プログラムが存在しない場合に限り書き込み + TAD_WRITE_OPTION_USER // ユーザーに選択させる +} TadWriteOption; + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define NUM_OF_MENU_SELECT 4 +#define NUM_OF_MENU_SELECT_INDIVIDUALLY 17 + +#define DOT_OF_MENU_SPACE 16 +#define DOT_OF_MENU_SPACE_INDIVIDUALLY 8 + +#define CHAR_OF_MENU_SPACE 2 +#define CHAR_OF_MENU_SPACE_INDIVIDUALLY 1 + +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 40 + + +// 表示&インポートできる.TADファイルは最大16個まで +// しかもSDカードのルートに存在するファイルのみというお手軽実装 +#define FILE_NUM_MAX 16 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s32 sMenuSelectNo; +static s32 sMenuSelectNoIndividually; + +static LCFGReadResult (*s_pReadSecureInfoFunc)( void ); + +static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; + +static u8 sFileNum; + +static void* spStack; + +static u32 sCurrentProgress; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static BOOL ImportTad(char* file_name, TadWriteOption option); +static void ProgressThread(void* arg); +static void Destructor(void* arg); +static void DumpTadInfo(void); +static void MakeFullPathForSD(char* file_name, char* full_path); +static void ShowTitleinfoDifference( NAMTitleInfo* titleInfoNand, NAMTitleInfo* titleInfoSd); +void ProgessInit(void); +void ProgressDraw(f32 ratio); +static void* ImportProcessReturn(void); + +static void* ImportIndividuallyProcess0(void); +static void* ImportIndividuallyProcess1(void); +static void* ImportIndividuallyProcess2(void); +static void* ImportIndividuallyProcess3(void); + +static void* ImportAllOverwriteProcess0(void); +static void* ImportAllOverwriteProcess1(void); +static void* ImportAllOverwriteProcess2(void); +static void* ImportAllOverwriteProcess3(void); + +static void* ImportAllNonexistentProcess0(void); +static void* ImportAllNonexistentProcess1(void); +static void* ImportAllNonexistentProcess2(void); +static void* ImportAllNonexistentProcess3(void); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: Import プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* ImportProcess0(void) +{ + FATFSFileHandle fat_handle; + FSFile dir; + int i; + + // F:sys/cert.sysが存在しないなら出直してもらう + fat_handle = FATFS_OpenFile(E_TICKET_FILE_PATH_IN_NAND, "r"); + if (!fat_handle) + { + FATFS_CloseFile(fat_handle); + return ImportProcessReturn; + } + FATFS_CloseFile(fat_handle); + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import TAD from SD"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 5, FONT_COLOR_BLACK, "l OVERWRITE ALL l l"); + kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l WRITE NONEXISTENT l l"); + kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l SELECT FILE >> l l"); + kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l RETURN l l"); + kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+--------------------+----+"); + + // 配列クリア + MI_CpuClear8( sFilePath, sizeof(sFilePath) ); + + // ファイル数初期化 + sFileNum = 0; + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景上部 + kamiFontFillChar( 0, BG_COLOR_PINK, BG_COLOR_PINK ); + kamiFontFillChar( 1, BG_COLOR_PINK, BG_COLOR_PINK ); + kamiFontFillChar( 2, BG_COLOR_PINK, BG_COLOR_TRANS ); + + // SDカードのルートディレクトリを検索 + if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) + { + kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory(sdmc:/)\n"); + } + else + { + FSDirectoryEntryInfo info[1]; + OS_Printf("[%s]:\n", "sdmc:/"); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "------ tad file List -----\n"); + + // .dat .nand .nor を探してファイル名を保存しておく + while (FS_ReadDirectory(&dir, info)) + { + OS_Printf(" %s", info->longname); + if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0) + { + OS_Printf("/\n"); + } + else + { + char* pExtension; + OS_Printf(" (%d BYTEs)\n", info->filesize); + + // 拡張子のチェック + pExtension = STD_SearchCharReverse( info->longname, '.'); + if (pExtension) + { + if (!STD_CompareString( pExtension, ".tad") ) + { + char full_path[FS_ENTRY_LONGNAME_MAX+6]; + + // フルパスを作成 + MakeFullPathForSD(info->longname, full_path); + + STD_CopyString( sFilePath[sFileNum], info->longname ); + kamiFontPrintfConsole(CONSOLE_ORANGE, "%d:%s\n", sFileNum, info->longname); + + // 最大16個で終了 + if (++sFileNum >= FILE_NUM_MAX) + { + break; + } + } + } + } + } + (void)FS_CloseDirectory(&dir); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n"); + +// DumpTadInfo(); + } + + return ImportProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Import プロセス1 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* ImportProcess1(void) +{ + // オート実行用 + if (gAutoFlag) + { + sMenuSelectNo = 0; + return ImportProcess2; + } + + // 選択メニューの変更 + if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) + { + if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; + } + else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) + { + if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return ImportProcess2; + } + // トップメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + return TopmenuProcess0; + } + + return ImportProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Import プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* ImportProcess2(void) +{ + switch( sMenuSelectNo ) + { + case 0: + return ImportAllOverwriteProcess0; + break; + case 1: + return ImportAllNonexistentProcess0; + break; + case 2: + return ImportIndividuallyProcess0; + case 3: + return TopmenuProcess0; + } + + return ImportProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Import プロセス3 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* ImportProcessReturn(void) +{ + int i; + + // 文字列全クリア + kamiFontClear(); + kamiFontPrintf(4, 10, FONT_COLOR_RED, "%s is not exist", E_TICKET_FILE_PATH_IN_NAND); + kamiFontPrintf(4, 11, FONT_COLOR_RED, "You should write e-ticket", E_TICKET_FILE_PATH_IN_NAND); + kamiFontPrintf(4, 12, FONT_COLOR_RED, "beforehand.", E_TICKET_FILE_PATH_IN_NAND); + kamiFontPrintf(4, 22, FONT_COLOR_BLACK, "B Button : return to menu"); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import TAD from SD"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景上部 + kamiFontFillChar( 0, BG_COLOR_PINK, BG_COLOR_PINK ); + kamiFontFillChar( 1, BG_COLOR_PINK, BG_COLOR_PINK ); + kamiFontFillChar( 2, BG_COLOR_PINK, BG_COLOR_TRANS ); + + // カーソル消去 + SetCursorPos((u16)200, (u16)200); + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + while(1) + { + kamiPadRead(); + if (kamiPadIsTrigger(PAD_BUTTON_B)) { break; } + } + + return TopmenuProcess0; +} + +/*---------------------------------------------------------------------------* + 全ファイルインポートプロセス(上書き) + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: 全ファイルImport プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +static void* ImportAllOverwriteProcess0(void) +{ + int i; + BOOL result = TRUE; + + kamiFontPrintf(25, 5, FONT_COLOR_BLACK, "WAIT"); + + for (i=0;i 0) return AutoProcess1; + else return AutoProcess2; + } + + return ImportProcess1; +} + +/*---------------------------------------------------------------------------* + 全ファイルインポートプロセス(既存ファイルは上書きしない) + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: 重複しないファイルImport プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +static void* ImportAllNonexistentProcess0(void) +{ + int i; + BOOL result = TRUE; + + kamiFontPrintf(25, 7, FONT_COLOR_BLACK, "WAIT"); + + for (i=0;i sFileNum) sMenuSelectNoIndividually = 0; + DumpTadInfo(); + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNoIndividually * DOT_OF_MENU_SPACE_INDIVIDUALLY)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return ImportIndividuallyProcess2; + } + // ひとつ前のメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + return ImportProcess0; + } + + return ImportIndividuallyProcess1; +} + +/*---------------------------------------------------------------------------* + Name: 個別Import プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +#define THREAD_STACK_SIZE (16*1024) + +void* ImportIndividuallyProcess2(void) +{ + BOOL ret; + + if (STD_GetStringLength(sFilePath[sMenuSelectNoIndividually])) + { + // 個別インポート + ret = ImportTad(sFilePath[sMenuSelectNoIndividually], TAD_WRITE_OPTION_USER); + } + else + { + // リターン + return ImportProcess0; + } + + // 今回の結果を表示 + if ( ret == TRUE ) + { + kamiFontPrintf(26, (s16)(5+sMenuSelectNoIndividually*CHAR_OF_MENU_SPACE_INDIVIDUALLY), FONT_COLOR_GREEN, "OK"); + } + else + { + kamiFontPrintf(26, (s16)(5+sMenuSelectNoIndividually*CHAR_OF_MENU_SPACE_INDIVIDUALLY), FONT_COLOR_RED, "NG"); + } + + return ImportIndividuallyProcess1; +} + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ImportTad + + Description: .tad ファイルインポート + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ +static BOOL ImportTad(char* file_name, TadWriteOption option) +{ + NAMTadInfo tadInfo; + NAMTitleInfo titleInfo; + char full_path[FS_ENTRY_LONGNAME_MAX+6]; + OSThread thread; + BOOL ret = FALSE; + + // フルパスを作成 + MakeFullPathForSD(file_name, full_path); + + // tadファイルの情報取得 + if (NAM_ReadTadInfo(&tadInfo, full_path) != NAM_OK) + { + return FALSE; + } + + // NANDの情報を取得 + if ( option != TAD_WRITE_OPTION_OVERWRITE && NAM_ReadTitleInfo(&titleInfo, tadInfo.titleInfo.titleId) == NAM_OK) + { + // NANDに既にインストールされているかどうか確認する + if (tadInfo.titleInfo.titleId == titleInfo.titleId) + { + switch (option) + { + case TAD_WRITE_OPTION_NONEXISTENT: + return TRUE; + case TAD_WRITE_OPTION_USER: + ShowTitleinfoDifference(&titleInfo, &tadInfo.titleInfo); + + kamiFontPrintfConsole(1, "The program has already existed."); + kamiFontPrintfConsole(1, "Do you overwrite ?\n"); + kamiFontPrintfConsole(1, " \n"); + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + while(1) + { + kamiPadRead(); + + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + break; + } + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + kamiFontPrintfConsole(CONSOLE_ORANGE, "Import was canceled.\n"); + return TRUE; + } + } + } + } + } + + // 進捗スレッド作成 + spStack = OS_Alloc(THREAD_STACK_SIZE); + MI_CpuClear8(spStack, THREAD_STACK_SIZE); + OS_CreateThread(&thread, ProgressThread, NULL, + (void*)((u32)spStack + THREAD_STACK_SIZE), THREAD_STACK_SIZE, OS_THREAD_PRIORITY_MAX); + // デストラクタセット + OS_SetThreadDestructor( &thread, Destructor ); + OS_WakeupThreadDirect(&thread); + + // Import開始 + OS_Printf( "Import %s Start.\n", full_path ); + kamiFontPrintfConsole(CONSOLE_ORANGE, "Import %s Start.\n", file_name ); + + if ( NAM_ImportTad( full_path ) == NAM_OK ) + { + ret = TRUE; + kamiFontPrintfConsole(CONSOLE_ORANGE, "Import %s Sucess.\n", file_name ); + } + else + { + kamiFontPrintfConsole(1, "Import %s Fail.\n", file_name ); + } + + return ret; +} + +static void Destructor(void* /*arg*/) +{ + OS_Free(spStack); +} + +/*---------------------------------------------------------------------------* + Name: ProgressThread + + Description: .tad ファイルインポートの進捗を表示するスレッド。 + 進捗が100%に達すると処理を抜ける。 + + Arguments: arg - 使用しない。 + + Returns: None. + *---------------------------------------------------------------------------*/ + +static void ProgressThread(void* /*arg*/) +{ + u32 currentSize; + u32 totalSize; + + ProgressInit(); + + while (TRUE) + { + NAM_GetProgress(¤tSize, &totalSize); + if (totalSize != 0) + { + ProgressDraw((f32)currentSize/totalSize); + + // 100%なら終了 + if (currentSize == totalSize) + { + break; + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: DumpTadInfo + + Description: .tad ファイルの情報を表示する + + Arguments: arg - 使用しない。 + + Returns: None. + *---------------------------------------------------------------------------*/ + +static void DumpTadInfo(void) +{ + NAMTadInfo info; + + // ファイル名の有無を確認 + if (STD_GetStringLength(sFilePath[sMenuSelectNoIndividually])) + { + char full_path[FS_ENTRY_LONGNAME_MAX+6]; + + // フルパスを作成 + MakeFullPathForSD( sFilePath[sMenuSelectNoIndividually], full_path ); + + // TADファイルの情報取得 + if (NAM_ReadTadInfo(&info, full_path) == NAM_OK) + { + char temp[100]; + u16 companyCode = MI_SwapEndian16(info.titleInfo.companyCode); + u32 gameCode = (u32)(info.titleInfo.titleId & 0xffffffff); + gameCode = MI_SwapEndian32(gameCode); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "------ tad profile -----\n"); + + // File Name + kamiFontPrintfConsole(CONSOLE_ORANGE, "%s\n", sFilePath[sMenuSelectNoIndividually]); + + // File Size + kamiFontPrintfConsole(CONSOLE_ORANGE, "fileSize = %d Byte\n", info.fileSize); + + // Company Code + MI_CpuCopy8( &companyCode, temp, sizeof(companyCode) ); + temp[sizeof(companyCode)] = NULL; + kamiFontPrintfConsole(CONSOLE_ORANGE, "Company Code = %s\n", temp); + + // Game Code + MI_CpuCopy8( &gameCode, temp, sizeof(gameCode) ); + temp[sizeof(gameCode)] = NULL; + kamiFontPrintfConsole(CONSOLE_ORANGE, "GameCode Code = %s\n", temp); + + // Game Version + kamiFontPrintfConsole(CONSOLE_ORANGE, "GameVersion = %d\n", info.titleInfo.version); + + // name + kamiFontPrintfConsole(CONSOLE_ORANGE, "name = %s\n", info.name); + + // user + kamiFontPrintfConsole(CONSOLE_ORANGE, "user = %s\n",info.user); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n"); + } + } +} + +/*---------------------------------------------------------------------------* + Name: MakeFullPathForSD + + Description: + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ +static void MakeFullPathForSD(char* file_name, char* full_path) +{ + // フルパスを作成 + STD_CopyString( full_path, "sdmc:/" ); + STD_ConcatenateString( full_path, file_name ); +} + +/*---------------------------------------------------------------------------* + Name: ShowTitleinfoDifference + + Description: 既存NANDプログラムとSDプログラムの比較情報を表示する + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ShowTitleinfoDifference( NAMTitleInfo* titleInfoNand, NAMTitleInfo* titleInfoSd) +{ + char tempOld[100]; + char tempNew[100]; + u16 companyCode; + u32 gameCode; + + kamiFontPrintfConsole(CONSOLE_ORANGE, "+--------------+-------+-------+"); + kamiFontPrintfConsole(CONSOLE_ORANGE, "l l NAND l SD l"); + kamiFontPrintfConsole(CONSOLE_ORANGE, "+--------------+-------+-------+"); + + // Company Code (nand) + companyCode = MI_SwapEndian16(titleInfoNand->companyCode); + MI_CpuCopy8( &companyCode, tempOld, sizeof(companyCode) ); + tempOld[sizeof(companyCode)] = NULL; + + // Company Code (sd) + companyCode = MI_SwapEndian16(titleInfoSd->companyCode); + MI_CpuCopy8( &companyCode, tempNew, sizeof(companyCode) ); + tempNew[sizeof(companyCode)] = NULL; + kamiFontPrintfConsole(CONSOLE_ORANGE, "l Company Code l %-2.2s l %-2.2s l", tempOld, tempNew); + + // Game Code (nand) + gameCode = (u32)(titleInfoNand->titleId & 0xffffffff); + gameCode = MI_SwapEndian32(gameCode); + MI_CpuCopy8( &gameCode, tempOld, sizeof(gameCode) ); + tempOld[sizeof(gameCode)] = NULL; + + // Game Code (sd) + gameCode = (u32)(titleInfoSd->titleId & 0xffffffff); + gameCode = MI_SwapEndian32(gameCode); + MI_CpuCopy8( &gameCode, tempNew, sizeof(gameCode) ); + tempNew[sizeof(gameCode)] = NULL; + kamiFontPrintfConsole(CONSOLE_ORANGE, "l Game Code l %-4.4s l %-4.4s l", tempOld, tempNew); + + // Game Version + kamiFontPrintfConsole(CONSOLE_ORANGE, "l Game Version l %-4.4d l %-4.4d l", titleInfoNand->version, titleInfoSd->version ); + kamiFontPrintfConsole(CONSOLE_ORANGE, "+--------------+-------+-------+"); +} + +/*---------------------------------------------------------------------------* + Name: ProgressInit + + Description: インポートの進捗を表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +void ProgressInit(void) +{ + sCurrentProgress = 0; +} + +/*---------------------------------------------------------------------------* + Name: ProgressDraw + + Description: インポートの進捗を表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +void ProgressDraw(f32 ratio) +{ + char square[2] = { 0x01, 0x00 }; + u32 temp; + s32 i; + + temp = (u32)(32 * ratio); + if (temp > sCurrentProgress) + { + s32 diff = (s32)(temp - sCurrentProgress); + for (i=0;i +#include +#include +#include +#include +#include "kami_font.h" +#include "kami_pxi.h" +#include "process_topmenu.h" +#include "process_nandfirm.h" +#include "process_import.h" +#include "process_auto.h" +#include "cursor.h" +#include "keypad.h" + +#include "TWLHWInfo_api.h" +#include +#include <../build/libraries/spi/ARM9/include/spi.h> + +/*---------------------------------------------------------------------------* + マクロ定義 + *---------------------------------------------------------------------------*/ +#define ROUND_UP(value, alignment) \ + (((u32)(value) + (alignment-1)) & ~(alignment-1)) + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define DOT_OF_MENU_SPACE 8 +#define CHAR_OF_MENU_SPACE 1 +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 40 + +#define FILE_NUM_MAX 16 + +#define NAND_BLOCK_BYTE 0x200 +#define NAND_BOOT_FLAG_ADDRESS 0x2ff +#define NAND_FIRM_START_OFFSET 0x200 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s32 sMenuSelectNo; +static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; +static u8 sFileNum; +static u8 sNandBootFlag = 0xff; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void MakeFullPathForSD(char* file_name, char* full_path); +static BOOL WriteNandfirm(char* file_name); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: Import プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* NandfirmProcess0(void) +{ + FSFile dir; + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import NandFirm from SD"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // 配列クリア + MI_CpuClear8( sFilePath, sizeof(sFilePath) ); + + // ファイル数初期化 + sFileNum = 0; + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景上部 + kamiFontFillChar( 0, BG_COLOR_GREEN, BG_COLOR_GREEN ); + kamiFontFillChar( 1, BG_COLOR_GREEN, BG_COLOR_GREEN ); + kamiFontFillChar( 2, BG_COLOR_GREEN, BG_COLOR_TRANS ); + + // SDカードのルートディレクトリを検索 + if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) + { + OS_Printf("Error FS_OpenDirectory(sdmc:/)\n"); + kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "Error FS_OpenDirectory(sdmc:/)"); + } + else + { + FSDirectoryEntryInfo info[1]; + OS_Printf("[%s]:\n", "sdmc:/"); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "------ nand file list -----\n"); + + // .nand を探してファイル名を保存しておく + while (FS_ReadDirectory(&dir, info)) + { + OS_Printf(" %s", info->longname); + if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0) + { + OS_Printf("/\n"); + } + else + { + char* pExtension; + OS_Printf(" (%d BYTEs)\n", info->filesize); + + // 拡張子のチェック + pExtension = STD_SearchCharReverse( info->longname, '.'); + if (pExtension) + { + if (!STD_CompareString( pExtension, ".nand") || !STD_CompareString( pExtension, ".NAND")) + { + STD_CopyString( sFilePath[sFileNum], info->longname ); + kamiFontPrintfConsole(CONSOLE_ORANGE, "%d:%s\n", sFileNum, info->longname); + + // 最大16個で終了 + if (++sFileNum >= FILE_NUM_MAX) + { + break; + } + } + } + } + } + (void)FS_CloseDirectory(&dir); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n"); + } + + // メニュー一覧 + kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf((s16)3, (s16)(5+sFileNum+1), FONT_COLOR_BLACK, "+--------------------+----+"); + + // tad ファイルリストを表示 + for (i=0;i sFileNum) sMenuSelectNo = 0; + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return NandfirmProcess2; + } + // トップメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + return TopmenuProcess0; + } + + return NandfirmProcess1; +} + +/*---------------------------------------------------------------------------* + Name: プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* NandfirmProcess2(void) +{ + BOOL ret; + + if (STD_GetStringLength(sFilePath[sMenuSelectNo])) + { + ret = WriteNandfirm(sFilePath[sMenuSelectNo]); + } + else + { + if (gAutoFlag) { return AutoProcess2; } + else { return TopmenuProcess0; } + } + + // 今回の結果を表示 + if ( ret == TRUE ) + { + kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "OK"); + } + else + { + kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_RED, "NG"); + } + + // Auto用 + if (gAutoFlag) + { + if (ret) return AutoProcess1; + else return AutoProcess2; + } + + return NandfirmProcess1; +} + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: MakeFullPathForSD + + Description: + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ +static void MakeFullPathForSD(char* file_name, char* full_path) +{ + // フルパスを作成 + STD_CopyString( full_path, "sdmc:/" ); + STD_ConcatenateString( full_path, file_name ); +} + +/*---------------------------------------------------------------------------* + Name: MakeFullPathForSD + + Description: + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ +static BOOL WriteNandfirm(char* file_name) +{ + FSFile file; + char full_path[FS_ENTRY_LONGNAME_MAX+6]; + BOOL open_is_ok; + BOOL read_is_ok; + u8* pTempBuf; + u32 file_size; + u32 alloc_size; + u32 write_size; + BOOL result = TRUE; + u16 crc_w1, crc_w2; + u16 crc_r1, crc_r2; + + // .nandのフルパスを作成 + MakeFullPathForSD(file_name, full_path); + + // .nandファイルオープン + FS_InitFile(&file); + open_is_ok = FS_OpenFile(&file, full_path); + OS_Printf("FS_OpenFile(\"%s\") ... %s!\n", full_path, open_is_ok ? "OK" : "ERROR"); + + // サイズチェック + file_size = FS_GetFileLength(&file) ; + if (file_size > (800*1024)) + { + kamiFontPrintfConsoleEx(1, "too big file size!\n"); + FS_CloseFile(&file); + return FALSE; + } + + // バッファ確保 + alloc_size = ROUND_UP(file_size, 32) ; + pTempBuf = OS_Alloc( alloc_size ); + if (pTempBuf == NULL) + { + kamiFontPrintfConsoleEx(1, "Fail Alloc()!\n"); + FS_CloseFile(&file); + return FALSE; + } + + // .nandファイルリード + read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); + DC_FlushRange(pTempBuf, file_size); + if (!read_is_ok) + { + kamiFontPrintfConsoleEx(1, "Fail FS_ReadFile!\n"); + FS_CloseFile(&file); + OS_Free(pTempBuf); + return FALSE; + } + + // ファイルクローズ + FS_CloseFile(&file); + + // 書き込み前のCRCを計算 + crc_w1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); + crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + + // まずNORHeaderDS領域を書き込む(40byte?) + if (kamiNvramWrite(0, (void*)pTempBuf, sizeof(NORHeaderDS)) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "Fail kamiNvramWrite()\n"); + result = FALSE; + } + + // CRCを計算するので念のためにクリアしてからリードする + MI_CpuFill8( pTempBuf, 0xee, sizeof(NORHeaderDS) ); + DC_FlushRange(pTempBuf, sizeof(NORHeaderDS)); + + // CRCチェックのためNvramからリード + if (kamiNvramRead(0, pTempBuf, sizeof(NORHeaderDS) ) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "Fail kamiNvramRead()!\n"); + } + + // 読み込みはARM7が直接メモリに書き出すため + DC_InvalidateRange(pTempBuf, sizeof(NORHeaderDS)); + // 書き込み後のCRCを計算 + crc_r1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); + + // NVRAM先頭部分のCRC比較 + if ( crc_w1 != crc_r1 ) + { + OS_Free(pTempBuf); + kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w1, crc_r1); + return FALSE; + } + + // nandfirm 起動フラグを立てる + if (kamiNvramWrite(NAND_BOOT_FLAG_ADDRESS, &sNandBootFlag, 1) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "Fail kamiNvramWrite()\n"); + result = FALSE; + } + + kamiFontPrintfConsoleEx(0, "NAND Firm Import Start!\n"); + + // NAND書き込み + write_size = file_size/NAND_BLOCK_BYTE + (file_size % NAND_BLOCK_BYTE != 0); + kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_size ); // ブロック単位、バイト単位、ブロック単位 + + kamiFontPrintfConsoleEx(0, "Start CRC check\n"); + kamiFontLoadScreenData(); + + // CRCを計算するので念のためにクリアしてからリードする + MI_CpuClear8( pTempBuf, file_size ); + DC_FlushRange(pTempBuf, file_size); + + // CRCチェックのためNandからリード + if (kamiNandRead(0, pTempBuf, file_size/512 ) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); + } + DC_FlushRange(pTempBuf, file_size); + + // 書き込み後のCRCを計算 + crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + + // NAND部分についてのCRCチェック + if (crc_w2 == crc_r2) + { + kamiFontPrintfConsoleEx(0, "Success! CRC check %x==%x\n", crc_w2, crc_r2); + } + else + { + result = FALSE; + kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w2, crc_r2); + } + + // メモリ解放 + OS_Free(pTempBuf); + + return result; +} + + + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_norfirm.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_norfirm.c new file mode 100644 index 00000000..70b5e2eb --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_norfirm.c @@ -0,0 +1,423 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_norfirm.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include "kami_font.h" +#include "kami_pxi.h" +#include "process_topmenu.h" +#include "process_import.h" +#include "process_norfirm.h" +#include "cursor.h" +#include "keypad.h" + +#include "TWLHWInfo_api.h" + +#include +#include +#include <../build/libraries/spi/ARM9/include/spi.h> + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define DOT_OF_MENU_SPACE 8 +#define CHAR_OF_MENU_SPACE 1 + +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 40 + +#define FILE_NUM_MAX 16 + +#define ROUND_UP(value, alignment) \ + (((u32)(value) + (alignment-1)) & ~(alignment-1)) + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s32 sMenuSelectNo; +static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; +static u8 sFileNum; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void MakeFullPathForSD(char* file_name, char* full_path); +static BOOL WriteNorfirm(char* file_name); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: Import プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* NorfirmProcess0(void) +{ + FSFile dir; + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import Norfirm from SD"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // 配列クリア + MI_CpuClear8( sFilePath, sizeof(sFilePath) ); + + // ファイル数初期化 + sFileNum = 0; + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景上部 + kamiFontFillChar( 0, BG_COLOR_VIOLET, BG_COLOR_VIOLET ); + kamiFontFillChar( 1, BG_COLOR_VIOLET, BG_COLOR_VIOLET ); + kamiFontFillChar( 2, BG_COLOR_VIOLET, BG_COLOR_TRANS ); + + // SDカードのルートディレクトリを検索 + if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) + { + OS_Printf("Error FS_OpenDirectory(sdmc:/)\n"); + kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "Error FS_OpenDirectory(sdmc:/)"); + } + else + { + FSDirectoryEntryInfo info[1]; + OS_Printf("[%s]:\n", "sdmc:/"); + + kamiFontPrintfConsole(0, "------ nor file list -----\n"); + + // .nor を探してファイル名を保存しておく + while (FS_ReadDirectory(&dir, info)) + { + OS_Printf(" %s", info->longname); + if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0) + { + OS_Printf("/\n"); + } + else + { + char* pExtension; + OS_Printf(" (%d BYTEs)\n", info->filesize); + + // 拡張子のチェック + pExtension = STD_SearchCharReverse( info->longname, '.'); + if (pExtension) + { + if (!STD_CompareString( pExtension, ".nor") || !STD_CompareString( pExtension, ".NOR")) + { + STD_CopyString( sFilePath[sFileNum], info->longname ); + kamiFontPrintfConsole(0, "%d:%s\n", sFileNum, info->longname); + + // 最大16個で終了 + if (++sFileNum >= FILE_NUM_MAX) + { + break; + } + } + } + } + } + (void)FS_CloseDirectory(&dir); + + kamiFontPrintfConsole(0, "--------------------------\n"); + } + + // メニュー一覧 + kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf((s16)3, (s16)(5+sFileNum+1), FONT_COLOR_BLACK, "+--------------------+----+"); + + // tad ファイルリストを表示 + for (i=0;i sFileNum) sMenuSelectNo = 0; + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return NorfirmProcess2; + } + // トップメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + return TopmenuProcess0; + } + + return NorfirmProcess1; +} + +/*---------------------------------------------------------------------------* + Name: プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* NorfirmProcess2(void) +{ + BOOL ret; + + if (STD_GetStringLength(sFilePath[sMenuSelectNo])) + { + ret = WriteNorfirm(sFilePath[sMenuSelectNo]); + } + else + { + // リターン + return TopmenuProcess0; + } + + // 今回の結果を表示 + if ( ret == TRUE ) + { + kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "OK"); + } + else + { + kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_RED, "NG"); + } + + return NorfirmProcess1; +} + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: MakeFullPathForSD + + Description: + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ +static void MakeFullPathForSD(char* file_name, char* full_path) +{ + // フルパスを作成 + STD_CopyString( full_path, "sdmc:/" ); + STD_ConcatenateString( full_path, file_name ); +} + +/*---------------------------------------------------------------------------* + Name: MakeFullPathForSD + + Description: + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ +#define NVRAM_PAGE_SIZE 256 + +static BOOL WriteNorfirm(char* file_name) +{ + FSFile file; + char full_path[FS_ENTRY_LONGNAME_MAX+6]; + BOOL open_is_ok; + BOOL read_is_ok; + u8* pTempBuf; + u32 file_size; + u32 alloc_size; + BOOL result = TRUE; + int nor_addr; + u16 crc_w1, crc_w2; + u16 crc_r1, crc_r2; + + // .norのフルパスを作成 + MakeFullPathForSD(file_name, full_path); + + // .norファイルオープン + FS_InitFile(&file); + open_is_ok = FS_OpenFile(&file, full_path); + OS_Printf("FS_OpenFile(\"%s\") ... %s!\n", full_path, open_is_ok ? "OK" : "ERROR"); + + // サイズチェック + file_size = FS_GetFileLength(&file) ; + if (file_size > 256*1024) + { + kamiFontPrintfConsoleEx(1, "too big file size!\n"); + FS_CloseFile(&file); + return FALSE; + } + + // バッファ確保 + alloc_size = ROUND_UP(file_size, 32) ; + pTempBuf = OS_Alloc( alloc_size ); + if (pTempBuf == NULL) + { + kamiFontPrintfConsoleEx(1, "Fail Alloc()\n"); + FS_CloseFile(&file); + return FALSE; + } + + // .norファイルリード + read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); + DC_FlushRange(pTempBuf, file_size); + if (!read_is_ok) + { + kamiFontPrintfConsoleEx(1, "FS_ReadFile(\"%s\") ... ERROR!\n", full_path); + FS_CloseFile(&file); + OS_Free(pTempBuf); + return FALSE; + } + + // ファイルクローズ + FS_CloseFile(&file); + + // 書き込み前のCRCを計算 + crc_w1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); + crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + + // まずNORHeaderDS領域を書き込む(40byte?) + if (kamiNvramWrite(0, (void*)pTempBuf, sizeof(NORHeaderDS)) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "Fail SPI_NvramPageWrite()\n"); + result = FALSE; + } + + // CRCチェックのためNvramからリード + if (kamiNvramRead(0, pTempBuf, sizeof(NORHeaderDS) ) == KAMI_RESULT_SEND_ERROR) + { + OS_Printf("kamiNvramRead ... ERROR!\n"); + } + + // 読み込みはARM7が直接メモリに書き出す + DC_InvalidateRange(pTempBuf, sizeof(NORHeaderDS)); + // 書き込み後のCRCを計算 + crc_r1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); + + // NVRAM前半部のCRCをチェック + if ( crc_w1 != crc_r1 ) + { + OS_Free(pTempBuf); + kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w1, crc_r1); + return FALSE; + } + + nor_addr = offsetof(NORHeader, l); // 512byte + + // 進捗メーター初期化 + ProgressInit(); + kamiFontPrintfConsole(0, "NOR Firm Import Start!\n"); + + while ( nor_addr < file_size) + { + // 書きこみ + if (kamiNvramWrite((u32)nor_addr, (void*)(pTempBuf + nor_addr), NVRAM_PAGE_SIZE) == KAMI_RESULT_SEND_ERROR) + { + OS_TPrintf("======= Fail SPI_NvramPageWrite() ======== \n"); + result = FALSE; + break; + } + nor_addr += NVRAM_PAGE_SIZE; + + // 進捗メーター表示 + ProgressDraw((f32)nor_addr/file_size); + } + + kamiFontPrintfConsoleEx(0, "Start CRC check\n"); + kamiFontLoadScreenData(); + + // CRCチェックのためNvramからリード + if (kamiNvramRead(0, pTempBuf, file_size ) == KAMI_RESULT_SEND_ERROR) + { + OS_Printf("kamiNvramRead ... ERROR!\n"); + } + + // 読み込みはARM7が直接メモリに書き出す + DC_InvalidateRange(pTempBuf, file_size); + + // 書き込み後のCRCを計算 + crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); + + // CRC比較 + if (crc_w2 != crc_r2) + { + result = FALSE; + kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w2, crc_r2); + } + + // メモリ解放 + OS_Free(pTempBuf); + + return result; +} + + + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_topmenu.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_topmenu.c new file mode 100644 index 00000000..6172b2c6 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_topmenu.c @@ -0,0 +1,217 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_topmenu.c + + 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:$ + *---------------------------------------------------------------------------*/ + +#include +#include "kami_font.h" +#include "process_topmenu.h" +#include "process_format.h" +#include "process_hw_info.h" +#include "process_import.h" +#include "process_eticket.h" +#include "process_nandfirm.h" +#include "process_norfirm.h" +#include "process_auto.h" +#include "cursor.h" +#include "keypad.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define NUM_OF_MENU_SELECT 6 +#define DOT_OF_MENU_SPACE 16 +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 56 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s8 sMenuSelectNo; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: Top Menu プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* TopmenuProcess0(void) +{ + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(4, 2, 0, "Nand Initializer ver 0.1"); + + // メニュー一覧 + kamiFontPrintf(3, 7, FONT_COLOR_BLACK, " FORMAT NAND "); + kamiFontPrintf(3, 9, FONT_COLOR_BLACK, " WRITE HARDWARE INFO "); + kamiFontPrintf(3, 11, FONT_COLOR_BLACK, " WRITE ETICKET SIGN "); + kamiFontPrintf(3, 13, FONT_COLOR_BLACK, " INPORT TAD FROM SD "); + kamiFontPrintf(3, 15, FONT_COLOR_BLACK, " INPORT NANDFIRM FROM SD"); + kamiFontPrintf(3, 17, FONT_COLOR_BLACK, " INPORT NORFIRM FROM SD"); + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); + } + + // 背景設定 + kamiFontFillChar( 6, BG_COLOR_TRANS, BG_COLOR_BLUE ); + kamiFontFillChar( 7, BG_COLOR_BLUE, BG_COLOR_BLUE ); + kamiFontFillChar( 8, BG_COLOR_BLUE, BG_COLOR_TRANS ); + + kamiFontFillChar( 8, BG_COLOR_NONE, BG_COLOR_PURPLE ); + kamiFontFillChar( 9, BG_COLOR_PURPLE, BG_COLOR_PURPLE ); + kamiFontFillChar(10, BG_COLOR_PURPLE, BG_COLOR_TRANS ); + + kamiFontFillChar(10, BG_COLOR_NONE, BG_COLOR_GRAY ); + kamiFontFillChar(11, BG_COLOR_GRAY, BG_COLOR_GRAY ); + kamiFontFillChar(12, BG_COLOR_GRAY, BG_COLOR_TRANS ); + + kamiFontFillChar(12, BG_COLOR_NONE, BG_COLOR_PINK ); + kamiFontFillChar(13, BG_COLOR_PINK, BG_COLOR_PINK ); + kamiFontFillChar(14, BG_COLOR_PINK, BG_COLOR_TRANS ); + + kamiFontFillChar(14, BG_COLOR_NONE, BG_COLOR_GREEN ); + kamiFontFillChar(15, BG_COLOR_GREEN, BG_COLOR_GREEN ); + kamiFontFillChar(16, BG_COLOR_GREEN, BG_COLOR_TRANS ); + + kamiFontFillChar(16, BG_COLOR_NONE, BG_COLOR_VIOLET ); + kamiFontFillChar(17, BG_COLOR_VIOLET, BG_COLOR_VIOLET ); + kamiFontFillChar(18, BG_COLOR_VIOLET, BG_COLOR_TRANS ); + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + return TopmenuProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Top Menu プロセス1 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* TopmenuProcess1(void) +{ + // 選択メニューの変更 + if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) + { + if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; + } + else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) + { + if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return TopmenuProcess2; + } + + // L&R同時押しでオート実行! + if (kamiPadIsPress(PAD_BUTTON_L) && kamiPadIsPress(PAD_BUTTON_R)) + { + return AutoProcess0; + } + + return TopmenuProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Top Menu プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* TopmenuProcess2(void) +{ + switch ( sMenuSelectNo ) + { + case 0: + return FormatProcess0; + case 1: + return HWInfoProcess0; + break; + case 2: + return eTicketProcess0; + break; + case 3: + return ImportProcess0; + break; + case 4: + return NandfirmProcess0; + break; + case 5: + return NorfirmProcess0; + break; + } + + return TopmenuProcess1; +} + +/*---------------------------------------------------------------------------* + Name: Top Menu プロセス3 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* TopmenuProcess3(void) +{ + return TopmenuProcess3; +} + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + diff --git a/build/systemMenu_RED/NandInitializer/Makefile b/build/systemMenu_RED/NandInitializer/Makefile new file mode 100644 index 00000000..d46f0a10 --- /dev/null +++ b/build/systemMenu_RED/NandInitializer/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# 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:: 2007-10-30#$ +# $Rev: 1951 $ +# $Author: yutaka $ +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + ARM7.TWL \ + ARM9.TWL \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/NandInitializer/banner/banner.bnr b/build/systemMenu_RED/NandInitializer/banner/banner.bnr new file mode 100644 index 0000000000000000000000000000000000000000..26fa30820c6b0bd2149d8b5dfa58db88a2cb6a34 GIT binary patch literal 2624 zcmeH|y^GX97{*6zuCOrC!cr&OXdy^)w|9lj?u;LY)xyL=xkh}0uy~@v1Qcu&xYB0Q ziWal@7tGz++*-}vR(D-)VK;0giJe%*H)|*O7hDE@d6GQI^N_E}Me^m_?cbknk^hal zu78$gS)Jv1mFE-0R`~?6!)jueXxC_$)>>ojz8M0J@+{vuH0J4{(T$I%=EmsEXsv(? zftyxmD$y!U&?dRHYbudEjV0$S;`R}6c^|n4yt2dN%7UouvP8^^{Zmt!(-ESd9E`L$ z&^rJ6H-DsoX}v6UR%~ijY+{X67@Q_DLIK8(pez^AjTT`S79!dRIcx~FVx6-P5$lYJ z4r9C%u%=_yFgnR*`a~h=3N=n(!2IHkN{Vh07m&!nkL8b2Mj#}FBEk+B%sCZv z79y0+1H4^@3D^GU*UOu-=ls13gXhf=em9BI=xvsmeb^@0j4nvrV?NpLHJ4t zK^S8ILSPL?VLk?+1OkK63J_dk2ku9qlsXQI<6*Gx`?Rr}4%cyd&OhM67tki;{j*D- zuYSL_c4PbI-ksyE>h9& + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define PXI_FIFO_TAG_KAMITEST PXI_FIFO_TAG_USER_1 + +#define KAMI_PXI_CONTINUOUS_PACKET_MAX 10 +#define KAMITEST_PXI_DATA_SIZE_MAX ((KAMI_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数 + +#define KAMITEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する +#define KAMITEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す + +#define KAMITEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置 +#define KAMITEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク +#define KAMITEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域 +#define KAMITEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置 +#define KAMITEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域 +#define KAMITEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum KAMIPxiResult +{ + KAMI_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり + KAMI_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド + KAMI_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ + KAMI_PXI_RESULT_ILLEGAL_STATUS, // KAMIの状態により処理を実行不可 + KAMI_PXI_RESULT_BUSY, // 他のリクエストを実行中 + KAMI_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗 + KAMI_PXI_RESULT_MAX +} +KAMIPxiResult; + +typedef enum KamiCommand +{ + CODEC_READ_REGISTER, + CODEC_WRITE_REGISTER, + GPIO333_WRITE, + EXE_FORMAT, + KAMI_NAND_IO, + KAMI_NVRAM_IO +} +KamiCommand; + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/NandInitializer/data/cert.sys b/build/systemMenu_RED/NandInitializer/data/cert.sys new file mode 100644 index 0000000000000000000000000000000000000000..9368fbbcbee56ab9d336f571c66fe71e057bef9e GIT binary patch literal 3136 zcmb`{_d6Tf9|!P+lo)BXgwjfN5HVAuT&);2Q#9yRqr?h=#$I2ep(Se6UWwXj#Hj6B zRkOsdqE)TiC@MP4QWf9c=idGSx9;cs@cHGuKj%E>c|8XJ1OO7v8n`bZ8N1Jj(@nmC zAim}@#rxPvQfnTsNtcIx)=88LguD>;5mgOCYo4QCcj_%P zS4=?b$s4Iexe%Pa7=6}X354`$> zQso~@uoth1-PAPH@{?fV%+fE(_jhMxN_Z6!?{EZ?KkZ4f<7vW0^MfT^&D;Biyb@bd_AnK7Esu8wl3`s4wF6JE!AMdsJG8*hEK_uI!GOO zvOn3g9=!+MSL>cppu26Hu}I97b?RGry1%C&Qo5QtC%OjW*#OJW(7>KD=y>>0i51PV zn}JMUb==t!pJN(ti)C-;#0Om$8q)!>F@sh!0oksorFK;@q!yc7{-${&uR3omt6U*Z z^YboL#kt2*Y-I_?nKPp*{SJ|!15TE4rD}9=bCOP)=!QFEpT<4C{$fdHc?3NwgAVm+WBMamyBX}x1I@2;nv zASWv#@hndL3OO;M5$cnBg?@RhWre@XYGgWHtzuxpFq?DQqf?}|r`dp~M5ACRlv1Hm zF;r+mskrD$F0qyn>z|&8rWHB$GO^m|#UNjFV*X9<*~>?Di^yLtj^FN}%1Z)(Ki03* zkDL|DqbTclN?dzEmt@}@Rc~Z9hfSxJyQ1p4Ij)v-wZFlucM2jn8b1{93kBegd*itb zT73g_x@;msh_QFfV8$v`*Hes^41LglH;0NUx2SqnJ=W6k7>!$E3P#>uLKNKgalYOZSNTi8Y(dI?)3QPKWa^ z@PS)qQctcJa+F52MpSik=a85J>>ln-9 z+{u^SkpP2k`IKNlcN7>bta2KDB53uHpt%Lal&y~p%VZE~P2RFRZSQvo0#Y#A2WpCO z7<4otl{4l;J>1_O^;qlavUTqXK(NBxvab|=l&=3`9*(IcIL&5NXaziC5((gME4}b! zuY*xU4KITaGaf$kMDIxZVf>T&c8*oOE42jX&tC)i4}idnDO-G>bkf`Q*^=l>yUqz* zl*B4pmRU*bX$p*nahX-ulo%@8BS+Gyf`YUBRnfOcESU<(PLQ z83<9n9<#aTaXaDth0Rha@p2{+@3NWuDNN>%=3Q9uPF-2KFl_xPofci+ri+MTbP4~q zk%Srs2zqI(H>k+!PSr9yAOVaXpyKZjN~7r5;Fnx#+FXJ~hD9#o9{JLotxe&MoE%ob zOQgaTJLu;7=#?~qL;c_Xg@1F?fBawickX}g{^9>2?Nvl zdJFfL&5ISHm}igs6Mz?J*t?gqNOH7_ErJf(ePS2~mm1eWs$DGqjjYvSlayi{v4h)i zvS#B6$)U$5v3@eY5sMVc0nRG9-B;~d>^JHtupEVmFZI`*$ckU`N_jX=pK_a2>UlKz%!%jV0m?2|bHl-0POMTgA!i|Mv;xAy zoG%&w$V~{dtOwnS|L&wEe7pXr`VuSx^5J2vXEhcM(M9K8Uz!aE3&Xy=UX@sVpjvG^ zRzAnYjmqiN|Fq41v^yhNoUg-3ZC;BZBV=-~X MUQd4Q)W1{z2SN)i%K!iX literal 0 HcmV?d00001