From 7068897306193595335793db16e763cc6ae21343 Mon Sep 17 00:00:00 2001 From: yutaka Date: Wed, 28 Nov 2007 00:03:09 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E7=95=AA=E7=94=A8MI/FATFS=E3=82=92FS?= =?UTF-8?q?=E3=81=AB=E7=B5=B1=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@274 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- include/firm/fs.h | 29 +++++++++ include/firm/fs/ARM7/fs_firm.h | 96 ++++++++++++++++++++++++++++ include/firm/fs/ARM9/fs_firm.h | 113 +++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 include/firm/fs.h create mode 100644 include/firm/fs/ARM7/fs_firm.h create mode 100644 include/firm/fs/ARM9/fs_firm.h diff --git a/include/firm/fs.h b/include/firm/fs.h new file mode 100644 index 00000000..3688fdf1 --- /dev/null +++ b/include/firm/fs.h @@ -0,0 +1,29 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs.h + + 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-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_H_ +#define FIRM_FS_H_ + +#ifdef SDK_ARM7 +#include +#else +#include +#endif // SDK_ARM7 + + +/* FIRM_FS_H_ */ +#endif diff --git a/include/firm/fs/ARM7/fs_firm.h b/include/firm/fs/ARM7/fs_firm.h new file mode 100644 index 00000000..7752481c --- /dev/null +++ b/include/firm/fs/ARM7/fs_firm.h @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs.h + + 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-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_FS_FIRM_H_ +#define FIRM_FS_FS_FIRM_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FS_OpenSrl + + Description: open srl file named in HW_TWL_FS_BOOT_SRL_PATH_BUF + + Arguments: None + + Returns: file discriptor + *---------------------------------------------------------------------------*/ +int FS_OpenSrl( void ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadBuffer + + Description: load data in file and pass to ARM9 via WRAM-B + + Arguments: fd file discriptor to read + offset offset to start to read in bytes + size total length to read in bytes + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadBuffer( int fd, u32 offset, u32 size ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadModule + + Description: load data in file and pass to ARM9 via WRAM-B in view of AES + settings in the ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: fd file discriptor to read + offset offset to start to read in bytes + size total length to read in bytes + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadModule( int fd, u32 offset, u32 size ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadHeader + + Description: load ROM header in the head of file and pass to ARM9 via WRAM-B + + Arguments: fd file discriptor to read + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadHeader( int fd ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadStatic + + Description: load static regions in file and pass to ARM9 via WRAM-B + specified by ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: fd file discriptor to read + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadStatic( int fd ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FS_FS_FIRM_H_ */ +#endif diff --git a/include/firm/fs/ARM9/fs_firm.h b/include/firm/fs/ARM9/fs_firm.h new file mode 100644 index 00000000..170235e4 --- /dev/null +++ b/include/firm/fs/ARM9/fs_firm.h @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs.h + + 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-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_FS_FIRM_H_ +#define FIRM_FS_FS_FIRM_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FS_ResolveSrl + + Description: resolve srl filename and store to HW_TWL_FS_BOOT_SRL_PATH_BUF + + Arguments: titleId title id for srl file + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_ResolveSrl( u64 titleId ); + +/*---------------------------------------------------------------------------* + Name: FS_SetDigestKey + + Description: set specified key or default key for HMAC-SHA-1 + + Arguments: digestKey pointer to key + if NULL, use default key + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +void FS_SetDigestKey( const u8* digestKey ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadBuffer + + Description: receive data from ARM7 via WRAM-B and store in destination address, + calculate SHA1 in parallel if ctx is specified + + Arguments: dest destination address to read + size total length to read in bytes + ctx pointer to SHA1 context or NULL + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadBuffer( u8* dest, u32 size, SVCSHA1Context *ctx ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadModule + + Description: receive data from ARM7 via WRAM-B and store in destination address + in view of AES settings in the ROM header at HW_TWL_ROM_HEADER_BUF, + then verify the digest + + Arguments: dest destination address to read + offset file offset to start to read in bytes + size total length to read in bytes + digest digest to verify + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadModule( u8* dest, u32 offset, u32 size, const u8 digest[SVC_SHA1_BLOCK_SIZE] ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadHeader + + Description: receive ROM header, store to HW_TWL_ROM_HEADER_BUF, + and verify signature + + Arguments: pool heap context to call SVC_DecryptSign + rsa_key public key to verify the signature + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadHeader( SVCSignHeapContext* pool, const void* rsa_key ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadStatic + + Description: receive static regions from ARM6 via WRAM-B and store them + specified by ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadStatic( void ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FS_FS_FIRM_H_ */ +#endif