PageRenderTime 26ms CodeModel.GetById 13ms app.highlight 11ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/libogcfpc/src/ogc/dvd.inc

https://github.com/slibre/freepascal
Pascal | 178 lines | 119 code | 55 blank | 4 comment | 0 complexity | 96b75d88bf32c566456c208045b339d1 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1
  2{$IFDEF OGC_INTERFACE}
  3const
  4  DVD_STATE_FATAL_ERROR = - 1;
  5  DVD_STATE_END = 0;
  6  DVD_STATE_BUSY = 1;
  7  DVD_STATE_WAITING = 2;
  8  DVD_STATE_COVER_CLOSED = 3;
  9  DVD_STATE_NO_DISK = 4;
 10  DVD_STATE_COVER_OPEN = 5;
 11  DVD_STATE_WRONG_DISK = 6;
 12  DVD_STATE_MOTOR_STOPPED = 7;
 13  DVD_STATE_IGNORED = 8;
 14  DVD_STATE_CANCELED = 10;
 15  DVD_STATE_RETRY = 11;
 16  DVD_ERROR_OK = 0;
 17  DVD_ERROR_FATAL = - 1;
 18  DVD_ERROR_IGNORED = - 2;
 19  DVD_ERROR_CANCELED = - 3;
 20  DVD_ERROR_COVER_CLOSED = - 4;
 21  DVD_RESETHARD = 0;  (*!< Performs a hard reset. Complete new boot of FW.  *)
 22  DVD_RESETSOFT = 1;  (*!< Performs a soft reset. FW restart and drive spinup  *)
 23  DVD_RESETNONE = 2;  (*!< Only initiate DI registers  *)
 24  DVD_SPINMOTOR_DOWN = $00000000;  (*!< Stop DVD drive  *)
 25  DVD_SPINMOTOR_UP = $00000100;  (*!< Start DVD drive  *)
 26  DVD_SPINMOTOR_ACCEPT = $00004000;  (*!< Force DVD to accept the disk  *)
 27  DVD_SPINMOTOR_CHECKDISK = $00008000;  (*!< Force DVD to perform a disc check  *)
 28
 29type
 30
 31  _dvddiskid = record
 32    gamename : array [0..3] of cint8;
 33    company : array [0..1] of cint8;
 34    disknum : cuint8;
 35    gamever : cuint8;
 36    streaming : cuint8;
 37    streambufsize : cuint8;
 38    pad : array [0..21] of cuint8;
 39  end;
 40  dvddiskid = _dvddiskid;
 41  pdvddiskid = ^dvddiskid;
 42
 43
 44  dvdcbcallback = procedure(result: cint32; block: pointer); cdecl;
 45
 46  _dvdcmdblk = record
 47    node : lwp_node;
 48    cmd : cuint32;
 49    state : cint32;
 50    offset : cint64;
 51    len : cuint32;
 52    buf : pointer;
 53    currtxsize : cuint32;
 54    txdsize : cuint32;
 55    id : Pdvddiskid;
 56    cb : dvdcbcallback;
 57    usrdata : pointer;
 58  end;
 59  dvdcmdblk = _dvdcmdblk;
 60  Pdvdcmdblk = ^dvdcmdblk;
 61
 62
 63  _dvddrvinfo = record
 64    rev_level : cuint16;
 65    dev_code : cuint16;
 66    rel_date : cuint32;
 67    pad : array [0..23] of cuint8;
 68  end;
 69  dvddrvinfo = _dvddrvinfo;
 70  Pdvddrvinfo = ^dvddrvinfo;
 71
 72
 73  dvdcallback = procedure(result: cint32; info: pointer); cdecl;
 74
 75  _dvdfileinfo = record
 76    block : dvdcmdblk;
 77    addr : cuint32;
 78    len : cuint32;
 79    cb : dvdcallback;
 80  end;
 81  dvdfileinfo = _dvdfileinfo;
 82  Pdvdfileinfo = ^dvdfileinfo;
 83
 84
 85procedure DVD_Init; cdecl; external;
 86
 87procedure DVD_Pause; cdecl; external;
 88
 89
 90procedure DVD_Reset(reset_mode: cuint32); cdecl; external;
 91
 92
 93function DVD_Mount: cint32; cdecl; external;
 94
 95function DVD_GetDriveStatus: cint32; cdecl; external;
 96
 97
 98function DVD_MountAsync(block: Pdvdcmdblk; cb: dvdcbcallback): cint32; cdecl; external;
 99
100
101function DVD_ControlDrive(block: Pdvdcmdblk; cmd: cuint32): cint32; cdecl; external;
102
103
104function DVD_ControlDriveAsync(block: Pdvdcmdblk; cmd: cuint32;
105  cb: dvdcbcallback): cint32; cdecl; external;
106
107
108function DVD_SetGCMOffset(block: Pdvdcmdblk; offset: cint64): cint32; cdecl; external;
109
110
111function DVD_SetGCMOffsetAsync(block: Pdvdcmdblk; offset: cint64;
112  cb: dvdcbcallback): cint32; cdecl; external;
113
114
115function DVD_GetCmdBlockStatus(block: Pdvdcmdblk): cint32; cdecl; external;
116
117function DVD_SpinUpDrive(block: Pdvdcmdblk): cint32; cdecl; external;
118
119function DVD_SpinUpDriveAsync(block: Pdvdcmdblk; cb: dvdcbcallback): cint32; cdecl; external;
120
121function DVD_Inquiry(block: Pdvdcmdblk; info: Pdvddrvinfo): cint32; cdecl; external;
122
123function DVD_InquiryAsync(block: Pdvdcmdblk; info: Pdvddrvinfo;
124  cb: dvdcbcallback): cint32; cdecl; external;
125
126function DVD_ReadPrio(block: Pdvdcmdblk; buf: pointer; len: cuint32;
127  offset: cint64; prio: cint32): cint32; cdecl; external;
128
129function DVD_ReadAbsAsyncPrio(block: Pdvdcmdblk; buf: pointer; len: cuint32;
130  offset: cint64; cb: dvdcbcallback; prio: cint32): cint32; cdecl; external;
131
132function DVD_ReadAbsAsyncForBS(block: Pdvdcmdblk; buf: pointer; len: cuint32;
133  offset: cint64; cb: dvdcbcallback): cint32; cdecl; external;
134
135function DVD_SeekPrio(block: Pdvdcmdblk; offset: cint64; prio: cint32): cint32; cdecl; external;
136
137function DVD_SeekAbsAsyncPrio(block: Pdvdcmdblk; offset: cint64;
138  cb: dvdcbcallback; prio: cint32): cint32; cdecl; external;
139
140function DVD_CancelAllAsync(cb: dvdcbcallback): cint32; cdecl; external;
141
142function DVD_StopStreamAtEndAsync(block: Pdvdcmdblk; cb: dvdcbcallback): cint32; cdecl; external;
143
144function DVD_StopStreamAtEnd(block: Pdvdcmdblk): cint32; cdecl; external;
145
146function DVD_ReadDiskID(block: Pdvdcmdblk; id: Pdvddiskid; cb: dvdcbcallback)
147  : cint32; cdecl; external;
148
149function DVD_SetAutoInvalidation(auto_inv: cuint32): cuint32; cdecl; external;
150
151function DVD_GetCurrentDiskID: Pdvddiskid; cdecl; external;
152
153function DVD_GetDriveInfo: Pdvddrvinfo; cdecl; external;
154
155
156procedure DVD_SetUserData(block: _dvdcmdblk; data: pointer); inline;
157function DVD_GetUserData(block: _dvdcmdblk): pointer; inline;
158
159const
160  DEVICE_TYPE_GAMECUBE_DVD = ((Ord('G') shl 24) or (Ord('D') shl 16) or (Ord('V') shl 8) or Ord('D'));
161
162var
163  __io_gcdvd : DISC_INTERFACE; cvar; external;
164{$ENDIF}
165
166
167{$IFDEF OGC_IMPLEMENTATION}
168procedure DVD_SetUserData(block: _dvdcmdblk; data: pointer); inline;
169begin
170  block.usrdata := data;
171end;
172
173function DVD_GetUserData(block: _dvdcmdblk): pointer; inline;
174begin
175  DVD_GetUserData := block.usrdata;
176end;
177{$ENDIF}
178