From 873c7cdb9bb60e6cb00c86629bd68f2fd49ac074 Mon Sep 17 00:00:00 2001 From: nakasima Date: Thu, 12 Apr 2007 07:27:46 +0000 Subject: [PATCH] fix for NitroSDK4.0. git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@20 4ee2a332-4b2b-5046-8439-1ba90f034370 --- build/libraries/os/common/os_entropy.c | 59 -------------------- include/nitro/code32.h | 72 +++++++++++++++++++++++++ include/nitro/hw/common/mmap_shared.h | 74 +++----------------------- include/nitro/os/common/interrupt.h | 4 ++ 4 files changed, 82 insertions(+), 127 deletions(-) delete mode 100644 build/libraries/os/common/os_entropy.c create mode 100644 include/nitro/code32.h diff --git a/build/libraries/os/common/os_entropy.c b/build/libraries/os/common/os_entropy.c deleted file mode 100644 index d3d504c..0000000 --- a/build/libraries/os/common/os_entropy.c +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: NitroSDK - OS - File: os_entropy.c - - Copyright 2003-2006 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. - - $Log: os_entropy.c,v $ - Revision 1.3 2006/01/18 02:11:30 kitase_hirotake - do-indent - - Revision 1.2 2005/07/27 12:15:36 seiki_masashi - MAC アドレスも追加 - - Revision 1.1 2005/07/27 07:36:41 seiki_masashi - 新規追加 - - $NoKeywords: $ - *---------------------------------------------------------------------------*/ -#include -#include - -//---------------------------------------------------------------------- - -extern vu64 OSi_TickCounter; - -/*---------------------------------------------------------------------------* - Name: OS_GetLowEntropyData - - Description: システム状態によって変化する低エントロピーのデータ列を取得する - - Arguments: buffer - データ列を受け取る配列へのポインタ - - Returns: None. - *---------------------------------------------------------------------------*/ -void OS_GetLowEntropyData(u32 buffer[OS_LOW_ENTROPY_DATA_SIZE / sizeof(u32)]) -{ - // System Work Memory 上の RTC のワーク領域 - const OSSystemWork *work = OS_GetSystemWork(); - const u8 *macAddress = - (u8 *)((u32)(work->nvramUserInfo) + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); - - buffer[0] = (u32)((GX_GetVCount() << 16) | OS_GetTickLo()); - buffer[1] = (u32)(*(u16 *)(macAddress + 4) << 16) ^ (u32)(OSi_TickCounter); - buffer[2] = (u32)(OSi_TickCounter >> 32) ^ *(u32 *)macAddress ^ work->vblankCount; -#ifdef reg_G3X_GXSTAT - buffer[2] ^= reg_G3X_GXSTAT; -#endif - buffer[3] = *(u32 *)(&work->real_time_clock[0]); - buffer[4] = *(u32 *)(&work->real_time_clock[4]); - buffer[5] = (((u32)work->mic_sampling_data) << 16) ^ work->mic_last_address; - buffer[6] = (u32)((*(u16 *)(&work->touch_panel[0]) << 16) | *(u16 *)(&work->touch_panel[2])); - buffer[7] = (u32)((work->wm_rssi_pool << 16) | (reg_PAD_KEYINPUT | *(vu16 *)HW_BUTTON_XY_BUF)); -} diff --git a/include/nitro/code32.h b/include/nitro/code32.h new file mode 100644 index 0000000..1e078d2 --- /dev/null +++ b/include/nitro/code32.h @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - include + File: code32.h + + Copyright 2003-2006 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. + + $Log: code32.h,v $ + Revision 1.8 2006/01/18 02:11:19 kitase_hirotake + do-indent + + Revision 1.7 2005/02/28 05:26:02 yosizaki + do-indent. + + Revision 1.6 2005/01/21 09:54:31 yasu + Copyright year 2004->2005 + + Revision 1.5 2005/01/21 07:34:19 yasu + merge with RC4branch + + Revision 1.4.38.1 2005/01/21 05:59:43 yasu + Fix a bug "MATH_CountLeadingZeros() not inlined" + + Revision 1.4 2004/02/25 06:25:03 nishida_kenji + Switches FX_Mul/FX_Mul32x64c implementation. + + Revision 1.3 2004/02/20 04:06:59 yasu + add comments + + Revision 1.2 2004/02/05 07:09:03 yasu + change SDK prefix iris -> nitro + + Revision 1.1 2003/12/16 10:56:00 yasu + 新規作成 + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +// +// include this instead of using C99 pragma extensions for compatibility +// +#if defined(SDK_CW) || defined(__MWERKS__) +#pragma thumb off +#elif defined(SDK_ADS) +TO BE DEFINED +#elif defined(SDK_GCC) +TO BE DEFINED +#endif +// Prepare to switch the definition of FX_Mul +#ifdef FX_Mul +#undef FX_Mul +#endif +// Prepare to switch the definition of FX_MulFx64c +#ifdef FX_Mul32x64c +#undef FX_Mul32x64c +#endif +// Prepare to switch the definition of MATH_CountLeadingZeros +#ifdef MATH_CountLeadingZeros +#undef MATH_CountLeadingZeros +#endif +// Because CPU is in ARM mode, inline versions are used. +#define FX_Mul(v1, v2) FX_MulInline(v1, v2) +#define FX_Mul32x64c(v32, v64c) FX_Mul32x64cInline(v32, v64c) +#ifdef SDK_ARM9 +#define MATH_CountLeadingZeros(x) MATH_CountLeadingZerosInline(x) +#else // SDK_ARM7 +#define MATH_CountLeadingZeros(x) MATH_CountLeadingZerosFunc(x) +#endif // SDK_ARM7 diff --git a/include/nitro/hw/common/mmap_shared.h b/include/nitro/hw/common/mmap_shared.h index 6aa7676..6c7d41b 100644 --- a/include/nitro/hw/common/mmap_shared.h +++ b/include/nitro/hw/common/mmap_shared.h @@ -11,6 +11,12 @@ in whole or in part, without the prior written consent of Nintendo. $Log: mmap_shared.h,v $ + Revision 1.43 2006/08/10 00:05:10 okubata_ryoma + カートリッジの活線挿抜に関する不具合修正 + + Revision 1.42 2006/07/05 09:14:54 yosizaki + delete definitions of OSSystemWork. (moved to os/systemWork.h) + Revision 1.41 2006/01/18 02:11:30 kitase_hirotake do-indent @@ -310,74 +316,6 @@ extern "C" { #define HW_CHECK_DEBUGGER_BUF1 (HW_RED_RESERVED + 0x014) // (u16)debugger checker. 1 if run on debugger. #define HW_CHECK_DEBUGGER_BUF2 (HW_MAIN_MEM_SYSTEM + 0x014) // (u16)debugger checker. 1 if run on debugger. -/* if include from Other Environment for exsample VC or BCB, */ -/* please define SDK_FROM_TOOL */ -#if !(defined(SDK_WIN32) || defined(SDK_FROM_TOOL)) -// -//-------------------------------------------------------------------- -#ifndef SDK_ASM -#include - -#include -#include -#include - -typedef union -{ - u32 b32; - u16 b16; -} -OSDmaClearSrc; -typedef struct -{ - u8 bootCheckInfo[0x20]; // 000-01f: 32byte boot check info - u32 resetParameter; // 020-023: 4byte reset parameter - u8 padding5[0x8]; // 024-02c: (8byte) - u32 romBaseOffset; // 02c-02f: 4byte ROM offset of own program - u8 cartridgeModuleInfo[12]; // 030-03b: 12byte cartridge module info - u32 vblankCount; // 03c-03f: 4byte Vブランクカウント - u8 wmBootBuf[0x40]; // 040-07f: 64byte WM のマルチブート用バッファ - u8 nvramUserInfo[0x100]; // 080-17f: 256bytes NVRAM user info - u8 isd_reserved1[0x20]; // 180-19f: 32bytes ISDebugger 予約 - u8 arenaInfo[0x48]; // 1a0-1e7: 72bytte アリーナ情報 - u8 real_time_clock[8]; // 1e8-1ef: 8bytes RTC - u32 dmaClearBuf[4]; // 1f0-1ff: 16bytes DMA クリア情報バッファ (ARM9-TEG用) - u8 rom_header[0x160]; // 200-35f: 352bytes ROM 内登録エリア情報退避バッファ - u8 isd_reserved2[32]; // 360-37f: 32bytes ISDebugger 予約 - u32 pxiSignalParam[2]; // 380-387: 8bytes Param for PXI Signal - u32 pxiHandleChecker[2]; // 388-38f: 8bytes Flag for PXI Command Handler Installed - u32 mic_last_address; // 390-393: 4bytes マイク 最新サンプリング結果の格納アドレス - u16 mic_sampling_data; // 394-395: 2bytes マイク 単体サンプリング結果 - u16 wm_callback_control; // 396-397: 2bytes WM コールバック同期用パラメータ - u16 wm_rssi_pool; // 398-399: 2bytes WM 受信強度による乱数源 - u8 padding3[2]; // 39a-39b: (2bytes) - u32 component_param; // 39c-39f: 4bytes Component 同期用パラメータ - OSThreadInfo *threadinfo_mainp; // 3a0-3a3: 4bytes ARM9 スレッド情報へのポインタ 初期値0であること - OSThreadInfo *threadinfo_subp; // 3a4-3a7: 4bytes ARM7 スレッド情報へのポインタ 初期値0であること - u16 button_XY; // 3a8-3a9: 2bytes XY ボタン情報格納位置 - u8 touch_panel[4]; // 3aa-3ad: 4bytes タッチパネル情報格納位置 - u16 autoloadSync; // 3ae-3af: 2bytes autoload sync between processors - u32 lockIDFlag_mainp[2]; // 3b0-3b7: 8bytes lockID管理フラグ(ARM9用) - u32 lockIDFlag_subp[2]; // 3b8-3bf: 8bytes lockID管理フラグ(ARM7用) - struct OSLockWord lock_VRAM_C; // 3c0-3c7: 8bytes C・ロックバッファ - struct OSLockWord lock_VRAM_D; // 3c8-3cf: 8bytes VRAM−D・ロックバッファ - struct OSLockWord lock_WRAM_BLOCK0; // 3d0-3d7: 8bytes ブロック0・ロックバッファ - struct OSLockWord lock_WRAM_BLOCK1; // 3d8-3df: 8bytes CPU内部ワークRAM・ブロック1・ロックバッファ - struct OSLockWord lock_CARD; // 3e0-3e7: 8bytes カード・ロックバッファ - struct OSLockWord lock_CARTRIDGE; // 3e8-3ef: 8bytes カートリッジ・ロックバッファ - struct OSLockWord lock_INIT; // 3f0-3f7: 8bytes 初期化ロックバッファ - u16 mmem_checker_mainp; // 3f8-3f9: 2bytes MainMomory Size Checker for Main processor - u16 mmem_checker_subp; // 3fa-3fb: 2bytes MainMomory Size Checker for Sub processor - u8 padding4[2]; // 3fc-3fd: (2bytes) - u16 command_area; // 3fe-3ff: 2bytes Command Area -} -OSSystemWork; - -#define OS_GetSystemWork() ((OSSystemWork *)HW_MAIN_MEM_SYSTEM) -#endif - - -#endif // SDK_FROM_TOOL #ifdef __cplusplus } /* extern "C" */ diff --git a/include/nitro/os/common/interrupt.h b/include/nitro/os/common/interrupt.h index 3f21d47..f6ec062 100644 --- a/include/nitro/os/common/interrupt.h +++ b/include/nitro/os/common/interrupt.h @@ -11,6 +11,9 @@ in whole or in part, without the prior written consent of Nintendo. $Log: $ + Revision 1.62 2006/07/05 09:13:49 yosizaki + fix about include header. + $NoKeywords: $ *---------------------------------------------------------------------------*/ @@ -25,6 +28,7 @@ extern "C" { #include #include #include +#include //---- for DMA, TIMER void OSi_EnterDmaCallback(u32 dmaNo, void (*callback) (void *), void *arg);