RetroArch
di.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------
2 
3 di.h -- Drive Interface library
4 
5 Team Twiizers
6 Copyright (C) 2008
7 
8 Erant
9 marcan
10 
11 This software is provided 'as-is', without any express or implied
12 warranty. In no event will the authors be held liable for any
13 damages arising from the use of this software.
14 
15 Permission is granted to anyone to use this software for any
16 purpose, including commercial applications, and to alter it and
17 redistribute it freely, subject to the following restrictions:
18 
19 1. The origin of this software must not be misrepresented; you
20 must not claim that you wrote the original software. If you use
21 this software in a product, an acknowledgment in the product
22 documentation would be appreciated but is not required.
23 
24 2. Altered source versions must be plainly marked as such, and
25 must not be misrepresented as being the original software.
26 
27 3. This notice may not be removed or altered from any source
28 distribution.
29 
30 -------------------------------------------------------------*/
31 
32 /*
33 All buffers in this document need to be 32-byte aligned!
34 */
35 
36 #ifndef __DI_H__
37 #define __DI_H__
38 
39 #include <stdint.h>
40 #include <ogc/ipc.h>
41 #include <ogc/disc_io.h>
42 
43 #define DVD_IDENTIFY 0x12
44 #define DVD_READ_DISCID 0x70
45 #define DVD_LOW_READ 0x71
46 #define DVD_WAITFORCOVERCLOSE 0x79
47 #define DVD_READ_PHYSICAL 0x80
48 #define DVD_READ_COPYRIGHT 0x81
49 #define DVD_READ_DISCKEY 0x82
50 #define DVD_GETCOVER 0x88
51 #define DVD_RESET 0x8A
52 #define DVD_OPEN_PARTITION 0x8B
53 #define DVD_CLOSE_PARTITION 0x8C
54 #define DVD_READ_UNENCRYPTED 0x8D
55 #define DVD_REPORTKEY 0xA4
56 #define DVD_READ 0xD0
57 #define DVD_READ_CONFIG 0xD1
58 #define DVD_READ_BCA 0xDA
59 #define DVD_GET_ERROR 0xE0
60 #define DVD_SET_MOTOR 0xE3
61 
62 #define DVD_READY 0x1
63 #define DVD_INIT 0x2
64 #define DVD_UNKNOWN 0x4
65 #define DVD_NO_DISC 0x8
66 #define DVD_IOS_ERROR 0x10
67 #define DVD_D0 0x20
68 #define DVD_A8 0x40
69 
70 #define DVD_COVER_DISC_INSERTED 0x02
71 
72 #define LIBDI_MAX_RETRIES 16
73 
74 #define DEVICE_TYPE_WII_DVD (('W'<<24)|('D'<<16)|('V'<<8)|'D')
75 
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79 
80 typedef struct{
84 }DI_DriveID;
85 
86 typedef int(*di_callback)(uint32_t status, uint32_t error);
87 typedef int(*read_func)(void*,uint32_t,uint32_t);
89 
90 extern int di_fd;
91 extern const DISC_INTERFACE __io_wiidvd;
92 
93 int DI_Init();
94 void DI_LoadDVDX(bool load);
95 void DI_UseCache(bool use);
97 void DI_Mount();
98 void DI_Close();
99 int DI_GetStatus();
100 
101 int DI_Identify(DI_DriveID* id);
102 int DI_CheckDVDSupport();
103 int DI_ReadDiscID(u64 *id);
105 int DI_GetCoverRegister(uint32_t* status);
106 int DI_Reset();
107 
108 int DI_StopMotor();
109 int DI_Eject();
110 int DI_KillDrive();
111 
112 int DI_ReadDVD(void* buf, uint32_t len, uint32_t lba);
113 int DI_ReadDVDAsync(void* buf, uint32_t len, uint32_t lba, ipccallback ipc_cb);
114 
115 int DI_Read(void *buf, u32 size, u32 offset);
116 int DI_UnencryptedRead(void *buf, u32 size, u32 offset);
117 
119 int DI_ReadDVDCopyright(uint32_t* copyright);
120 int DI_ReadDVDDiscKey(void *buf);
121 int DI_ReadDVDPhysical(void *buf);
122 int DI_Read_BCA(void *buf);
123 int DI_ReportKey(int keytype, uint32_t lba, void* buf);
124 
126 int DI_ClosePartition(void);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif
133 
int(* read_func)(void *, uint32_t, uint32_t)
Definition: di.h:87
int DI_Identify(DI_DriveID *id)
int DI_KillDrive()
GLuint GLfloat * val
Definition: glext.h:7847
int DI_Eject()
int DI_GetError(uint32_t *error)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
int DI_ReadDVDDiscKey(void *buf)
GLenum GLsizei len
Definition: glext.h:7389
GLsizeiptr size
Definition: glext.h:6559
int DI_ReportKey(int keytype, uint32_t lba, void *buf)
uint16_t dev_code
Definition: di.h:82
int DI_ReadDVD(void *buf, uint32_t len, uint32_t lba)
int(* di_callback)(uint32_t status, uint32_t error)
Definition: di.h:86
void DI_Mount()
int di_fd
void DI_LoadDVDX(bool load)
void DI_SetInitCallback(di_callback cb)
int DI_Read(void *buf, u32 size, u32 offset)
int DI_ReadDVDAsync(void *buf, uint32_t len, uint32_t lba, ipccallback ipc_cb)
uint32_t rel_date
Definition: di.h:83
const DISC_INTERFACE __io_wiidvd
int DI_Read_BCA(void *buf)
int(* read_func_async)(void *, uint32_t, uint32_t, ipccallback)
Definition: di.h:88
static l_noret error(LoadState *S, const char *why)
Definition: lundump.c:39
Definition: di.h:80
void DI_Close()
int DI_ReadDiscID(u64 *id)
int DI_ClosePartition(void)
uint64_t u64
64bit unsigned integer
Definition: gctypes.h:20
uint16_t rev
Definition: di.h:81
s32(* ipccallback)(s32 result, void *usrdata)
Definition: ipc.h:64
int DI_GetStatus()
Definition: iosuhax_disc_interface.h:52
void DI_UseCache(bool use)
int DI_ReadDVDPhysical(void *buf)
int DI_GetCoverRegister(uint32_t *status)
int DI_UnencryptedRead(void *buf, u32 size, u32 offset)
int DI_Reset()
int DI_ReadDVDCopyright(uint32_t *copyright)
int DI_CheckDVDSupport()
GLintptr offset
Definition: glext.h:6560
int DI_Init()
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19
unsigned short uint16_t
Definition: stdint.h:125
unsigned int uint32_t
Definition: stdint.h:126
int DI_StopMotor()
int DI_OpenPartition(u32 offset)
int DI_ReadDVDConfig(uint32_t *val, uint32_t flag)