/*---------------------------------------------------------------------------* Project: Cafe File: PPCArch.h Copyright 1998-2011 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. *---------------------------------------------------------------------------*/ #ifndef __PPCARCH_H__ #define __PPCARCH_H__ #ifndef EPPC #define EPPC // embedded PowerPC #endif // EPPC #ifdef __cplusplus extern "C" { #endif #ifndef _ASSEMBLER #include #endif // _ASSEMBLER /*---------------------------------------------------------------------------* GQR *---------------------------------------------------------------------------*/ #ifndef _ASSEMBLER typedef struct { u32 _pad0 :2; u32 loadScale :6; u32 _pad1 :5; u32 loadType :3; u32 _pad2 :2; u32 storeScale :6; u32 _pad3 :5; u32 storeType :3; } PPC_GQR_t; typedef union { u32 val; PPC_GQR_t f; } PPC_GQR_u; #endif // _ASSEMBLER /*---------------------------------------------------------------------------* DMA fields *---------------------------------------------------------------------------*/ #ifndef _ASSEMBLER typedef struct { u32 memAddr :27; u32 dmaLenU :5; } PPC_DMA_U_t; typedef union { u32 val; PPC_DMA_U_t f; } PPC_DMA_U_u; typedef struct { u32 lcAddr :27; u32 dmaLd :1; u32 dmaLenL :2; u32 dmaTrigger :1; u32 dmaFlush :1; } PPC_DMA_L_t; typedef union { u32 val; PPC_DMA_L_t f; } PPC_DMA_L_u; #endif // _ASSEMBLER #ifndef _ASSEMBLER /*---------------------------------------------------------------------------* PPC instructions *---------------------------------------------------------------------------*/ #ifdef __ghs__ #define WEAK_SYMBOL #else #define WEAK_SYMBOL __declspec(weak) #endif u32 PPCMfmsr ( void ); void PPCMtmsr ( u32 newMSR ); u32 PPCOrMsr ( u32 value ); u32 PPCAndMsr ( u32 value ); u32 PPCAndCMsr( u32 value ); u32 PPCMfhid0 ( void ); void PPCMthid0 ( u32 newHID0 ); u32 PPCMfhid1 ( void ); u32 PPCMfhid2 ( void ); void PPCMthid2 ( u32 newhid2 ); u32 PPCMfwpar ( void ); // Note: this will flush the write pipe void PPCMtwpar ( u32 newwpar ); u32 PPCMfdmaU ( void ); u32 PPCMfdmaL ( void ); void PPCMtdmaU ( u32 newdmau ); void PPCMtdmaL ( u32 newdmal ); u32 PPCMfl2cr ( void ); void PPCMtl2cr ( u32 newL2cr ); void PPCMtdec ( u32 newDec ); u32 PPCMfdec ( void ); void PPCSync ( void ); void PPCEieio ( void ); void __PPCHalt ( void ); void __PPCExit ( int result ); void PPCHalt ( char* msg, u32 size ); void PPCIsync ( void ); u32 PPCMfmmcr0( void ); void PPCMtmmcr0( u32 newMmcr0 ); u32 PPCMfmmcr1( void ); void PPCMtmmcr1( u32 newMmcr1 ); u32 PPCMfpmc1 ( void ); void PPCMtpmc1 ( u32 newPmc1 ); u32 PPCMfpmc2 ( void ); void PPCMtpmc2 ( u32 newPmc2 ); u32 PPCMfpmc3 ( void ); void PPCMtpmc3 ( u32 newPmc3 ); u32 PPCMfpmc4 ( void ); void PPCMtpmc4 ( u32 newPmc4 ); u32 PPCMfsia ( void ); void PPCMtsia ( u32 newSia ); u32 PPCMfpvr ( void ); u32 PPCMffpscr( void ); void PPCMtfpscr( u32 newFPSCR ); /*---------------------------------------------------------------------------* PPC mode functions *---------------------------------------------------------------------------*/ void PPCEnableSpeculation ( void ); void PPCDisableSpeculation ( void ); void PPCSetFpIEEEMode ( void ); void PPCSetFpNonIEEEMode ( void ); u32 PPCMfhid4 ( void ); void PPCMthid4 ( register u32 newhid4 ); u32 PPCMfpir ( void ); u32 PPCMfsprg0 ( void ); #endif // _ASSEMBLER #ifdef __cplusplus } #endif #endif //__PPCARCH_H__