ftp.nice.ch/pub/next/tools/cdrom/mCD.96Sep09.s.tar.gz#/mCD/scsi_cd.subproj/cd_commands.h

This is cd_commands.h in view mode; [Download] [Up]

/*
 * cd_commands.h: header file for cd_commands.c
 *
 * This is based on the file that NeXT included in
 *      /NextDeveloper/Examples/UNIX/SCSI_CD,
 *      done by James C. Lee at NeXT, Sep 1991.
 * It has been changed "just a bit" by Garance Alistair Drosehn/March 1994.
 *
 */

#ifndef CD_COMMANDS
#define CD_COMMANDS

#import <sys/types.h>
#import <libc.h>
#import <sys/time.h>
#import "cd_toc.h"		/* declares struct cd_toc */

/* I use a copy of the NS-3.1 version of bsd/dev/scsireg.h, because
 * at some point I think I want to split it apart into "field values"
 * (such as #define DEVTYPE_DISK), and actual structure definitions.
 *                  Garance Drosehn/Mar 94
 */
/* #import <bsd/dev/scsireg.h> */
#import "scsireg_31.h"		/* garance... */

int
do_eject_1b(int fd, struct timeval * tvp, struct esense_reply * erp);
int
do_spinup_1b(int fd, struct timeval * tvp, struct esense_reply * erp);
int
do_stopunit_1b(int fd, struct timeval * tvp, struct esense_reply * erp);
int
do_pauseaudio_4b(int fd, int pause, struct esense_reply * erp);
int
do_pauseaudio_c5(int fd, int pause, struct esense_reply * erp);
int
do_preventremoval_1e(int fd, int prevent, struct esense_reply * erp);
int
do_rezerounit_01(int fd, struct esense_reply * erp);
int
do_readtoc_43(int fd, struct cd_toc * toc_all, struct esense_reply * erp);

int
do_playaudio_c8(int fd, int lba, int length, struct esense_reply * erp);

struct pa_msf {
    u_int               min:8,
                        sec:8,
                        frame:8;
};
int
do_playaudio_msf_47(int fd, struct pa_msf startmsf, struct pa_msf endmsf,
		    struct esense_reply * erp);

struct pb_status_reply {	/* playback status */
    u_char              pbs_audio_status;
    u_int               pbs_logical_block;	/* LBA format of abs time */
    u_short             pbs_hour,	/* MSF format of abs time */
                        pbs_min,
                        pbs_sec,
                        pbs_frame;
    u_char              pbs_ch0_sel,	/* volume-of-play settings */
                        pbs_ch0_vol;
    u_char              pbs_ch1_sel,
                        pbs_ch1_vol;
    u_char              pbs_ch2_sel,
                        pbs_ch2_vol;
    u_char              pbs_ch3_sel,
                        pbs_ch3_vol;
};

/* values returned for pbs_audio_status: */
#define PBS_ASTAT_PLAYING	0x00
#define PBS_ASTAT_PAUSED	0x01
#define PBS_ASTAT_MUTED		0x02	/* audio muting on */
#define PBS_ASTAT_PLAYCOMPLETE	0x03	/* previous play command just
					 * completed */
#define PBS_ASTAT_PLAYABORTED 	0x04	/* previous play command just aborted */
#define PBS_ASTAT_NOREQ		0x05	/* audio play not requested (yet?) */

int
do_playbackstatus_c4(int fd, struct pb_status_reply * pbstatus,
		     struct esense_reply * erp);
int
do_playbackvolume_c9(int fd, int leftVolume, int rightVolume,
		     struct esense_reply * erp);

/* instead of having a do_readsubchannel_42 routine, there are routines to
 * return specific information from that (C10OP_READSUBCHANNEL = 42h) SCSI
 * command.  These fill in a few fields, and mainly isolate calling programs
 * from byte-endian issues in getting a "page of sub-q channel data".  Any
 * program which wants a do_readsubchannel_42 routine should include the
 * cd_cmdsint.h definitions directly.
 */
struct rsc_cur_pos_reply {
    u_int               track:8,
                        index:8;
    u_int               rsc_control:8,
                        rsc_audio_status:8;
 /*
  * "absolute time" is position on disk, "relative time" is position in the
  * current track 
  */
    u_int               abs_logical_block;	/* LBA format of abs time */
    u_int               rel_logical_block;	/* LBA format of rel time */
    u_short             abs_hour,
                        abs_min,
                        abs_sec,
                        abs_frame;
    u_short             rel_hour,
                        rel_min,
                        rel_sec,
                        rel_frame;
};

/* values for rsc_audio_status:
 * Note the CD-ROM that NeXT used to sell is all too eager to return
 * "Paused" in situations where the drive isn't really pausing in the
 * middle of a play request.  This makes audio_status much less useful.
 */
#define RSC_ASTAT_NOTSUPPORTED	0x00
#define RSC_ASTAT_PLAYING	0x11
#define RSC_ASTAT_PAUSED	0x12
#define RSC_ASTAT_PLAYCOMPLETE	0x13	/* previous play command just
					 * completed */
#define RSC_ASTAT_PLAYABORTED 	0x14	/* previous play command was just
					 * aborted */
#define RSC_ASTAT_NONE		0x15	/* no audio status (nothing is
					 * happening) */
int
do_readcurrentposition_42(int fd, struct rsc_cur_pos_reply * curpos,
			  struct esense_reply * erp);

#define MEDIA_CATNUM_LENGTH 15
struct rsc_media_catnum_reply {
    u_char              catnum_isSet;
    u_char              media_catnum[MEDIA_CATNUM_LENGTH];
};
int
do_readmediacatnum_42(int fd, struct rsc_media_catnum_reply * catnum,
		      struct esense_reply * erp);

/* not done yet:
int
do_readtrackISRC_42(int fd, int track, struct rsc_track_isrc_reply *isrc,
	struct esense_reply *erp);
*/

struct cd_volset_reply {	/* volume-of-play settings */
    u_char              ch0_sel,
                        ch0_vol;
    u_char              ch1_sel,
                        ch1_vol;
    u_char              ch2_sel,
                        ch2_vol;
    u_char              ch3_sel,
                        ch3_vol;
};

int
do_modesense_pc_E(int fd, struct cd_volset_reply * volset, struct esense_reply * erp);
int
do_modeselect_pc_E(int fd, int leftVolume, int rightVolume, struct esense_reply * erp);

#endif CD_COMMANDS

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.