mirror of
https://github.com/rvtr/ctr_firmware.git
synced 2025-06-19 01:05:32 -04:00
(shirait) nfsテスト追加
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@284 b871894f-2f95-9b40-918c-086798483c85
This commit is contained in:
parent
080e5d5613
commit
aeb80dda11
59
trunk/firmware/build/tests/nfs/ARM11/Makefile
Normal file
59
trunk/firmware/build/tests/nfs/ARM11/Makefile
Normal file
@ -0,0 +1,59 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: CtrBrom - bootrom - nfs
|
||||
# File: Makefile
|
||||
#
|
||||
# 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$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
#FIRM_DEF_LINK_SCATLD = TRUE
|
||||
|
||||
FIRM_TARGET = APP
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
TARGET_BIN = nfs11.dasm
|
||||
|
||||
INCDIR = $(FIRM_ROOT)/include/firm/nfs $(FIRM_ROOT)/include/firm/fatfs
|
||||
SRCS = \
|
||||
main.c \
|
||||
|
||||
#LCFILE = # using default
|
||||
|
||||
#FIRM_INCDIR = $(CTRBROM_ROOT)/include $(CTRFIRM_ROOT)/include $(FIRM_ROOT)/include
|
||||
|
||||
include $(CTRFIRM_ROOT)/build/buildtools/commondefs
|
||||
|
||||
#ƒ‰ƒCƒuƒ‰ƒŠ‚̒ljÁ
|
||||
GLIBRARIES += $(addsuffix $(FIRM_LIBSUFFIX).a, libnand$(FIRM_PROFILE_TYPE))
|
||||
GLIBRARIES += $(addsuffix $(FIRM_LIBSUFFIX).a, libnfs$(FIRM_PROFILE_TYPE))
|
||||
GLIBRARIES += $(addsuffix $(FIRM_LIBSUFFIX).a, libstd$(FIRM_PROFILE_TYPE))
|
||||
GLIBRARIES += $(addsuffix $(FIRM_LIBSUFFIX).a, libheap$(FIRM_PROFILE_TYPE))
|
||||
|
||||
SRCDIR = . $(CTRFIRM_ROOT)/build/tests/nfs/ARM11 \
|
||||
|
||||
INSTALL_DIR = ..
|
||||
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN_BASENAME).axf
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
do-build: $(TARGETS)
|
||||
|
||||
|
||||
include $(CTRFIRM_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
147
trunk/firmware/build/tests/nfs/ARM11/main.c
Normal file
147
trunk/firmware/build/tests/nfs/ARM11/main.c
Normal file
@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlBrom - thread
|
||||
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 <brom.h>
|
||||
#include <brom/nand/nand.h>
|
||||
#include <firm/fatfs/rtfs.h>
|
||||
#include <revolution/wfstypes.h>
|
||||
#include <revolution/wfs.h>
|
||||
|
||||
//REG_NAND_COMMAND
|
||||
#define NAND_START (0x0100)
|
||||
#define NAND_BUSY NAND_START
|
||||
#define NAND_RESET 6
|
||||
#define NAND_READ_STATUS 5
|
||||
#define NAND_ERASE_BLOCK 4
|
||||
#define NAND_PROGRAM_PAGE 3
|
||||
#define NAND_READ_PAGE 1
|
||||
|
||||
//REG_NAND_ECC
|
||||
#define NAND_ENABLE_ECC 1
|
||||
|
||||
#define REG_NAND_ADR_LO (0x18019840)
|
||||
#define REG_NAND_ADR_HI (0x18019842)
|
||||
#define REG_NAND_COMMAND (0x1801984E)
|
||||
|
||||
#define REG_NAND_ECC (0x18019850)
|
||||
|
||||
#define REG_NAND_DATA (0x18019000)
|
||||
#define REG_NAND_SPARE (0x18019800)
|
||||
|
||||
void NandReset( void);
|
||||
void NandErase( u16 adr_hi, u16 adr_lo);
|
||||
void NandWrite( u16 adr_hi, u16 adr_lo, u32* buf);
|
||||
void NandRead( u16 adr_hi, u16 adr_lo);
|
||||
|
||||
u32 CalcECC( u32* buf);
|
||||
u32 CalcCP( u32* buf, u32 st, u32 cmp, u32 logic);
|
||||
u32 CalcLP( u32* buf, u32 st, u32 cmp, u32 logic);
|
||||
BOOL i_nandCheckECC( u32* data, u32* stored_ecc, u32 new_ecc);
|
||||
void nandSetFormatRequest( u16 partition_num, u32* partition_sectors);
|
||||
|
||||
NandPageCacheFormat NandPageCache[1];
|
||||
u32 BlockBuf[2*1024/4];
|
||||
u32 my_heap[0x40400/4];
|
||||
|
||||
u16 WfsWorkBuf[(WFS_MIN_WORK_SPACE_SIZE/2)+512];
|
||||
u16* WfsAlignedWorkBuf;
|
||||
WFSResult WFSDebugSetTitleId(WFSTitleId titleId);
|
||||
|
||||
#define MY_STACK_SIZE (4*1024)
|
||||
OSThread my_tsk;
|
||||
u64 my_stack[MY_STACK_SIZE / sizeof(u64)];
|
||||
|
||||
void MyThread( void* arg)
|
||||
{
|
||||
(void)osEnableInterrupts();
|
||||
while( 1) {
|
||||
osSleep( 1);
|
||||
};
|
||||
}
|
||||
|
||||
void BromMain( void )
|
||||
{
|
||||
u32 partition_sectors[5];
|
||||
DEV_GEOMETRY dgeometry;
|
||||
PCFD fd;
|
||||
int result;
|
||||
u32 s_ecc, n_ecc;
|
||||
|
||||
osInitException();
|
||||
osInitBROM();
|
||||
|
||||
osPrintf( "ARM11: start\n" );
|
||||
|
||||
osInitThread();
|
||||
(void)osEnableInterrupts();
|
||||
|
||||
/**/
|
||||
// osCreateThread( &my_tsk, MyThread, NULL, (my_stack+MY_STACK_SIZE / sizeof(u64)), MY_STACK_SIZE, 14);
|
||||
// osWakeupThreadDirect( &my_tsk);
|
||||
|
||||
/*nandドライバ初期化*/
|
||||
nandInit();
|
||||
nandEnable( NandPageCache);
|
||||
|
||||
{
|
||||
char path_str[128];
|
||||
char wfsVolumeId[16];
|
||||
WFSFileHandle fileHandle;
|
||||
WFSResult wfsResult;
|
||||
|
||||
buddy_allocator_init( my_heap, 0x40000); //32KB
|
||||
|
||||
/*--- WFSライブラリ初期化 ---*/
|
||||
osTPrintf( "ok\n");
|
||||
WfsAlignedWorkBuf = (u16*)(MATH_ROUNDUP( (int)WfsWorkBuf, 512));
|
||||
osTPrintf( "aligned buffer : 0x%x\n", (u32)WfsAlignedWorkBuf);
|
||||
wfsResult = WFSInit( WfsAlignedWorkBuf, WFS_MIN_WORK_SPACE_SIZE);
|
||||
osTPrintf( "WFSInit : %d\n", wfsResult);
|
||||
/*--- フォーマット ---*/
|
||||
WFSDebugSetTitleId( WFS_ROOT_ID);
|
||||
wfsResult = WFSInitializeDevice( "msc01");
|
||||
osTPrintf( "WFSInitializeDevice : %d\n", wfsResult);
|
||||
|
||||
/*--- マウント ---*/
|
||||
wfsResult = WFSGetVolumeId( "msc01", wfsVolumeId);
|
||||
osTPrintf( "WFSGetVolumeId : %d\n", wfsResult);
|
||||
wfsResult = WFSMountDevice( "msc01", wfsVolumeId);
|
||||
osTPrintf( "WFSMountDevice : %d\n", wfsResult);
|
||||
osTPrintf( "/vol/%s\n", wfsVolumeId);
|
||||
|
||||
#if 1
|
||||
/*--- ディレクトリ ---*/
|
||||
osSPrintf( (char*)path_str, "/vol/%s/%s", wfsVolumeId, "home");
|
||||
osTPrintf( "createdir ... %s\n", path_str);
|
||||
// wfsResult = WFSCreateDirectory( (char*)path_str, (WFS_PERM_READ | WFS_PERM_ADD_OR_DELETE_FILE | WFS_PERM_LIST | WFS_PERM_DELETE_OR_MOVE), 0);
|
||||
wfsResult = WFSCreateDirectory( (char*)path_str, WFS_PERM_FULL, 0);
|
||||
osTPrintf( "WFSCreateDirectory : %d\n", wfsResult);
|
||||
#endif
|
||||
WFSExit();
|
||||
}
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
u32 pmon = osGetPerfMonitor(OS_MONITOR_1);
|
||||
OSTick tick = osGetTick();
|
||||
osSleep(1000);
|
||||
tick = osGetTick() - tick;
|
||||
pmon = osGetPerfMonitor(OS_MONITOR_1) - pmon;
|
||||
osTPrintf( "sleep tick = %llu msec\n", OS_TICK_TO_MSEC(tick) );
|
||||
osTPrintf( "sleep mon = %llu msec\n", OS_PMON_TO_MSEC(pmon) );
|
||||
}
|
||||
}
|
52
trunk/firmware/build/tests/nfs/ARM9/Makefile
Normal file
52
trunk/firmware/build/tests/nfs/ARM9/Makefile
Normal file
@ -0,0 +1,52 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: CtrBrom - bootrom - nfs
|
||||
# File: Makefile
|
||||
#
|
||||
# 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$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#FIRM_DEF_LINK_SCATLD = TRUE
|
||||
|
||||
FIRM_TARGET = APP
|
||||
FIRM_PROC = ARM9
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
TARGET_BIN = nfs9.dasm
|
||||
|
||||
SRCS = \
|
||||
main.c \
|
||||
|
||||
#LCFILE = # using default
|
||||
|
||||
include $(CTRFIRM_ROOT)/build/buildtools/commondefs
|
||||
|
||||
SRCDIR = . $(ROOT)/bootrom/build/bootrom/nfs/ARM9 \
|
||||
|
||||
INSTALL_DIR = ..
|
||||
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN_BASENAME).axf
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
do-build: $(TARGETS)
|
||||
|
||||
|
||||
include $(CTRFIRM_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
35
trunk/firmware/build/tests/nfs/ARM9/main.c
Normal file
35
trunk/firmware/build/tests/nfs/ARM9/main.c
Normal file
@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlBrom - thread
|
||||
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 <brom.h>
|
||||
|
||||
void BromSpMain( void )
|
||||
{
|
||||
osInitException();
|
||||
osInitBROM();
|
||||
|
||||
osPrintf( "ARM9: start\n" );
|
||||
|
||||
osInitThread();
|
||||
while (1)
|
||||
{
|
||||
OSTick tick = osGetTick();
|
||||
osSleep(1000);
|
||||
tick = osGetTick() - tick;
|
||||
osTPrintf( "sleep tick = %llu msec\n", OS_TICK_TO_MSEC(tick) );
|
||||
}
|
||||
}
|
||||
|
33
trunk/firmware/build/tests/nfs/Makefile
Normal file
33
trunk/firmware/build/tests/nfs/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: CtrBrom - build
|
||||
# File: Makefile
|
||||
#
|
||||
# Copyright 2009 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 $(CTRFIRM_ROOT)/build/buildtools/commondefs
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUBDIRS = \
|
||||
ARM11 \
|
||||
ARM9 \
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
include $(CTRFIRM_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
Loading…
Reference in New Issue
Block a user