marge from NitroSDK4.0.

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@22 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
nakasima 2007-04-12 10:47:01 +00:00
parent 0a30f97eca
commit 07af35779d
7 changed files with 106 additions and 24 deletions

View File

@ -0,0 +1,20 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlBromSDK - buildtools - compiler dependant settings for RVCT
# File: modulerules.cctype.RVCT
#
# Copyright 2005 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: $
# $NoKeywords: $
#----------------------------------------------------------------------------
-include $(BROM_BUILDTOOLSDIR)/modulerules.cctype.$(NITRO_CCTYPE)
#----- End of modulerules.cctype.RVCT -----

View File

@ -2,7 +2,7 @@
Project: NitroSDK - CTRDG
File: ctrdg.c
Copyright 2003-2006 Nintendo. All rights reserved.
Copyright 2003-2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
@ -11,6 +11,15 @@
in whole or in part, without the prior written consent of Nintendo.
$Log: ctrdg_proc.c,v $
Revision 1.31 2007/02/20 00:28:11 kitase_hirotake
indent source
Revision 1.30 2006/08/10 00:25:57 okubata_ryoma
small fix
Revision 1.29 2006/08/10 00:02:52 okubata_ryoma
Revision 1.28 2006/05/02 02:04:47 kitase_hirotake
@ -170,7 +179,7 @@ void CTRDG_Init(void)
CTRDGi_InitTaskThread(&CTRDGTaskList);
}
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_CTRDG_PHI, CTRDGi_CallbackForSetPhi );
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_CTRDG_PHI, CTRDGi_CallbackForSetPhi);
/*
* enable .
@ -209,8 +218,6 @@ void CTRDGi_InitModuleInfo(void)
OSIrqMask lastIE;
BOOL lastIME;
CTRDGModuleInfo *cip = CTRDGi_GetModuleInfoAddr();
if (isInitialized)
{
return;
@ -254,10 +261,14 @@ void CTRDGi_InitModuleInfo(void)
//---- release privilege for accessing cartridge
CTRDGi_UnlockByProcessor(CTRDGi_Work.lockID, &lockInfo);
//---- copy the information of peripheral devices to system area
// 前回チェックでカートリッジが挿入されていた場合、または
// ソフトリセットが一度も実行されていない場合のみカートリッジデータを更新する
if ((*(u8 *)HW_IS_CTRDG_EXIST) || !(*(u8 *)HW_SET_CTRDG_MODULE_INFO_ONCE))
{
//---- copy the information of peripheral devices to system area
int i;
CTRDGHeader *chb = &headerBuf;
CTRDGModuleInfo *cip = CTRDGi_GetModuleInfoAddr();
cip->moduleID.raw = chb->moduleID;
for (i = 0; i < 3; i++)
@ -266,6 +277,11 @@ void CTRDGi_InitModuleInfo(void)
}
cip->makerCode = chb->makerCode;
cip->gameCode = chb->gameCode;
// カートリッジが挿入されているのかチェック
*(u8 *)HW_IS_CTRDG_EXIST = (u8)((CTRDG_IsExisting())? 1 : 0);
// カートリッジの情報が一回でも更新されればTRUE
(*(u8 *)HW_SET_CTRDG_MODULE_INFO_ONCE) = TRUE;
}
//---- copy NINTENDO logo data in the ARM9 system ROM to main memory
@ -360,7 +376,7 @@ static void CTRDGi_PulledOutCallback(PXIFifoTag tag, u32 data, BOOL err)
}
else
{
OS_Printf(">>>tag[%x] data[%x] err[%x]\n", tag, data, err);
OS_Printf(">>>tag[%x] data[%x] err[%x]\n", tag, data, err);
#ifndef SDK_FINALROM
OS_Panic("illegal Cartridge pxi command.");
#else
@ -431,7 +447,7 @@ void CTRDG_CheckPulledOut(void)
{
return;
}
//---------------- check cartridge pulled out
//---- check cartridge
isCartridgePullOut = CTRDG_IsPulledOut();
@ -466,26 +482,26 @@ void CTRDG_CheckPulledOut(void)
*---------------------------------------------------------------------------*/
void CTRDG_SetPhiClock(CTRDGPhiClock clock)
{
u32 data = ((u32)clock << CTRDG_PXI_COMMAND_PARAM_SHIFT)| CTRDG_PXI_COMMAND_SET_PHI;
u32 data = ((u32)clock << CTRDG_PXI_COMMAND_PARAM_SHIFT) | CTRDG_PXI_COMMAND_SET_PHI;
//---- check parameter range
SDK_ASSERT( (u32)clock <= CTRDG_PHI_CLOCK_16MHZ );
//---- check parameter range
SDK_ASSERT((u32)clock <= CTRDG_PHI_CLOCK_16MHZ);
//---- set ARM9 PHI output clock
MIi_SetPhiClock( (MIiPhiClock)clock );
//---- set ARM9 PHI output clock
MIi_SetPhiClock((MIiPhiClock) clock);
//---- send command to set ARM7 phi clock
CTRDGi_Lock = TRUE;
//---- send command to set ARM7 phi clock
CTRDGi_Lock = TRUE;
while (PXI_SendWordByFifo(PXI_FIFO_TAG_CTRDG_PHI, data, FALSE) != PXI_FIFO_SUCCESS)
{
SVC_WaitByLoop(1);
}
//---- wait response
while( CTRDGi_Lock )
{
SVC_WaitByLoop(1);
}
//---- wait response
while (CTRDGi_Lock)
{
SVC_WaitByLoop(1);
}
}
/*---------------------------------------------------------------------------*
@ -502,5 +518,5 @@ void CTRDG_SetPhiClock(CTRDGPhiClock clock)
static void CTRDGi_CallbackForSetPhi(PXIFifoTag tag, u32 data, BOOL err)
{
#pragma unused(tag, data, err)
CTRDGi_Lock = FALSE;
CTRDGi_Lock = FALSE;
}

View File

@ -11,6 +11,9 @@
in whole or in part, without the prior written consent of Nintendo.
$Log: ctrdg.c,v $
Revision 1.24 2007/02/20 00:28:11 kitase_hirotake
indent source
Revision 1.23 2006/04/24 00:05:09 okubata_ryoma
CW2.0
@ -418,7 +421,7 @@ BOOL CTRDG_IsExisting(void)
}
#if defined(SDK_ARM7)
//---- get privilege for accessing cartridge
if(CTRDGi_LockByProcessor(CTRDGi_Work.lockID, &lockInfo) == FALSE)
if (CTRDGi_LockByProcessor(CTRDGi_Work.lockID, &lockInfo) == FALSE)
{
(void)OS_RestoreInterrupts(lockInfo.irq);
return TRUE;

View File

@ -11,6 +11,9 @@
in whole or in part, without the prior written consent of Nintendo.
$Log: $
Revision 1.50 2006/08/09 06:11:26 yosizaki
change to wait vcount.
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <nitro/code32.h>
@ -63,6 +66,12 @@ SDK_WEAK_SYMBOL asm void _start( void )
mov r12, #HW_REG_BASE
str r12, [r12, #REG_IME_OFFSET]
//---- adjust VCOUNT.
@wait_vcount_0:
ldrh r0, [r12, #REG_VCOUNT_OFFSET]
cmp r0, #0
bne @wait_vcount_0
//---- initialize cp15
bl init_cp15
@ -203,7 +212,7 @@ void *const _start_ModuleParams[] = {
(void *)SDK_STATIC_BSS_START,
(void *)SDK_STATIC_BSS_END,
(void *)0, // CompressedStaticEnd
(void *)0, //SDK_VERSION_ID, // SDK version info
(void *)SDK_VERSION_ID, // SDK version info
(void *)SDK_NITROCODE_BE, // Checker 1
(void *)SDK_NITROCODE_LE, // Checker 2
};

View File

@ -11,6 +11,9 @@
in whole or in part, without the prior written consent of Nintendo.
$Log: os_terminate_sp.c,v $
Revision 1.3 2006/07/05 09:25:28 yosizaki
fix about include header.
Revision 1.2 2006/01/18 02:11:30 kitase_hirotake
do-indent
@ -19,8 +22,8 @@
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <nitro/os/common/system.h>
#include <nitro/ctrdg/ARM7/ctrdg_sp.h>
#include <nitro/os.h>
#include <nitro/ctrdg.h>
//============================================================================
// TERMINATE and HALT

View File

@ -11,6 +11,12 @@
in whole or in part, without the prior written consent of Nintendo.
$Log: os_init.c,v $
Revision 1.52 2006/11/14 04:33:19 okubata_ryoma
small fix
Revision 1.51 2006/11/14 01:36:26 okubata_ryoma
ARM9のOS_Init終了時にvcountを0に揃える処理を追加
Revision 1.50 2006/01/18 02:11:30 kitase_hirotake
do-indent
@ -173,6 +179,25 @@
#include <nitro/ctrdg.h>
#endif
#include <nitro/code32.h>
static asm void OSi_WaitVCount0( void )
{
//---- set IME = 0
// ( use that LSB of HW_REG_BASE equal to 0 )
mov r12, #HW_REG_BASE
ldr r1, [r12, #REG_IME_OFFSET]
str r12, [r12, #REG_IME_OFFSET]
//---- adjust VCOUNT.
@wait_vcount_0:
ldrh r0, [r12, #REG_VCOUNT_OFFSET]
cmp r0, #0
bne @wait_vcount_0
str r1, [r12, #REG_IME_OFFSET]
bx lr
}
#include <nitro/codereset.h>
/*---------------------------------------------------------------------------*
Name: OS_Init
@ -253,6 +278,9 @@ void OS_Init(void)
// PM_Init();
#endif
//---- adjust VCOUNT
OSi_WaitVCount0();
#else // SDK_ARM9
//----------------------------------------------------------------
// for ARM7

View File

@ -282,6 +282,9 @@ extern "C" {
#define HW_WM_CALLBACK_CONTROL (HW_MAIN_MEM_SYSTEM + 0x396) // WM コールバック同期用パラメータ
#define HW_WM_RSSI_POOL (HW_MAIN_MEM_SYSTEM + 0x398) // WM 受信強度による乱数源
#define HW_SET_CTRDG_MODULE_INFO_ONCE (HW_MAIN_MEM_SYSTEM + 0x39a) // set ctrdg module info flag
#define HW_IS_CTRDG_EXIST (HW_MAIN_MEM_SYSTEM + 0x39b) // ctrdg exist flag
#define HW_COMPONENT_PARAM (HW_MAIN_MEM_SYSTEM + 0x39c) // Component 同期用パラメータ
#define HW_THREADINFO_MAIN (HW_MAIN_MEM_SYSTEM + 0x3a0) // ThreadInfo for Main processor