📄 cdrom.h
字号:
/* * -- <linux/cdrom.h> * General header file for linux CD-ROM drivers * Copyright (C) 1992 David Giller, rafetmad@oxy.edu * 1994, 1995 Eberhard Moenkeberg, emoenke@gwdg.de * 1996 David van Leeuwen, david@tm.tno.nl * 1997, 1998 Erik Andersen, andersee@debian.org * 1998, 1999 Jens Axboe, axboe@image.dk */ #ifndef _LINUX_CDROM_H#define _LINUX_CDROM_H/******************************************************* * As of Linux 2.1.x, all Linux CD-ROM application programs will use this * (and only this) include file. It is my hope to provide Linux with * a uniform interface between software accessing CD-ROMs and the various * device drivers that actually talk to the drives. There may still be * 23 different kinds of strange CD-ROM drives, but at least there will * now be one, and only one, Linux CD-ROM interface. * * Additionally, as of Linux 2.1.x, all Linux application programs * should use the O_NONBLOCK option when opening a CD-ROM device * for subsequent ioctl commands. This allows for neat system errors * like "No medium found" or "Wrong medium type" upon attempting to * mount or play an empty slot, mount an audio disc, or play a data disc. * Generally, changing an application program to support O_NONBLOCK * is as easy as the following: * - drive = open("/dev/cdrom", O_RDONLY); * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); * It is worth the small change. * * Patches for many common CD programs (provided by David A. van Leeuwen) * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ * *******************************************************//* When a driver supports a certain function, but the cdrom drive we are * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will * borrow the "Operation not supported" error from the network folks to * accomplish this. Maybe someday we will get a more targeted error code, * but this will do for now... */#define EDRIVE_CANT_DO_THIS EOPNOTSUPP/******************************************************* * The CD-ROM IOCTL commands -- these should be supported by * all the various cdrom drivers. For the CD-ROM ioctls, we * will commandeer byte 0x53, or 'S'. *******************************************************/#define CDROMPAUSE 0x5301 /* Pause Audio Operation */ #define CDROMRESUME 0x5302 /* Resume paused Audio Operation */#define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */#define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index (struct cdrom_ti) */#define CDROMREADTOCHDR 0x5305 /* Read TOC header (struct cdrom_tochdr) */#define CDROMREADTOCENTRY 0x5306 /* Read TOC entry (struct cdrom_tocentry) */#define CDROMSTOP 0x5307 /* Stop the cdrom drive */#define CDROMSTART 0x5308 /* Start the cdrom drive */#define CDROMEJECT 0x5309 /* Ejects the cdrom media */#define CDROMVOLCTRL 0x530a /* Control output volume (struct cdrom_volctrl) */#define CDROMSUBCHNL 0x530b /* Read subchannel data (struct cdrom_subchnl) */#define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) (struct cdrom_read) */#define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) (struct cdrom_read) */#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */#define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */#define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session address of multi session disks (struct cdrom_multisession) */#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" if available (struct cdrom_mcn) */#define CDROM_GET_UPC CDROM_GET_MCN /* This one is depricated, but here anyway for compatability */#define CDROMRESET 0x5312 /* hard-reset the drive */#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting (struct cdrom_volctrl) */#define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) (struct cdrom_read) *//* * These ioctls are used only used in aztcd.c and optcd.c */#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */#define CDROMSEEK 0x5316 /* seek msf address */ /* * This ioctl is only used by the scsi-cd driver. It is for playing audio in logical block addressing mode. */#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) *//* * These ioctls are used only used in optcd.c */#define CDROMREADALL 0x5318 /* read all 2646 bytes */#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT *//* * These ioctls are implemented through the uniform CD-ROM driver * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM * drivers are eventually ported to the uniform CD-ROM driver interface. */#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */#define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */#define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */#define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */#define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */#define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */#define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */#define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */#define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities *//* This ioctl is only used by sbpcd at the moment */#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size *//******************************************************* * CDROM IOCTL structures *******************************************************//* Address in MSF format */struct cdrom_msf0 { u_char minute; u_char second; u_char frame;};/* Address in either MSF or logical format */union cdrom_addr { struct cdrom_msf0 msf; int lba;};/* This struct is used by the CDROMPLAYMSF ioctl */ struct cdrom_msf { u_char cdmsf_min0; /* start minute */ u_char cdmsf_sec0; /* start second */ u_char cdmsf_frame0; /* start frame */ u_char cdmsf_min1; /* end minute */ u_char cdmsf_sec1; /* end second */ u_char cdmsf_frame1; /* end frame */};/* This struct is used by the CDROMPLAYTRKIND ioctl */struct cdrom_ti { u_char cdti_trk0; /* start track */ u_char cdti_ind0; /* start index */ u_char cdti_trk1; /* end track */ u_char cdti_ind1; /* end index */};/* This struct is used by the CDROMREADTOCHDR ioctl */struct cdrom_tochdr { u_char cdth_trk0; /* start track */ u_char cdth_trk1; /* end track */};/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */struct cdrom_volctrl{ u_char channel0; u_char channel1; u_char channel2; u_char channel3;};/* This struct is used by the CDROMSUBCHNL ioctl */struct cdrom_subchnl { u_char cdsc_format; u_char cdsc_audiostatus; u_char cdsc_adr: 4; u_char cdsc_ctrl: 4; u_char cdsc_trk; u_char cdsc_ind; union cdrom_addr cdsc_absaddr; union cdrom_addr cdsc_reladdr;};/* This struct is used by the CDROMREADTOCENTRY ioctl */struct cdrom_tocentry { u_char cdte_track; u_char cdte_adr :4; u_char cdte_ctrl :4; u_char cdte_format; union cdrom_addr cdte_addr; u_char cdte_datamode;};/* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */struct cdrom_read { int cdread_lba; caddr_t cdread_bufaddr; int cdread_buflen;};/* This struct is used by the CDROMREADAUDIO ioctl */struct cdrom_read_audio{ union cdrom_addr addr; /* frame address */ u_char addr_format; /* CDROM_LBA or CDROM_MSF */ int nframes; /* number of 2352-byte-frames to read at once */ u_char *buf; /* frame buffer (size: nframes*2352 bytes) */};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -