-
Notifications
You must be signed in to change notification settings - Fork 256
/
internal.h
138 lines (118 loc) · 3.61 KB
/
internal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef __CDVDMAN_INTERNAL__
#define __CDVDMAN_INTERNAL__
#include "dev9.h"
#include "oplsmb.h"
#include "smb.h"
#include "atad.h"
#include "ioplib_util.h"
#include "cdvdman_opl.h"
#include "cdvd_config.h"
#include "device.h"
#include <loadcore.h>
#include <stdio.h>
#include <sifman.h>
#include <sysclib.h>
#include <sysmem.h>
#include <thbase.h>
#include <thevent.h>
#include <intrman.h>
#include <ioman.h>
#include <thsemap.h>
#include <errno.h>
#include <io_common.h>
#include <usbd.h>
#include <cdvdman.h>
#include "ioman_add.h"
#include <defs.h>
#include "smsutils.h"
#define memcpy mips_memcpy
#define memset mips_memset
#ifdef __IOPCORE_DEBUG
#define DPRINTF(args...) printf(args)
#define iDPRINTF(args...) Kprintf(args)
#else
#define DPRINTF(args...)
#define iDPRINTF(args...)
#endif
#define CDVDMAN_SETTINGS_DEFAULT_COMMON \
{ \
0x69, 0x69, 0x1234, 0x39393939, "B00BS" \
}
#define CDVDMAN_SETTINGS_DEFAULT_HDD 0x12345678
#define CDVDMAN_SETTINGS_DEFAULT_SMB \
"###### FILENAME ######", \
{ \
{ \
"192.168.0.10", 0x8510, "PS2SMB", "", "GUEST", "" \
} \
}
#ifdef HDD_DRIVER
#define CDVDMAN_SETTINGS_TYPE cdvdman_settings_hdd
#define CDVDMAN_SETTINGS_DEFAULT_DEVICE_SETTINGS CDVDMAN_SETTINGS_DEFAULT_HDD,
#elif SMB_DRIVER
#define CDVDMAN_SETTINGS_TYPE cdvdman_settings_smb
#define CDVDMAN_SETTINGS_DEFAULT_DEVICE_SETTINGS CDVDMAN_SETTINGS_DEFAULT_SMB,
#elif BDM_DRIVER
#define CDVDMAN_SETTINGS_TYPE cdvdman_settings_bdm
#define CDVDMAN_SETTINGS_DEFAULT_DEVICE_SETTINGS
#else
#error Unknown driver type. Please check the Makefile.
#endif
struct SteamingData
{
unsigned short int StBufmax;
unsigned short int StBankmax;
unsigned short int StBanksize;
unsigned short int StWritePtr;
unsigned short int StReadPtr;
unsigned short int StStreamed;
unsigned short int StStat;
unsigned short int StIsReading;
void *StIOP_bufaddr;
u32 Stlsn;
};
typedef struct
{
int err;
int status;
struct SteamingData StreamingData;
int intr_ef;
int disc_type_reg;
u32 cdread_lba;
u32 cdread_sectors;
void *cdread_buf;
} cdvdman_status_t;
struct dirTocEntry
{
short length;
u32 fileLBA; // 2
u32 fileLBA_bigend; // 6
u32 fileSize; // 10
u32 fileSize_bigend; // 14
u8 dateStamp[6]; // 18
u8 reserved1; // 24
u8 fileProperties; // 25
u8 reserved2[6]; // 26
u8 filenameLength; // 32
char filename[128]; // 33
} __attribute__((packed));
typedef void (*StmCallback_t)(void);
//Internal (common) function prototypes
extern void SetStm0Callback(StmCallback_t callback);
extern int cdvdman_AsyncRead(u32 lsn, u32 sectors, void *buf);
extern int cdvdman_SyncRead(u32 lsn, u32 sectors, void *buf);
extern int cdvdman_sendSCmd(u8 cmd, const void *in, u16 in_size, void *out, u16 out_size);
extern void cdvdman_cb_event(int reason);
extern void cdvdman_init(void);
extern void cdvdman_fs_init(void);
extern void cdvdman_searchfile_init(void);
extern void cdvdman_initdev(void);
extern struct CDVDMAN_SETTINGS_TYPE cdvdman_settings;
#define CDVDMAN_BUF_SECTORS 2
extern u8 cdvdman_buf[CDVDMAN_BUF_SECTORS * 2048];
extern int cdrom_io_sema;
extern int cdvdman_searchfilesema;
extern cdvdman_status_t cdvdman_stat;
extern unsigned char sync_flag;
extern unsigned char cdvdman_cdinited;
#endif