⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ide-cd.h

📁 ep9315平台下硬盘驱动的源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* *  linux/drivers/ide/ide_cd.h * *  Copyright (C) 1996-98  Erik Andersen *  Copyright (C) 1998-2000 Jens Axboe */#ifndef _IDE_CD_H#define _IDE_CD_H#include <linux/cdrom.h>#include <asm/byteorder.h>/* Turn this on to have the driver print out the meanings of the   ATAPI error codes.  This will use up additional kernel-space   memory, though. */#ifndef VERBOSE_IDE_CD_ERRORS#define VERBOSE_IDE_CD_ERRORS 1#endif/* Turning this on will remove code to work around various nonstandard   ATAPI implementations.  If you know your drive follows the standard,   this will give you a slightly smaller kernel. */#ifndef STANDARD_ATAPI#define STANDARD_ATAPI 0#endif/* Turning this on will disable the door-locking functionality.   This is apparently needed for supermount. */#ifndef NO_DOOR_LOCKING#define NO_DOOR_LOCKING 0#endif/************************************************************************/#define SECTOR_BITS 		9#ifndef SECTOR_SIZE#define SECTOR_SIZE		(1 << SECTOR_BITS)#endif#define SECTORS_PER_FRAME	(CD_FRAMESIZE >> SECTOR_BITS)#define SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32)#define SECTORS_BUFFER		(SECTOR_BUFFER_SIZE >> SECTOR_BITS)#define SECTORS_MAX		(131072 >> SECTOR_BITS)#define BLOCKS_PER_FRAME	(CD_FRAMESIZE / BLOCK_SIZE)#define MIN(a,b) ((a) < (b) ? (a) : (b))/* special command codes for strategy routine. */#define PACKET_COMMAND        4315#define REQUEST_SENSE_COMMAND 4316#define RESET_DRIVE_COMMAND   4317/* Configuration flags.  These describe the capabilities of the drive.   They generally do not change after initialization, unless we learn   more about the drive from stuff failing. */struct ide_cd_config_flags {	__u8 drq_interrupt	: 1; /* Device sends an interrupt when ready					for a packet command. */	__u8 no_doorlock	: 1; /* Drive cannot lock the door. */	__u8 no_eject		: 1; /* Drive cannot eject the disc. */	__u8 nec260		: 1; /* Drive is a pre-1.2 NEC 260 drive. */	__u8 playmsf_as_bcd	: 1; /* PLAYMSF command takes BCD args. */	__u8 tocaddr_as_bcd	: 1; /* TOC addresses are in BCD. */	__u8 toctracks_as_bcd	: 1; /* TOC track numbers are in BCD. */	__u8 subchan_as_bcd	: 1; /* Subchannel info is in BCD. */	__u8 is_changer		: 1; /* Drive is a changer. */	__u8 cd_r		: 1; /* Drive can write to CD-R media . */	__u8 cd_rw		: 1; /* Drive can write to CD-R/W media . */	__u8 dvd		: 1; /* Drive is a DVD-ROM */	__u8 dvd_r		: 1; /* Drive can write DVD-R */	__u8 dvd_ram		: 1; /* Drive can write DVD-RAM */	__u8 test_write		: 1; /* Drive can fake writes */	__u8 supp_disc_present	: 1; /* Changer can report exact contents					of slots. */	__u8 limit_nframes	: 1; /* Drive does not provide data in					multiples of SECTOR_SIZE when more					than one interrupt is needed. */	__u8 seeking		: 1; /* Seeking in progress */	__u8 audio_play		: 1; /* can do audio related commands */	__u8 close_tray		: 1; /* can close the tray */	__u8 writing		: 1; /* pseudo write in progress */	__u8 reserved		: 3;	byte max_speed;		     /* Max speed of the drive */};#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) /* State flags.  These give information about the current state of the   drive, and will change during normal operation. */struct ide_cd_state_flags {	__u8 media_changed : 1; /* Driver has noticed a media change. */	__u8 toc_valid     : 1; /* Saved TOC information is current. */	__u8 door_locked   : 1; /* We think that the drive door is locked. */	__u8 writing       : 1; /* the drive is currently writing */	__u8 reserved      : 4;	byte current_speed;	/* Current speed of the drive */};#define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags))struct packet_command {	char *buffer;	int buflen;	int stat;	int quiet;	int timeout;	struct request_sense *sense;	unsigned char c[12];};/* Structure of a MSF cdrom address. */struct atapi_msf {	byte reserved;	byte minute;	byte second;	byte frame;};/* Space to hold the disk TOC. */#define MAX_TRACKS 99struct atapi_toc_header {	unsigned short toc_length;	byte first_track;	byte last_track;};struct atapi_toc_entry {	byte reserved1;#if defined(__BIG_ENDIAN_BITFIELD)	__u8 adr     : 4;	__u8 control : 4;#elif defined(__LITTLE_ENDIAN_BITFIELD)	__u8 control : 4;	__u8 adr     : 4;#else#error "Please fix <asm/byteorder.h>"#endif	byte track;	byte reserved2;	union {		unsigned lba;		struct atapi_msf msf;	} addr;};struct atapi_toc {	int    last_session_lba;	int    xa_flag;	unsigned long capacity;	struct atapi_toc_header hdr;	struct atapi_toc_entry  ent[MAX_TRACKS+1];	  /* One extra for the leadout. */};/* This structure is annoyingly close to, but not identical with,   the cdrom_subchnl structure from cdrom.h. */struct atapi_cdrom_subchnl { 	u_char  acdsc_reserved; 	u_char  acdsc_audiostatus; 	u_short acdsc_length;	u_char  acdsc_format;#if defined(__BIG_ENDIAN_BITFIELD)	u_char  acdsc_ctrl:     4;	u_char  acdsc_adr:      4;#elif defined(__LITTLE_ENDIAN_BITFIELD)	u_char  acdsc_adr:	4;	u_char  acdsc_ctrl:	4;#else#error "Please fix <asm/byteorder.h>"#endif	u_char  acdsc_trk;	u_char  acdsc_ind;	union {		struct atapi_msf msf;		int	lba;	} acdsc_absaddr;	union {		struct atapi_msf msf;		int	lba;	} acdsc_reladdr;};/* This should probably go into cdrom.h along with the other * generic stuff now in the Mt. Fuji spec. */struct atapi_capabilities_page {	struct mode_page_header header;#if defined(__BIG_ENDIAN_BITFIELD)	__u8 parameters_saveable : 1;	__u8 reserved1           : 1;	__u8 page_code           : 6;#elif defined(__LITTLE_ENDIAN_BITFIELD)	__u8 page_code           : 6;	__u8 reserved1           : 1;	__u8 parameters_saveable : 1;#else#error "Please fix <asm/byteorder.h>"#endif	byte     page_length;#if defined(__BIG_ENDIAN_BITFIELD)	__u8 reserved2           : 2;	/* Drive supports reading of DVD-RAM discs */	__u8 dvd_ram_read        : 1;	/* Drive supports reading of DVD-R discs */	__u8 dvd_r_read          : 1;	/* Drive supports reading of DVD-ROM discs */	__u8 dvd_rom             : 1;	/* Drive supports reading CD-R discs with addressing method 2 */	__u8 method2             : 1; /* reserved in 1.2 */	/* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */	__u8 cd_rw_read		 : 1; /* reserved in 1.2 */	/* Drive supports read from CD-R discs (orange book, part II) */	__u8 cd_r_read           : 1; /* reserved in 1.2 */#elif defined(__LITTLE_ENDIAN_BITFIELD)	/* Drive supports read from CD-R discs (orange book, part II) */	__u8 cd_r_read           : 1; /* reserved in 1.2 */	/* Drive can read from CD-R/W (CD-E) discs (orange book, part III) */	__u8 cd_rw_read          : 1; /* reserved in 1.2 */	/* Drive supports reading CD-R discs with addressing method 2 */	__u8 method2             : 1;	/* Drive supports reading of DVD-ROM discs */	__u8 dvd_rom             : 1;	/* Drive supports reading of DVD-R discs */	__u8 dvd_r_read          : 1;	/* Drive supports reading of DVD-RAM discs */	__u8 dvd_ram_read        : 1;	__u8 reserved2		 : 2;#else#error "Please fix <asm/byteorder.h>"#endif#if defined(__BIG_ENDIAN_BITFIELD)	__u8 reserved3           : 2;	/* Drive can write DVD-RAM discs */	__u8 dvd_ram_write       : 1;	/* Drive can write DVD-R discs */	__u8 dvd_r_write         : 1;	__u8 reserved3a          : 1;	/* Drive can fake writes */	__u8 test_write          : 1;	/* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */	__u8 cd_rw_write	 : 1; /* reserved in 1.2 */	/* Drive supports write to CD-R discs (orange book, part II) */	__u8 cd_r_write          : 1; /* reserved in 1.2 */#elif defined(__LITTLE_ENDIAN_BITFIELD)	/* Drive can write to CD-R discs (orange book, part II) */	__u8 cd_r_write          : 1; /* reserved in 1.2 */	/* Drive can write to CD-R/W (CD-E) discs (orange book, part III) */	__u8 cd_rw_write	 : 1; /* reserved in 1.2 */	/* Drive can fake writes */	__u8 test_write          : 1;	__u8 reserved3a          : 1;	/* Drive can write DVD-R discs */	__u8 dvd_r_write         : 1;	/* Drive can write DVD-RAM discs */	__u8 dvd_ram_write       : 1;	__u8 reserved3           : 2;#else#error "Please fix <asm/byteorder.h>"#endif#if defined(__BIG_ENDIAN_BITFIELD)	__u8 reserved4           : 1;	/* Drive can read multisession discs. */	__u8 multisession        : 1;	/* Drive can read mode 2, form 2 data. */	__u8 mode2_form2         : 1;	/* Drive can read mode 2, form 1 (XA) data. */	__u8 mode2_form1         : 1;	/* Drive supports digital output on port 2. */	__u8 digport2            : 1;	/* Drive supports digital output on port 1. */	__u8 digport1            : 1;	/* Drive can deliver a composite audio/video data stream. */	__u8 composite           : 1;	/* Drive supports audio play operations. */	__u8 audio_play          : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD)	/* Drive supports audio play operations. */	__u8 audio_play          : 1;	/* Drive can deliver a composite audio/video data stream. */	__u8 composite           : 1;	/* Drive supports digital output on port 1. */	__u8 digport1            : 1;	/* Drive supports digital output on port 2. */	__u8 digport2            : 1;	/* Drive can read mode 2, form 1 (XA) data. */	__u8 mode2_form1         : 1;	/* Drive can read mode 2, form 2 data. */	__u8 mode2_form2         : 1;	/* Drive can read multisession discs. */	__u8 multisession        : 1;	__u8 reserved4           : 1;#else#error "Please fix <asm/byteorder.h>"#endif#if defined(__BIG_ENDIAN_BITFIELD)	__u8 reserved5           : 1;	/* Drive can return Media Catalog Number (UPC) info. */	__u8 upc                 : 1;	/* Drive can return International Standard Recording Code info. */	__u8 isrc                : 1;	/* Drive supports C2 error pointers. */	__u8 c2_pointers         : 1;	/* R-W data will be returned deinterleaved and error corrected. */	__u8 rw_corr             : 1;	/* Subchannel reads can return combined R-W information. */	__u8 rw_supported        : 1;	/* Drive can continue a read cdda operation from a loss of streaming.*/	__u8 cdda_accurate       : 1;	/* Drive can read Red Book audio data. */	__u8 cdda                : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD)	/* Drive can read Red Book audio data. */	__u8 cdda                : 1;	/* Drive can continue a read cdda operation from a loss of streaming.*/	__u8 cdda_accurate       : 1;	/* Subchannel reads can return combined R-W information. */	__u8 rw_supported        : 1;	/* R-W data will be returned deinterleaved and error corrected. */	__u8 rw_corr             : 1;	/* Drive supports C2 error pointers. */	__u8 c2_pointers         : 1;	/* Drive can return International Standard Recording Code info. */	__u8 isrc                : 1;	/* Drive can return Media Catalog Number (UPC) info. */	__u8 upc                 : 1;	__u8 reserved5           : 1;#else#error "Please fix <asm/byteorder.h>"#endif#if defined(__BIG_ENDIAN_BITFIELD)	/* Drive mechanism types. */	mechtype_t mechtype	 : 3;	__u8 reserved6           : 1;	/* Drive can eject a disc or changer cartridge. */	__u8 eject               : 1;	/* State of prevent/allow jumper. */	__u8 prevent_jumper      : 1;	/* Present state of door lock. */	__u8 lock_state          : 1;	/* Drive can lock the door. */	__u8 lock                : 1;#elif defined(__LITTLE_ENDIAN_BITFIELD)	/* Drive can lock the door. */	__u8 lock                : 1;	/* Present state of door lock. */	__u8 lock_state          : 1;	/* State of prevent/allow jumper. */	__u8 prevent_jumper      : 1;	/* Drive can eject a disc or changer cartridge. */	__u8 eject               : 1;	__u8 reserved6           : 1;	/* Drive mechanism types. */	mechtype_t mechtype	 : 3;#else#error "Please fix <asm/byteorder.h>"#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -