| 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 |
| 10 | #ifndef _CD_SYS_H\r |
| 11 | #define _CD_SYS_H\r |
| 12 | \r |
| 13 | #include "cd_file.h"\r |
| 14 | \r |
| 15 | #ifdef __cplusplus\r |
| 16 | extern "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 |
| 33 | typedef struct\r |
| 34 | {\r |
| 35 | unsigned char M;\r |
| 36 | unsigned char S;\r |
| 37 | unsigned char F;\r |
| 38 | } _msf;\r |
| 39 | \r |
| 40 | typedef struct\r |
| 41 | {\r |
| 42 | // unsigned char Type; // always 1 (data) for 1st track, 0 (audio) for others\r |
| 43 | // unsigned char Num; // unused\r |
| 44 | _msf MSF;\r |
| 45 | //\r |
| 46 | char ftype; // TYPE_ISO, TYPE_BIN, TYPE_MP3\r |
| 47 | void *F;\r |
| 48 | int Length;\r |
| 49 | short KBtps; // kbytes per sec for mp3s (bitrate / 1000 / 8)\r |
| 50 | short pad;\r |
| 51 | } _scd_track;\r |
| 52 | \r |
| 53 | typedef struct\r |
| 54 | {\r |
| 55 | // unsigned char First_Track; // always 1\r |
| 56 | _scd_track Tracks[100];\r |
| 57 | unsigned int Last_Track;\r |
| 58 | } _scd_toc;\r |
| 59 | \r |
| 60 | typedef struct {\r |
| 61 | unsigned int Status_CDD;\r |
| 62 | unsigned int Status_CDC;\r |
| 63 | int Cur_LBA;\r |
| 64 | unsigned int Cur_Track;\r |
| 65 | int File_Add_Delay;\r |
| 66 | char CDD_Complete;\r |
| 67 | int pad[6];\r |
| 68 | } _scd;\r |
| 69 | \r |
| 70 | \r |
| 71 | PICO_INTERNAL void LBA_to_MSF(int lba, _msf *MSF);\r |
| 72 | PICO_INTERNAL int Track_to_LBA(int track);\r |
| 73 | \r |
| 74 | // moved to Pico.h\r |
| 75 | // int Insert_CD(char *iso_name, int is_bin);\r |
| 76 | // void Stop_CD(void);\r |
| 77 | \r |
| 78 | PICO_INTERNAL void Check_CD_Command(void);\r |
| 79 | \r |
| 80 | PICO_INTERNAL int Init_CD_Driver(void);\r |
| 81 | PICO_INTERNAL void End_CD_Driver(void);\r |
| 82 | PICO_INTERNAL void Reset_CD(void);\r |
| 83 | \r |
| 84 | PICO_INTERNAL int Get_Status_CDD_c0(void);\r |
| 85 | PICO_INTERNAL int Stop_CDD_c1(void);\r |
| 86 | PICO_INTERNAL int Get_Pos_CDD_c20(void);\r |
| 87 | PICO_INTERNAL int Get_Track_Pos_CDD_c21(void);\r |
| 88 | PICO_INTERNAL int Get_Current_Track_CDD_c22(void);\r |
| 89 | PICO_INTERNAL int Get_Total_Lenght_CDD_c23(void);\r |
| 90 | PICO_INTERNAL int Get_First_Last_Track_CDD_c24(void);\r |
| 91 | PICO_INTERNAL int Get_Track_Adr_CDD_c25(void);\r |
| 92 | PICO_INTERNAL int Play_CDD_c3(void);\r |
| 93 | PICO_INTERNAL int Seek_CDD_c4(void);\r |
| 94 | PICO_INTERNAL int Pause_CDD_c6(void);\r |
| 95 | PICO_INTERNAL int Resume_CDD_c7(void);\r |
| 96 | PICO_INTERNAL int Fast_Foward_CDD_c8(void);\r |
| 97 | PICO_INTERNAL int Fast_Rewind_CDD_c9(void);\r |
| 98 | PICO_INTERNAL int CDD_cA(void);\r |
| 99 | PICO_INTERNAL int Close_Tray_CDD_cC(void);\r |
| 100 | PICO_INTERNAL int Open_Tray_CDD_cD(void);\r |
| 101 | \r |
| 102 | PICO_INTERNAL int CDD_Def(void);\r |
| 103 | \r |
| 104 | \r |
| 105 | #ifdef __cplusplus\r |
| 106 | };\r |
| 107 | #endif\r |
| 108 | \r |
| 109 | #endif\r |
| 110 | \r |