mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-03 14:34:32 +00:00
* Create stack.h for STACK/STACK_TOP * Import libleo from Decompollaborate/n64dd Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> * Use (unsigned) int when in mdebug * Apply suggestions from code review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Use && in leocmdex.c * Use proper names for character tables, revert sNonKanjiIndices * Fix incorrect OSMesg casts * Use LEO_ERROR_GOOD even where docs say 0 Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Remove "Presumably" comment * Whitespace * Remove redundant (debug-only) returns --------- Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
33 lines
896 B
C
33 lines
896 B
C
#include "global.h"
|
|
#include "ultra64/leo.h"
|
|
#include "ultra64/leoappli.h"
|
|
#include "ultra64/leodrive.h"
|
|
|
|
void leoSeek(void) {
|
|
u32 tgt_tk; // Unused
|
|
u8 sense_code;
|
|
u8 retry_cntr = 20;
|
|
|
|
if (LEOcur_command->data.seek.lba > LEO_LBA_MAX) {
|
|
LEOcur_command->header.sense = LEO_SENSE_LBA_OUT_OF_RANGE;
|
|
LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION;
|
|
return;
|
|
}
|
|
|
|
leoLba_to_phys(LEOcur_command->data.seek.lba + 0x18);
|
|
|
|
do {
|
|
sense_code = leoSeek_w();
|
|
if (sense_code == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) {
|
|
LEOcur_command->header.status = LEO_STATUS_GOOD;
|
|
return;
|
|
}
|
|
|
|
if (leoChk_err_retry(sense_code) != 0) {
|
|
break;
|
|
}
|
|
} while (retry_cntr--);
|
|
|
|
LEOcur_command->header.sense = sense_code;
|
|
LEOcur_command->header.status = LEO_SENSE_DIAGNOSTIC_FAILURE;
|
|
}
|