sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
devices.c
Go to the documentation of this file.
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
15
16
#include "
defs.h
"
17
#include "
stdio.h
"
18
#include "
sysclib.h
"
19
20
#include "
iomanX.h
"
/* just for fstypes */
21
22
#include "
iopmgr.h
"
23
34
iop_device_t *
iopmgr_get_iomandev
(
char
*device)
35
{
36
ModuleInfo_t
*info = 0;
37
iop_device_t **devinfo_table;
38
int
i;
39
int
len = strlen(device) + 1;
40
41
if
(!(info =
smod_get_mod_by_name
(IOPMGR_IOMAN_IDENT))) {
42
return
0;
43
}
44
45
/* Find the start of the device info array, in .bss. */
46
devinfo_table = (iop_device_t **)(info->text_start + info->text_size + info->data_size + 0x0c);
47
48
/* The device info table had 16 entries, but some may be empty. Just look at all of them. */
49
for
(i = 0; i < 16; i++) {
50
if
(devinfo_table[i])
51
if
(!memcmp(devinfo_table[i]->name, device, len))
52
return
(devinfo_table[i]);
53
}
54
return
0;
55
}
56
67
iop_device_t *
iopmgr_get_iomanxdev
(
char
*device)
68
{
69
ModuleInfo_t
*info;
70
iop_device_t **devinfo_table;
71
int
i;
72
int
len = strlen(device) + 1;
73
74
if
(!(info =
smod_get_mod_by_name
(IOPMGR_IOMANX_IDENT))) {
75
return
0;
76
}
77
78
/* Find the start of the device info array, in .bss. */
79
devinfo_table = (iop_device_t **)(info->text_start + info->text_size + info->data_size);
80
81
/* The device info table had 32 entries, but some may be empty. Just look at all of them. */
82
for
(i = 0; i < 32; i++) {
83
if
(devinfo_table[i])
84
if
(!memcmp(devinfo_table[i]->name, device, len))
85
return
(devinfo_table[i]);
86
}
87
return
0;
88
}
89
102
int
iopmgr_get_devicelist
(
int
man,
int
devtype,
char
*buffer)
103
{
104
ModuleInfo_t
*info;
105
iop_device_t **devinfo_table;
106
int
i;
107
char
*bufptr = buffer;
108
int
count
= 0;
109
110
/* do the ioman devices */
111
if
((man & IOPMGR_DEVTYPE_IOMAN))
112
if
((info =
smod_get_mod_by_name
(IOPMGR_IOMAN_IDENT)))
113
{
114
/* Find the start of the device info array, in .bss. */
115
devinfo_table = (iop_device_t **)(info->text_start + info->text_size + info->data_size + 0x0c);
116
117
/* The device info table had 16 entries, but some may be empty. Just look at all of them. */
118
for
(i = 0; i < 16; i++)
119
{
120
if
(devinfo_table[i])
121
if
((devinfo_table[i]->type & devtype))
122
{
123
strcpy(bufptr,devinfo_table[i]->name);
124
bufptr += strlen(bufptr)+1;
125
count
++;
126
}
127
}
128
}
129
130
/* do the iomanx devices */
131
if
((man & IOPMGR_DEVTYPE_IOMANX))
132
if
((info =
smod_get_mod_by_name
(IOPMGR_IOMANX_IDENT)))
133
{
134
/* Find the start of the device info array, in .bss. */
135
devinfo_table = (iop_device_t **)(info->text_start + info->text_size + info->data_size);
136
137
/* The device info table had 32 entries, but some may be empty. Just look at all of them. */
138
for
(i = 0; i < 32; i++)
139
{
140
if
(devinfo_table[i])
141
/* only add iomanx ones here, so must have extended flag set else we get duplication with new iomanx */
142
if
((devinfo_table[i]->type &
IOP_DT_FSEXT
) && (devinfo_table[i]->type & devtype))
143
{
144
strcpy(bufptr,devinfo_table[i]->name);
145
bufptr += strlen(bufptr)+1;
146
count
++;
147
}
148
}
149
}
150
return
count
;
151
}
152
163
iop_device_t *
iopmgr_get_device
(
char
*device)
164
{
165
iop_device_t *devptr;
166
devptr =
iopmgr_get_iomandev
(device);
167
if
(devptr != NULL)
return
(devptr);
168
devptr =
iopmgr_get_iomanxdev
(device);
169
if
(devptr != NULL)
return
(devptr);
170
return
0;
171
}
172
184
int
iopmgr_get_devicetype
(
char
*device)
185
{
186
if
(
iopmgr_get_iomandev
(device) != NULL)
187
return
(IOPMGR_DEVTYPE_IOMAN);
188
if
(
iopmgr_get_iomanxdev
(device) != NULL)
189
return
(IOPMGR_DEVTYPE_IOMANX);
190
return
IOPMGR_DEVTYPE_INVALID;
191
}
defs.h
iopmgr_get_iomandev
iop_device_t * iopmgr_get_iomandev(char *device)
Definition
devices.c:34
iopmgr_get_device
iop_device_t * iopmgr_get_device(char *device)
Definition
devices.c:163
iopmgr_get_iomanxdev
iop_device_t * iopmgr_get_iomanxdev(char *device)
Definition
devices.c:67
iopmgr_get_devicelist
int iopmgr_get_devicelist(int man, int devtype, char *buffer)
Definition
devices.c:102
smod_get_mod_by_name
ModuleInfo_t * smod_get_mod_by_name(const char *name)
Definition
smod.c:63
iopmgr_get_devicetype
int iopmgr_get_devicetype(char *device)
Definition
devices.c:184
iomanX.h
IOP_DT_FSEXT
#define IOP_DT_FSEXT
Definition
iomanX.h:67
iopmgr.h
ModuleInfo_t
struct _ModuleInfo ModuleInfo_t
stdio.h
sysclib.h
count
u32 count
start sector of fragmented bd/file
Definition
usbhdfsd-common.h:1
core
iopmgr
src
devices.c
Generated by
1.18.0