sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
ioman_mod.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7# Copyright (c) 2004 adresd <adresd_ps2dev@yahoo.com>
8# Licenced under Academic Free License version 2.0
9# Review ps2sdk README & LICENSE files for further details.
10*/
11
17
18#ifndef __IOMAN_MOD_H__
19#define __IOMAN_MOD_H__
20
21#include <types.h>
22#include <irx.h>
23#include <io_common.h>
24#include <iox_stat.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30extern int io_open(const char *name, int mode);
31extern int io_close(int fd);
32extern int io_read(int fd, void *ptr, size_t size);
33extern int io_write(int fd, void *ptr, size_t size);
34extern int io_lseek(int fd, int pos, int mode);
35extern int io_ioctl(int fd, unsigned long arg, void *param);
36extern int io_remove(const char *name);
37extern int io_mkdir(const char *path);
38extern int io_rmdir(const char *path);
39extern int io_dopen(const char *path, int mode);
40extern int io_dclose(int fd);
41extern int io_dread(int fd, io_dirent_t *buf);
42extern int io_getstat(const char *name, io_stat_t *stat);
43extern int io_chstat(const char *name, io_stat_t *stat, unsigned int statmask);
44extern int io_format(const char *dev);
45
46/* Device drivers. */
47
48/* Device types. */
49#define IOP_DT_CHAR 0x01
50#define IOP_DT_CONS 0x02
51#define IOP_DT_BLOCK 0x04
52#define IOP_DT_RAW 0x08
53#define IOP_DT_FS 0x10
54
66
67typedef struct _iop_io_device {
68 const char *name;
69 unsigned int type;
71 unsigned int version;
72 const char *desc;
73 struct _iop_io_device_ops *ops;
74} iop_io_device_t;
75
76#define IOMAN_RETURN_VALUE_IMPL(val) \
77 static inline int my_ioman_retval_##val##_int(void) {return -val;} \
78 static inline signed long long my_ioman_retval_##val##_s64(void) {return -val;}
79#define IOMAN_RETURN_VALUE(val) ((void*)&my_ioman_retval_##val##_int)
80#define IOMAN_RETURN_VALUE_S64(val) ((void*)&my_ioman_retval_##val##_s64)
81
82typedef struct _iop_io_device_ops {
83 int (*io_init)(iop_io_device_t *device);
84 int (*io_deinit)(iop_io_device_t *device);
85 int (*io_format)(iop_io_file_t *f);
86 int (*io_open)(iop_io_file_t *f, const char *name, int flags);
87 int (*io_close)(iop_io_file_t *f);
88 int (*io_read)(iop_io_file_t *f, void *ptr, int size);
89 int (*io_write)(iop_io_file_t *f, void *ptr, int size);
90 int (*io_lseek)(iop_io_file_t *f, int offset, int mode);
91 int (*io_ioctl)(iop_io_file_t *f, unsigned long cmd, void *param);
92 int (*io_remove)(iop_io_file_t *f, const char *name);
93 int (*io_mkdir)(iop_io_file_t *f, const char *path);
94 int (*io_rmdir)(iop_io_file_t *f, const char *path);
95 int (*io_dopen)(iop_io_file_t *f, const char *path);
96 int (*io_dclose)(iop_io_file_t *f);
97 int (*io_dread)(iop_io_file_t *f, io_dirent_t *buf);
98 int (*io_getstat)(iop_io_file_t *f, const char *name, io_stat_t *stat_);
99 int (*io_chstat)(iop_io_file_t *f, const char *name, io_stat_t *stat_, unsigned int statmask);
100} iop_io_device_ops_t;
101
102extern int io_AddDrv(iop_io_device_t *device);
103extern int io_DelDrv(const char *name);
104
105#define ioman_mod_IMPORTS_start DECLARE_IMPORT_TABLE(ioman, 1, 1)
106#define ioman_mod_IMPORTS_end END_IMPORT_TABLE
107
108#define I_io_open DECLARE_IMPORT(4, io_open)
109#define I_io_close DECLARE_IMPORT(5, io_close)
110#define I_io_read DECLARE_IMPORT(6, io_read)
111#define I_io_write DECLARE_IMPORT(7, io_write)
112#define I_io_lseek DECLARE_IMPORT(8, io_lseek)
113#define I_io_ioctl DECLARE_IMPORT(9, io_ioctl)
114#define I_io_remove DECLARE_IMPORT(10, io_remove)
115#define I_io_mkdir DECLARE_IMPORT(11, io_mkdir)
116#define I_io_rmdir DECLARE_IMPORT(12, io_rmdir)
117#define I_io_dopen DECLARE_IMPORT(13, io_dopen)
118#define I_io_dclose DECLARE_IMPORT(14, io_dclose)
119#define I_io_dread DECLARE_IMPORT(15, io_dread)
120#define I_io_getstat DECLARE_IMPORT(16, io_getstat)
121#define I_io_chstat DECLARE_IMPORT(17, io_chstat)
122#define I_io_format DECLARE_IMPORT(18, io_format)
123#define I_io_AddDrv DECLARE_IMPORT(20, io_AddDrv);
124#define I_io_DelDrv DECLARE_IMPORT(21, io_DelDrv);
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* __IOMAN_MOD_H__ */
struct _iop_io_file iop_io_file_t
unsigned int version
Definition ioman_mod.h:71
struct _iop_io_device * device
Definition ioman_mod.h:62
void * privdata
Definition ioman_mod.h:64