filename | src/gdrom/gdrom.h |
changeset | 342:850502f0e8de |
prev | 245:a1d0655a88d3 |
next | 422:61a0598e07ff |
author | nkeynes |
date | Tue Sep 04 08:32:10 2007 +0000 (16 years ago) |
permissions | -rw-r--r-- |
last change | Change sh4x86 test to translate/disasm full basic blocks Add prelim sym-tab support |
file | annotate | diff | log | raw |
1.1 --- a/src/gdrom/gdrom.h Tue Dec 19 09:52:56 2006 +00001.2 +++ b/src/gdrom/gdrom.h Tue Sep 04 08:32:10 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**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.7 *1.8 * This file defines the structures and functions used by the GD-Rom1.9 * disc driver. (ie, the modules that supply a CD image to be used by the1.10 @@ -23,6 +23,8 @@1.12 #include "dream.h"1.14 +#define MAX_SECTOR_SIZE 23521.15 +1.16 typedef uint16_t gdrom_error_t;1.18 struct gdrom_toc {1.19 @@ -69,19 +71,84 @@1.20 uint32_t offset; /* File offset of start of track - image files only */1.21 } *gdrom_track_t;1.23 +typedef struct gdrom_disc {1.24 + /**1.25 + * Read a single sector from the disc at the specified logical address.1.26 + * @param disc pointer to the disc structure1.27 + * @param lba logical address to read from1.28 + * @param mode mode field from the read command1.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.32 + */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.36 +1.37 + /**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-rom1.40 + * format.1.41 + * @param disc pointer to the disc structure1.42 + * @param buf buffer to receive data (0x198 bytes long)1.43 + */1.44 + gdrom_error_t (*read_toc)(struct gdrom_disc *disc, char *buf);1.46 -typedef struct gdrom_disc {1.47 + /**1.48 + * Read the information for the specified sector and return it in the1.49 + * supplied buffer.1.50 + * @param disc pointer to the disc structure1.51 + * @param session of interest. If 0, return end of disc information.1.52 + * @param buf buffer to receive data (6 bytes)1.53 + */1.54 + gdrom_error_t (*read_session)(struct gdrom_disc *disc, int session, char *buf);1.55 +1.56 + /**1.57 + * Read the position information (subchannel) for the specified sector1.58 + * and return it in the supplied buffer. This method does not need to1.59 + * write the first 4 bytes of the buffer.1.60 + * @param disc pointer to the disc structure1.61 + * @param lba sector to get position information for1.62 + * @param buf buffer to receive data (14 bytes)1.63 + */1.64 + gdrom_error_t (*read_position)(struct gdrom_disc *disc, uint32_t lba, char *buf);1.65 +1.66 + /**1.67 + * Return the current disc status, expressed as a combination of the1.68 + * IDE_DISC_* flags above.1.69 + * @param disc pointer to the disc structure1.70 + * @return an integer status value.1.71 + */1.72 + int (*drive_status)(struct gdrom_disc *disc);1.73 +1.74 + /**1.75 + * Begin playing audio from the given lba address on the disc.1.76 + */1.77 + gdrom_error_t (*play_audio)(struct gdrom_disc *disc, uint32_t lba);1.78 +1.79 + /**1.80 + * Executed once per time slice to perform house-keeping operations1.81 + * (checking disc status, media changed, etc).1.82 + */1.83 + uint32_t (*run_time_slice)( struct gdrom_disc *disc, uint32_t nanosecs );1.84 +1.85 + /**1.86 + * Close the disc and release any storage or resources allocated including1.87 + * the disc structure itself.1.88 + */1.89 + void (*close)( struct gdrom_disc *disc );1.90 +} *gdrom_disc_t;1.91 +1.92 +1.93 +typedef struct gdrom_image {1.94 + struct gdrom_disc disc;1.95 int disc_type;1.96 int track_count;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.105 -} *gdrom_disc_t;1.106 + FILE *file; /* Open file stream */1.107 +} *gdrom_image_t;1.109 /**1.110 *
.