utils.c 935 Bytes

/*---------------------------------------------------------------------*
        Copyright (C) 1998 Nintendo. (Originated by SGI)
        
        $RCSfile: utils.c,v $
        $Revision: 1.1.1.1 $
        $Date: 2002/05/02 03:27:18 $
 *---------------------------------------------------------------------*/


#include <ultra64.h>
#include "utils.h"
#include "music.h"

extern OSMesgQueue      dmaMessageQ;


void
romCopy(char *src, char *dest, int len)
{
    OSIoMesg dmaIoMesgBuf;
    OSMesg dummyMesg;
    
/*    osInvalDCache(dest, len); */  /* invalidate buffer */
    osWritebackDCacheAll();

    dmaIoMesgBuf.hdr.pri      = OS_MESG_PRI_NORMAL;
    dmaIoMesgBuf.hdr.retQueue = &dmaMessageQ;
    dmaIoMesgBuf.dramAddr     = dest;
    dmaIoMesgBuf.devAddr      = (u32)src;
    dmaIoMesgBuf.size         = len;

    osEPiStartDma(handler, &dmaIoMesgBuf, OS_READ);
    (void) osRecvMesg(&dmaMessageQ, &dummyMesg, OS_MESG_BLOCK);
}