1.1 --- a/src/gdrom/gdrom.h Tue Dec 19 09:52:56 2006 +0000
1.2 +++ b/src/gdrom/gdrom.h Wed Sep 19 11:30:30 2007 +0000
1.5 - * $Id: gdrom.h,v 1.9 2006-12-19 09:52:56 nkeynes Exp $
1.6 + * $Id: gdrom.h,v 1.10 2007-01-31 10:58:42 nkeynes Exp $
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.14 +#define MAX_SECTOR_SIZE 2352
1.16 typedef uint16_t gdrom_error_t;
1.20 uint32_t offset; /* File offset of start of track - image files only */
1.23 +typedef struct gdrom_disc {
1.25 + * Read a single sector from the disc at the specified logical address.
1.26 + * @param disc pointer to the disc structure
1.27 + * @param lba logical address to read from
1.28 + * @param mode mode field from the read command
1.29 + * @param buf buffer to receive data (at least MAX_SECTOR_SIZE bytes)
1.30 + * @param length unsigned int to receive the number of bytes actually read.
1.31 + * @return PKT_ERR_OK on success, or another PKT_ERR_* code on failure.
1.33 + gdrom_error_t (*read_sector)( struct gdrom_disc *disc,
1.34 + uint32_t lba, int mode,
1.35 + char *buf, uint32_t *length );
1.38 + * Read the TOC from the disc and write it into the specified buffer.
1.39 + * The method is responsible for returning the data in gd-rom
1.41 + * @param disc pointer to the disc structure
1.42 + * @param buf buffer to receive data (0x198 bytes long)
1.44 + gdrom_error_t (*read_toc)(struct gdrom_disc *disc, char *buf);
1.46 -typedef struct gdrom_disc {
1.48 + * Read the information for the specified sector and return it in the
1.49 + * supplied buffer.
1.50 + * @param disc pointer to the disc structure
1.51 + * @param session of interest. If 0, return end of disc information.
1.52 + * @param buf buffer to receive data (6 bytes)
1.54 + gdrom_error_t (*read_session)(struct gdrom_disc *disc, int session, char *buf);
1.57 + * Read the position information (subchannel) for the specified sector
1.58 + * and return it in the supplied buffer. This method does not need to
1.59 + * write the first 4 bytes of the buffer.
1.60 + * @param disc pointer to the disc structure
1.61 + * @param lba sector to get position information for
1.62 + * @param buf buffer to receive data (14 bytes)
1.64 + gdrom_error_t (*read_position)(struct gdrom_disc *disc, uint32_t lba, char *buf);
1.67 + * Return the current disc status, expressed as a combination of the
1.68 + * IDE_DISC_* flags above.
1.69 + * @param disc pointer to the disc structure
1.70 + * @return an integer status value.
1.72 + int (*drive_status)(struct gdrom_disc *disc);
1.75 + * Begin playing audio from the given lba address on the disc.
1.77 + gdrom_error_t (*play_audio)(struct gdrom_disc *disc, uint32_t lba);
1.80 + * Executed once per time slice to perform house-keeping operations
1.81 + * (checking disc status, media changed, etc).
1.83 + uint32_t (*run_time_slice)( struct gdrom_disc *disc, uint32_t nanosecs );
1.86 + * Close the disc and release any storage or resources allocated including
1.87 + * the disc structure itself.
1.89 + void (*close)( struct gdrom_disc *disc );
1.93 +typedef struct gdrom_image {
1.94 + struct gdrom_disc disc;
1.97 struct gdrom_track track[99];
1.98 gchar mcn[14]; /* Media catalogue number */
1.99 const gchar *filename; /* Image filename */
1.100 - FILE *file; /* Stream, for image files */
1.101 - gdrom_error_t (*read_sectors)( struct gdrom_disc *disc,
1.102 - uint32_t lba, uint32_t sector_count,
1.103 - int mode, char *buf, uint32_t *length );
1.104 - void (*close)( struct gdrom_disc *disc );
1.106 + FILE *file; /* Open file stream */