Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

270 lines
4.6 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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.
  9. */
  10. /**
  11. * @file
  12. * fileXio RPC client/server shared includes
  13. * This header contains the common definitions for fileXio
  14. * that are used by both IOP and EE sides. This header
  15. * conflicts with ps2ip_rpc.h
  16. */
  17. #ifndef __FILEXIO_H__
  18. #define __FILEXIO_H__
  19. #include <tamtypes.h>
  20. #include <iox_stat.h>
  21. #ifdef _EE
  22. #ifndef NEWLIB_PORT_AWARE
  23. #error "Using fio/fileXio functions directly in the newlib port will lead to problems."
  24. #error "Use posix function calls instead."
  25. #endif
  26. #endif
  27. #define FILEXIO_IRX 0xb0b0b00
  28. enum FILEXIO_CMDS{
  29. FILEXIO_DOPEN = 0x01,
  30. FILEXIO_DREAD,
  31. FILEXIO_DCLOSE,
  32. FILEXIO_MOUNT,
  33. FILEXIO_UMOUNT,
  34. FILEXIO_GETDIR,
  35. FILEXIO_STOP,
  36. FILEXIO_COPYFILE,
  37. FILEXIO_OPEN,
  38. FILEXIO_CLOSE,
  39. FILEXIO_READ,
  40. FILEXIO_WRITE,
  41. FILEXIO_LSEEK,
  42. FILEXIO_IOCTL,
  43. FILEXIO_RMDIR,
  44. FILEXIO_GETSTAT,
  45. FILEXIO_CHSTAT,
  46. FILEXIO_FORMAT,
  47. FILEXIO_ADDDRV,
  48. FILEXIO_DELDRV,
  49. FILEXIO_RENAME,
  50. FILEXIO_CHDIR,
  51. FILEXIO_SYNC,
  52. FILEXIO_DEVCTL,
  53. FILEXIO_SYMLINK,
  54. FILEXIO_READLINK,
  55. FILEXIO_IOCTL2,
  56. FILEXIO_LSEEK64,
  57. FILEXIO_MKDIR,
  58. FILEXIO_REMOVE,
  59. FILEXIO_GETDEVICELIST,
  60. FILEXIO_SETRWBUFFSIZE
  61. };
  62. /** Used for buffer alignment correction when reading data. */
  63. typedef struct {
  64. int ssize;
  65. int esize;
  66. void *sbuf;
  67. void *ebuf;
  68. u8 sbuffer[64];
  69. u8 ebuffer[64];
  70. } rests_pkt; // sizeof = 144
  71. #define FILEXIO_MOUNTFLAG_NORMAL 0
  72. #define FILEXIO_MOUNTFLAG_READONLY 1
  73. #define FILEXIO_MOUNTFLAG_ROBUST 2
  74. #define FILEXIO_DIRFLAGS_DIR 0xa0
  75. #define FILEXIO_DIRFLAGS_FILE 0x80
  76. #define CTL_BUF_SIZE 2048
  77. #define IOCTL_BUF_SIZE 1024
  78. #define FILEXIO_MAX_DEVICES 32
  79. #define FILEXIO_DT_CHAR 0x01
  80. #define FILEXIO_DT_CONS 0x02
  81. #define FILEXIO_DT_BLOCK 0x04
  82. #define FILEXIO_DT_RAW 0x08
  83. #define FILEXIO_DT_FS 0x10
  84. /** Supports calls after chstat(). */
  85. #define FILEXIO_DT_FSEXT 0x10000000
  86. struct fileXioDirEntry
  87. {
  88. u32 fileSize;
  89. u8 fileProperties;
  90. char filename[128+1];
  91. } __attribute__((aligned(64)));
  92. struct fileXioDevice
  93. {
  94. char name[16];
  95. unsigned int type;
  96. /** Not so sure about this one. */
  97. unsigned int version;
  98. char desc[128];
  99. } __attribute__((aligned(64)));
  100. struct fxio_devlist_packet {
  101. struct fileXioDevice* deviceEntry;
  102. unsigned int reqEntries;
  103. };
  104. struct fxio_getdir_packet {
  105. char pathname[512];
  106. struct fileXioDirEntry* dirEntry;
  107. unsigned int reqEntries;
  108. };
  109. struct fxio_mount_packet {
  110. char blockdevice[512];
  111. char mountpoint[512];
  112. int flags;
  113. };
  114. struct fxio_unmount_packet {
  115. char mountpoint[512];
  116. };
  117. struct fxio_copyfile_packet {
  118. char source[512];
  119. char dest[512];
  120. int mode;
  121. };
  122. struct fxio_mkdir_packet {
  123. char pathname[512];
  124. int mode;
  125. };
  126. /** Also used for rmdir, chdir and dopen. */
  127. struct fxio_pathsel_packet {
  128. char pathname[512];
  129. };
  130. /** Also used for symlink. */
  131. struct fxio_rename_packet {
  132. char source[512];
  133. char dest[512];
  134. };
  135. struct fxio_readlink_packet {
  136. char source[512];
  137. void *buffer;
  138. unsigned int buflen;
  139. };
  140. struct fxio_open_packet {
  141. char pathname[512];
  142. int flags, mode;
  143. };
  144. /** Also used by dclose. */
  145. struct fxio_close_packet {
  146. int fd;
  147. };
  148. struct fxio_read_packet {
  149. int fd;
  150. void *buffer;
  151. int size;
  152. void *intrData;
  153. };
  154. struct fxio_write_packet {
  155. int fd;
  156. const void *buffer;
  157. int size;
  158. unsigned int unalignedDataLen;
  159. unsigned char unalignedData[64];
  160. };
  161. struct fxio_lseek_packet {
  162. int fd;
  163. u32 offset;
  164. int whence;
  165. };
  166. struct fxio_lseek64_packet {
  167. int fd;
  168. u32 offset_lo;
  169. u32 offset_hi;
  170. int whence;
  171. };
  172. struct fxio_chstat_packet {
  173. char pathname[512];
  174. iox_stat_t *stat;
  175. int mask;
  176. };
  177. struct fxio_getstat_packet {
  178. char pathname[512];
  179. iox_stat_t *stat;
  180. };
  181. struct fxio_format_packet {
  182. char device[128];
  183. char blockDevice[512];
  184. char args[512];
  185. int arglen;
  186. };
  187. struct fxio_sync_packet {
  188. char device[512];
  189. int flags;
  190. };
  191. struct fxio_dread_packet {
  192. int fd;
  193. iox_dirent_t *dirent;
  194. };
  195. struct fxio_devctl_packet {
  196. char name[CTL_BUF_SIZE];
  197. u8 arg[CTL_BUF_SIZE];
  198. int cmd;
  199. int arglen;
  200. void *buf;
  201. int buflen;
  202. void *intr_data;
  203. };
  204. struct fxio_ioctl_packet {
  205. int fd;
  206. u8 arg[IOCTL_BUF_SIZE];
  207. int cmd;
  208. };
  209. struct fxio_ioctl2_packet {
  210. int fd;
  211. u8 arg[CTL_BUF_SIZE];
  212. int cmd;
  213. int arglen;
  214. void *buf;
  215. int buflen;
  216. void *intr_data;
  217. };
  218. struct fxio_ctl_return_pkt {
  219. void *dest;
  220. int len;
  221. u8 buf[CTL_BUF_SIZE];
  222. int padding[2];
  223. };
  224. struct fxio_lseek64_return_pkt {
  225. u32 pos_lo, pos_hi;
  226. };
  227. struct fxio_rwbuff{
  228. int size;
  229. };
  230. #endif /* __FILEXIO_H__ */