Search
lxdream.org :: lxdream/src/gdrom/gdrom.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdrom.h
changeset 1097:d4807997e450
prev1023:264e2fd90be8
next1101:78e762cec843
author nkeynes
date Sun Jan 31 18:35:06 2010 +1000 (12 years ago)
permissions -rw-r--r--
last change Refactor CDROM host support
- Completely separate GDROM hardware (in gdrom/gdrom.c) from generic CDROM
support (now in drivers/cdrom)
- Add concept of 'sector sources' that can be mixed and matched to create
cdrom discs (makes support of arbitrary disc types much simpler)
file annotate diff log raw
1.1 --- a/src/gdrom/gdrom.h Mon Jun 08 04:12:21 2009 +0000
1.2 +++ b/src/gdrom/gdrom.h Sun Jan 31 18:35:06 2010 +1000
1.3 @@ -22,6 +22,7 @@
1.4
1.5 #include "lxdream.h"
1.6 #include "hook.h"
1.7 +#include "drivers/cdrom/defs.h"
1.8 #include <glib/glist.h>
1.9
1.10 #ifdef __cplusplus
1.11 @@ -32,19 +33,7 @@
1.12 #define GDROM_SESSION_INFO_SIZE 6 /* Size of GDROM session info structure */
1.13 #define GDROM_SHORT_STATUS_SIZE 14 /* Size of GDROM short status structure */
1.14
1.15 -typedef uint16_t gdrom_error_t;
1.16 -
1.17 -
1.18 -struct gdrom_device {
1.19 - char *name; // internal name
1.20 - char *device_name; // Human-readable device name
1.21 -};
1.22 -
1.23 -typedef struct gdrom_device *gdrom_device_t;
1.24 -
1.25 -typedef struct gdrom_disc *gdrom_disc_t;
1.26 -
1.27 -typedef gboolean (*gdrom_disc_change_hook_t)( gdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );
1.28 +typedef gboolean (*gdrom_disc_change_hook_t)( cdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );
1.29 DECLARE_HOOK(gdrom_disc_change_hook, gdrom_disc_change_hook_t);
1.30
1.31 typedef gboolean (*gdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );
1.32 @@ -53,13 +42,7 @@
1.33 /**
1.34 * Open an image file
1.35 */
1.36 -gdrom_disc_t gdrom_image_open( const gchar *filename );
1.37 -
1.38 -/**
1.39 - * Read image bootstrap info
1.40 - */
1.41 -gboolean gdrom_image_read_info( gdrom_disc_t d );
1.42 -
1.43 +cdrom_disc_t gdrom_image_open( const gchar *filename );
1.44
1.45 /**
1.46 * Shortcut to open and mount an image file
1.47 @@ -67,51 +50,49 @@
1.48 */
1.49 gboolean gdrom_mount_image( const gchar *filename );
1.50
1.51 -void gdrom_mount_disc( gdrom_disc_t disc );
1.52 +void gdrom_mount_disc( cdrom_disc_t disc );
1.53
1.54 void gdrom_unmount_disc( void );
1.55
1.56 gboolean gdrom_is_mounted( void );
1.57
1.58 -gdrom_disc_t gdrom_get_current_disc();
1.59 +cdrom_disc_t gdrom_get_current_disc();
1.60
1.61 const gchar *gdrom_get_current_disc_name();
1.62
1.63 const gchar *gdrom_get_current_disc_title();
1.64
1.65 -
1.66 /**
1.67 - * Find the track (numbered from 1) containing the sector specified by LBA.
1.68 - * Note: this function does not check for media change.
1.69 - * @return The track number, or -1 if no track contains the sector.
1.70 + * Find the track which should be checked for the
1.71 + * dreamcast bootstrap - this is the first data track on the last
1.72 + * session (where there are at least 2 sessions). If a boot track
1.73 + * cannot be found, returns NULL.
1.74 */
1.75 -int gdrom_disc_get_track_by_lba( gdrom_disc_t disc, uint32_t lba );
1.76 +cdrom_track_t gdrom_disc_get_boot_track( cdrom_disc_t disc );
1.77
1.78 /**
1.79 * Check if the disc contains valid media.
1.80 - * @return PKT_ERR_OK if disc is present, otherwise PKT_ERR_NODISC
1.81 + * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC
1.82 */
1.83 -gdrom_error_t gdrom_disc_check_media( gdrom_disc_t disc );
1.84 +cdrom_error_t gdrom_check_media( );
1.85
1.86 /**
1.87 * Retrieve the disc table of contents, and write it into the buffer in the
1.88 * format expected by the DC.
1.89 - * @param disc The disc to read
1.90 * @param buf Buffer to receive the TOC data, which must be at least
1.91 * GDROM_TOC_SIZE bytes long.
1.92 * @return 0 on success, error code on failure (eg no disc)
1.93 */
1.94 -gdrom_error_t gdrom_disc_get_toc( gdrom_disc_t disc, unsigned char *buf );
1.95 +cdrom_error_t gdrom_read_toc( unsigned char *buf );
1.96
1.97 /**
1.98 * Retrieve the short (6-byte) session info, and write it into the buffer.
1.99 - * @param disc The disc to read
1.100 * @param session The session to read (numbered from 1), or 0
1.101 * @param buf Buffer to receive the session data, which must be at least
1.102 * GDROM_SESSION_INFO_SIZE bytes long.
1.103 * @return 0 on success, error code on failure.
1.104 */
1.105 -gdrom_error_t gdrom_disc_get_session_info( gdrom_disc_t disc, int session, unsigned char *buf );
1.106 +cdrom_error_t gdrom_read_session( int session, unsigned char *buf );
1.107
1.108 /**
1.109 * Generate the position data as returned from a STATUS(1) packet.
1.110 @@ -121,33 +102,31 @@
1.111 * GDROM_SHORT_STATUS_SIZE bytes long.
1.112 * @return 0 on success, error code on failure.
1.113 */
1.114 -gdrom_error_t gdrom_disc_get_short_status( gdrom_disc_t disc, uint32_t lba, unsigned char *buf );
1.115 +cdrom_error_t gdrom_read_short_status( uint32_t lba, unsigned char *buf );
1.116 +
1.117 +/**
1.118 + * Read sectors from the current disc.
1.119 + * @param lba Address of first sector to read
1.120 + * @param count Number of sectors to read
1.121 + * @param read_mode GDROM format read-mode
1.122 + * @param buf Buffer to receive read sectors
1.123 + * @param length If not null, will be written with the number of bytes read.
1.124 + * @return 0 on success, otherwise error code.
1.125 + */
1.126 +cdrom_error_t gdrom_read_cd( cdrom_lba_t lba, cdrom_count_t count,
1.127 + unsigned read_mode, unsigned char *buf, size_t *length );
1.128 +
1.129 +cdrom_error_t gdrom_play_audio( cdrom_lba_t lba, cdrom_count_t count );
1.130
1.131 /**
1.132 * Return the 1-byte status code for the disc (combination of IDE_DISC_* flags)
1.133 */
1.134 -int gdrom_disc_get_drive_status( gdrom_disc_t disc );
1.135 +int gdrom_get_drive_status( );
1.136
1.137 /**
1.138 - * Native CD-ROM API - provided by drivers/cd_*.c
1.139 - *
1.140 - * A device name is either a system special file (most unixes) or a url of the
1.141 - * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system
1.142 - * defined string that uniquely identifies a particular device.
1.143 + * Run GDROM time slice (if any)
1.144 */
1.145 -
1.146 -/**
1.147 - * Return a list of gdrom_device_t defining all CD/DVD drives in the host system.
1.148 - */
1.149 -GList *cdrom_get_native_devices();
1.150 -
1.151 -/**
1.152 - * Open a native device given a device name and url method. Eg, for the url dvd://1
1.153 - * this function will be invoked with method = "dvd" and name = "1"
1.154 - *
1.155 - * @return NULL on failure, otherwise a valid gdrom_disc_t that can be mounted.
1.156 - */
1.157 -gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *name );
1.158 +void gdrom_run_slice( uint32_t nanosecs );
1.159
1.160 #ifdef __cplusplus
1.161 }
.