Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added new copyright and license
[palacios.git] / palacios / include / devices / cdrom.h
1 /*
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
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.
13  *
14  * Author: Zheng Cui<cuizheng@cs.unm.edu> 
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #ifndef __DEVICES_CDROM_H_
21 #define __DEVICES_CDROM_H_
22
23 #include <geekos/ktypes.h>
24
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;
30
31 #define uint8 Bit8u 
32 #define uint16 Bit16u 
33 #define uint32 Bit32u 
34
35 struct cdrom_interface;
36
37 struct cdrom_ops {
38   
39   void (*init)(struct cdrom_interface *cdrom);
40
41   /* 
42    * Load CD-ROM. Returns false if CD is not ready. 
43    */
44   rd_bool (*insert_cdrom)(struct cdrom_interface *cdrom, char *dev /*= NULL*/);
45
46   /* 
47    * Logically eject the CD.
48    */
49   void (*eject_cdrom)(struct cdrom_interface *cdrom);
50   
51   /* 
52    * Read CD TOC. Returns false if start track is out of bounds.
53    */
54   rd_bool (*read_toc)(struct cdrom_interface *cdrom, uint8* buf, int* length, rd_bool msf, int start_track);
55   
56   /* 
57    * Return CD-ROM capacity (in 2048 byte frames)
58    */
59   uint32 (*capacity)(struct cdrom_interface *cdrom);
60   
61   /*
62    * Read a single block from the CD
63    */
64   void (*read_block)(struct cdrom_interface *cdrom, uint8* buf, int lba);
65   
66   /*
67    * Start (spin up) the CD.
68    */
69   int (*start_cdrom)(struct cdrom_interface *cdrom);
70 };
71
72
73 struct cdrom_interface {
74
75   struct cdrom_ops ops;
76
77   ulong_t fd; //memory address
78   ulong_t capacity_B;
79   ulong_t head; //current position
80
81   uchar_t lba;
82
83   char *path; //for ramdisk, NULL
84   int using_file; //no
85 };
86
87 void init_cdrom(struct cdrom_interface *cdrom);
88
89 #endif