1 /***********************************************************
\r
3 * This source file 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
8 ***********************************************************/
\r
12 #include "../pico_int.h"
\r
14 #include "cd_file.h"
\r
18 #define TRAY_OPEN 0x0500 // TRAY OPEN CDD status
\r
19 #define NOCD 0x0000 // CD removed CDD status
\r
20 #define STOPPED 0x0900 // STOPPED CDD status (happen after stop or close tray command)
\r
21 #define READY 0x0400 // READY CDD status (also used for seeking)
\r
22 #define FAST_FOW 0x0300 // FAST FORWARD track CDD status
\r
23 #define FAST_REV 0x10300 // FAST REVERSE track CDD status
\r
24 #define PLAYING 0x0100 // PLAYING audio track CDD status
\r
27 static int CD_Present = 0;
\r
30 #define CHECK_TRAY_OPEN \
\r
31 if (Pico_mcd->scd.Status_CDD == TRAY_OPEN) \
\r
33 Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD; \
\r
35 Pico_mcd->cdd.Minute = 0; \
\r
36 Pico_mcd->cdd.Seconde = 0; \
\r
37 Pico_mcd->cdd.Frame = 0; \
\r
38 Pico_mcd->cdd.Ext = 0; \
\r
40 Pico_mcd->scd.CDD_Complete = 1; \
\r
46 #define CHECK_CD_PRESENT \
\r
49 Pico_mcd->scd.Status_CDD = NOCD; \
\r
50 Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD; \
\r
52 Pico_mcd->cdd.Minute = 0; \
\r
53 Pico_mcd->cdd.Seconde = 0; \
\r
54 Pico_mcd->cdd.Frame = 0; \
\r
55 Pico_mcd->cdd.Ext = 0; \
\r
57 Pico_mcd->scd.CDD_Complete = 1; \
\r
63 static int MSF_to_LBA(_msf *MSF)
\r
65 return (MSF->M * 60 * 75) + (MSF->S * 75) + MSF->F - 150;
\r
69 PICO_INTERNAL void LBA_to_MSF(int lba, _msf *MSF)
\r
71 if (lba < -150) lba = 0;
\r
73 MSF->M = lba / (60 * 75);
\r
74 MSF->S = (lba / 75) % 60;
\r
79 static unsigned int MSF_to_Track(_msf *MSF)
\r
83 Start = (MSF->M << 16) + (MSF->S << 8) + MSF->F;
\r
85 for(i = 1; i <= (Pico_mcd->TOC.Last_Track + 1); i++)
\r
87 Cur = Pico_mcd->TOC.Tracks[i - 1].MSF.M << 16;
\r
88 Cur += Pico_mcd->TOC.Tracks[i - 1].MSF.S << 8;
\r
89 Cur += Pico_mcd->TOC.Tracks[i - 1].MSF.F;
\r
91 if (Cur > Start) break;
\r
96 if (i > Pico_mcd->TOC.Last_Track) return 100;
\r
97 else if (i < 1) i = 1;
\r
99 return (unsigned) i;
\r
103 static unsigned int LBA_to_Track(int lba)
\r
107 LBA_to_MSF(lba, &MSF);
\r
108 return MSF_to_Track(&MSF);
\r
112 static void Track_to_MSF(int track, _msf *MSF)
\r
114 if (track < 1) track = 1;
\r
115 else if (track > Pico_mcd->TOC.Last_Track) track = Pico_mcd->TOC.Last_Track;
\r
117 MSF->M = Pico_mcd->TOC.Tracks[track - 1].MSF.M;
\r
118 MSF->S = Pico_mcd->TOC.Tracks[track - 1].MSF.S;
\r
119 MSF->F = Pico_mcd->TOC.Tracks[track - 1].MSF.F;
\r
123 PICO_INTERNAL int Track_to_LBA(int track)
\r
127 Track_to_MSF(track, &MSF);
\r
128 return MSF_to_LBA(&MSF);
\r
132 PICO_INTERNAL void Check_CD_Command(void)
\r
134 cdprintf("CHECK CD COMMAND");
\r
137 if (Pico_mcd->scd.Status_CDC & 1) // CDC is reading data ...
\r
139 cdprintf("Got a read command");
\r
142 if (Pico_mcd->scd.Cur_Track == 1)
\r
143 Pico_mcd->s68k_regs[0x36] |= 0x01;
\r
144 else Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO
\r
146 if (Pico_mcd->scd.File_Add_Delay == 0)
\r
148 FILE_Read_One_LBA_CDC();
\r
150 else Pico_mcd->scd.File_Add_Delay--;
\r
154 if (Pico_mcd->scd.CDD_Complete)
\r
156 Pico_mcd->scd.CDD_Complete = 0;
\r
158 CDD_Export_Status();
\r
161 if (Pico_mcd->scd.Status_CDD == FAST_FOW)
\r
163 Pico_mcd->scd.Cur_LBA += 10;
\r
164 CDC_Update_Header();
\r
167 else if (Pico_mcd->scd.Status_CDD == FAST_REV)
\r
169 Pico_mcd->scd.Cur_LBA -= 10;
\r
170 if (Pico_mcd->scd.Cur_LBA < -150) Pico_mcd->scd.Cur_LBA = -150;
\r
171 CDC_Update_Header();
\r
176 PICO_INTERNAL int Init_CD_Driver(void)
\r
182 PICO_INTERNAL void End_CD_Driver(void)
\r
188 PICO_INTERNAL void Reset_CD(void)
\r
190 Pico_mcd->scd.Cur_Track = 0;
\r
191 Pico_mcd->scd.Cur_LBA = -150;
\r
192 Pico_mcd->scd.Status_CDC &= ~1;
\r
193 Pico_mcd->scd.Status_CDD = CD_Present ? READY : NOCD;
\r
194 Pico_mcd->scd.CDD_Complete = 0;
\r
195 Pico_mcd->scd.File_Add_Delay = 0;
\r
199 int Insert_CD(const char *cdimg_name, int type)
\r
204 Pico_mcd->scd.Status_CDD = NOCD;
\r
206 if (cdimg_name != NULL && type != CIT_NOT_CD)
\r
208 ret = Load_CD_Image(cdimg_name, type);
\r
211 /* for open tray close command will handle Status_CDD */
\r
212 if (Pico_mcd->scd.Status_CDD != TRAY_OPEN)
\r
213 Pico_mcd->scd.Status_CDD = READY;
\r
229 PICO_INTERNAL void Change_CD(void)
\r
231 if (Pico_mcd->scd.Status_CDD == TRAY_OPEN) Close_Tray_CDD_cC();
\r
232 else Open_Tray_CDD_cD();
\r
236 PICO_INTERNAL int Get_Status_CDD_c0(void)
\r
238 cdprintf("Status command : Cur LBA = %d", Pico_mcd->scd.Cur_LBA);
\r
240 // Clear immediat status
\r
241 if ((Pico_mcd->cdd.Status & 0x0F00) == 0x0200)
\r
242 Pico_mcd->cdd.Status = (Pico_mcd->scd.Status_CDD & 0xFF00) | (Pico_mcd->cdd.Status & 0x00FF);
\r
243 else if ((Pico_mcd->cdd.Status & 0x0F00) == 0x0700)
\r
244 Pico_mcd->cdd.Status = (Pico_mcd->scd.Status_CDD & 0xFF00) | (Pico_mcd->cdd.Status & 0x00FF);
\r
245 else if ((Pico_mcd->cdd.Status & 0x0F00) == 0x0E00)
\r
246 Pico_mcd->cdd.Status = (Pico_mcd->scd.Status_CDD & 0xFF00) | (Pico_mcd->cdd.Status & 0x00FF);
\r
248 Pico_mcd->scd.CDD_Complete = 1;
\r
254 PICO_INTERNAL int Stop_CDD_c1(void)
\r
258 Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
\r
260 if (CD_Present) Pico_mcd->scd.Status_CDD = STOPPED;
\r
261 else Pico_mcd->scd.Status_CDD = NOCD;
\r
262 Pico_mcd->cdd.Status = 0x0000;
\r
264 Pico_mcd->s68k_regs[0x36] |= 0x01; // Data bit set because stopped
\r
266 Pico_mcd->cdd.Minute = 0;
\r
267 Pico_mcd->cdd.Seconde = 0;
\r
268 Pico_mcd->cdd.Frame = 0;
\r
269 Pico_mcd->cdd.Ext = 0;
\r
271 Pico_mcd->scd.CDD_Complete = 1;
\r
277 PICO_INTERNAL int Get_Pos_CDD_c20(void)
\r
281 cdprintf("command 200 : Cur LBA = %d", Pico_mcd->scd.Cur_LBA);
\r
285 Pico_mcd->cdd.Status &= 0xFF;
\r
288 Pico_mcd->scd.Status_CDD = NOCD;
\r
289 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
291 // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
292 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
294 cdprintf("Status CDD = %.4X Status = %.4X", Pico_mcd->scd.Status_CDD, Pico_mcd->cdd.Status);
\r
296 LBA_to_MSF(Pico_mcd->scd.Cur_LBA, &MSF);
\r
298 Pico_mcd->cdd.Minute = INT_TO_BCDW(MSF.M);
\r
299 Pico_mcd->cdd.Seconde = INT_TO_BCDW(MSF.S);
\r
300 Pico_mcd->cdd.Frame = INT_TO_BCDW(MSF.F);
\r
301 Pico_mcd->cdd.Ext = 0;
\r
303 Pico_mcd->scd.CDD_Complete = 1;
\r
309 PICO_INTERNAL int Get_Track_Pos_CDD_c21(void)
\r
314 cdprintf("command 201 : Cur LBA = %d", Pico_mcd->scd.Cur_LBA);
\r
318 Pico_mcd->cdd.Status &= 0xFF;
\r
321 Pico_mcd->scd.Status_CDD = NOCD;
\r
322 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
324 // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
325 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
327 elapsed_time = Pico_mcd->scd.Cur_LBA - Track_to_LBA(LBA_to_Track(Pico_mcd->scd.Cur_LBA));
\r
328 LBA_to_MSF(elapsed_time - 150, &MSF);
\r
330 cdprintf(" elapsed = %d", elapsed_time);
\r
332 Pico_mcd->cdd.Minute = INT_TO_BCDW(MSF.M);
\r
333 Pico_mcd->cdd.Seconde = INT_TO_BCDW(MSF.S);
\r
334 Pico_mcd->cdd.Frame = INT_TO_BCDW(MSF.F);
\r
335 Pico_mcd->cdd.Ext = 0;
\r
337 Pico_mcd->scd.CDD_Complete = 1;
\r
343 PICO_INTERNAL int Get_Current_Track_CDD_c22(void)
\r
345 cdprintf("Status CDD = %.4X Status = %.4X", Pico_mcd->scd.Status_CDD, Pico_mcd->cdd.Status);
\r
349 Pico_mcd->cdd.Status &= 0xFF;
\r
352 Pico_mcd->scd.Status_CDD = NOCD;
\r
353 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
355 // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
356 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
358 Pico_mcd->scd.Cur_Track = LBA_to_Track(Pico_mcd->scd.Cur_LBA);
\r
360 if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02;
\r
361 else Pico_mcd->cdd.Minute = INT_TO_BCDW(Pico_mcd->scd.Cur_Track);
\r
362 Pico_mcd->cdd.Seconde = 0;
\r
363 Pico_mcd->cdd.Frame = 0;
\r
364 Pico_mcd->cdd.Ext = 0;
\r
366 Pico_mcd->scd.CDD_Complete = 1;
\r
372 PICO_INTERNAL int Get_Total_Lenght_CDD_c23(void)
\r
376 Pico_mcd->cdd.Status &= 0xFF;
\r
379 Pico_mcd->scd.Status_CDD = NOCD;
\r
380 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
382 // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
383 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
385 Pico_mcd->cdd.Minute = INT_TO_BCDW(Pico_mcd->TOC.Tracks[Pico_mcd->TOC.Last_Track].MSF.M);
\r
386 Pico_mcd->cdd.Seconde = INT_TO_BCDW(Pico_mcd->TOC.Tracks[Pico_mcd->TOC.Last_Track].MSF.S);
\r
387 Pico_mcd->cdd.Frame = INT_TO_BCDW(Pico_mcd->TOC.Tracks[Pico_mcd->TOC.Last_Track].MSF.F);
\r
388 Pico_mcd->cdd.Ext = 0;
\r
390 Pico_mcd->scd.CDD_Complete = 1;
\r
396 PICO_INTERNAL int Get_First_Last_Track_CDD_c24(void)
\r
400 Pico_mcd->cdd.Status &= 0xFF;
\r
403 Pico_mcd->scd.Status_CDD = NOCD;
\r
405 // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
406 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
408 Pico_mcd->cdd.Minute = INT_TO_BCDW(1);
\r
409 Pico_mcd->cdd.Seconde = INT_TO_BCDW(Pico_mcd->TOC.Last_Track);
\r
410 Pico_mcd->cdd.Frame = 0;
\r
411 Pico_mcd->cdd.Ext = 0;
\r
413 Pico_mcd->scd.CDD_Complete = 1;
\r
419 PICO_INTERNAL int Get_Track_Adr_CDD_c25(void)
\r
425 // track number in TC4 & TC5
\r
427 track_number = (Pico_mcd->s68k_regs[0x38+10+4] & 0xF) * 10 + (Pico_mcd->s68k_regs[0x38+10+5] & 0xF);
\r
429 Pico_mcd->cdd.Status &= 0xFF;
\r
432 Pico_mcd->scd.Status_CDD = NOCD;
\r
433 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
435 // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
436 Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD;
\r
438 if (track_number > Pico_mcd->TOC.Last_Track) track_number = Pico_mcd->TOC.Last_Track;
\r
439 else if (track_number < 1) track_number = 1;
\r
441 Pico_mcd->cdd.Minute = INT_TO_BCDW(Pico_mcd->TOC.Tracks[track_number - 1].MSF.M);
\r
442 Pico_mcd->cdd.Seconde = INT_TO_BCDW(Pico_mcd->TOC.Tracks[track_number - 1].MSF.S);
\r
443 Pico_mcd->cdd.Frame = INT_TO_BCDW(Pico_mcd->TOC.Tracks[track_number - 1].MSF.F);
\r
444 Pico_mcd->cdd.Ext = track_number % 10;
\r
446 if (track_number == 1) Pico_mcd->cdd.Frame |= 0x0800; // data track
\r
448 Pico_mcd->scd.CDD_Complete = 1;
\r
453 PICO_INTERNAL int Play_CDD_c3(void)
\r
456 int delay, new_lba;
\r
461 // MSF of the track to play in TC buffer
\r
463 MSF.M = (Pico_mcd->s68k_regs[0x38+10+2] & 0xF) * 10 + (Pico_mcd->s68k_regs[0x38+10+3] & 0xF);
\r
464 MSF.S = (Pico_mcd->s68k_regs[0x38+10+4] & 0xF) * 10 + (Pico_mcd->s68k_regs[0x38+10+5] & 0xF);
\r
465 MSF.F = (Pico_mcd->s68k_regs[0x38+10+6] & 0xF) * 10 + (Pico_mcd->s68k_regs[0x38+10+7] & 0xF);
\r
467 Pico_mcd->scd.Cur_Track = MSF_to_Track(&MSF);
\r
469 new_lba = MSF_to_LBA(&MSF);
\r
470 delay = new_lba - Pico_mcd->scd.Cur_LBA;
\r
471 if (delay < 0) delay = -delay;
\r
474 Pico_mcd->scd.Cur_LBA = new_lba;
\r
475 CDC_Update_Header();
\r
477 cdprintf("Read : Cur LBA = %d, M=%d, S=%d, F=%d", Pico_mcd->scd.Cur_LBA, MSF.M, MSF.S, MSF.F);
\r
479 if (Pico_mcd->scd.Status_CDD != PLAYING) delay += 20;
\r
481 Pico_mcd->scd.Status_CDD = PLAYING;
\r
482 Pico_mcd->cdd.Status = 0x0102;
\r
483 // Pico_mcd->cdd.Status = COMM_OK;
\r
485 if (Pico_mcd->scd.File_Add_Delay == 0) Pico_mcd->scd.File_Add_Delay = delay;
\r
487 if (Pico_mcd->scd.Cur_Track == 1)
\r
489 Pico_mcd->s68k_regs[0x36] |= 0x01; // DATA
\r
493 Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO
\r
497 if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02;
\r
498 else Pico_mcd->cdd.Minute = INT_TO_BCDW(Pico_mcd->scd.Cur_Track);
\r
499 Pico_mcd->cdd.Seconde = 0;
\r
500 Pico_mcd->cdd.Frame = 0;
\r
501 Pico_mcd->cdd.Ext = 0;
\r
503 Pico_mcd->scd.Status_CDC |= 1; // Read data with CDC
\r
505 Pico_mcd->scd.CDD_Complete = 1;
\r
510 PICO_INTERNAL int Seek_CDD_c4(void)
\r
517 // MSF to seek in TC buffer
\r
519 MSF.M = (Pico_mcd->s68k_regs[0x38+10+2] & 0xF) * 10 + (Pico_mcd->s68k_regs[0x38+10+3] & 0xF);
\r
520 MSF.S = (Pico_mcd->s68k_regs[0x38+10+4] & 0xF) * 10 + (Pico_mcd->s68k_regs[0x38+10+5] & 0xF);
\r
521 MSF.F = (Pico_mcd->s68k_regs[0x38+10+6] & 0xF) * 10 + (Pico_mcd->s68k_regs[0x38+10+7] & 0xF);
\r
523 Pico_mcd->scd.Cur_Track = MSF_to_Track(&MSF);
\r
524 Pico_mcd->scd.Cur_LBA = MSF_to_LBA(&MSF);
\r
525 CDC_Update_Header();
\r
527 Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
\r
529 Pico_mcd->scd.Status_CDD = READY;
\r
530 Pico_mcd->cdd.Status = 0x0200;
\r
533 if (Pico_mcd->scd.Cur_Track == 1)
\r
534 Pico_mcd->s68k_regs[0x36] |= 0x01;
\r
535 else Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO
\r
537 Pico_mcd->cdd.Minute = 0;
\r
538 Pico_mcd->cdd.Seconde = 0;
\r
539 Pico_mcd->cdd.Frame = 0;
\r
540 Pico_mcd->cdd.Ext = 0;
\r
542 Pico_mcd->scd.CDD_Complete = 1;
\r
548 PICO_INTERNAL int Pause_CDD_c6(void)
\r
553 Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read to start a new one if raw data
\r
555 Pico_mcd->scd.Status_CDD = READY;
\r
556 Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD;
\r
558 Pico_mcd->s68k_regs[0x36] |= 0x01; // Data bit set because stopped
\r
560 Pico_mcd->cdd.Minute = 0;
\r
561 Pico_mcd->cdd.Seconde = 0;
\r
562 Pico_mcd->cdd.Frame = 0;
\r
563 Pico_mcd->cdd.Ext = 0;
\r
565 Pico_mcd->scd.CDD_Complete = 1;
\r
571 PICO_INTERNAL int Resume_CDD_c7(void)
\r
576 Pico_mcd->scd.Cur_Track = LBA_to_Track(Pico_mcd->scd.Cur_LBA);
\r
581 LBA_to_MSF(Pico_mcd->scd.Cur_LBA, &MSF);
\r
582 cdprintf("Resume read : Cur LBA = %d, M=%d, S=%d, F=%d", Pico_mcd->scd.Cur_LBA, MSF.M, MSF.S, MSF.F);
\r
586 Pico_mcd->scd.Status_CDD = PLAYING;
\r
587 Pico_mcd->cdd.Status = 0x0102;
\r
589 if (Pico_mcd->scd.Cur_Track == 1)
\r
591 Pico_mcd->s68k_regs[0x36] |= 0x01; // DATA
\r
595 Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO
\r
599 if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02;
\r
600 else Pico_mcd->cdd.Minute = INT_TO_BCDW(Pico_mcd->scd.Cur_Track);
\r
601 Pico_mcd->cdd.Seconde = 0;
\r
602 Pico_mcd->cdd.Frame = 0;
\r
603 Pico_mcd->cdd.Ext = 0;
\r
605 Pico_mcd->scd.Status_CDC |= 1; // Read data with CDC
\r
607 Pico_mcd->scd.CDD_Complete = 1;
\r
612 PICO_INTERNAL int Fast_Foward_CDD_c8(void)
\r
617 Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
\r
619 Pico_mcd->scd.Status_CDD = FAST_FOW;
\r
620 Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD | 2;
\r
622 Pico_mcd->cdd.Minute = INT_TO_BCDW(Pico_mcd->scd.Cur_Track);
\r
623 Pico_mcd->cdd.Seconde = 0;
\r
624 Pico_mcd->cdd.Frame = 0;
\r
625 Pico_mcd->cdd.Ext = 0;
\r
627 Pico_mcd->scd.CDD_Complete = 1;
\r
633 PICO_INTERNAL int Fast_Rewind_CDD_c9(void)
\r
638 Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
\r
640 Pico_mcd->scd.Status_CDD = FAST_REV;
\r
641 Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD | 2;
\r
643 Pico_mcd->cdd.Minute = INT_TO_BCDW(Pico_mcd->scd.Cur_Track);
\r
644 Pico_mcd->cdd.Seconde = 0;
\r
645 Pico_mcd->cdd.Frame = 0;
\r
646 Pico_mcd->cdd.Ext = 0;
\r
648 Pico_mcd->scd.CDD_Complete = 1;
\r
654 PICO_INTERNAL int Close_Tray_CDD_cC(void)
\r
656 Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
\r
658 elprintf(EL_STATUS, "tray close\n");
\r
660 if (PicoMCDcloseTray != NULL)
\r
661 PicoMCDcloseTray();
\r
663 Pico_mcd->scd.Status_CDD = CD_Present ? STOPPED : NOCD;
\r
664 Pico_mcd->cdd.Status = 0x0000;
\r
666 Pico_mcd->cdd.Minute = 0;
\r
667 Pico_mcd->cdd.Seconde = 0;
\r
668 Pico_mcd->cdd.Frame = 0;
\r
669 Pico_mcd->cdd.Ext = 0;
\r
671 Pico_mcd->scd.CDD_Complete = 1;
\r
677 PICO_INTERNAL int Open_Tray_CDD_cD(void)
\r
681 Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
\r
683 elprintf(EL_STATUS, "tray open\n");
\r
688 if (PicoMCDopenTray != NULL)
\r
691 Pico_mcd->scd.Status_CDD = TRAY_OPEN;
\r
692 Pico_mcd->cdd.Status = 0x0E00;
\r
694 Pico_mcd->cdd.Minute = 0;
\r
695 Pico_mcd->cdd.Seconde = 0;
\r
696 Pico_mcd->cdd.Frame = 0;
\r
697 Pico_mcd->cdd.Ext = 0;
\r
699 Pico_mcd->scd.CDD_Complete = 1;
\r
705 PICO_INTERNAL int CDD_cA(void)
\r
710 Pico_mcd->scd.Status_CDC &= ~1;
\r
712 Pico_mcd->scd.Status_CDD = READY;
\r
713 Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD;
\r
715 Pico_mcd->cdd.Minute = 0;
\r
716 Pico_mcd->cdd.Seconde = INT_TO_BCDW(1);
\r
717 Pico_mcd->cdd.Frame = INT_TO_BCDW(1);
\r
718 Pico_mcd->cdd.Ext = 0;
\r
720 Pico_mcd->scd.CDD_Complete = 1;
\r
726 PICO_INTERNAL int CDD_Def(void)
\r
728 Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD;
\r
730 Pico_mcd->cdd.Minute = 0;
\r
731 Pico_mcd->cdd.Seconde = 0;
\r
732 Pico_mcd->cdd.Frame = 0;
\r
733 Pico_mcd->cdd.Ext = 0;
\r