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.


4546f4fafa1023f1a6aaacbd7c53dd0a344a0c1b
[palacios.git] / palacios / include / devices / cdrom.h
1 /*
2  * Zheng Cui
3  * cuizheng@cs.unm.edu
4  * July 2008
5  */
6
7 #ifndef __DEVICES_CDROM_H_
8 #define __DEVICES_CDROM_H_
9
10 #include <geekos/ktypes.h>
11
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;
17
18 #define uint8 Bit8u 
19 #define uint16 Bit16u 
20 #define uint32 Bit32u 
21
22 struct cdrom_interface;
23
24 struct cdrom_ops {
25   
26   void (*init)(struct cdrom_interface *cdrom);
27
28   /* 
29    * Load CD-ROM. Returns false if CD is not ready. 
30    */
31   rd_bool (*insert_cdrom)(struct cdrom_interface *cdrom, char *dev /*= NULL*/);
32
33   /* 
34    * Logically eject the CD.
35    */
36   void (*eject_cdrom)(struct cdrom_interface *cdrom);
37   
38   /* 
39    * Read CD TOC. Returns false if start track is out of bounds.
40    */
41   rd_bool (*read_toc)(struct cdrom_interface *cdrom, uint8* buf, int* length, rd_bool msf, int start_track);
42   
43   /* 
44    * Return CD-ROM capacity (in 2048 byte frames)
45    */
46   uint32 (*capacity)(struct cdrom_interface *cdrom);
47   
48   /*
49    * Read a single block from the CD
50    */
51   void (*read_block)(struct cdrom_interface *cdrom, uint8* buf, int lba);
52   
53   /*
54    * Start (spin up) the CD.
55    */
56   int (*start_cdrom)(struct cdrom_interface *cdrom);
57 };
58
59
60 struct cdrom_interface {
61
62   struct cdrom_ops ops;
63
64   ulong_t fd; //memory address
65   ulong_t capacity_B;
66   ulong_t head; //current position
67
68   uchar_t lba;
69
70   char *path; //for ramdisk, NULL
71   int using_file; //no
72 };
73
74 void init_cdrom(struct cdrom_interface *cdrom);
75
76 #endif