Disabling auto-refresh of game list by default, as it is causing bugs sometimes
[open-ps2-loader.git] / modules / hdd / ps2hdd / hdd_fio.h
blob2d446cc0e41df34b00af38b332cc2e14a11a7645
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
10 # $Id: hdd_fio.h 1511 2009-01-15 09:11:30Z radad $
13 #ifndef _HDD_FIO_H
14 #define _HDD_FIO_H
18 // IOCTL2 commands
20 #define APA_IOCTL2_ADD_SUB 0x00006801
21 #define APA_IOCTL2_DELETE_LAST_SUB 0x00006802
22 #define APA_IOCTL2_NUMBER_OF_SUBS 0x00006803
23 #define APA_IOCTL2_FLUSH_CACHE 0x00006804
25 #define APA_IOCTL2_TRANSFER_DATA 0x00006832 // used by pfs to read/write data :P
26 #define APA_IOCTL2_GETSIZE 0x00006833 // for main(0)/subs(1+)
27 #define APA_IOCTL2_SET_PART_ERROR 0x00006834 // set(sector of a apa header) that has a error :)
28 #define APA_IOCTL2_GET_PART_ERROR 0x00006835 // get(sector of a apa header) that has a error
29 #define APA_IOCTL2_GETHEADER 0x00006836 // get apa header
31 // structs for IOCTL2 commands
32 typedef struct
34 u32 sub; // main(0)/subs(1+) to read/write
35 u32 sector;
36 u32 size; // in sectors
37 u32 mode; // ATAD_MODE_READ/ATAD_MODE_WRITE.....
38 void *buffer;
39 } hddIoctl2Transfer_t;
42 // DEVCTL commands
44 #define APA_DEVCTL_MAX_SECTORS 0x00004801 // max partition size(in sectors)
45 #define APA_DEVCTL_TOTAL_SECTORS 0x00004802
46 #define APA_DEVCTL_IDLE 0x00004803
47 #define APA_DEVCTL_FLUSH_CACHE 0x00004804
48 #define APA_DEVCTL_SWAP_TMP 0x00004805
49 #define APA_DEVCTL_DEV9_SHUTDOWN 0x00004806
50 #define APA_DEVCTL_STATUS 0x00004807
51 #define APA_DEVCTL_FORMAT 0x00004808
52 #define APA_DEVCTL_SMART_STAT 0x00004809
53 //#define APA_DEVCTL_FREE_SECTORS 0x0000480A// REMOVED! is not true free...
55 #define APA_DEVCTL_GETTIME 0x00006832
56 #define APA_DEVCTL_SET_OSDMBR 0x00006833// arg = hddSetOsdMBR_t
57 #define APA_DEVCTL_GET_SECTOR_ERROR 0x00006834
58 #define APA_DEVCTL_GET_ERROR_PART_NAME 0x00006835// bufp = namebuffer[0x20]
59 #define APA_DEVCTL_ATA_READ 0x00006836// arg = hddAtaTransfer_t
60 #define APA_DEVCTL_ATA_WRITE 0x00006837// arg = hddAtaTransfer_t
61 #define APA_DEVCTL_SCE_IDENTIFY_DRIVE 0x00006838// bufp = buffer for atadSceIdentifyDrive
62 //#define APA_DEVCTL_FREE_SECTORS2 0x00006839
63 #define APA_DEVCTL_IS_48BIT 0x00006840
64 #define APA_DEVCTL_SET_TRANSFER_MODE 0x00006841
65 #define APA_DEVCTL_ATA_IOP_WRITE 0x00006842
67 // structs for DEVCTL commands
69 typedef struct
71 u32 lba;
72 u32 size;
73 u8 data[0];
74 } hddAtaTransfer_t;
76 typedef struct
78 u32 lba;
79 u32 size;
80 u8 *data;
81 } hddAtaIOPTransfer_t;
83 typedef struct
85 int type;
86 int mode;
87 } hddAtaSetMode_t;
89 typedef struct
91 u32 start;
92 u32 size;
93 } hddSetOsdMBR_t;
96 ///////////////////////////////////////////////////////////////////////////////
97 // Function declerations
98 int fioPartitionSizeLookUp(char *str);
99 int fioInputBreaker(char const **arg, char *outBuf, int maxout);
100 int fioDataTransfer(iop_file_t *f, void *buf, int size, int mode);
101 int getFileSlot(input_param *params, hdd_file_slot_t **fileSlot);
103 int ioctl2Transfer(u32 device, hdd_file_slot_t *fileSlot, hddIoctl2Transfer_t *arg);
104 void fioGetStatFiller(apa_cache *clink1, iox_stat_t *stat);
105 int ioctl2AddSub(hdd_file_slot_t *fileSlot, char *argp);
106 int ioctl2DeleteLastSub(hdd_file_slot_t *fileSlot);
108 int devctlSwapTemp(u32 device, char *argp);
110 // Functions which hook into IOMAN
111 int hddInit(iop_device_t *f);
112 int hddDeinit(iop_device_t *f);
113 int hddFormat(iop_file_t *f, const char *dev, const char *blockdev, void *arg, size_t arglen);
114 int hddOpen(iop_file_t *f, const char *name, int mode, int other_mode);
115 int hddClose(iop_file_t *f);
116 int hddRead(iop_file_t *f, void *buf, int size);
117 int hddWrite(iop_file_t *f, void *buf, int size);
118 int hddLseek(iop_file_t *f, unsigned long post, int whence);
119 int hddIoctl2(iop_file_t *f, int request, void *argp, unsigned int arglen, void *bufp, unsigned intbuflen);
120 int hddRemove(iop_file_t *f, const char *name);
121 int hddDopen(iop_file_t *f, const char *name);
122 int hddDread(iop_file_t *f, iox_dirent_t *dirent);
123 int hddGetStat(iop_file_t *f, const char *name, iox_stat_t *stat);
124 int hddReName(iop_file_t *f, const char *oldname, const char *newname);
125 int hddDevctl(iop_file_t *f, const char *devname, int cmd, void *arg, unsigned int arglen, void *bufp, unsigned int buflen);
127 int hddUnsupported(iop_file_t *f);
129 #endif /* _HDD_FIO_H */