filename | src/gdrom/gdrom.h |
changeset | 1097:d4807997e450 |
prev | 1023:264e2fd90be8 |
next | 1101:78e762cec843 |
author | nkeynes |
date | Mon Feb 15 17:27:14 2010 +1000 (14 years ago) |
permissions | -rw-r--r-- |
last change | Hook up the fake bios boot Use fakebios if invoked with -b, or if there's no boot rom loaded |
view | annotate | diff | log | raw |
1 /**
2 * $Id$
3 *
4 * This file defines the public structures and functions exported by the
5 * GD-Rom subsystem
6 *
7 * Copyright (c) 2005 Nathan Keynes.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
20 #ifndef lxdream_gdrom_H
21 #define lxdream_gdrom_H 1
23 #include "lxdream.h"
24 #include "hook.h"
25 #include "drivers/cdrom/defs.h"
26 #include <glib/glist.h>
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 #define GDROM_TOC_SIZE (102*4) /* Size of GDROM TOC structure */
33 #define GDROM_SESSION_INFO_SIZE 6 /* Size of GDROM session info structure */
34 #define GDROM_SHORT_STATUS_SIZE 14 /* Size of GDROM short status structure */
36 typedef gboolean (*gdrom_disc_change_hook_t)( cdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );
37 DECLARE_HOOK(gdrom_disc_change_hook, gdrom_disc_change_hook_t);
39 typedef gboolean (*gdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );
40 DECLARE_HOOK(gdrom_drive_list_change_hook, gdrom_drive_list_change_hook_t);
42 /**
43 * Open an image file
44 */
45 cdrom_disc_t gdrom_image_open( const gchar *filename );
47 /**
48 * Shortcut to open and mount an image file
49 * @return true on success
50 */
51 gboolean gdrom_mount_image( const gchar *filename );
53 void gdrom_mount_disc( cdrom_disc_t disc );
55 void gdrom_unmount_disc( void );
57 gboolean gdrom_is_mounted( void );
59 cdrom_disc_t gdrom_get_current_disc();
61 const gchar *gdrom_get_current_disc_name();
63 const gchar *gdrom_get_current_disc_title();
65 /**
66 * Find the track which should be checked for the
67 * dreamcast bootstrap - this is the first data track on the last
68 * session (where there are at least 2 sessions). If a boot track
69 * cannot be found, returns NULL.
70 */
71 cdrom_track_t gdrom_disc_get_boot_track( cdrom_disc_t disc );
73 /**
74 * Check if the disc contains valid media.
75 * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC
76 */
77 cdrom_error_t gdrom_check_media( );
79 /**
80 * Retrieve the disc table of contents, and write it into the buffer in the
81 * format expected by the DC.
82 * @param buf Buffer to receive the TOC data, which must be at least
83 * GDROM_TOC_SIZE bytes long.
84 * @return 0 on success, error code on failure (eg no disc)
85 */
86 cdrom_error_t gdrom_read_toc( unsigned char *buf );
88 /**
89 * Retrieve the short (6-byte) session info, and write it into the buffer.
90 * @param session The session to read (numbered from 1), or 0
91 * @param buf Buffer to receive the session data, which must be at least
92 * GDROM_SESSION_INFO_SIZE bytes long.
93 * @return 0 on success, error code on failure.
94 */
95 cdrom_error_t gdrom_read_session( int session, unsigned char *buf );
97 /**
98 * Generate the position data as returned from a STATUS(1) packet.
99 * @param disc The disc to read
100 * @param lba The current head position
101 * @param buf The buffer to receive the position data, which must be at least
102 * GDROM_SHORT_STATUS_SIZE bytes long.
103 * @return 0 on success, error code on failure.
104 */
105 cdrom_error_t gdrom_read_short_status( uint32_t lba, unsigned char *buf );
107 /**
108 * Read sectors from the current disc.
109 * @param lba Address of first sector to read
110 * @param count Number of sectors to read
111 * @param read_mode GDROM format read-mode
112 * @param buf Buffer to receive read sectors
113 * @param length If not null, will be written with the number of bytes read.
114 * @return 0 on success, otherwise error code.
115 */
116 cdrom_error_t gdrom_read_cd( cdrom_lba_t lba, cdrom_count_t count,
117 unsigned read_mode, unsigned char *buf, size_t *length );
119 cdrom_error_t gdrom_play_audio( cdrom_lba_t lba, cdrom_count_t count );
121 /**
122 * Return the 1-byte status code for the disc (combination of IDE_DISC_* flags)
123 */
124 int gdrom_get_drive_status( );
126 /**
127 * Run GDROM time slice (if any)
128 */
129 void gdrom_run_slice( uint32_t nanosecs );
131 #ifdef __cplusplus
132 }
133 #endif
135 #endif /* !lxdream_gdrom_H */
.