RetroArch
cdrom.h
Go to the documentation of this file.
1 /* license:BSD-3-Clause
2  * copyright-holders:Aaron Giles
3 ***************************************************************************
4 
5  cdrom.h
6 
7  Generic MAME cd-rom implementation
8 
9 ***************************************************************************/
10 
11 #pragma once
12 
13 #ifndef __CDROM_H__
14 #define __CDROM_H__
15 
16 #include <stdint.h>
17 
18 
19 /***************************************************************************
20  CONSTANTS
21 ***************************************************************************/
22 
23 /* tracks are padded to a multiple of this many frames */
24 #define CD_TRACK_PADDING (4)
25 
26 #define CD_MAX_TRACKS (99) /* AFAIK the theoretical limit */
27 #define CD_MAX_SECTOR_DATA (2352)
28 #define CD_MAX_SUBCODE_DATA (96)
29 
30 #define CD_FRAME_SIZE (CD_MAX_SECTOR_DATA + CD_MAX_SUBCODE_DATA)
31 #define CD_FRAMES_PER_HUNK (8)
32 
33 #define CD_METADATA_WORDS (1+(CD_MAX_TRACKS * 6))
34 
35 enum
36 {
37  CD_TRACK_MODE1 = 0, /* mode 1 2048 bytes/sector */
38  CD_TRACK_MODE1_RAW, /* mode 1 2352 bytes/sector */
39  CD_TRACK_MODE2, /* mode 2 2336 bytes/sector */
40  CD_TRACK_MODE2_FORM1, /* mode 2 2048 bytes/sector */
41  CD_TRACK_MODE2_FORM2, /* mode 2 2324 bytes/sector */
42  CD_TRACK_MODE2_FORM_MIX, /* mode 2 2336 bytes/sector */
43  CD_TRACK_MODE2_RAW, /* mode 2 2352 bytes / sector */
44  CD_TRACK_AUDIO, /* redbook audio track 2352 bytes/sector (588 samples) */
45 
46  CD_TRACK_RAW_DONTCARE /* special flag for cdrom_read_data: just return me whatever is there */
47 };
48 
49 enum
50 {
51  CD_SUB_NORMAL = 0, /* "cooked" 96 bytes per sector */
52  CD_SUB_RAW, /* raw uninterleaved 96 bytes per sector */
53  CD_SUB_NONE /* no subcode data stored */
54 };
55 
56 #define CD_FLAG_GDROM 0x00000001 /* disc is a GD-ROM, all tracks should be stored with GD-ROM metadata */
57 #define CD_FLAG_GDROMLE 0x00000002 /* legacy GD-ROM, with little-endian CDDA data */
58 
59 /***************************************************************************
60  FUNCTION PROTOTYPES
61 ***************************************************************************/
62 
63 #ifdef WANT_RAW_DATA_SECTOR
64 /* ECC utilities */
65 int ecc_verify(const uint8_t *sector);
66 void ecc_generate(uint8_t *sector);
67 void ecc_clear(uint8_t *sector);
68 #endif
69 
70 #endif /* __CDROM_H__ */
Definition: cdrom.h:44
Definition: cdrom.h:46
Definition: cdrom.h:38
Definition: cdrom.h:42
Definition: cdrom.h:53
Definition: cdrom.h:37
Definition: cdrom.h:41
Definition: cdrom.h:52
Definition: cdrom.h:43
Definition: cdrom.h:39
Definition: cdrom.h:40
Definition: cdrom.h:51
unsigned char uint8_t
Definition: stdint.h:124