// EE initialization functions // [made by] [RO]man, zerofrog #include #include #include "eekernel.h" #include "eeirq.h" void InitializeGS(); void InitializeGIF(); void InitializeDMAC(int code); void InitializeVU1(); void InitializeVIF1(); void InitializeIPU(); void InitializeVIF0(); void InitializeVU0(); void InitializeFPU(); void InitializeScratchPad(); void InitializeUserMemory(u32 base); void InitializeINTC(int a); void InitializeTIMER(); //////////////////////////////////////////////////////////////////// //8000AA60 //////////////////////////////////////////////////////////////////// void InitializeGS() { } //////////////////////////////////////////////////////////////////// //8000AB98 //////////////////////////////////////////////////////////////////// void InitializeGIF() { GIF_CTRL = 1; __asm__ ("sync\n"); GIF_FIFO = 0; } //////////////////////////////////////////////////////////////////// //8000AD68 SYSCALL 001 ResetEE //////////////////////////////////////////////////////////////////// int _ResetEE(int init) { if (init & 0x01) { __printf("# Initialize DMAC ...\n"); InitializeDMAC(0x31F); } if (init & 0x02) { __printf("# Initialize VU1 ...\n"); InitializeVU1(); } if (init & 0x04) { __printf("# Initialize VIF1 ...\n"); InitializeVIF1(); } if (init & 0x08) { __printf("# Initialize GIF ...\n"); InitializeGIF(); } if (init & 0x10) { __printf("# Initialize VU0 ...\n"); InitializeVU0(); } if (init & 0x04) { __printf("# Initialize VIF0 ...\n"); InitializeVIF0(); } if (init & 0x40) { __printf("# Initialize IPU ...\n"); InitializeIPU(); } InitializeINTC(0xC); // return (*(int*)0x1000F410 &= 0xFFFBFFFF); code never reached :) } //////////////////////////////////////////////////////////////////// //8000AE88 //////////////////////////////////////////////////////////////////// int Initialize() { __printf("# Initialize Start.\n"); __printf("# Initialize GS ..."); InitializeGS(); _SetGsCrt(1, 2, 1); __printf("\n"); __printf("# Initialize INTC ...\n"); InitializeINTC(0xFFFF); __printf("# Initialize TIMER ...\n"); InitializeTIMER(); ResetEE(0x7F); __printf("# Initialize FPU ...\n"); InitializeFPU(); __printf("# Initialize User Memory ...\n"); InitializeUserMemory(0x80000); __printf("# Initialize Scratch Pad ...\n"); InitializeScratchPad(); __printf("# Initialize Done.\n"); } //////////////////////////////////////////////////////////////////// //8000AF50 //////////////////////////////////////////////////////////////////// int Restart() { __printf("# Restart.\n"); __printf("# Initialize GS ..."); INTC_STAT = 4; while (INTC_STAT & 4) { __asm__ ("nop\nnop\nnop\n"); } INTC_STAT = 4; InitializeGS(); _SetGsCrt(1, 2, 1); __printf("\n"); __printf("# Initialize INTC ...\n"); InitializeINTC(0xDFFD); __printf("# Initialize TIMER ...\n"); InitializeTIMER(); ResetEE(0x7F); __printf("# Initialize FPU ...\n"); InitializeFPU(); __printf("# Initialize User Memory ...\n"); InitializeUserMemory(0x82000); __printf("# Initialize Scratch Pad ...\n"); InitializeScratchPad(); __printf("# Restart Done.\n"); //wait for syncing IOP while (SBUS_SMFLG & SBFLG_IOPSYNC) { __asm__ ("nop\nnop\nnop\n"); } SBUS_SMFLG=SBFLG_IOPSYNC; } //////////////////////////////////////////////////////////////////// //8000B0A0 //////////////////////////////////////////////////////////////////// void InitializeDMAC(int code) { int i; int *addr; for (i=0; i<10; i++) { if (!(code & (1< 48) { __printf("# TLB over flow (1)\n"); } ptr = (u32*)(tlb_config[4] + 0x10); for (i=1; i 48) { __printf("# TLB over flow (2)\n"); } if (tlb_config[1]) { ptr = (u32*)(tlb_config[5]); for (; i 48) { __printf("# TLB over flow (3)\n"); } ptr = (u32*)(tlb_config[6]); for (; i