KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
syscalls.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/syscalls.h
4 Copyright (C) 2024 Andy Barajas
5*/
6
7/** \file dc/syscalls.h
8 \brief Functions to access the system calls of the Dreamcast ROM.
9 \ingroup system_calls
10
11\todo
12 - syscall_sysinfo_icon(): Discover + document icon format.
13 - Look into additional syscall vector for GD-ROM - 0x0C0000C0
14
15 \author Marcus Comstedt
16 \author Andy Barajas
17*/
18
19/** \defgroup system_calls System Calls
20 \brief API for the Dreamcast's system calls
21 \ingroup system
22
23 This module encapsulates all the system calls available in the Dreamcast
24 BIOS, allowing direct interaction with system hardware
25 components such as the GDROM drive, flash ROM, and bios fonts. These
26 functions are essential for performing low-level operations that are not
27 handled by standard user-space APIs.
28
29 @{
30*/
31
32#ifndef __DC_SYSCALLS_H
33#define __DC_SYSCALLS_H
34
35#include <kos/cdefs.h>
36__BEGIN_DECLS
37
38#include <stdint.h>
39#include <sys/types.h>
40
41/** \brief Inits data needed by sysinfo id/icon
42 \note This is called automatically by KOS during initialization.
43 This function prepares syscall_sysinfo_icon and syscall_sysinfo_id
44 calls for use by copying the relevant data from the system flashrom
45 into 8C000068-8C00007F.
46*/
48
49/** \brief Reads an icon from the flashrom.
50
51 This function reads an icon from the flashrom into a destination
52 buffer.
53
54 \note
55 The format of these icons is not known.
56
57 \param icon The icon number (0-9, 5-9 seems to really
58 be icons).
59 \param dest The destination buffer (704 bytes in size).
60
61 \return Number of bytes read on success, or -1 on
62 failure.
63*/
64int syscall_sysinfo_icon(uint32_t icon, uint8_t *dest);
65
66/** \brief Reads the ID of the Dreamcast.
67
68 This function returns the unique 64-bit ID for the Dreamcast.
69
70 \return The Dreamcast ID.
71*/
72uint64_t syscall_sysinfo_id(void);
73
74/** \brief Gets the romfont address.
75
76 This function returns the address of the ROM font.
77
78 \warning
79 Before attempting to access the font data, you should always call
80 syscall_font_lock() to ensure that you have exclusive access to the
81 G1 BUS the ROM is located on. Call syscall_font_unlock() when you're
82 done accessing the data.
83
84 \note
85 Defined in syscall_font.s
86
87 \return The address of the font.
88*/
89uint8_t *syscall_font_address(void);
90
91/** \brief Locks access to ROM font.
92
93 This function tries to lock a mutex for exclusive access to the ROM
94 font. This is needed because you can't access the BIOS font during
95 G1 DMA.
96
97 \note
98 Defined in syscall_font.s
99
100 \retval 0 On success.
101 \retval -1 On failure.
102
103 \sa syscall_font_unlock()
104*/
106
107/** \brief Unlocks access to ROM font.
108 \ingroup system_calls
109
110 This function releases the mutex locked with syscall_font_lock().
111
112 \note
113 Defined in syscall_font.s
114
115 \sa syscall_font_lock()
116*/
118
119/** \brief Gets info on partition in the flashrom.
120
121 This function fetches the info of a partition in the flashrom.
122
123 \param part The partition number (0-4).
124 \param info The buffer to store info (8 bytes in size).
125
126 \retval 0 On success.
127 \retval -1 On failure.
128*/
129int syscall_flashrom_info(uint32_t part, void *info);
130
131/** \brief Read data from the flashrom.
132
133 This function reads data from an offset into the flashrom to the
134 destination buffer.
135
136 \param pos The read start position into the flashrom.
137 \param dest The destination buffer.
138 \param n The number of bytes to read.
139
140 \return Number of bytes read on success, or -1 on
141 failure.
142
143 \sa syscall_flashrom_write(), syscall_flashrom_delete()
144*/
145int syscall_flashrom_read(uint32_t pos, void *dest, size_t n);
146
147/** \brief Write data to the flashrom.
148
149 This function writes data to an offset into the flashrom from the
150 source buffer.
151
152 \warning
153 It is only possible to overwrite 1's with 0's. 0's can not be written
154 back to 1's so general overwriting is therefore not possible. You
155 would need to delete a whole partition to overwrite it.
156
157 \param pos The start position to write into the flashrom.
158 \param src The source buffer.
159 \param n The number of bytes to write.
160
161 \return Number of bytes written on success, or -1 on
162 failure.
163
164 \sa syscall_flashrom_read(), syscall_flashrom_delete()
165*/
166int syscall_flashrom_write(uint32_t pos, const void *src, size_t n);
167
168/** \brief Delete a partition of the flashrom.
169
170 This function returns a flashrom partition to all 1's, so that it may
171 be rewritten.
172
173 \warning
174 ALL data in the entire partition will be lost.
175
176 \param pos The offset from the start of the flashrom you
177 want to delete.
178
179 \retval 0 On success.
180 \retval -1 On failure.
181
182 \sa syscall_flashrom_read(), syscall_flashrom_write()
183*/
185
186/** \defgroup gdrom_syscalls GDROM System Calls
187 \brief GDROM Syscalls and Data Types
188 \ingroup system_calls
189 \ingroup gdrom
190
191 These are the syscalls that allow operation of the GDROM drive
192 as well as data types for their returns and parameters.
193*/
194
195/** \brief Status of GDROM drive
196 \ingroup gdrom_syscalls
197
198 These are the values that can be returned as the first param of
199 syscall_gdrom_check_drive.
200*/
201typedef enum cd_stat {
202 CD_STATUS_READ_FAIL = -1, /**< \brief Can't read status */
203 CD_STATUS_BUSY = 0, /**< \brief Drive is busy */
204 CD_STATUS_PAUSED = 1, /**< \brief Disc is paused */
205 CD_STATUS_STANDBY = 2, /**< \brief Drive is in standby */
206 CD_STATUS_PLAYING = 3, /**< \brief Drive is currently playing */
207 CD_STATUS_SEEKING = 4, /**< \brief Drive is currently seeking */
208 CD_STATUS_SCANNING = 5, /**< \brief Drive is scanning */
209 CD_STATUS_OPEN = 6, /**< \brief Disc tray is open */
210 CD_STATUS_NO_DISC = 7, /**< \brief No disc inserted */
211 CD_STATUS_RETRY = 8, /**< \brief Retry is needed */
212 CD_STATUS_ERROR = 9, /**< \brief System error */
213 CD_STATUS_FATAL = 12, /**< \brief Need reset syscalls */
214} cd_stat_t;
215
216/** \brief Disc types the GDROM can identify
217 \ingroup gdrom_syscalls
218
219 These are the values that can be returned as the second param of
220 syscall_gdrom_check_drive.
221*/
222typedef enum cd_disc_types {
223 CD_CDDA = 0x00, /**< \brief Audio CD (Red book) or no disc */
224 CD_CDROM = 0x10, /**< \brief CD-ROM or CD-R (Yellow book) */
225 CD_CDROM_XA = 0x20, /**< \brief CD-ROM XA (Yellow book extension) */
226 CD_CDI = 0x30, /**< \brief CD-i (Green book) */
227 CD_GDROM = 0x80, /**< \brief GD-ROM */
228 CD_FAIL = 0xf0 /**< \brief Need reset syscalls */
230
231/** \brief Status filled by Check Drive syscall
232 \ingroup gdrom_syscalls
233*/
234typedef struct cd_check_drive_status {
238
239/** \brief Handle for a requested command
240 \ingroup gdrom_syscalls
241
242 This is returned by syscall_gdrom_send_command and then is passed
243 to other syscalls to specify which command to act on.
244*/
245typedef int32_t gdc_cmd_hnd_t;
246
247/** \brief Command codes for GDROM syscalls
248 \ingroup gdrom_syscalls
249
250 These are the syscall command codes used to actually do stuff with the
251 GDROM drive. These were originally provided by maiwe.
252*/
253typedef enum cd_cmd_code {
254 CD_CMD_CHECK_LICENSE = 2, /**< \brief Check license */
255 CD_CMD_REQ_SPI_CMD = 4, /**< \brief Request to Sega Packet Interface */
256 CD_CMD_PIOREAD = 16, /**< \brief Read via PIO */
257 CD_CMD_DMAREAD = 17, /**< \brief Read via DMA */
258 CD_CMD_GETTOC = 18, /**< \brief Read TOC */
259 CD_CMD_GETTOC2 = 19, /**< \brief Read TOC */
260 CD_CMD_PLAY_TRACKS = 20, /**< \brief Play track */
261 CD_CMD_PLAY_SECTORS = 21, /**< \brief Play sectors */
262 CD_CMD_PAUSE = 22, /**< \brief Pause playback */
263 CD_CMD_RELEASE = 23, /**< \brief Resume from pause */
264 CD_CMD_INIT = 24, /**< \brief Initialize the drive */
265 CD_CMD_DMA_ABORT = 25, /**< \brief Abort DMA transfer */
266 CD_CMD_OPEN_TRAY = 26, /**< \brief Open CD tray (on DevBox?) */
267 CD_CMD_SEEK = 27, /**< \brief Seek to a new position */
268 CD_CMD_DMAREAD_STREAM = 28, /**< \brief Stream DMA until end/abort */
269 CD_CMD_NOP = 29, /**< \brief No operation */
270 CD_CMD_REQ_MODE = 30, /**< \brief Request mode */
271 CD_CMD_SET_MODE = 31, /**< \brief Setup mode */
272 CD_CMD_SCAN_CD = 32, /**< \brief Scan CD */
273 CD_CMD_STOP = 33, /**< \brief Stop the disc from spinning */
274 CD_CMD_GETSCD = 34, /**< \brief Get subcode data */
275 CD_CMD_GETSES = 35, /**< \brief Get session */
276 CD_CMD_REQ_STAT = 36, /**< \brief Request stat */
277 CD_CMD_PIOREAD_STREAM = 37, /**< \brief Stream PIO until end/abort */
278 CD_CMD_DMAREAD_STREAM_EX = 38, /**< \brief Stream DMA transfer */
279 CD_CMD_PIOREAD_STREAM_EX = 39, /**< \brief Stream PIO transfer */
280 CD_CMD_GET_VERS = 40, /**< \brief Get syscall driver version */
281 CD_CMD_MAX = 47, /**< \brief Max of GD syscall commands */
283
284/** \brief Params for READ commands.
285 \ingroup gdrom_syscalls
286
287 These are the parameters for the CMD_PIOREAD and CMD_DMAREAD commands.
288
289*/
290typedef struct cd_read_params {
291 uint32_t start_sec; /* Starting sector */
292 size_t num_sec; /* Number of sectors */
293 void *buffer; /* Output buffer */
294 uint32_t is_test; /* Enable test mode */
296
297/** \brief Disc area to read TOC from.
298 \ingroup gdrom_syscalls
299
300 This is the allowed values for the first param of the GETTOC commands,
301 defining which disc area to read the TOC from.
302
303*/
304typedef enum cd_area {
306 CD_AREA_HIGH = 1
308
309/** \brief TOC structure returned by the BIOS.
310 \ingroup gdrom_syscalls
311
312 This is the structure that the CD_CMD_GETTOC2 syscall command will return for
313 the TOC. Note the data is in FAD, not LBA/LSN.
314
315*/
316typedef struct cd_toc {
317 uint32_t entry[99]; /**< \brief TOC space for 99 tracks */
318 uint32_t first; /**< \brief Point A0 information (1st track) */
319 uint32_t last; /**< \brief Point A1 information (last track) */
320 uint32_t leadout_sector; /**< \brief Point A2 information (leadout) */
321} cd_toc_t;
322
323/** \brief Params for GETTOC commands
324 \ingroup gdrom_syscalls
325
326 Params for CD_CMD_GETTOC and CD_CMD_GETTOC2.
327
328*/
329typedef struct cd_cmd_toc_params {
333
334/** \brief Params for PLAY command
335 \ingroup gdrom_syscalls
336
337 Params for CD_CMD_PLAY_TRACKS and CD_CMD_PLAY_SECTORS.
338
339*/
340typedef struct cd_cmd_play_params {
341 uint32_t start; /**< \brief Track to play from */
342 uint32_t end; /**< \brief Track to play to */
343 uint32_t repeat; /**< \brief Times to repeat (0-15, 15=infinite) */
345
346/** \brief Types of data to read from sector subcode
347 \ingroup gdrom_syscalls
348
349 Types of data available to read from the sector subcode. These are
350 possible values for the first parameter sent to the GETSCD syscall.
351*/
352typedef enum cd_sub_type {
353 CD_SUB_Q_ALL = 0, /**< \brief Read all Subcode Data */
354 CD_SUB_Q_CHANNEL = 1, /**< \brief Read Q Channel Subcode Data */
355 CD_SUB_MEDIA_CATALOG = 2, /**< \brief Read the Media Catalog Subcode Data */
356 CD_SUB_TRACK_ISRC = 3, /**< \brief Read the ISRC Subcode Data */
357 CD_SUB_RESERVED = 4 /**< \brief Reserved */
359
360/** \brief Params for GETSCD command
361 \ingroup gdrom_syscalls
362*/
363typedef struct cd_cmd_getscd_params {
364 cd_sub_type_t which; /**< \brief The type of subcode read to perform */
365 size_t buflen; /**< \brief The size of the buffer we provide */
366 void *buffer; /**< \brief The buffer to put the subcode data in */
368
369/** \brief Subcode Audio Statuses
370 \ingroup gdrom_syscalls
371
372 Information about CDDA playback returned by the GETSCD syscall command.
373 This is returned in the second byte of the buffer.
374*/
383
384/** \brief Initialize the GDROM drive.
385 \ingroup gdrom_syscalls
386
387 This function initializes the GDROM drive. Should be called before any
388 commands are sent.
389*/
391
392/** \brief Reset the GDROM drive.
393 \ingroup gdrom_syscalls
394
395 This function resets the GDROM drive.
396*/
398
399/** \brief Checks the GDROM drive status.
400 \ingroup gdrom_syscalls
401
402 This function retrieves the general condition of the GDROM drive. It
403 populates a provided array with two elements. The first element
404 indicates the current drive status (cd_stat_t), and the second
405 element identifies the type of disc inserted if any (cd_disc_types_t).
406
407 \param status A cd_check_drive_status_t filled with drive
408 status information.
409
410 \return 0 on success, or non-zero on
411 failure.
412*/
414
415/** \brief Send a command to the GDROM command queue.
416 \ingroup gdrom_syscalls
417
418 This function sends a command to the GDROM queue.
419
420 \note
421 Call syscall_gdrom_exec_server() to run queued commands.
422
423 \param cmd The command code (see cd_cmd_code_t above).
424 \param params The pointer to parameter block for the command,
425 can be NULL if the command does not take
426 parameters.
427
428 \return The request id (>=1) on success, or 0 on failure.
429
430 \sa syscall_gdrom_check_command(), syscall_gdrom_exec_server()
431*/
433/** \brief Responses from GDROM check command syscall
434 \ingroup gdrom_syscalls
435
436 These are return values of syscall_gdrom_check_command.
437*/
438typedef enum cd_cmd_chk {
439 CD_CMD_FAILED = -1, /**< \brief Command failed */
440 CD_CMD_NOT_FOUND = 0, /**< \brief Command requested not found */
441 CD_CMD_PROCESSING = 1, /**< \brief Processing command */
442 CD_CMD_COMPLETED = 2, /**< \brief Command completed successfully */
443 CD_CMD_STREAMING = 3, /**< \brief Stream type command is in progress */
444 CD_CMD_BUSY = 4, /**< \brief GD syscalls is busy */
446
447/** \brief ATA Statuses
448 \ingroup gdrom_syscalls
449
450 These are the different statuses that can be returned in
451 the 4th field of cd_cmd_chk_status by syscall_gdrom_check_command.
452
453*/
454typedef enum cd_cmd_chk_ata_status {
459 ATA_STAT_BUSY = 0x04
461
462/** \brief GDROM Command Extra Status
463 \ingroup gdrom_syscalls
464
465 This represents the data filled in by syscall_gdrom_check_command.
466 It provides more detailled data on the possible reasons a command
467 may have failed or have not yet been processed to supplement the
468 return value of the syscall.
469*/
470typedef struct cd_cmd_chk_status {
471 int32_t err1; /**< \brief Error code 1 */
472 int32_t err2; /**< \brief Error code 2 */
473 size_t size; /**< \brief Transferred size */
474 cd_cmd_chk_ata_status_t ata; /**< \brief ATA status */
476
477/** \brief Check status of queued command for the GDROM.
478 \ingroup gdrom_syscalls
479
480 This function checks if a queued command has completed.
481
482 \param hnd The request to check.
483 \param status cd_cmd_chk_status_t that will receive the status.
484
485 \retval CD_CMD_FAILED Request has failed.
486 \retval CD_CMD_NOT_FOUND Request not found.
487 \retval CD_CMD_PROCESSING Request is still being processed.
488 \retval CD_CMD_COMPLETED Request completed successfully.
489 \retval CD_CMD_STREAMING Stream type command is in progress.
490 \retval CD_CMD_BUSY GD syscalls are busy.
491
492 \sa syscall_gdrom_send_command(), syscall_gdrom_exec_server()
493*/
495
496/** \brief Process queued GDROM commands.
497 \ingroup gdrom_syscalls
498
499 This function starts processing queued commands. This must be
500 called a few times to process all commands. An example of it in
501 use can be seen in \sa cdrom_exec_cmd_timed() (see hardware/cdrom.c).
502
503 \sa syscall_gdrom_send_command(), syscall_gdrom_check_command()
504*/
506
507/** \brief Abort a queued GDROM command.
508 \ingroup gdrom_syscalls
509
510 This function tries to abort a previously queued command.
511
512 \param hnd The request to abort.
513
514 \return 0 on success, or non-zero on
515 failure.
516*/
518
519/** \brief Read Sector Part
520 \ingroup gdrom_syscalls
521
522 Parts of the a disc sector to read. These are possible values for the
523 second parameter word sent with syscall_gdrom_sector_mode.
524
525 \note CD_READ_DEFAULT not supported by the syscall and is provided
526 for compatibility in cdrom_reinit_ex
527*/
528typedef enum cd_read_sec_part {
529 CDROM_READ_WHOLE_SECTOR = 0x1000, /**< \brief Read the whole sector */
530 CDROM_READ_DATA_AREA = 0x2000, /**< \brief Read the data area */
531 CDROM_READ_DEFAULT = -1 /**< \brief cdrom_reinit default */
533
534/** \brief Sector mode params
535 \ingroup gdrom_syscalls
536
537 These are the parameters sent to syscall_gdrom_sector_mode.
538
539*/
540typedef struct cd_sec_mode_params {
541 uint32_t rw; /* 0 = set, 1 = get */
542 cd_read_sec_part_t sector_part; /* Get Data or Full Sector */
543 int track_type; /* CD-XA mode 1/2 */
544 int sector_size; /* sector size */
546
547/** \brief Sets/gets the sector mode for read commands.
548 \ingroup gdrom_syscalls
549
550 This function sets/gets the sector mode for read commands.
551
552 \param mode The pointer to a struct of four 32 bit integers
553 containing new values, or to receive the old
554 values.
555
556 \retval 0 On success.
557 \retval -1 On failure.
558*/
560
561/** \brief Setup GDROM DMA callback.
562 \ingroup gdrom_syscalls
563
564 This function sets up DMA transfer end callback for
565 \ref CMD_DMAREAD_STREAM_EX (\ref dc/cdrom.h).
566
567 \param callback The function to call upon completion of the DM.
568 \param param The data to pass to the callback function.
569*/
570void syscall_gdrom_dma_callback(uintptr_t callback, void *param);
571
572/** \brief Parameters for transfer
573 \ingroup gdrom_syscalls
574
575 These are parameters passed to the syscall_gdrom_*_transfer syscalls.
576*/
577typedef struct cd_transfer_params {
578 void *addr; /**< \brief Destination address of transfer */
579 size_t size; /**< \brief How many bytes to transfer */
581
582/** \brief Initiates a GDROM DMA transfer.
583 \ingroup gdrom_syscalls
584
585 This function initiates a DMA transfer for
586 \ref CMD_DMAREAD_STREAM_EX (\ref dc/cdrom.h).
587
588 \param hnd The stream request to start transferring.
589 \param params The pointer to a cd_transfer_params_t.
590
591 \return 0 on success, or non-zero on
592 failure.
593*/
595
596/** \brief Checks a GDROM DMA transfer.
597 \ingroup gdrom_syscalls
598
599 This function checks the progress of a DMA transfer for
600 \ref CMD_DMAREAD_STREAM_EX (see \ref dc/cdrom.h).
601
602 \param hnd The stream request to check.
603 \param size The pointer to receive the remaining amount of
604 bytes to transfer.
605
606 \retval 0 On success.
607 \retval -1 On failure.
608*/
610
611/** \brief Setup GDROM PIO callback.
612 \ingroup gdrom_syscalls
613
614 This function sets up PIO transfer end callback for
615 \ref CMD_PIOREAD_STREAM_EX (see \ref dc/cdrom.h).
616
617 \param callback The function to call upon completion of the
618 transfer.
619 \param param The data to pass to the callback function.
620*/
621void syscall_gdrom_pio_callback(uintptr_t callback, void *param);
622
623/** \brief Initiates a GDROM PIO transfer.
624 \ingroup gdrom_syscalls
625
626 This function initiates a PIO transfer for
627 \ref CMD_PIOREAD_STREAM_EX (see \ref dc/cdrom.h).
628
629 \param hnd The stream request to start transferring.
630 \param params The pointer to a cd_transfer_params_t.
631
632 \return 0 on success, or non-zero on
633 failure.
634*/
636
637/** \brief Checks a GDROM PIO transfer.
638 \ingroup gdrom_syscalls
639
640 This function checks the progress of a PIO transfer for
641 \ref CMD_PIOREAD_STREAM_EX (see \ref dc/cdrom.h).
642
643 \param hnd The stream request to check.
644 \param size The pointer to receive the remaining amount of
645 bytes to transfer.
646
647 \retval 0 On success.
648 \retval -1 On failure.
649*/
651
652/** \brief Initializes all the syscall vectors.
653
654 This function initializes all the syscall vectors to their default values.
655
656 \return 0
657*/
659
660/** \brief Set/Clear a user defined super function.
661
662 This function sets/clears the handler for one of the seven user defined
663 super functions. Setting a handler is only allowed if it not currently set.
664
665 \param super The super function number (1-7).
666 \param handler The pointer to handler function, or NULL to
667 clear.
668
669 \retval 0 On success.
670 \retval -1 On failure.
671*/
672int syscall_misc_setvector(uint32_t super, uintptr_t handler);
673
674/** \brief Resets the Dreamcast.
675
676 This function soft resets the Dreamcast console.
677*/
679
680/** \brief Go to the BIOS menu.
681
682 This function exits the program to the BIOS menu.
683*/
685
686/** \brief Exit to CD menu.
687
688 This function exits the program to the BIOS CD menu.
689*/
691
692/** @} */
693
694__END_DECLS
695
696#endif
697
int mode
Definition 2ndmix.c:539
pvr_init_params_t params
Definition 2ndmix.c:821
void hnd(const char *file, int line, const char *expr, const char *msg, const char *func)
Definition asserthnd.c:53
Various common macros used throughout the codebase.
object * dest
Definition nehe26.c:54
cd_area_t
Disc area to read TOC from.
Definition syscalls.h:304
cd_cmd_chk_t syscall_gdrom_check_command(gdc_cmd_hnd_t hnd, cd_cmd_chk_status_t *status)
Check status of queued command for the GDROM.
int32_t gdc_cmd_hnd_t
Handle for a requested command.
Definition syscalls.h:245
int syscall_gdrom_check_drive(cd_check_drive_status_t *status)
Checks the GDROM drive status.
cd_sub_audio_t
Subcode Audio Statuses.
Definition syscalls.h:375
gdc_cmd_hnd_t syscall_gdrom_send_command(cd_cmd_code_t cmd, void *params)
Send a command to the GDROM command queue.
int syscall_gdrom_dma_check(gdc_cmd_hnd_t hnd, size_t *size)
Checks a GDROM DMA transfer.
void syscall_gdrom_dma_callback(uintptr_t callback, void *param)
Setup GDROM DMA callback.
void syscall_gdrom_pio_callback(uintptr_t callback, void *param)
Setup GDROM PIO callback.
int syscall_gdrom_sector_mode(cd_sec_mode_params_t *mode)
Sets/gets the sector mode for read commands.
cd_read_sec_part_t
Read Sector Part.
Definition syscalls.h:528
int syscall_gdrom_pio_check(gdc_cmd_hnd_t hnd, size_t *size)
Checks a GDROM PIO transfer.
void syscall_gdrom_exec_server(void)
Process queued GDROM commands.
cd_sub_type_t
Types of data to read from sector subcode.
Definition syscalls.h:352
void syscall_gdrom_reset(void)
Reset the GDROM drive.
int syscall_gdrom_pio_transfer(gdc_cmd_hnd_t hnd, const cd_transfer_params_t *params)
Initiates a GDROM PIO transfer.
cd_disc_types_t
Disc types the GDROM can identify.
Definition syscalls.h:222
cd_cmd_chk_ata_status_t
ATA Statuses.
Definition syscalls.h:454
cd_stat_t
Status of GDROM drive.
Definition syscalls.h:201
void syscall_gdrom_init(void)
Initialize the GDROM drive.
int syscall_gdrom_abort_command(gdc_cmd_hnd_t hnd)
Abort a queued GDROM command.
int syscall_gdrom_dma_transfer(gdc_cmd_hnd_t hnd, const cd_transfer_params_t *params)
Initiates a GDROM DMA transfer.
cd_cmd_chk_t
Responses from GDROM check command syscall.
Definition syscalls.h:438
cd_cmd_code_t
Command codes for GDROM syscalls.
Definition syscalls.h:253
@ CD_AREA_HIGH
Definition syscalls.h:306
@ CD_AREA_LOW
Definition syscalls.h:305
@ CD_SUB_AUDIO_STATUS_ENDED
Definition syscalls.h:379
@ CD_SUB_AUDIO_STATUS_ERROR
Definition syscalls.h:380
@ CD_SUB_AUDIO_STATUS_PLAYING
Definition syscalls.h:377
@ CD_SUB_AUDIO_STATUS_NO_INFO
Definition syscalls.h:381
@ CD_SUB_AUDIO_STATUS_PAUSED
Definition syscalls.h:378
@ CD_SUB_AUDIO_STATUS_INVALID
Definition syscalls.h:376
@ CDROM_READ_DATA_AREA
Read the data area.
Definition syscalls.h:530
@ CDROM_READ_WHOLE_SECTOR
Read the whole sector.
Definition syscalls.h:529
@ CDROM_READ_DEFAULT
cdrom_reinit default
Definition syscalls.h:531
@ CD_SUB_Q_ALL
Read all Subcode Data.
Definition syscalls.h:353
@ CD_SUB_MEDIA_CATALOG
Read the Media Catalog Subcode Data.
Definition syscalls.h:355
@ CD_SUB_TRACK_ISRC
Read the ISRC Subcode Data.
Definition syscalls.h:356
@ CD_SUB_RESERVED
Reserved.
Definition syscalls.h:357
@ CD_SUB_Q_CHANNEL
Read Q Channel Subcode Data.
Definition syscalls.h:354
@ CD_CDDA
Audio CD (Red book) or no disc.
Definition syscalls.h:223
@ CD_GDROM
GD-ROM.
Definition syscalls.h:227
@ CD_CDROM_XA
CD-ROM XA (Yellow book extension)
Definition syscalls.h:225
@ CD_FAIL
Need reset syscalls.
Definition syscalls.h:228
@ CD_CDI
CD-i (Green book)
Definition syscalls.h:226
@ CD_CDROM
CD-ROM or CD-R (Yellow book)
Definition syscalls.h:224
@ ATA_STAT_IRQ
Definition syscalls.h:456
@ ATA_STAT_BUSY
Definition syscalls.h:459
@ ATA_STAT_DRQ_1
Definition syscalls.h:458
@ ATA_STAT_DRQ_0
Definition syscalls.h:457
@ ATA_STAT_INTERNAL
Definition syscalls.h:455
@ CD_STATUS_STANDBY
Drive is in standby.
Definition syscalls.h:205
@ CD_STATUS_SCANNING
Drive is scanning.
Definition syscalls.h:208
@ CD_STATUS_RETRY
Retry is needed.
Definition syscalls.h:211
@ CD_STATUS_OPEN
Disc tray is open.
Definition syscalls.h:209
@ CD_STATUS_PAUSED
Disc is paused.
Definition syscalls.h:204
@ CD_STATUS_SEEKING
Drive is currently seeking.
Definition syscalls.h:207
@ CD_STATUS_BUSY
Drive is busy.
Definition syscalls.h:203
@ CD_STATUS_ERROR
System error.
Definition syscalls.h:212
@ CD_STATUS_PLAYING
Drive is currently playing.
Definition syscalls.h:206
@ CD_STATUS_FATAL
Need reset syscalls.
Definition syscalls.h:213
@ CD_STATUS_NO_DISC
No disc inserted.
Definition syscalls.h:210
@ CD_STATUS_READ_FAIL
Can't read status.
Definition syscalls.h:202
@ 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
#define __noreturn
Identify a function that will never return.
Definition cdefs.h:49
int syscall_misc_setvector(uint32_t super, uintptr_t handler)
Set/Clear a user defined super function.
void syscall_system_bios_menu(void) __noreturn
Go to the BIOS menu.
uint8_t * syscall_font_address(void)
Gets the romfont address.
uint64_t syscall_sysinfo_id(void)
Reads the ID of the Dreamcast.
void syscall_sysinfo_init(void)
Inits data needed by sysinfo id/icon.
int syscall_flashrom_write(uint32_t pos, const void *src, size_t n)
Write data to the flashrom.
void syscall_system_cd_menu(void) __noreturn
Exit to CD menu.
int syscall_misc_init(void)
Initializes all the syscall vectors.
void syscall_system_reset(void) __noreturn
Resets the Dreamcast.
int syscall_flashrom_info(uint32_t part, void *info)
Gets info on partition in the flashrom.
void syscall_font_unlock(void)
Unlocks access to ROM font.
int syscall_sysinfo_icon(uint32_t icon, uint8_t *dest)
Reads an icon from the flashrom.
int syscall_flashrom_delete(uint32_t pos)
Delete a partition of the flashrom.
int syscall_flashrom_read(uint32_t pos, void *dest, size_t n)
Read data from the flashrom.
int syscall_font_lock(void)
Locks access to ROM font.
static float pos
Definition sdl_sound.c:32
Status filled by Check Drive syscall.
Definition syscalls.h:234
cd_stat_t status
Definition syscalls.h:235
cd_disc_types_t disc_type
Definition syscalls.h:236
GDROM Command Extra Status.
Definition syscalls.h:470
size_t size
Transferred size.
Definition syscalls.h:473
cd_cmd_chk_ata_status_t ata
ATA status.
Definition syscalls.h:474
int32_t err1
Error code 1.
Definition syscalls.h:471
int32_t err2
Error code 2.
Definition syscalls.h:472
Params for GETSCD command.
Definition syscalls.h:363
size_t buflen
The size of the buffer we provide.
Definition syscalls.h:365
void * buffer
The buffer to put the subcode data in.
Definition syscalls.h:366
cd_sub_type_t which
The type of subcode read to perform.
Definition syscalls.h:364
Params for PLAY command.
Definition syscalls.h:340
uint32_t end
Track to play to.
Definition syscalls.h:342
uint32_t start
Track to play from.
Definition syscalls.h:341
uint32_t repeat
Times to repeat (0-15, 15=infinite)
Definition syscalls.h:343
Params for GETTOC commands.
Definition syscalls.h:329
cd_toc_t * buffer
Definition syscalls.h:331
cd_area_t area
Definition syscalls.h:330
Params for READ commands.
Definition syscalls.h:290
uint32_t is_test
Definition syscalls.h:294
size_t num_sec
Definition syscalls.h:292
void * buffer
Definition syscalls.h:293
uint32_t start_sec
Definition syscalls.h:291
Sector mode params.
Definition syscalls.h:540
int track_type
Definition syscalls.h:543
int sector_size
Definition syscalls.h:544
cd_read_sec_part_t sector_part
Definition syscalls.h:542
uint32_t rw
Definition syscalls.h:541
TOC structure returned by the BIOS.
Definition syscalls.h:316
uint32_t first
Point A0 information (1st track)
Definition syscalls.h:318
uint32_t leadout_sector
Point A2 information (leadout)
Definition syscalls.h:320
uint32_t last
Point A1 information (last track)
Definition syscalls.h:319
Parameters for transfer.
Definition syscalls.h:577
void * addr
Destination address of transfer.
Definition syscalls.h:578
size_t size
How many bytes to transfer.
Definition syscalls.h:579