scdreg.h revision 13765
17332Sjkh/*- 27332Sjkh * Copyright (c) 1995 Mikael Hybsch 37332Sjkh * All rights reserved. 47332Sjkh * 57332Sjkh * Redistribution and use in source and binary forms, with or without 67332Sjkh * modification, are permitted provided that the following conditions 77332Sjkh * are met: 87332Sjkh * 1. Redistributions of source code must retain the above copyright 97332Sjkh * notice, this list of conditions and the following disclaimer 107332Sjkh * in this position and unchanged. 117332Sjkh * 2. Redistributions in binary form must reproduce the above copyright 127332Sjkh * notice, this list of conditions and the following disclaimer in the 137332Sjkh * documentation and/or other materials provided with the distribution. 147332Sjkh * 3. The name of the author may not be used to endorse or promote products 1513765Smpp * derived from this software without specific prior written permission 167332Sjkh * 177332Sjkh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 187332Sjkh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 197332Sjkh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 207332Sjkh * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 217332Sjkh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 227332Sjkh * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 237332Sjkh * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 247332Sjkh * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 257332Sjkh * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 267332Sjkh * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 277332Sjkh * 2813765Smpp * $Id: scdreg.h,v 1.1 1995/03/24 18:33:02 jkh Exp $ 297332Sjkh * 307332Sjkh */ 317332Sjkh 327332Sjkh#ifndef SCD_H 337332Sjkh#define SCD_H 347332Sjkh 357332Sjkh#ifdef __GNUC__ 367332Sjkh#if __GNUC__ >= 2 377332Sjkh#pragma pack(1) 387332Sjkh#endif 397332Sjkh#endif 407332Sjkh 417332Sjkhtypedef unsigned char bcd_t; 427332Sjkh#define M_msf(msf) msf[0] 437332Sjkh#define S_msf(msf) msf[1] 447332Sjkh#define F_msf(msf) msf[2] 457332Sjkh 467332Sjkh#define IS_ATTENTION(port) ((inb(port+IREG_STATUS) & SBIT_ATTENTION) != 0) 477332Sjkh#define IS_BUSY(port) ((inb(port+IREG_STATUS) & SBIT_BUSY) != 0) 487332Sjkh#define IS_DATA_RDY(port) ((inb(port+IREG_STATUS) & SBIT_DATA_READY) != 0) 497332Sjkh#define STATUS_BIT(port, bit) ((inb(port+IREG_STATUS) & (bit)) != 0) 507332Sjkh#define FSTATUS_BIT(port, bit) ((inb(port+IREG_FSTATUS) & (bit)) != 0) 517332Sjkh 527332Sjkh#define OREG_COMMAND 0 537332Sjkh#define OREG_WPARAMS 1 547332Sjkh#define OREG_CONTROL 3 557332Sjkh#define CBIT_ATTENTION_CLEAR 0x01 567332Sjkh#define CBIT_RESULT_READY_CLEAR 0x02 577332Sjkh#define CBIT_DATA_READY_CLEAR 0x04 587332Sjkh#define CBIT_RPARAM_CLEAR 0x40 597332Sjkh#define CBIT_RESET_DRIVE 0x80 607332Sjkh 617332Sjkh#define IREG_STATUS 0 627332Sjkh#define SBIT_ATTENTION 0x01 637332Sjkh#define SBIT_RESULT_READY 0x02 647332Sjkh#define SBIT_DATA_READY 0x04 657332Sjkh#define SBIT_BUSY 0x80 667332Sjkh 677332Sjkh#define IREG_RESULT 1 687332Sjkh#define IREG_DATA 2 697332Sjkh#define IREG_FSTATUS 3 707332Sjkh#define FBIT_WPARAM_READY 0x01 717332Sjkh 727332Sjkh#define CMD_GET_DRIVE_CONFIG 0x00 737332Sjkh#define CMD_SET_DRIVE_PARAM 0x10 747332Sjkh#define CMD_GET_SUBCHANNEL_DATA 0x21 757332Sjkh#define CMD_GET_TOC 0x24 767332Sjkh#define CMD_READ_TOC 0x30 777332Sjkh#define CMD_READ 0x34 787332Sjkh#define CMD_PLAY_AUDIO 0x40 797332Sjkh#define CMD_STOP_AUDIO 0x41 807332Sjkh#define CMD_EJECT 0x50 817332Sjkh#define CMD_SPIN_UP 0x51 827332Sjkh#define CMD_SPIN_DOWN 0x52 837332Sjkh 847332Sjkh#define ERR_CD_NOT_LOADED 0x20 857332Sjkh#define ERR_NO_CD_INSIDE 0x21 867332Sjkh#define ERR_NOT_SPINNING 0x22 877332Sjkh#define ERR_FATAL_READ_ERROR1 0x53 887332Sjkh#define ERR_FATAL_READ_ERROR2 0x57 897332Sjkh 907332Sjkh#define ATTEN_DRIVE_LOADED 0x80 917332Sjkh#define ATTEN_EJECT_PUSHED 0x81 927332Sjkh#define ATTEN_AUDIO_DONE 0x90 937332Sjkh#define ATTEN_SPIN_UP_DONE 0x24 947332Sjkh#define ATTEN_SPIN_DOWN 0x27 957332Sjkh#define ATTEN_EJECT_DONE 0x28 967332Sjkh 977332Sjkh 987332Sjkhstruct sony_drive_configuration { 997332Sjkh char vendor[8]; 1007332Sjkh char product[16]; 1017332Sjkh char revision[8]; 1027332Sjkh u_short config; 1037332Sjkh}; 1047332Sjkh 1057332Sjkh/* Almost same as cd_sub_channel_position_data */ 1067332Sjkhstruct sony_subchannel_position_data { 1077332Sjkh u_char control:4; 1087332Sjkh u_char addr_type:4; 1097332Sjkh u_char track_number; 1107332Sjkh u_char index_number; 1117332Sjkh u_char rel_msf[3]; 1127332Sjkh u_char dummy; 1137332Sjkh u_char abs_msf[3]; 1147332Sjkh}; 1157332Sjkh 1167332Sjkhstruct sony_tracklist { 1177332Sjkh u_char adr :4; /* xcdplayer needs these two values */ 1187332Sjkh u_char ctl :4; 1197332Sjkh u_char track; 1207332Sjkh u_char start_msf[3]; 1217332Sjkh}; 1227332Sjkh 1237332Sjkh#define MAX_TRACKS 100 1247332Sjkh 1257332Sjkhstruct sony_toc { 1267332Sjkh u_char session_number; 1277332Sjkh 1287332Sjkh u_char :8; 1297332Sjkh u_char :8; 1307332Sjkh u_char first_track; 1317332Sjkh u_char :8; 1327332Sjkh u_char :8; 1337332Sjkh 1347332Sjkh u_char :8; 1357332Sjkh u_char :8; 1367332Sjkh u_char last_track; 1377332Sjkh u_char :8; 1387332Sjkh u_char :8; 1397332Sjkh 1407332Sjkh u_char :8; 1417332Sjkh u_char :8; 1427332Sjkh u_char lead_out_start_msf[3]; 1437332Sjkh 1447332Sjkh struct sony_tracklist tracks[MAX_TRACKS]; 1457332Sjkh 1467332Sjkh /* The rest is just to take space in case all data is returned */ 1477332Sjkh 1487332Sjkh u_char dummy[6*9]; 1497332Sjkh}; 1507332Sjkh 1517332Sjkh#endif /* SCD_H */ 152