32x: built-in BIOS; reset handling; 68k memhandler split
[picodrive.git] / pico / cd / cd_sys.h
CommitLineData
6cadc2da 1/***********************************************************\r
2 * *\r
3 * This source was taken from the Gens project *\r
4 * Written by Stéphane Dallongeville *\r
5 * Copyright (c) 2002 by Stéphane Dallongeville *\r
6 * Modified/adapted for PicoDrive by notaz, 2007 *\r
7 * *\r
8 ***********************************************************/\r
9\r
cc68a136 10#ifndef _CD_SYS_H\r
11#define _CD_SYS_H\r
12\r
75736070 13#include "cd_file.h"\r
14\r
cc68a136 15#ifdef __cplusplus\r
16extern "C" {\r
17#endif\r
18\r
19\r
20#define INT_TO_BCDB(c) \\r
21((c) > 99)?(0x99):((((c) / 10) << 4) + ((c) % 10));\r
22\r
23#define INT_TO_BCDW(c) \\r
24((c) > 99)?(0x0909):((((c) / 10) << 8) + ((c) % 10));\r
25\r
26#define BCDB_TO_INT(c) \\r
27(((c) >> 4) * 10) + ((c) & 0xF);\r
28\r
29#define BCDW_TO_INT(c) \\r
30(((c) >> 8) * 10) + ((c) & 0xF);\r
31\r
32\r
33typedef struct\r
34{\r
35 unsigned char M;\r
36 unsigned char S;\r
37 unsigned char F;\r
38} _msf;\r
39\r
40typedef struct\r
41{\r
75736070 42// unsigned char Type; // always 1 (data) for 1st track, 0 (audio) for others\r
43// unsigned char Num; // unused\r
cc68a136 44 _msf MSF;\r
75736070 45 //\r
46 char ftype; // TYPE_ISO, TYPE_BIN, TYPE_MP3\r
83bd0b76 47 void *F;\r
75736070 48 int Length;\r
9037e45d 49 int Offset; // sector offset, when single file is used for multiple virtual tracks\r
75736070 50 short KBtps; // kbytes per sec for mp3s (bitrate / 1000 / 8)\r
51 short pad;\r
cc68a136 52} _scd_track;\r
53\r
54typedef struct\r
55{\r
75736070 56// unsigned char First_Track; // always 1\r
cc68a136 57 _scd_track Tracks[100];\r
75736070 58 unsigned int Last_Track;\r
cc68a136 59} _scd_toc;\r
60\r
61typedef struct {\r
62 unsigned int Status_CDD;\r
63 unsigned int Status_CDC;\r
cc68a136 64 int Cur_LBA;\r
65 unsigned int Cur_Track;\r
51a902ae 66 int File_Add_Delay;\r
67 char CDD_Complete;\r
48e8482f 68 int pad[6];\r
cc68a136 69} _scd;\r
70\r
71\r
eff55556 72PICO_INTERNAL void LBA_to_MSF(int lba, _msf *MSF);\r
73PICO_INTERNAL int Track_to_LBA(int track);\r
74\r
efcba75f 75// moved to pico.h\r
eff55556 76// int Insert_CD(char *iso_name, int is_bin);\r
77// void Stop_CD(void);\r
78\r
79PICO_INTERNAL void Check_CD_Command(void);\r
80\r
81PICO_INTERNAL int Init_CD_Driver(void);\r
82PICO_INTERNAL void End_CD_Driver(void);\r
83PICO_INTERNAL void Reset_CD(void);\r
84\r
85PICO_INTERNAL int Get_Status_CDD_c0(void);\r
86PICO_INTERNAL int Stop_CDD_c1(void);\r
87PICO_INTERNAL int Get_Pos_CDD_c20(void);\r
88PICO_INTERNAL int Get_Track_Pos_CDD_c21(void);\r
89PICO_INTERNAL int Get_Current_Track_CDD_c22(void);\r
90PICO_INTERNAL int Get_Total_Lenght_CDD_c23(void);\r
91PICO_INTERNAL int Get_First_Last_Track_CDD_c24(void);\r
92PICO_INTERNAL int Get_Track_Adr_CDD_c25(void);\r
93PICO_INTERNAL int Play_CDD_c3(void);\r
94PICO_INTERNAL int Seek_CDD_c4(void);\r
95PICO_INTERNAL int Pause_CDD_c6(void);\r
96PICO_INTERNAL int Resume_CDD_c7(void);\r
97PICO_INTERNAL int Fast_Foward_CDD_c8(void);\r
98PICO_INTERNAL int Fast_Rewind_CDD_c9(void);\r
99PICO_INTERNAL int CDD_cA(void);\r
100PICO_INTERNAL int Close_Tray_CDD_cC(void);\r
101PICO_INTERNAL int Open_Tray_CDD_cD(void);\r
102\r
103PICO_INTERNAL int CDD_Def(void);\r
cc68a136 104\r
cc68a136 105\r
106#ifdef __cplusplus\r
107};\r
108#endif\r
109\r
110#endif\r
111\r