Simplify sun SCSI command generation

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23940 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-07-30 15:53:50 +00:00
parent 0ce80b61cb
commit 317fbd8905
1 changed files with 6 additions and 26 deletions

View File

@ -1,3 +1,4 @@
#include "libavutil/intreadwrite.h"
//=================== VideoCD ==========================
#if defined(linux) || defined(sun) || defined(__bsdi__)
@ -185,36 +186,15 @@ static int sun_vcd_read(mp_vcd_priv_t* vcd, int *offset)
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;