Nugget
common
psxlibc
device.h
1
/*
2
3
MIT License
4
5
Copyright (c) 2020 PCSX-Redux authors
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13
14
The above copyright notice and this permission notice shall be included in all
15
copies or substantial portions of the Software.
16
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
SOFTWARE.
24
25
*/
26
27
#pragma once
28
29
#include <stdint.h>
30
31
#include "common/psxlibc/stdio.h"
32
33
struct
File
;
34
35
enum
FileAction {
36
PSXREAD = 1,
37
PSXWRITE = 2,
38
};
39
40
enum
{
41
PSXDTTYPE_CHAR = 0x01,
42
PSXDTTYPE_CONS = 0x02,
43
PSXDTTYPE_BLOCK = 0x04,
44
PSXDTTYPE_RAW = 0x08,
45
PSXDTTYPE_FS = 0x10,
46
};
47
48
typedef
void (*device_init)();
49
typedef
int (*device_open)(
struct
File
*,
const
char
*filename,
int
mode);
50
typedef
int (*device_action)(
struct
File
*,
enum
FileAction);
51
typedef
int (*device_close)(
struct
File
*);
52
typedef
int (*device_ioctl)(
struct
File
*,
int
cmd,
int
arg);
53
typedef
int (*device_read)(
struct
File
*,
void
*buffer,
int
size);
54
typedef
int (*device_write)(
struct
File
*,
void
*buffer,
int
size);
55
typedef
struct
DirEntry
*(*device_firstFile)(
struct
File
*file,
const
char
*filename,
struct
DirEntry
*entry);
56
typedef
struct
DirEntry
*(*device_nextFile)(
struct
File
*file,
struct
DirEntry
*entry);
57
typedef
int (*device_format)(
struct
File
*file);
58
typedef
void (*device_deinit)();
59
60
struct
Device
{
61
const
char
*name;
62
uint32_t flags
/* PSXDTTYPE_* */
;
63
uint32_t blockSize;
64
const
char
*desc;
65
device_init init;
66
device_open open;
67
device_action action;
68
device_close close;
69
device_ioctl ioctl;
70
device_read read;
71
device_write write;
72
void
*erase, *undelete;
73
device_firstFile firstFile;
74
device_nextFile nextFile;
75
device_format format;
76
void
*chdir, *rename;
77
device_deinit deinit;
78
void
*check;
79
};
Device
Definition:
device.h:60
DirEntry
Definition:
direntry.h:33
File
Definition:
stdio.h:96
Generated by
1.9.1