
        Internalizing the Pi/EPi Raw functions


1. The Former Problem

 When a Pi/Epi Raw function (osPiRawReadIo, osPiRawWriteIo, oEPiRawReadIo, oEPiRawWriteIo, osPiRawStartDma and osEPiRawStartDma) is interrupted during execution, the process is moved to another thread.  But when Pi is accessed by that thread, the wrong data can be read if Pi is in the Busy state.  


2. The Present Correction

  This problem does not occur for non-Raw functions, namely osPiReadIo, osPiWriteIo, oEPiReadIo, oEPiWriteIo, osPiStartDma and osEPiStartDma.  

  This patch prevents the problem from occurring by making all Pi/Epi Raw functions internal functions which, as a rule, are not used in the game.

   Accordingly, the Raw functions have been renamed as follows: 

                osPiRawReadIo      ->   __osPiRawReadIo
                osPiRawWriteIo     ->   __osPiRawWriteIo
                oEPiRawReadIo      ->   __oEPiRawReadIo
                oEPiRawWriteIo     ->   __oEPiRawWriteIo
                osPiRawStartDma    ->   __osPiRawStartDma
                osEPiRawStartDma   ->   __osEPiRawStartDma

   If you have used these Raw functions in the past, please as a rule use them henceforth as non-Raw functions. 


3. Using the Raw Functions

   If, for some reason, you need to use the Raw functions, this can be done by performing the following extern declarations. 

   However, because of the problem explained above, you need to be careful when using them.  Please employ some method such as accessing Pi only from a specific thread in the game. 

        extern s32      __osPiRawWriteIo(u32, u32);
        extern s32      __osPiRawReadIo(u32, u32 *);
        extern s32      __osEPiRawWriteIo(OSPiHandle *, u32 , u32);
        extern s32      __osEPiRawReadIo(OSPiHandle *, u32 , u32 *);
        extern s32      __osPiRawStartDma(s32, u32, void *, u32);
        extern s32      __osEPiRawStartDma(OSPiHandle *, s32 , u32 ,
                                           void *, u32 );
