1 /*---------------------------------------------------------------------------* 2 Project: Dolphin GX library 3 File: GXFifo.h 4 5 Copyright 1998- 2002 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: GXFifo.h,v $ 14 Revision 1.5 2006/03/10 07:29:36 mitu 15 changed include file from <dolphin/-.h> to <revolution/-.h>. 16 17 Revision 1.4 2006/02/09 12:30:03 hirose 18 Added const specifier to GXSet* APIs. Added GXGetFifoWrap(). 19 20 Revision 1.3 2006/02/06 05:01:12 hirose 21 API updates. Deleted obsolete portion. 22 23 Revision 1.2 2006/02/04 11:56:46 hashida 24 (none) 25 26 Revision 1.1.1.1 2005/12/29 06:53:28 hiratsu 27 Initial import. 28 29 Revision 1.1.1.1 2005/05/12 02:41:07 yasuh-to 30 Ported from dolphin source tree. 31 32 33 13 2002/07/24 9:06 Hirose 34 Resolved version conflicts. 35 36 13 2002/04/09 15:15 Hirose 37 const type specifier support. (worked by hiratsu@IRD) 38 39 12 2001/04/10 6:47p Carl 40 Added GXSaveGPFifo. 41 42 11 2000/11/09 3:52p Tian 43 Added write gather pipe redirection 44 45 10 2000/11/01 11:13a Hirose 46 flag fix EPPC -> !EMU 47 48 9 2000/06/05 3:46p Carl 49 Removed GetFifoTop; added GetFifoLimits. 50 51 8 2000/05/30 4:37p Tian 52 Added overflow count API 53 54 7 2000/05/23 6:45p Carl 55 Added get prototypes. 56 57 6 2000/04/26 4:53p Carl 58 CallBacks are now Callbacks. Set callback routines now return old 59 callbacks. Added gets for fifo objects. 60 61 5 2000/03/15 1:30p Tian 62 Added fifo wrap bit to GXGetFifoStatus 63 64 4 2000/03/13 4:16p Tian 65 Added breakpoint callback 66 67 3 2000/03/13 3:05p Tian 68 Added GXGetGPStatus, updated GXGetFifoStatus. 69 70 2 2000/02/17 5:52p Tian 71 Added GXSetCurrentGXThread and GXGetCurrentGXThread 72 73 12 1999/10/26 6:14p Tian 74 Cleanup, added min fifo size and size of hi water mark buffer. 75 76 11 1999/10/25 11:02a Tian 77 made __GXWritePI available in all EPPC builds 78 79 10 1999/10/22 3:23p Tian 80 Added __GXWritePI to capture all PI commands for CSIM 81 82 9 1999/10/04 11:10a Tian 83 Updated GXGetFifoStatus prototype 84 85 8 1999/09/23 3:26p Tian 86 New GXFifo API 87 88 7 1999/09/08 5:15p Alligator 89 90 5 1999/08/02 4:17p Shiki 91 Included <revolution/os/OSAlarm.h>. 92 93 4 1999/07/30 6:37p Shiki 94 Added EPPC specific functions. 95 96 3 1999/07/30 5:13p Shiki 97 Uncommented. Fixed minor errors. 98 99 2 1999/07/27 1:07p Alligator 100 updated api 101 102 1 1999/07/14 4:20p Alligator 103 Split gx.h into individual header files for each major section of API 104 $NoKeywords: $ 105 *---------------------------------------------------------------------------*/ 106 107 #ifndef __GXFIFO_H__ 108 #define __GXFIFO_H__ 109 110 #ifdef __cplusplus 111 extern "C" { 112 #endif 113 114 #include <revolution/types.h> 115 #include <revolution/gx/GXEnum.h> 116 117 118 // Minimum size for any FIFO is 64k 119 // The hi watermark is automatically set to fifosize - 16k, 120 // large enough for a full locked cache DMA. 121 #define GX_FIFO_MINSIZE (64*1024) 122 #define GX_FIFO_HI_WATERMARK_BUFFER (16*1024) 123 124 // Placeholder structure for GXFifoObj. Actual structure members are private. 125 #define GX_FIFO_OBJ_SIZE 128 126 127 typedef struct{ 128 u8 pad[GX_FIFO_OBJ_SIZE]; 129 } GXFifoObj; 130 131 typedef void (*GXBreakPtCallback)(void); 132 133 134 /*---------------------------------------------------------------------------* 135 Init FIFO APIs 136 *---------------------------------------------------------------------------*/ 137 void GXInitFifoBase( 138 GXFifoObj* fifo, 139 void* base, 140 u32 size ); 141 142 void GXInitFifoPtrs( 143 GXFifoObj* fifo, 144 void* readPtr, 145 void* writePtr ); 146 147 void GXInitFifoLimits( 148 GXFifoObj* fifo, 149 u32 hiWaterMark, 150 u32 loWaterMark ); 151 152 153 /*---------------------------------------------------------------------------* 154 Attaching FIFOs to CPU/GP 155 *---------------------------------------------------------------------------*/ 156 void GXSetCPUFifo ( const GXFifoObj* fifo ); 157 void GXSetGPFifo ( const GXFifoObj* fifo ); 158 159 160 /*---------------------------------------------------------------------------* 161 Get APIs 162 *---------------------------------------------------------------------------*/ 163 void GXGetGPStatus( 164 GXBool* overhi, 165 GXBool* underlow, 166 GXBool* readIdle, 167 GXBool* cmdIdle, 168 GXBool* brkpt); 169 170 GXBool GXGetCPUFifo( GXFifoObj* fifo ); 171 GXBool GXGetGPFifo ( GXFifoObj* fifo ); 172 173 void* GXGetFifoBase( const GXFifoObj* fifo ); 174 void GXGetFifoPtrs( const GXFifoObj* fifo, void** readPtr, void** writePtr ); 175 u32 GXGetFifoCount( const GXFifoObj* fifo ); 176 u32 GXGetFifoSize( const GXFifoObj* fifo ); 177 void GXGetFifoLimits( const GXFifoObj* fifo, u32* hi, u32* lo ); 178 GXBool GXGetFifoWrap( const GXFifoObj* fifo ); 179 180 GXBool GXIsCPUGPFifoLinked( void ); 181 182 183 /*---------------------------------------------------------------------------* 184 Breakpoint APIs 185 *---------------------------------------------------------------------------*/ 186 GXBreakPtCallback GXSetBreakPtCallback( GXBreakPtCallback cb ); 187 188 void GXEnableBreakPt( void* breakPtr ); 189 void GXDisableBreakPt( void ); 190 191 192 /*---------------------------------------------------------------------------* 193 Redirecting write gather pipe 194 *---------------------------------------------------------------------------*/ 195 volatile void* GXRedirectWriteGatherPipe ( void * ptr ); 196 void GXRestoreWriteGatherPipe ( void ); 197 198 199 /*---------------------------------------------------------------------------* 200 GX thread that will be interrupted by FIFO handlers in immediate mode 201 *---------------------------------------------------------------------------*/ 202 #include <revolution/os/OSThread.h> 203 OSThread* GXSetCurrentGXThread ( void ); 204 OSThread* GXGetCurrentGXThread ( void ); 205 206 207 208 /*---------------------------------------------------------------------------* 209 Overflow counter API 210 *---------------------------------------------------------------------------*/ 211 u32 GXGetOverflowCount ( void ); 212 u32 GXResetOverflowCount ( void ); 213 214 215 #ifdef __cplusplus 216 } 217 #endif 218 219 #endif //__GXFIFO_H__ 220