KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
cdrom.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/cdrom.h
4 Copyright (C) 2000-2001 Megan Potter
5 Copyright (C) 2014, 2025 Donald Haase
6 Copyright (C) 2023, 2024, 2025 Ruslan Rostovtsev
7*/
8
9#ifndef __DC_CDROM_H
10#define __DC_CDROM_H
11
12#include <kos/cdefs.h>
13__BEGIN_DECLS
14
15#include <stdint.h>
16#include <stdbool.h>
17#include <dc/syscalls.h>
18#include <kos/regfield.h>
19
20/** \file dc/cdrom.h
21 \brief CD access to the GD-ROM drive.
22 \ingroup gdrom
23
24 This file contains the interface to the Dreamcast's GD-ROM drive. It is
25 simply called cdrom.h and cdrom.c because, by design, you cannot directly
26 use this code to read the high-density area of GD-ROMs. This is the way it
27 always has been, and always will be.
28
29 The way things are set up, as long as you're using fs_iso9660 to access the
30 CD, it will automatically detect and react to disc changes for you.
31
32 This file only facilitates reading raw sectors and doing other fairly low-
33 level things with CDs. If you're looking for higher-level stuff, like
34 normal file reading, consult with the stuff for the fs and for fs_iso9660.
35
36 If you're looking for *even lower* level things with CDs, see the gdrom
37 related syscalls or g1ata.
38
39 \author Megan Potter
40 \author Donald Haase
41 \author Ruslan Rostovtsev
42
43 \see kos/fs.h
44 \see dc/fs_iso9660.h
45 \see dc/syscalls.h
46 \see dc/g1ata.h
47*/
48
49/** \defgroup gdrom GD-ROM
50 \brief Driver for the Dreamcast's GD-ROM drive
51 \ingroup vfs
52*/
53
54/* These are defines provided for compatibility. These defines are now part of `cd_cmd_code_t` in dc/syscalls.h */
55static const uint8_t CMD_CHECK_LICENSE __depr("Please use the new CD_ prefixed versions.") = CD_CMD_CHECK_LICENSE;
56static const uint8_t CMD_REQ_SPI_CMD __depr("Please use the new CD_ prefixed versions.") = CD_CMD_REQ_SPI_CMD;
57static const uint8_t CMD_PIOREAD __depr("Please use the new CD_ prefixed versions.") = CD_CMD_PIOREAD;
58static const uint8_t CMD_DMAREAD __depr("Please use the new CD_ prefixed versions.") = CD_CMD_DMAREAD;
59static const uint8_t CMD_GETTOC __depr("Please use the new CD_ prefixed versions.") = CD_CMD_GETTOC;
60static const uint8_t CMD_GETTOC2 __depr("Please use the new CD_ prefixed versions.") = CD_CMD_GETTOC2;
61static const uint8_t CMD_PLAY __depr("Please use the new CD_ prefixed versions.") = CD_CMD_PLAY_TRACKS;
62static const uint8_t CMD_PLAY2 __depr("Please use the new CD_ prefixed versions.") = CD_CMD_PLAY_SECTORS;
63static const uint8_t CMD_PAUSE __depr("Please use the new CD_ prefixed versions.") = CD_CMD_PAUSE;
64static const uint8_t CMD_RELEASE __depr("Please use the new CD_ prefixed versions.") = CD_CMD_RELEASE;
65static const uint8_t CMD_INIT __depr("Please use the new CD_ prefixed versions.") = CD_CMD_INIT;
66static const uint8_t CMD_DMA_ABORT __depr("Please use the new CD_ prefixed versions.") = CD_CMD_DMA_ABORT;
67static const uint8_t CMD_OPEN_TRAY __depr("Please use the new CD_ prefixed versions.") = CD_CMD_OPEN_TRAY;
68static const uint8_t CMD_SEEK __depr("Please use the new CD_ prefixed versions.") = CD_CMD_SEEK;
69static const uint8_t CMD_DMAREAD_STREAM __depr("Please use the new CD_ prefixed versions.") = CD_CMD_DMAREAD_STREAM;
70static const uint8_t CMD_NOP __depr("Please use the new CD_ prefixed versions.") = CD_CMD_NOP;
71static const uint8_t CMD_REQ_MODE __depr("Please use the new CD_ prefixed versions.") = CD_CMD_REQ_MODE;
72static const uint8_t CMD_SET_MODE __depr("Please use the new CD_ prefixed versions.") = CD_CMD_SET_MODE;
73static const uint8_t CMD_SCAN_CD __depr("Please use the new CD_ prefixed versions.") = CD_CMD_SCAN_CD;
74static const uint8_t CMD_STOP __depr("Please use the new CD_ prefixed versions.") = CD_CMD_STOP;
75static const uint8_t CMD_GETSCD __depr("Please use the new CD_ prefixed versions.") = CD_CMD_GETSCD;
76static const uint8_t CMD_GETSES __depr("Please use the new CD_ prefixed versions.") = CD_CMD_GETSES;
77static const uint8_t CMD_REQ_STAT __depr("Please use the new CD_ prefixed versions.") = CD_CMD_REQ_STAT;
78static const uint8_t CMD_PIOREAD_STREAM __depr("Please use the new CD_ prefixed versions.") = CD_CMD_PIOREAD_STREAM;
79static const uint8_t CMD_DMAREAD_STREAM_EX __depr("Please use the new CD_ prefixed versions.") = CD_CMD_DMAREAD_STREAM_EX;
80static const uint8_t CMD_PIOREAD_STREAM_EX __depr("Please use the new CD_ prefixed versions.") = CD_CMD_PIOREAD_STREAM_EX;
81static const uint8_t CMD_GET_VERS __depr("Please use the new CD_ prefixed versions.") = CD_CMD_GET_VERS;
82static const uint8_t CMD_MAX __depr("Please use the new CD_ prefixed versions.") = CD_CMD_MAX;
83
84/** \defgroup cd_cmd_response Command Responses
85 \brief Responses from GD-ROM syscalls
86 \ingroup gdrom
87
88 These are the values that the various functions can return as error codes.
89 @{
90*/
91#define ERR_OK 0 /**< \brief No error */
92#define ERR_NO_DISC 1 /**< \brief No disc in drive */
93#define ERR_DISC_CHG 2 /**< \brief Disc changed, but not reinitted yet */
94#define ERR_SYS 3 /**< \brief System error */
95#define ERR_ABORTED 4 /**< \brief Command aborted */
96#define ERR_NO_ACTIVE 5 /**< \brief System inactive? */
97#define ERR_TIMEOUT 6 /**< \brief Aborted due to timeout */
98/** @} */
99
100/* These are defines provided for compatibility. These defines are now part of `cd_cmd_chk_t` in dc/syscalls.h */
101static const uint8_t FAILED __depr("Please use the new CD_CMD_ prefixed versions.") = CD_CMD_FAILED;
102static const uint8_t NO_ACTIVE __depr("Please use the new CD_CMD_ prefixed versions.") = CD_CMD_NOT_FOUND;
103static const uint8_t PROCESSING __depr("Please use the new CD_CMD_ prefixed versions.") = CD_CMD_PROCESSING;
104static const uint8_t COMPLETED __depr("Please use the new CD_CMD_ prefixed versions.") = CD_CMD_COMPLETED;
105static const uint8_t STREAMING __depr("Please use the new CD_CMD_ prefixed versions.") = CD_CMD_STREAMING;
106static const uint8_t BUSY __depr("Please use the new CD_CMD_ prefixed versions.") = CD_CMD_BUSY;
107
108/** \defgroup cdda_read_modes CDDA Read Modes
109 \brief Read modes for CDDA
110 \ingroup gdrom
111
112 Valid values to pass to the cdrom_cdda_play() function for the mode
113 parameter.
114 @{
115*/
116#define CDDA_TRACKS 1 /**< \brief Play by track number */
117#define CDDA_SECTORS 2 /**< \brief Play by sector number */
118/** @} */
119
120/* Compat. These got converted to a plain bool. */
121static const bool CDROM_READ_PIO __depr("Please just use false to not use dma.") = false;
122static const bool CDROM_READ_DMA __depr("Please just use true to use dma.") = true;
123
124/* Compat. This can now be found in dc/syscalls.h */
125#define CDROM_TOC __depr("Use the type cd_toc_t rather than CDROM_TOC.") cd_toc_t
126
127/** \defgroup cd_toc_access TOC Access Macros
128 \brief Macros used to access the TOC
129 \ingroup gdrom
130
131 @{
132*/
133
134/** \brief Get the FAD address of a TOC entry.
135 \param n The actual entry from the TOC to look at.
136 \return The FAD of the entry.
137*/
138#define TOC_LBA(n) FIELD_GET(n, 0x00ffffff)
139
140/** \brief Get the address of a TOC entry.
141 \param n The entry from the TOC to look at.
142 \return The entry's address.
143*/
144#define TOC_ADR(n) FIELD_GET(n, 0x0f000000)
145
146/** \brief Get the control data of a TOC entry.
147 \param n The entry from the TOC to look at.
148 \return The entry's control value.
149*/
150#define TOC_CTRL(n) FIELD_GET(n, 0xf0000000)
151
152/** \brief Get the track number of a TOC entry.
153 \param n The entry from the TOC to look at.
154 \return The entry's track.
155*/
156#define TOC_TRACK(n) FIELD_GET(n, 0x00ff0000)
157/** @} */
158
159/** \brief CD-ROM streams callback
160*/
161typedef void (*cdrom_stream_callback_t)(void *data);
162
163/** \brief Set the sector size for read sectors.
164 \ingroup gdrom
165
166 This function sets the sector size that the cdrom_read_sectors() function
167 will return. Be sure to set this to the correct value for the type of
168 sectors you're trying to read. Common values are 2048 (for reading CD-ROM
169 sectors) or 2352 (for reading raw sectors).
170
171 \param size The size of the sector data.
172
173 \return \ref cd_cmd_response
174*/
176
177/** \brief Execute a CD-ROM command.
178 \ingroup gdrom
179
180 This function executes the specified command using the BIOS syscall for
181 executing GD-ROM commands.
182
183 \param cmd The command to execute.
184 \param param Data to pass to the syscall.
185
186 \return \ref cd_cmd_response
187*/
188int cdrom_exec_cmd(cd_cmd_code_t cmd, void *param);
189
190/** \brief Execute a CD-ROM command with timeout.
191 \ingroup gdrom
192
193 This function executes the specified command using the BIOS syscall for
194 executing GD-ROM commands with timeout.
195
196 \param cmd The command to execute.
197 \param param Data to pass to the syscall.
198 \param timeout Timeout in milliseconds.
199
200 \return \ref cd_cmd_response
201*/
202int cdrom_exec_cmd_timed(cd_cmd_code_t cmd, void *param, uint32_t timeout);
203
204/** \brief Abort a CD-ROM command with timeout.
205 \ingroup gdrom
206
207 This function aborts current command using the BIOS syscall for
208 aborting GD-ROM commands. They can also abort DMA transfers.
209
210 \param timeout Timeout in milliseconds.
211 \param abort_dma Whether to abort the DMA transfer.
212
213 \return \ref cd_cmd_response
214*/
215int cdrom_abort_cmd(uint32_t timeout, bool abort_dma);
216
217/** \brief Get the status of the GD-ROM drive.
218 \ingroup gdrom
219
220 \param status Space to return the drive's status.
221 \param disc_type Space to return the type of disc in the drive.
222
223 \return \ref cd_cmd_response
224 \see cd_status_values
225 \see cd_disc_types
226*/
227int cdrom_get_status(int *status, int *disc_type);
228
229/** \brief Change the datatype of disc.
230 \ingroup gdrom
231
232 This function will take in all parameters to pass to the change_datatype
233 syscall. This allows these parameters to be modified without a reinit.
234 Each parameter allows -1 as a default, which is tied to the former static
235 values provided by cdrom_reinit and cdrom_set_sector_size.
236
237 \param sector_part How much of each sector to return.
238 \param track_type What CDXA mode to read as (if applicable).
239 \param sector_size What sector size to read (eg. - 2048, 2532).
240
241 \return \ref cd_cmd_response
242 \see cd_read_sector_part
243*/
244int cdrom_change_datatype(cd_read_sec_part_t sector_part, int track_type, int sector_size);
245
246/** \brief Re-initialize the GD-ROM drive.
247 \ingroup gdrom
248
249 This function is for reinitializing the GD-ROM drive after a disc change to
250 its default settings. Calls cdrom_reinit(-1,-1,-1)
251
252 \return \ref cd_cmd_response
253 \see cdrom_reinit_ex
254*/
255int cdrom_reinit(void);
256
257/** \brief Re-initialize the GD-ROM drive with custom parameters.
258 \ingroup gdrom
259
260 At the end of each cdrom_reinit(), cdrom_change_datatype is called.
261 This passes in the requested values to that function after
262 reinitialization, as opposed to defaults.
263
264 \param sector_part How much of each sector to return.
265 \param cdxa What CDXA mode to read as (if applicable).
266 \param sector_size What sector size to read (eg. - 2048, 2532).
267
268 \return \ref cd_cmd_response
269 \see cd_read_sec_part_t
270 \see cdrom_change_datatype
271*/
272int cdrom_reinit_ex(cd_read_sec_part_t sector_part, int cdxa, int sector_size);
273
274/** \brief Read the table of contents from the disc.
275 \ingroup gdrom
276
277 This function reads the TOC from the specified area of the disc.
278 On regular CD-ROMs, there are only low density area.
279
280 \param toc_buffer Space to store the returned TOC in.
281 \param high_density Whether to read from the high density area.
282 \return \ref cd_cmd_response
283*/
284int cdrom_read_toc(cd_toc_t *toc_buffer, bool high_density);
285
286/** \brief Read one or more sector from a CD-ROM.
287 \ingroup gdrom
288
289 This function reads the specified number of sectors from the disc, starting
290 where requested. This will respect the size of the sectors set with
291 cdrom_change_datatype(). The buffer must have enough space to store the
292 specified number of sectors and size must be a multiple of 32 for DMA.
293
294 \param buffer Space to store the read sectors.
295 \param sector The sector to start reading from.
296 \param cnt The number of sectors to read.
297 \param dma True for read using dma, false for pio.
298 \return \ref cd_cmd_response
299
300 \note If the buffer address points to the P2 memory area,
301 the caller function will be responsible for ensuring
302 memory coherency.
303
304*/
305int cdrom_read_sectors_ex(void *buffer, uint32_t sector, size_t cnt, bool dma);
306
307/** \brief Read one or more sector from a CD-ROM in PIO mode.
308 \ingroup gdrom
309
310 Default version of cdrom_read_sectors_ex, which forces PIO mode.
311
312 \param buffer Space to store the read sectors.
313 \param sector The sector to start reading from.
314 \param cnt The number of sectors to read.
315 \return \ref cd_cmd_response
316 \see cdrom_read_sectors_ex
317*/
318int cdrom_read_sectors(void *buffer, uint32_t sector, size_t cnt);
319
320/** \brief Start streaming from a CD-ROM.
321 \ingroup gdrom
322
323 This function pre-reads the specified number of sectors from the disc.
324
325 \param sector The sector to start reading from.
326 \param cnt The number of sectors to read, 0x1ff means until end of disc.
327 \param dma True for read using dma, false for pio.
328
329 \return \ref cd_cmd_response
330 \see cdrom_transfer_request
331*/
332int cdrom_stream_start(int sector, int cnt, bool dma);
333
334/** \brief Stop streaming from a CD-ROM.
335 \ingroup gdrom
336
337 This function finishing stream commands.
338
339 \param abort_dma Abort current G1 DMA transfer.
340
341 \return \ref cd_cmd_response
342 \see cdrom_transfer_request
343*/
344int cdrom_stream_stop(bool abort_dma);
345
346/** \brief Request stream transfer.
347 \ingroup gdrom
348
349 This function request data from stream.
350
351 \param buffer Space to store the read sectors (DMA aligned to 32, PIO to 2).
352 \param size The size in bytes to read (DMA min 32, PIO min 2).
353 \param block True to block until DMA transfer completes.
354 \return \ref cd_cmd_response
355 \see cdrom_stream_start
356*/
357int cdrom_stream_request(void *buffer, size_t size, bool block);
358
359/** \brief Check requested stream transfer.
360 \ingroup gdrom
361
362 This function check requested stream transfer.
363
364 \param size The transfered (if in progress) or remain size in bytes.
365 \return 1 - is in progress, 0 - done
366 \see cdrom_transfer_request
367*/
368int cdrom_stream_progress(size_t *size);
369
370/** \brief Setting up a callback for transfers.
371 \ingroup gdrom
372
373 This callback is called for every transfer request that is completed.
374
375 \param callback Callback function.
376 \param param Callback function param.
377 \see cdrom_transfer_request
378*/
380
381/** \brief Read subcode data from the most recently read sectors.
382 \ingroup gdrom
383
384 After reading sectors, this can pull subcode data regarding the sectors
385 read. If reading all subcode data with CD_SUB_CURRENT_POSITION, this needs
386 to be performed one sector at a time.
387
388 \param buffer Space to store the read subcode data.
389 \param buflen Amount of data to be read.
390 \param which Which subcode type do you wish to get.
391
392 \return \ref cd_cmd_response
393 \see cd_sub_type_t
394*/
396
397/** \brief Locate the sector of the data track.
398 \ingroup gdrom
399
400 This function will search the toc for the last entry that has a CTRL value
401 of 4, and return its FAD address.
402
403 \param toc The TOC to search through.
404 \return The FAD of the track, or 0 if none is found.
405*/
407
408/** \brief Play CDDA audio tracks or sectors.
409 \ingroup gdrom
410
411 This function starts playback of CDDA audio.
412
413 \param start The track or sector to start playback from.
414 \param end The track or sector to end playback at.
415 \param loops The number of times to repeat (max of 15).
416 \param mode The mode to play (see \ref cdda_read_modes).
417 \return \ref cd_cmd_response
418*/
419int cdrom_cdda_play(uint32_t start, uint32_t end, uint32_t loops, int mode);
420
421/** \brief Pause CDDA audio playback.
422 \ingroup gdrom
423
424 \return \ref cd_cmd_response
425*/
427
428/** \brief Resume CDDA audio playback after a pause.
429 \ingroup gdrom
430
431 \return \ref cd_cmd_response
432*/
434
435/** \brief Spin down the CD.
436 \ingroup gdrom
437
438 This stops the disc in the drive from spinning until it is accessed again.
439
440 \return \ref cd_cmd_response
441*/
443
444/** \brief Initialize the GD-ROM for reading CDs.
445 \ingroup gdrom
446
447 This initializes the CD-ROM reading system, reactivating the drive and
448 handling initial setup of the disc.
449*/
450void cdrom_init(void);
451
452/** \brief Shutdown the CD reading system.
453 \ingroup gdrom
454 */
455void cdrom_shutdown(void);
456
457__END_DECLS
458
459#endif /* __DC_CDROM_H */
int mode
Definition 2ndmix.c:539
static struct @69 data[BARRIER_COUNT]
Various common macros used throughout the codebase.
static const uint8_t CMD_DMAREAD_STREAM
Definition cdrom.h:69
static const uint8_t CMD_MAX
Definition cdrom.h:82
static const uint8_t CMD_STOP
Definition cdrom.h:74
static const uint8_t FAILED
Definition cdrom.h:101
static const uint8_t CMD_PLAY
Definition cdrom.h:61
static const uint8_t CMD_GETTOC2
Definition cdrom.h:60
static const uint8_t BUSY
Definition cdrom.h:106
static const uint8_t CMD_PIOREAD_STREAM_EX
Definition cdrom.h:80
static const uint8_t CMD_GETSCD
Definition cdrom.h:75
static const uint8_t CMD_DMAREAD
Definition cdrom.h:58
static const uint8_t STREAMING
Definition cdrom.h:105
static const uint8_t CMD_NOP
Definition cdrom.h:70
static const uint8_t CMD_CHECK_LICENSE
Definition cdrom.h:55
static const uint8_t COMPLETED
Definition cdrom.h:104
static const uint8_t CMD_GETTOC
Definition cdrom.h:59
static const uint8_t CMD_REQ_SPI_CMD
Definition cdrom.h:56
static const uint8_t CMD_GETSES
Definition cdrom.h:76
static const uint8_t CMD_SET_MODE
Definition cdrom.h:72
static const uint8_t CMD_PAUSE
Definition cdrom.h:63
static const uint8_t CMD_SEEK
Definition cdrom.h:68
static const uint8_t CMD_RELEASE
Definition cdrom.h:64
static const uint8_t CMD_PLAY2
Definition cdrom.h:62
static const uint8_t CMD_SCAN_CD
Definition cdrom.h:73
static const uint8_t CMD_PIOREAD
Definition cdrom.h:57
static const bool CDROM_READ_DMA
Definition cdrom.h:122
static const uint8_t CMD_GET_VERS
Definition cdrom.h:81
static const uint8_t CMD_OPEN_TRAY
Definition cdrom.h:67
static const uint8_t CMD_DMA_ABORT
Definition cdrom.h:66
static const uint8_t CMD_DMAREAD_STREAM_EX
Definition cdrom.h:79
static const uint8_t CMD_REQ_MODE
Definition cdrom.h:71
static const uint8_t PROCESSING
Definition cdrom.h:103
static const uint8_t NO_ACTIVE
Definition cdrom.h:102
static const bool CDROM_READ_PIO
Definition cdrom.h:121
static const uint8_t CMD_PIOREAD_STREAM
Definition cdrom.h:78
static const uint8_t CMD_REQ_STAT
Definition cdrom.h:77
static const uint8_t CMD_INIT
Definition cdrom.h:65
void(* cdrom_stream_callback_t)(void *data)
CD-ROM streams callback.
Definition cdrom.h:161
cd_read_sec_part_t
Read Sector Part.
Definition syscalls.h:528
cd_sub_type_t
Types of data to read from sector subcode.
Definition syscalls.h:352
cd_cmd_code_t
Command codes for GDROM syscalls.
Definition syscalls.h:253
@ CD_CMD_COMPLETED
Command completed successfully.
Definition syscalls.h:442
@ CD_CMD_FAILED
Command failed.
Definition syscalls.h:439
@ CD_CMD_NOT_FOUND
Command requested not found.
Definition syscalls.h:440
@ CD_CMD_BUSY
GD syscalls is busy.
Definition syscalls.h:444
@ CD_CMD_PROCESSING
Processing command.
Definition syscalls.h:441
@ CD_CMD_STREAMING
Stream type command is in progress.
Definition syscalls.h:443
@ CD_CMD_INIT
Initialize the drive.
Definition syscalls.h:264
@ CD_CMD_GETSCD
Get subcode data.
Definition syscalls.h:274
@ CD_CMD_PAUSE
Pause playback.
Definition syscalls.h:262
@ CD_CMD_GETTOC
Read TOC.
Definition syscalls.h:258
@ CD_CMD_RELEASE
Resume from pause.
Definition syscalls.h:263
@ CD_CMD_DMAREAD_STREAM_EX
Stream DMA transfer.
Definition syscalls.h:278
@ CD_CMD_DMAREAD_STREAM
Stream DMA until end/abort.
Definition syscalls.h:268
@ CD_CMD_GETSES
Get session.
Definition syscalls.h:275
@ CD_CMD_NOP
No operation.
Definition syscalls.h:269
@ CD_CMD_SET_MODE
Setup mode.
Definition syscalls.h:271
@ CD_CMD_MAX
Max of GD syscall commands.
Definition syscalls.h:281
@ CD_CMD_PLAY_SECTORS
Play sectors.
Definition syscalls.h:261
@ CD_CMD_DMAREAD
Read via DMA.
Definition syscalls.h:257
@ CD_CMD_PIOREAD_STREAM
Stream PIO until end/abort.
Definition syscalls.h:277
@ CD_CMD_DMA_ABORT
Abort DMA transfer.
Definition syscalls.h:265
@ CD_CMD_REQ_STAT
Request stat.
Definition syscalls.h:276
@ CD_CMD_SEEK
Seek to a new position.
Definition syscalls.h:267
@ CD_CMD_GET_VERS
Get syscall driver version.
Definition syscalls.h:280
@ CD_CMD_STOP
Stop the disc from spinning.
Definition syscalls.h:273
@ CD_CMD_REQ_SPI_CMD
Request to Sega Packet Interface.
Definition syscalls.h:255
@ CD_CMD_PIOREAD
Read via PIO.
Definition syscalls.h:256
@ CD_CMD_GETTOC2
Read TOC.
Definition syscalls.h:259
@ CD_CMD_SCAN_CD
Scan CD.
Definition syscalls.h:272
@ CD_CMD_CHECK_LICENSE
Check license.
Definition syscalls.h:254
@ CD_CMD_OPEN_TRAY
Open CD tray (on DevBox?)
Definition syscalls.h:266
@ CD_CMD_PLAY_TRACKS
Play track.
Definition syscalls.h:260
@ CD_CMD_REQ_MODE
Request mode.
Definition syscalls.h:270
@ CD_CMD_PIOREAD_STREAM_EX
Stream PIO transfer.
Definition syscalls.h:279
int cdrom_exec_cmd_timed(cd_cmd_code_t cmd, void *param, uint32_t timeout)
Execute a CD-ROM command with timeout.
int cdrom_spin_down(void)
Spin down the CD.
int cdrom_stream_start(int sector, int cnt, bool dma)
Start streaming from a CD-ROM.
int cdrom_stream_request(void *buffer, size_t size, bool block)
Request stream transfer.
int cdrom_change_datatype(cd_read_sec_part_t sector_part, int track_type, int sector_size)
Change the datatype of disc.
uint32_t cdrom_locate_data_track(cd_toc_t *toc)
Locate the sector of the data track.
int cdrom_stream_progress(size_t *size)
Check requested stream transfer.
int cdrom_cdda_resume(void)
Resume CDDA audio playback after a pause.
int cdrom_abort_cmd(uint32_t timeout, bool abort_dma)
Abort a CD-ROM command with timeout.
int cdrom_cdda_pause(void)
Pause CDDA audio playback.
void cdrom_stream_set_callback(cdrom_stream_callback_t callback, void *param)
Setting up a callback for transfers.
int cdrom_reinit(void)
Re-initialize the GD-ROM drive.
void cdrom_init(void)
Initialize the GD-ROM for reading CDs.
int cdrom_get_subcode(void *buffer, size_t buflen, cd_sub_type_t which)
Read subcode data from the most recently read sectors.
int cdrom_set_sector_size(int size)
Set the sector size for read sectors.
void cdrom_shutdown(void)
Shutdown the CD reading system.
int cdrom_get_status(int *status, int *disc_type)
Get the status of the GD-ROM drive.
int cdrom_cdda_play(uint32_t start, uint32_t end, uint32_t loops, int mode)
Play CDDA audio tracks or sectors.
int cdrom_read_toc(cd_toc_t *toc_buffer, bool high_density)
Read the table of contents from the disc.
int cdrom_exec_cmd(cd_cmd_code_t cmd, void *param)
Execute a CD-ROM command.
int cdrom_read_sectors(void *buffer, uint32_t sector, size_t cnt)
Read one or more sector from a CD-ROM in PIO mode.
int cdrom_stream_stop(bool abort_dma)
Stop streaming from a CD-ROM.
int cdrom_read_sectors_ex(void *buffer, uint32_t sector, size_t cnt, bool dma)
Read one or more sector from a CD-ROM.
int cdrom_reinit_ex(cd_read_sec_part_t sector_part, int cdxa, int sector_size)
Re-initialize the GD-ROM drive with custom parameters.
uint8_t end[]
static uint8_t block[4096]
Definition mke2fs.c:45
static int buflen
Definition porthelper.c:12
static char buffer[256]
Definition porthelper.c:11
Macros to help dealing with register fields.
static void start(char *fn)
Definition songmenu.c:239
TOC structure returned by the BIOS.
Definition syscalls.h:316
Functions to access the system calls of the Dreamcast ROM.