changeset 23920:bbf984f520af

Simplify sun SCSI command generation
author reimar
date Mon, 30 Jul 2007 15:53:50 +0000
parents 440d23a28592
children 70cc4846c885
files stream/vcd_read.h
diffstat 1 files changed, 6 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/stream/vcd_read.h	Mon Jul 30 15:47:17 2007 +0000
+++ b/stream/vcd_read.h	Mon Jul 30 15:53:50 2007 +0000
@@ -1,3 +1,4 @@
+#include "libavutil/intreadwrite.h"
 //=================== VideoCD ==========================
 #if	defined(linux) || defined(sun) || defined(__bsdi__)
 
@@ -185,36 +186,15 @@
   union scsi_cdb cdb;
   int lba = vcd_get_msf(vcd);
   int blocks = 1;
-  int sector_type;
-  int sync, header_code, user_data, edc_ecc, error_field;
-  int sub_channel;
-
-  /* sector_type = 3; *//* mode2 */
-  sector_type = 5;	/* mode2/form2 */
-  sync = 0;
-  header_code = 0;
-  user_data = 1;
-  edc_ecc = 0;
-  error_field = 0;
-  sub_channel = 0;
 
   memset(&cdb, 0, sizeof(cdb));
   memset(&sc, 0, sizeof(sc));
   cdb.scc_cmd = 0xBE;
-  cdb.cdb_opaque[1] = (sector_type) << 2;
-  cdb.cdb_opaque[2] = (lba >> 24) & 0xff;
-  cdb.cdb_opaque[3] = (lba >> 16) & 0xff;
-  cdb.cdb_opaque[4] = (lba >>  8) & 0xff;
-  cdb.cdb_opaque[5] =  lba & 0xff;
-  cdb.cdb_opaque[6] = (blocks >> 16) & 0xff;
-  cdb.cdb_opaque[7] = (blocks >>  8) & 0xff;
-  cdb.cdb_opaque[8] =  blocks & 0xff;
-  cdb.cdb_opaque[9] = (sync << 7) |
-		      (header_code << 5) |
-		      (user_data << 4) |
-		      (edc_ecc << 3) |
-		      (error_field << 1);
-  cdb.cdb_opaque[10] = sub_channel;
+  cdb.cdb_opaque[1] = 5 << 2; // mode2 / form2
+  AV_WB32(&cdb.cdb_opaque[2], lba);
+  AV_WB24(&cdb.cdb_opaque[6], blocks);
+  cdb.cdb_opaque[9] = 1 << 4; // user data only
+  cdb.cdb_opaque[10] = 0;     // subchannel
 
   sc.uscsi_cdb = (caddr_t)&cdb;
   sc.uscsi_cdblen = 12;