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