mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-16 12:54:40 +00:00
[ntsc-1.2] Import libleo from Decompollaborate/n64dd (#2104)
* 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>
This commit is contained in:
parent
6f396e7cc8
commit
2152d1df2d
56 changed files with 4363 additions and 22 deletions
|
@ -1,7 +1,14 @@
|
|||
#ifndef ULTRA64_LEODRIVE_H
|
||||
#define ULTRA64_LEODRIVE_H
|
||||
|
||||
#include "leo.h"
|
||||
#include "leoappli.h"
|
||||
#include "message.h"
|
||||
#include "pi.h"
|
||||
#include "rcp.h"
|
||||
#include "stack.h"
|
||||
#include "thread.h"
|
||||
#include "ultratypes.h"
|
||||
|
||||
#define ASIC_BASE PI_DOM2_ADDR1
|
||||
|
||||
|
@ -44,4 +51,144 @@
|
|||
// ASIC_STATUS read bits
|
||||
#define LEO_STATUS_MECHANIC_INTR 0x02000000 // Mechanic Interrupt Raised
|
||||
|
||||
typedef union {
|
||||
/* 0x0 */ u8 u8_data[4];
|
||||
/* 0x0 */ u16 u16_data[2];
|
||||
/* 0x0 */ u32 u32_data;
|
||||
} data_trans_form; // size = 0x4
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8* pntr;
|
||||
/* 0x04 */ u8* c2buff_e;
|
||||
/* 0x08 */ u8 err_pos[4];
|
||||
/* 0x0C */ u8 err_num;
|
||||
/* 0x0D */ u8 bytes;
|
||||
/* 0x0E */ u16 blkbytes;
|
||||
} block_param_form; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u16 lba;
|
||||
/* 0x2 */ u16 cylinder;
|
||||
/* 0x4 */ u16 blk_bytes;
|
||||
/* 0x6 */ u8 sec_bytes;
|
||||
/* 0x7 */ u8 head;
|
||||
/* 0x8 */ u8 zone;
|
||||
/* 0x9 */ u8 rdwr_blocks;
|
||||
/* 0xA */ u8 start_block;
|
||||
} tgt_param_form; // size = 0xC
|
||||
|
||||
typedef union {
|
||||
/* 0x00 */ struct {
|
||||
/* 0x00 */ u32 country;
|
||||
/* 0x04 */ u8 fmt_type;
|
||||
/* 0x05 */ u8 disk_type;
|
||||
/* 0x06 */ u16 ipl_load_len;
|
||||
/* 0x08 */ u8 defect_num[20];
|
||||
/* 0x1C */ void* loadptr;
|
||||
/* 0x20 */ u8 defect_data[192];
|
||||
/* 0xE0 */ u16 rom_end_lba;
|
||||
/* 0xE2 */ u16 ram_start_lba;
|
||||
/* 0xE4 */ u16 ram_end_lba;
|
||||
} param;
|
||||
/* 0x00 */ u64 u64_data[29];
|
||||
} leo_sys_form; // size = 0xE8
|
||||
|
||||
void leomain(void* arg);
|
||||
void leointerrupt(void* arg);
|
||||
|
||||
OSPiHandle* osLeoDiskInit(void);
|
||||
s32 __osLeoInterrupt(void);
|
||||
|
||||
void leoClr_queue(void);
|
||||
void leoInquiry(void);
|
||||
void leoTest_unit_rdy(void);
|
||||
void leoRezero(void);
|
||||
void leoRead(void);
|
||||
void leoWrite(void);
|
||||
void leoSeek(void);
|
||||
void leoStart_stop(void);
|
||||
void leoRd_capacity(void);
|
||||
void leoTranslate();
|
||||
void leoMode_sel(void);
|
||||
void leoReadDiskId(void);
|
||||
void leoReadTimer(void);
|
||||
void leoSetTimer(void);
|
||||
void leoClr_reset(void);
|
||||
|
||||
u16 leoLba_to_phys(u32 lba);
|
||||
u16 leoLba_to_vzone(u32 lba);
|
||||
|
||||
u8 leoAnalize_asic_status(void);
|
||||
u8 leoChk_asic_ready(u32 asic_cmd);
|
||||
u8 leoChk_done_status(u32 asic_cmd);
|
||||
u8 leoSend_asic_cmd_i(u32 asic_cmd, u32 asic_data);
|
||||
u8 leoWait_mecha_cmd_done(u32 asic_cmd);
|
||||
u8 leoSend_asic_cmd_w(u32 asic_cmd, u32 asic_data);
|
||||
u8 leoSend_asic_cmd_w_nochkDiskChange(u32 asic_cmd, u32 asic_data);
|
||||
u8 leoDetect_index_w(void);
|
||||
u8 leoRecal_i(void);
|
||||
u8 leoRecal_w(void);
|
||||
u8 leoSeek_i(u16 rwmode);
|
||||
u8 leoSeek_w(void);
|
||||
u8 leoRecv_event_mesg(s32 control);
|
||||
u32 leoChk_err_retry(u32 sense);
|
||||
u8 leoChk_cur_drvmode(void);
|
||||
void leoDrive_reset(void);
|
||||
u32 leoChkUnit_atten(void);
|
||||
u32 leoRetUnit_atten(void);
|
||||
void leoClrUA_RESET(void);
|
||||
void leoClrUA_MEDIUM_CHANGED(void);
|
||||
void leoSetUA_MEDIUM_CHANGED(void);
|
||||
void leoInitUnit_atten(void);
|
||||
|
||||
s32 __leoSetReset(void);
|
||||
|
||||
void leoRead_common(unsigned int offset);
|
||||
|
||||
int leoC2_Correction(void);
|
||||
|
||||
void leoSet_mseq(u16 rwmode);
|
||||
|
||||
extern leo_sys_form LEO_sys_data;
|
||||
extern OSThread LEOcommandThread;
|
||||
extern OSThread LEOinterruptThread;
|
||||
extern STACK(LEOcommandThreadStack, 0x400);
|
||||
extern STACK(LEOinterruptThreadStack, 0x400);
|
||||
extern OSMesgQueue LEOcommand_que;
|
||||
extern OSMesgQueue LEOevent_que;
|
||||
extern OSMesgQueue LEOcontrol_que;
|
||||
extern OSMesgQueue LEOdma_que;
|
||||
extern OSMesgQueue LEOblock_que;
|
||||
extern OSMesg LEOevent_que_buf[1];
|
||||
extern OSMesg LEOcontrol_que_buf[1];
|
||||
extern OSMesg LEOdma_que_buf[2];
|
||||
extern OSMesg LEOblock_que_buf[1];
|
||||
extern u8* LEOwrite_pointer;
|
||||
extern LEOCmd* LEOcur_command;
|
||||
extern u32 LEOasic_bm_ctl_shadow;
|
||||
extern u32 LEOasic_seq_ctl_shadow;
|
||||
extern u8 LEOdrive_flag;
|
||||
extern vu8 LEOclr_que_flag;
|
||||
// needs to not be volatile in some files
|
||||
// extern vu16 LEOrw_flags;
|
||||
extern u8 LEOdisk_type;
|
||||
extern tgt_param_form LEOtgt_param;
|
||||
extern u32 LEO_country_code;
|
||||
|
||||
extern const char LEOfirmware_rev[];
|
||||
extern const u8 LEOBYTE_TBL1[];
|
||||
extern const u16 LEOBYTE_TBL2[];
|
||||
extern const u16 LEOVZONE_TBL[][0x10];
|
||||
extern const u16 LEOZONE_SCYL_TBL[];
|
||||
extern const u8 LEOVZONE_PZONEHD_TBL[][0x10];
|
||||
extern const u16 LEOZONE_OUTERCYL_TBL[];
|
||||
extern const u16 LEORAM_START_LBA[];
|
||||
extern const s32 LEORAM_BYTE[];
|
||||
|
||||
extern s32 __leoActive;
|
||||
extern LEOVersion __leoVersion;
|
||||
extern STACK(leoDiskStack, 0xFF0);
|
||||
|
||||
extern OSPiHandle* LEOPiInfo;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue