Return to BSD News archive
Newsgroups: comp.unix.bsd Path: sserve!manuel!munnari.oz.au!network.ucsd.edu!usc!wupost!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!tfs.com!tfs.com!julian From: julian@tfs.com (Julian Elischer) Subject: New scsi system beta3 (part 6 of 10) Message-ID: <1992Oct3.040153.13752@tfs.com> Organization: TRW Financial Systems Date: Sat, 3 Oct 1992 04:01:53 GMT Lines: 448 # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # sys/cdio.h # scsi/scsi_cd.h # echo x - sys/cdio.h sed 's/^X//' >sys/cdio.h << 'END-of-sys/cdio.h' X X X/* Shared between kernel & process */ X Xstruct cd_toc_entry { X u_char :8; X u_char control:4; X u_char addr_type:4; X u_char track; X u_char :8; X u_char addr[4]; X}; X Xstruct cd_sub_channel_header { X u_char :8; X u_char audio_status; X#define CD_AS_AUDIO_INVALID 0x00 X#define CD_AS_PLAY_IN_PROGRESS 0x11 X#define CD_AS_PLAY_PAUSED 0x12 X#define CD_AS_PLAY_COMPLETED 0x13 X#define CD_AS_PLAY_ERROR 0x14 X#define CD_AS_NO_STATUS 0x15 X u_char data_len[2]; X}; X Xstruct cd_sub_channel_position_data { X u_char data_format; X u_char control:4; X u_char addr_type:4; X u_char track_number; X u_char index_number; X u_char absaddr[4]; X u_char reladdr[4]; X}; X Xstruct cd_sub_channel_media_catalog { X u_char data_format; X u_char :8; X u_char :8; X u_char :8; X u_char :7; X u_char mc_valid:1; X u_char mc_number[15]; X}; X Xstruct cd_sub_channel_track_info { X u_char data_format; X u_char :8; X u_char track_number; X u_char :8; X u_char :7; X u_char ti_valid:1; X u_char ti_number[15]; X}; X Xstruct cd_sub_channel_info { X struct cd_sub_channel_header header; X union { X struct cd_sub_channel_position_data position; X struct cd_sub_channel_media_catalog media_catalog; X struct cd_sub_channel_track_info track_info; X } what; X}; X X/***************************************************************\ X* Ioctls for the CD drive * X\***************************************************************/ Xstruct ioc_play_track X{ X u_char start_track; X u_char start_index; X u_char end_track; X u_char end_index; X}; X X#define CDIOCPLAYTRACKS _IOW('c',1,struct ioc_play_track) Xstruct ioc_play_blocks X{ X int blk; X int len; X}; X#define CDIOCPLAYBLOCKS _IOW('c',2,struct ioc_play_blocks) X Xstruct ioc_read_subchannel { X u_char address_format; X#define CD_LBA_FORMAT 1 X#define CD_MSF_FORMAT 2 X u_char data_format; X#define CD_SUBQ_DATA 0 X#define CD_CURRENT_POSITION 1 X#define CD_MEDIA_CATALOG 2 X#define CD_TRACK_INFO 3 X u_char track; X int data_len; X struct cd_sub_channel_info *data; X}; X#define CDIOCREADSUBCHANNEL _IOWR('c', 3 , struct ioc_read_subchannel ) X X Xstruct ioc_toc_header { X u_short len; X u_char starting_track; X u_char ending_track; X}; X X#define CDIOREADTOCHEADER _IOR('c',4,struct ioc_toc_header) X Xstruct ioc_read_toc_entry { X u_char address_format; X u_char starting_track; X u_short data_len; X struct cd_toc_entry *data; X}; X#define CDIOREADTOCENTRYS _IOWR('c',5,struct ioc_read_toc_entry) X Xstruct ioc_patch X{ X u_char patch[4]; /* one for each channel */ X}; X#define CDIOCSETPATCH _IOW('c',9,struct ioc_patch) Xstruct ioc_vol X{ X u_char vol[4]; /* one for each channel */ X}; X#define CDIOCGETVOL _IOR('c',10,struct ioc_vol) X#define CDIOCSETVOL _IOW('c',11,struct ioc_vol) X#define CDIOCSETMONO _IO('c',12) X#define CDIOCSETSTERIO _IO('c',13) X#define CDIOCSETMUTE _IO('c',14) X#define CDIOCSETLEFT _IO('c',15) X#define CDIOCSETRIGHT _IO('c',16) X#define CDIOCSETDEBUG _IO('c',17) X#define CDIOCCLRDEBUG _IO('c',18) X#define CDIOCPAUSE _IO('c',19) X#define CDIOCRESUME _IO('c',20) X#define CDIOCRESET _IO('c',21) X#define CDIOCSTART _IO('c',22) X#define CDIOCSTOP _IO('c',23) X#define CDIOCEJECT _IO('c',24) X X X END-of-sys/cdio.h echo x - scsi/scsi_cd.h sed 's/^X//' >scsi/scsi_cd.h << 'END-of-scsi/scsi_cd.h' X/* X * Written by Julian Elischer (julian@tfs.com) X * for TRW Financial Systems. X * X * TRW Financial Systems, in accordance with their agreement with Carnegie X * Mellon University, makes this software available to CMU to distribute X * or use in any manner that they see fit as long as this message is kept with X * the software. For this reason TFS also grants any other persons or X * organisations permission to use or modify this software. X * X * TFS supplies this software to be publicly redistributed X * on the understanding that TFS is not responsible for the correct X * functioning of this software in any circumstances. X * X */ X X X X/* X * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 X */ X X/* X * SCSI command format X */ X Xstruct scsi_read_capacity_cd X{ X u_char op_code; X u_char :5; X u_char lun:3; X u_char addr_3; /* Most Significant */ X u_char addr_2; X u_char addr_1; X u_char addr_0; /* Least Significant */ X u_char unused[3]; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_pause X{ X u_char op_code; X u_char :5; X u_char lun:3; X u_char unused[6]; X u_char resume:1; X u_char :7; X u_char link:1; X u_char flag:1; X u_char :6; X}; X#define PA_PAUSE 1 X#define PA_RESUME 0 X Xstruct scsi_play_msf X{ X u_char op_code; X u_char :5; X u_char lun:3; X u_char unused; X u_char start_m; X u_char start_s; X u_char start_f; X u_char end_m; X u_char end_s; X u_char end_f; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_play_track X{ X u_char op_code; X u_char :5; X u_char lun:3; X u_char unused[2]; X u_char start_track; X u_char start_index; X u_char unused1; X u_char end_track; X u_char end_index; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_play X{ X u_char op_code; X u_char reladdr:1; X u_char :4; X u_char lun:3; X u_char blk_addr[4]; X u_char unused; X u_char xfer_len[2]; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_play_big X{ X u_char op_code; X u_char reladdr:1; X u_char :4; X u_char lun:3; X u_char blk_addr[4]; X u_char xfer_len[4]; X u_char unused; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_play_rel_big X{ X u_char op_code; X u_char reladdr:1; X u_char :4; X u_char lun:3; X u_char blk_addr[4]; X u_char xfer_len[4]; X u_char track; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_read_header X{ X u_char op_code; X u_char :1; X u_char msf:1; X u_char :3; X u_char lun:3; X u_char blk_addr[4]; X u_char unused; X u_char data_len[2]; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_read_subchannel X{ X u_char op_code; X u_char :1; X u_char msf:1; X u_char :3; X u_char lun:3; X u_char :6; X u_char subQ:1; X u_char :1; X u_char subchan_format; X u_char unused[2]; X u_char track; X u_char data_len[2]; X u_char link:1; X u_char flag:1; X u_char :6; X}; X Xstruct scsi_read_toc X{ X u_char op_code; X u_char :1; X u_char msf:1; X u_char :3; X u_char lun:3; X u_char unused[4]; X u_char from_track; X u_char data_len[2]; X u_char link:1; X u_char flag:1; X u_char :6; X}; X; X Xstruct scsi_read_cd_capacity X{ X u_char op_code; X u_char :5; X u_char lun:3; X u_char addr_3; /* Most Significant */ X u_char addr_2; X u_char addr_1; X u_char addr_0; /* Least Significant */ X u_char unused[3]; X u_char link:1; X u_char flag:1; X u_char :6; X}; X X/* X * Opcodes X */ X X#define READ_CD_CAPACITY 0x25 /* slightly different from disk */ X#define READ_SUBCHANNEL 0x42 /* cdrom read Subchannel */ X#define READ_TOC 0x43 /* cdrom read TOC */ X#define READ_HEADER 0x44 /* cdrom read header */ X#define PLAY 0x45 /* cdrom play 'play audio' mode */ X#define PLAY_MSF 0x47 /* cdrom play Min,Sec,Frames mode */ X#define PLAY_TRACK 0x48 /* cdrom play track/index mode */ X#define PLAY_TRACK_REL 0x49 /* cdrom play track/index mode */ X#define PAUSE 0x4b /* cdrom pause in 'play audio' mode */ X#define PLAY_BIG 0xa5 /* cdrom pause in 'play audio' mode */ X#define PLAY_TRACK_REL_BIG 0xa9 /* cdrom play track/index mode */ X X Xstruct cd_inquiry_data /* in case there is some special info */ X{ X u_char device_type:5; X u_char device_qualifier:3; X u_char dev_qual2:7; X u_char removable:1; X u_char ansii_version:3; X u_char :5; X u_char response_format; X u_char additional_length; X u_char unused[2]; X u_char :3; X u_char can_link:1; X u_char can_sync:1; X u_char :3; X char vendor[8]; X char product[16]; X char revision[4]; X u_char extra[8]; X}; X Xstruct scsi_read_cd_cap_data X{ X u_char addr_3; /* Most significant */ X u_char addr_2; X u_char addr_1; X u_char addr_0; /* Least significant */ X u_char length_3; /* Most significant */ X u_char length_2; X u_char length_1; X u_char length_0; /* Least significant */ X}; X Xunion cd_pages X{ X#define AUDIO_PAGE 0x0e X struct audio_page X { X u_char page_code:6; X u_char :1; X u_char ps:1; X u_char param_len; X u_char :1; X u_char sotc:1; X u_char immed:1; X u_char :5; X u_char unused[2]; X u_char format_lba:4; X u_char :3; X u_char apr_valid:1; X u_char lb_per_sec[2]; X struct port_control X { X u_char channels:4; X#define CHANNEL_0 1 X#define CHANNEL_1 2 X#define CHANNEL_2 4 X#define CHANNEL_3 8 X#define LEFT_CHANNEL CHANNEL_0 X#define RIGHT_CHANNEL CHANNEL_1 X u_char :4; X u_char volume; X } port[4]; X#define LEFT_PORT 0 X#define RIGHT_PORT 1 X }audio; X}; X Xstruct cd_mode_data X{ X struct scsi_mode_header header; X struct blk_desc blk_desc; X union cd_pages page; X}; X END-of-scsi/scsi_cd.h exit