mirror of
https://github.com/rvtr/ctr_firmware.git
synced 2025-10-31 07:51:08 -04:00
testsにnandサンプル追加。 git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@255 b871894f-2f95-9b40-918c-086798483c85
87 lines
2.3 KiB
C
87 lines
2.3 KiB
C
/*---------------------------------------------------------------------------*
|
|
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>
|
|
|
|
//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)
|
|
|
|
|
|
NandPageCacheFormat NandPageCache[1];
|
|
u32 BlockBuf [2*1024/4];
|
|
|
|
|
|
void BromMain( void )
|
|
{
|
|
u32 s_ecc, n_ecc;
|
|
|
|
osInitException();
|
|
osInitBROM();
|
|
|
|
osPrintf( "ARM11: start\n" );
|
|
|
|
osInitThread();
|
|
|
|
nandInit();
|
|
nandEnable( NandPageCache);
|
|
|
|
miCpuFill8( BlockBuf, 0x33, 2*1024);
|
|
osTPrintf( "nandWriteSector...");
|
|
nandWriteSector( BlockBuf, 0, 1);
|
|
osTPrintf( "done\n");
|
|
|
|
osTPrintf( "nandFlush...");
|
|
nandFlush();
|
|
osTPrintf( "done\n");
|
|
|
|
miCpuFill8( BlockBuf, 0x5A, 2*1024);
|
|
osTPrintf( "nandReadSector...");
|
|
nandReadSector( BlockBuf, 0, 1);
|
|
osTPrintf( "done\n");
|
|
|
|
osTPrintf( "finished.\n");
|
|
|
|
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) );
|
|
}
|
|
}
|