sm64

A Super Mario 64 decompilation
Log | Files | Refs | README | LICENSE

osDriveRomInit.c (1004B)


      1 #include "libultra_internal.h"
      2 #include "PR/os_pi.h"
      3 #include "PR/rcp.h"
      4 #include "bstring.h"
      5 #include <sm64.h>
      6 
      7 extern OSPiHandle *__osPiTable;
      8 extern OSPiHandle DriveRomHandle;
      9 
     10 OSPiHandle *osDriveRomInit(void) { // Why is this compiled with -g???
     11     UNUSED s32 sp1c = 0;
     12     u32 saveMask;
     13 
     14     DriveRomHandle.type = DEVICE_TYPE_BULK;
     15     DriveRomHandle.baseAddress = PHYS_TO_K1(PI_DOM1_ADDR1);
     16     DriveRomHandle.latency = 64;
     17     DriveRomHandle.pulse = 7;
     18     DriveRomHandle.pageSize = 7;
     19     DriveRomHandle.relDuration = 2;
     20 
     21     IO_WRITE(PI_BSD_DOM1_LAT_REG, DriveRomHandle.latency);
     22     IO_WRITE(PI_BSD_DOM1_PWD_REG, DriveRomHandle.pulse);
     23     IO_WRITE(PI_BSD_DOM1_PGS_REG, DriveRomHandle.pageSize);
     24     IO_WRITE(PI_BSD_DOM1_RLS_REG, DriveRomHandle.relDuration);
     25 
     26     bzero(&DriveRomHandle.transferInfo, sizeof(__OSTranxInfo));
     27 
     28     saveMask = __osDisableInt();
     29     DriveRomHandle.next = __osPiTable;
     30     __osPiTable = &DriveRomHandle;
     31     __osRestoreInt(saveMask);
     32 
     33     return &DriveRomHandle;
     34 }