diff --git a/progress/progress.dk64_boot.csv b/progress/progress.dk64_boot.csv index 1346a7c..2831bbf 100644 --- a/progress/progress.dk64_boot.csv +++ b/progress/progress.dk64_boot.csv @@ -145,7 +145,7 @@ us,boot,__osInsertTimer,392,yes us,boot,osAiSetFrequency,324,yes us,boot,func_dk64_boot_800073D0,132,yes us,boot,func_dk64_boot_800004B4,64,yes -us,boot,__osPackEepReadData,140,no +us,boot,__osPackEepReadData,140,yes us,boot,osContInit,368,yes us,boot,func_dk64_boot_80003120,192,no us,boot,osViSetSpecialFeatures,440,yes @@ -191,7 +191,7 @@ us,boot,guOrthoF,340,yes us,boot,__osSpSetPc,52,yes us,boot,func_dk64_boot_80002DE4,180,no us,boot,__ull_divremi,96,yes -us,boot,osEepromRead,452,no +us,boot,osEepromRead,452,yes us,boot,__osEnqueueThread,72,yes us,boot,__osPiGetAccess,68,yes us,boot,__osPopThread,16,yes diff --git a/progress/progress.total.csv b/progress/progress.total.csv index 4850a8b..df6fd8d 100644 --- a/progress/progress.total.csv +++ b/progress/progress.total.csv @@ -4420,7 +4420,7 @@ us,boot,__osInsertTimer,392,yes us,boot,osAiSetFrequency,324,yes us,boot,func_dk64_boot_800073D0,132,yes us,boot,func_dk64_boot_800004B4,64,yes -us,boot,__osPackEepReadData,140,no +us,boot,__osPackEepReadData,140,yes us,boot,osContInit,368,yes us,boot,func_dk64_boot_80003120,192,no us,boot,osViSetSpecialFeatures,440,yes @@ -4466,7 +4466,7 @@ us,boot,guOrthoF,340,yes us,boot,__osSpSetPc,52,yes us,boot,func_dk64_boot_80002DE4,180,no us,boot,__ull_divremi,96,yes -us,boot,osEepromRead,452,no +us,boot,osEepromRead,452,yes us,boot,__osEnqueueThread,72,yes us,boot,__osPiGetAccess,68,yes us,boot,__osPopThread,16,yes diff --git a/progress/progress_dk64_boot.svg b/progress/progress_dk64_boot.svg index 298475b..c9aa2d8 100644 --- a/progress/progress_dk64_boot.svg +++ b/progress/progress_dk64_boot.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ dk64_boot - 62.0421% - 62.0421% + 63.1093% + 63.1093% diff --git a/progress/progress_total.svg b/progress/progress_total.svg index e88a29a..42e4fb6 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Donkey Kong 64 (US) - 41.4867% - 41.4867% + 41.5226% + 41.5226% diff --git a/src/dk64_boot/io/conteepread.c b/src/dk64_boot/io/conteepread.c index cda0222..f019285 100644 --- a/src/dk64_boot/io/conteepread.c +++ b/src/dk64_boot/io/conteepread.c @@ -1,8 +1,87 @@ #include #include "functions.h" +#include "controller.h" +void __osSiGetAccess(); +s32 __osSiRawStartDma(s32, void *); +void __osSiRelAccess(void); +extern OSPifRam __osEepPifRam; +void __osPackEepReadData(u8); +s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer) { + s32 ret; + s32 i; + u16 type; + u8 *ptr; + OSContStatus sdata; + __OSContEepromFormat eepromformat; -#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/conteepread/osEepromRead.s") + ret = 0; + i = 0; + ptr = (u8*)&__osEepPifRam; + __osSiGetAccess(); + ret = __osEepStatus(mq, &sdata); + if (!ret) { + type = sdata.type & (CONT_EEPROM | CONT_EEP16K); + switch (type) { + case CONT_EEPROM: + if (address >= EEPROM_MAXBLOCKS) { + ret = -1; + } + break; + case CONT_EEPROM | CONT_EEP16K: + if (address >= EEP16K_MAXBLOCKS) { + ret = -1; + } + break; + default: + ret = 8; + } + } + if (ret) { + __osSiRelAccess(); + return ret; + } + while (sdata.status & CONT_EEPROM_BUSY) { + __osEepStatus(mq, &sdata); + } + __osPackEepReadData(address); + __osSiRawStartDma(1, &__osEepPifRam); + osRecvMesg(mq, NULL, 1); + __osSiRawStartDma(0, &__osEepPifRam); + __osContLastCmd = 4; + osRecvMesg(mq, NULL, 1); -#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/conteepread/__osPackEepReadData.s") + for (i = 0; i < MAXCONTROLLERS; i++) { + ptr++; + } + eepromformat = *(__OSContEepromFormat *)ptr; + ret = CHNL_ERR(eepromformat); + + if (ret == 0) { + for (i = 0; i < ARRLEN(eepromformat.data); i++) { + *buffer++ = eepromformat.data[i]; + } + } + __osSiRelAccess(); + return ret; +} + +void __osPackEepReadData(u8 address) { + u8 *ptr; + __OSContEepromFormat eepromformat; + s32 i; + + ptr = &__osEepPifRam.ramarray; + __osEepPifRam.pifstatus = CONT_CMD_EXE; + eepromformat.txsize = CONT_CMD_READ_EEPROM_TX; + eepromformat.rxsize = CONT_CMD_READ_EEPROM_RX; + eepromformat.cmd = CONT_CMD_READ_EEPROM; + eepromformat.address = address; + for (i = 0; i < 4; i++) { + *ptr++ = 0; + } + *(__OSContEepromFormat *)(ptr) = eepromformat; + ptr += sizeof(__OSContEepromFormat); + ptr[0] = CONT_CMD_END; +} \ No newline at end of file