Search
lxdream.org :: lxdream/src/gdrom/gdrom.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdrom.h
changeset 138:afabd7e6d26d
prev125:49bf45f8210a
next142:2f631c3a3946
author nkeynes
date Sun Apr 30 01:51:08 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Add Nero file format handler and general gdrom disc hooks
file annotate diff log raw
1.1 --- a/src/gdrom/gdrom.h Wed Mar 22 14:29:02 2006 +0000
1.2 +++ b/src/gdrom/gdrom.h Sun Apr 30 01:51:08 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: gdrom.h,v 1.1 2006-03-22 14:29:02 nkeynes Exp $
1.6 + * $Id: gdrom.h,v 1.2 2006-04-30 01:51:08 nkeynes Exp $
1.7 *
1.8 * This file defines the structures and functions used by the GD-Rom
1.9 * disc driver. (ie, the modules that supply a CD image to be used by the
1.10 @@ -23,22 +23,87 @@
1.11
1.12 #include "dream.h"
1.13
1.14 -typedef struct gdrom_toc {
1.15 +struct gdrom_toc {
1.16 uint32_t tracks[99];
1.17 uint32_t first, last, leadout;
1.18 -} *gdrom_toc_t;
1.19 +};
1.20 +
1.21 +#define GDROM_PREGAP 150 /* Sectors */
1.22 +
1.23 +extern uint32_t gdrom_sector_size[];
1.24 +#define GDROM_SECTOR_SIZE(x) gdrom_sector_size[x]
1.25 +typedef enum {
1.26 + GDROM_MODE1,
1.27 + GDROM_MODE2,
1.28 + GDROM_MODE2_XA1,
1.29 + GDROM_MODE2_XA2,
1.30 + GDROM_CDDA,
1.31 + GDROM_GD
1.32 +} gdrom_track_mode_t;
1.33 +
1.34 +/* The disc register indicates the current contents of the drive. When open
1.35 + * contains 0x06.
1.36 + */
1.37 +#define IDE_DISC_AUDIO 0x00
1.38 +#define IDE_DISC_NONE 0x06
1.39 +#define IDE_DISC_CDROM 0x20
1.40 +#define IDE_DISC_GDROM 0x80
1.41 +#define IDE_DISC_READY 0x01 /* ored with above */
1.42 +#define IDE_DISC_IDLE 0x02 /* ie spun-down */
1.43 +
1.44 +struct gdrom_track {
1.45 + gdrom_track_mode_t mode;
1.46 + int session; /* session # containing this track */
1.47 + uint32_t lba; /* start sector address */
1.48 + uint32_t sector_size; /* For convenience, determined by mode */
1.49 + uint32_t sector_count;
1.50 + uint32_t offset; /* File offset of start of track - image files only */
1.51 +};
1.52
1.53
1.54 typedef struct gdrom_disc {
1.55 -
1.56 - gboolean (*read_toc)( gdrom_toc_t toc );
1.57 -
1.58 - gboolean (*read_data_sectors)( uint32_t lba, uint32_t sector_count,
1.59 - char *buf );
1.60 + int disc_type;
1.61 + int track_count;
1.62 + struct gdrom_track track[99];
1.63 + gchar mcn[14]; /* Media catalogue number */
1.64 + const gchar *filename; /* Image filename */
1.65 + FILE *file; /* Stream, for image files */
1.66 + uint32_t (*read_sectors)( struct gdrom_disc *disc,
1.67 + uint32_t lba, uint32_t sector_count,
1.68 + char *buf );
1.69 + void (*close)( struct gdrom_disc *disc );
1.70 } *gdrom_disc_t;
1.71
1.72 -void gdrom_mount( gdrom_disc_t disc );
1.73 +/**
1.74 + * Construct a new image file using the default methods.
1.75 + */
1.76 +gdrom_disc_t gdrom_image_new( FILE *file );
1.77
1.78 -void gdrom_unmount( void );
1.79 +/**
1.80 + * Open an image file
1.81 + */
1.82 +gdrom_disc_t gdrom_image_open( const gchar *filename );
1.83 +gdrom_disc_t nrg_image_open( const gchar *filename );
1.84 +
1.85 +/**
1.86 + * Retrieve the disc table of contents, and write it into the buffer in the
1.87 + * format expected by the DC.
1.88 + * @return TRUE on success, FALSE on failure (eg no disc mounted)
1.89 + */
1.90 +gboolean gdrom_get_toc( char *buf );
1.91 +
1.92 +/**
1.93 + * Shortcut to open and mount an image file
1.94 + */
1.95 +gdrom_disc_t gdrom_mount_image( const gchar *filename );
1.96 +
1.97 +void gdrom_mount_disc( gdrom_disc_t disc );
1.98 +
1.99 +void gdrom_unmount_disc( void );
1.100 +
1.101 +gboolean gdrom_is_mounted( void );
1.102 +
1.103 +uint32_t gdrom_read_sectors( uint32_t sector, uint32_t sector_count,
1.104 + char *buf );
1.105
1.106 #endif
.