Explorar el Código

Added mode page 0x0D and a vendor-specific way to stop playback.

saybur hace 2 años
padre
commit
9e2b1a4a6a
Se han modificado 2 ficheros con 44 adiciones y 0 borrados
  1. 22 0
      lib/SCSI2SD/src/firmware/mode.c
  2. 22 0
      src/BlueSCSI_cdrom.cpp

+ 22 - 0
lib/SCSI2SD/src/firmware/mode.c

@@ -221,6 +221,16 @@ static const uint8_t ControlModePage[] =
 };
 
 #ifdef ENABLE_AUDIO_OUTPUT
+static const uint8_t CDROMCDParametersPage[] =
+{
+0x0D, // page code
+0x06, // page length
+0x00, // reserved
+0x0D, // reserved, inactivity time 8 min
+0x00, 0x3C, // 60 seconds per MSF M unit
+0x00, 0x4B  // 75 frames per MSF S unit
+};
+
 static const uint8_t CDROMAudioControlParametersPage[] =
 {
 0x0E, // page code
@@ -514,6 +524,18 @@ static void doModeSense(
 	}
 
 #ifdef ENABLE_AUDIO_OUTPUT
+	if ((scsiDev.target->cfg->deviceType == S2S_CFG_OPTICAL)
+		&& (pageCode == 0x0D || pageCode == 0x3F))
+	{
+		pageFound = 1;
+		pageIn(
+			pc,
+			idx,
+			CDROMCDParametersPage,
+			sizeof(CDROMCDParametersPage));
+		idx += sizeof(CDROMCDParametersPage);
+	}
+
 	if ((scsiDev.target->cfg->deviceType == S2S_CFG_OPTICAL)
 		&& (pageCode == 0x0E || pageCode == 0x3F))
 	{

+ 22 - 0
src/BlueSCSI_cdrom.cpp

@@ -1065,6 +1065,19 @@ static void doPauseResumeAudio(bool resume)
 #endif
 }
 
+static void doStopAudio()
+{
+    debuglog("------ CD-ROM Stop Audio request");
+#ifdef ENABLE_AUDIO_OUTPUT
+    image_config_t &img = *(image_config_t*)scsiDev.target->cfg;
+    uint8_t target_id = img.scsiId & 7;
+    audio_stop(target_id);
+#endif
+
+    scsiDev.status = 0;
+    scsiDev.phase = STATUS;
+}
+
 static void doMechanismStatus(uint16_t allocation_length)
 {
     uint8_t *buf = scsiDev.data;
@@ -1337,6 +1350,7 @@ static void doReadSubchannel(bool time, bool subq, uint8_t parameter, uint8_t tr
             if (time)
             {
                 LBA2MSF(lba, buf);
+                debuglog("------ ABS M ", *(buf+1), " S ", *(buf+2), " F ", *(buf+3));
                 *buf += 4;
             }
             else
@@ -1351,6 +1365,7 @@ static void doReadSubchannel(bool time, bool subq, uint8_t parameter, uint8_t tr
             if (time)
             {
                 LBA2MSF(relpos, buf);
+                debuglog("------ REL M ", *(buf+1), " S ", *(buf+2), " F ", *(buf+3));
                 *buf += 4;
             }
             else
@@ -1612,6 +1627,13 @@ extern "C" int scsiCDRomCommand()
 
         doReadCD(lba, blocks, 0, 0x10, 0);
     }
+    else if (command == 0x01)
+    {
+        // REZERO UNIT
+        // AppleCD Audio Player uses this as a nonstandard
+        // "stop audio playback" command
+        doStopAudio();
+    }
     else
     {
         commandHandled = 0;