grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / filesys / CDVDFS / src / cdrom.h
blob3054da9bc88d7e8a4f053268eca7f78b21bcb76d
1 /* cdrom.h: */
3 /*
4 * History:
6 * 06-Mar-09 error - Removed madness, fixed insanity. Cleanup started
7 */
9 #ifndef _CDROM_H_
10 #define _CDROM_H_
12 #include <exec/types.h>
13 #include <exec/memory.h>
14 #include <exec/io.h>
15 #include <devices/scsidisk.h>
17 #include <inttypes.h>
19 #define VERSION "CDROM-Handler 1.15 (03.11.94)"
21 #define SCSI_BUFSIZE 2048
23 #ifndef __packed
24 #ifdef __GNUC__
25 #define __packed __attribute__((__packed__))
26 #else
27 #define __packed
28 #endif
29 #endif
31 typedef struct CDROM {
32 struct CDVDBase *global;
33 unsigned char *buffer;
34 unsigned char **buffers;
35 unsigned char *buffer_data;
36 unsigned char *buffer_io;
37 unsigned char sense[20];
38 short lun;
39 short buffers_cnt;
40 uint32_t t_changeint;
41 uint32_t t_changeint2;
42 long *current_sectors;
43 uint32_t *last_used;
44 uint32_t tick;
45 struct MsgPort *port;
46 struct IOStdReq *scsireq;
47 struct SCSICmd cmd;
48 short device_open;
49 struct IOStdReq *iochangeint;
50 struct Interrupt changeint;
52 } CDROM;
54 typedef struct inquiry_data {
55 char peripheral_type;
56 char modifier;
57 char version;
58 char flags1;
59 char additional_length;
60 char reserved[2];
61 char flags2;
62 char vendor[8];
63 char product[16];
64 char revision[4];
65 } __packed t_inquiry_data;
67 typedef struct toc_header {
68 unsigned short length;
69 unsigned char first_track;
70 unsigned char last_track;
71 } __packed t_toc_header;
73 typedef struct toc_data {
74 char reserved1;
75 unsigned char flags;
76 unsigned char track_number;
77 char reserved2;
78 uint32_t address;
79 } __packed t_toc_data;
81 CDROM *Open_CDROM
83 struct CDVDBase *global,
84 char *p_device,
85 int p_scsi_id,
86 uint32_t p_memory_type,
87 int p_std_buffers,
88 int p_file_buffers
91 int Read_Chunk(CDROM *p_cd, long p_sector);
92 void Cleanup_CDROM(CDROM *p_cd);
93 int Test_Unit_Ready(CDROM *p_cd);
94 int Mode_Select(CDROM *p_cd, int p_on, int p_block_length);
95 int Inquire(CDROM *p_cd, t_inquiry_data *p_data);
96 t_toc_data *Read_TOC
98 CDROM *p_cd,
99 uint32_t *p_toc_len
101 int Has_Audio_Tracks(CDROM *p_cd);
102 int Data_Tracks(CDROM *p_cd, uint32_t** p_buf);
103 void block2msf (uint32_t blk, unsigned char *msf);
104 int Start_Play_Audio(CDROM *p_cd);
105 int Stop_Play_Audio(CDROM *p_cd);
106 void Clear_Sector_Buffers (CDROM *p_cd);
107 int Find_Last_Session(CDROM *p_cd, uint32_t *p_result);
109 enum {
110 CDROMERR_OK = 0, /* no error */
111 CDROMERR_NO_MEMORY, /* out of memory */
112 CDROMERR_MSGPORT, /* cannot create message port */
113 CDROMERR_IOREQ, /* cannot create I/O request */
114 CDROMERR_DEVICE, /* cannot open scsi device */
115 CDROMERR_BLOCKSIZE /* illegal blocksize */
118 #endif /* _CDROM_H_ */