7 #ifndef __DEVICES_CDROM_H_
8 #define __DEVICES_CDROM_H_
10 #include <geekos/ktypes.h>
12 typedef unsigned int rd_bool;
13 typedef uchar_t Bit8u;
14 typedef ushort_t Bit16u;
15 typedef uint_t Bit32u;
16 typedef ullong_t Bit64u;
22 struct cdrom_interface;
26 void (*init)(struct cdrom_interface *cdrom);
29 * Load CD-ROM. Returns false if CD is not ready.
31 rd_bool (*insert_cdrom)(struct cdrom_interface *cdrom, char *dev /*= NULL*/);
34 * Logically eject the CD.
36 void (*eject_cdrom)(struct cdrom_interface *cdrom);
39 * Read CD TOC. Returns false if start track is out of bounds.
41 rd_bool (*read_toc)(struct cdrom_interface *cdrom, uint8* buf, int* length, rd_bool msf, int start_track);
44 * Return CD-ROM capacity (in 2048 byte frames)
46 uint32 (*capacity)(struct cdrom_interface *cdrom);
49 * Read a single block from the CD
51 void (*read_block)(struct cdrom_interface *cdrom, uint8* buf, int lba);
54 * Start (spin up) the CD.
56 int (*start_cdrom)(struct cdrom_interface *cdrom);
60 struct cdrom_interface {
64 ulong_t fd; //memory address
66 ulong_t head; //current position
70 char *path; //for ramdisk, NULL
74 void init_cdrom(struct cdrom_interface *cdrom);