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.


18dc385af21f044d5918eb1294018d6d2e91e6e1
[palacios.git] / palacios / include / devices / cdrom.h
1 /* (c) 2008, Zheng Cui <cuizheng@cs.unm.edu> */
2 /* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
3 /* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
4
5 #ifndef __DEVICES_CDROM_H_
6 #define __DEVICES_CDROM_H_
7
8 #include <devices/ramdisk.h>
9 #include <devices/ide.h>
10 #include <palacios/vmm_types.h>
11
12
13
14
15 struct cdrom_interface;
16
17 struct cdrom_ops {
18   
19   void (*init)(struct cdrom_interface *cdrom);
20
21   /* 
22    * Load CD-ROM. Returns false if CD is not ready. 
23    */
24   rd_bool (*insert_cdrom)(struct cdrom_interface *cdrom, char *dev /*= NULL*/);
25
26   /* 
27    * Logically eject the CD.
28    */
29   void (*eject_cdrom)(struct cdrom_interface *cdrom);
30   
31   /* 
32    * Read CD TOC. Returns false if start track is out of bounds.
33    */
34   rd_bool (*read_toc)(struct cdrom_interface * cdrom, uint8_t * buf, int* length, rd_bool msf, int start_track);
35   
36   /* 
37    * Return CD-ROM capacity (in 2048 byte frames)
38    */
39   uint32_t (*capacity)(struct cdrom_interface *cdrom);
40   
41   /*
42    * Read a single block from the CD
43    */
44   void (*read_block)(struct cdrom_interface *cdrom, uint8_t* buf, int lba);
45   
46   /*
47    * Start (spin up) the CD.
48    */
49   int (*start_cdrom)(struct cdrom_interface *cdrom);
50 };
51
52
53 struct cdrom_interface {
54
55   struct cdrom_ops ops;
56
57   ulong_t fd; //memory address
58   ulong_t capacity_B;
59   ulong_t head; //current position
60
61   uchar_t lba;
62
63   char *path; //for ramdisk, NULL
64   int using_file; //no
65 };
66
67 void init_cdrom(struct cdrom_interface *cdrom);
68
69 #endif