2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Zheng Cui<cuizheng@cs.unm.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Zheng Cui<cuizheng@cs.unm.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #ifndef __DEVICES_CDROM_H_
21 #define __DEVICES_CDROM_H_
23 #include <geekos/ktypes.h>
25 typedef unsigned int rd_bool;
26 typedef uchar_t Bit8u;
27 typedef ushort_t Bit16u;
28 typedef uint_t Bit32u;
29 typedef ullong_t Bit64u;
35 struct cdrom_interface;
39 void (*init)(struct cdrom_interface *cdrom);
42 * Load CD-ROM. Returns false if CD is not ready.
44 rd_bool (*insert_cdrom)(struct cdrom_interface *cdrom, char *dev /*= NULL*/);
47 * Logically eject the CD.
49 void (*eject_cdrom)(struct cdrom_interface *cdrom);
52 * Read CD TOC. Returns false if start track is out of bounds.
54 rd_bool (*read_toc)(struct cdrom_interface *cdrom, uint8* buf, int* length, rd_bool msf, int start_track);
57 * Return CD-ROM capacity (in 2048 byte frames)
59 uint32 (*capacity)(struct cdrom_interface *cdrom);
62 * Read a single block from the CD
64 void (*read_block)(struct cdrom_interface *cdrom, uint8* buf, int lba);
67 * Start (spin up) the CD.
69 int (*start_cdrom)(struct cdrom_interface *cdrom);
73 struct cdrom_interface {
77 ulong_t fd; //memory address
79 ulong_t head; //current position
83 char *path; //for ramdisk, NULL
87 void init_cdrom(struct cdrom_interface *cdrom);