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

📄 ide.h

📁 ARM 嵌入式 系统 设计与实例开发 实验教材 二源码
💻 H
📖 第 1 页 / 共 3 页
字号:
typedef void		(ide_release_proc)(struct inode *, struct file *, ide_drive_t *);typedef int		(ide_check_media_change_proc)(ide_drive_t *);typedef void		(ide_revalidate_proc)(ide_drive_t *);typedef void		(ide_pre_reset_proc)(ide_drive_t *);typedef unsigned long	(ide_capacity_proc)(ide_drive_t *);typedef ide_startstop_t	(ide_special_proc)(ide_drive_t *);typedef void		(ide_setting_proc)(ide_drive_t *);typedef int		(ide_driver_reinit_proc)(ide_drive_t *);typedef struct ide_driver_s {	const char			*name;	const char			*version;	byte				media;	unsigned busy			: 1;	unsigned supports_dma		: 1;	unsigned supports_dsc_overlap	: 1;	ide_cleanup_proc		*cleanup;	ide_do_request_proc		*do_request;	ide_end_request_proc		*end_request;	ide_ioctl_proc			*ioctl;	ide_open_proc			*open;	ide_release_proc		*release;	ide_check_media_change_proc	*media_change;	ide_revalidate_proc		*revalidate;	ide_pre_reset_proc		*pre_reset;	ide_capacity_proc		*capacity;	ide_special_proc		*special;	ide_proc_entry_t		*proc;	ide_driver_reinit_proc		*driver_reinit;} ide_driver_t;#define DRIVER(drive)		((ide_driver_t *)((drive)->driver))/* * IDE modules. */#define IDE_CHIPSET_MODULE		0	/* not supported yet */#define IDE_PROBE_MODULE		1#define IDE_DRIVER_MODULE		2typedef int	(ide_module_init_proc)(void);typedef struct ide_module_s {	int				type;	ide_module_init_proc		*init;	void				*info;	struct ide_module_s		*next;} ide_module_t;/* * ide_hwifs[] is the master data structure used to keep track * of just about everything in ide.c.  Whenever possible, routines * should be using pointers to a drive (ide_drive_t *) or * pointers to a hwif (ide_hwif_t *), rather than indexing this * structure directly (the allocation/layout may change!). * */#ifndef _IDE_Cextern	ide_hwif_t	ide_hwifs[];		/* master data repository */extern	ide_module_t	*ide_modules;extern	ide_module_t	*ide_probe;#endifextern int noautodma;/* * We need blk.h, but we replace its end_request by our own version. */#define IDE_DRIVER		/* Toggle some magic bits in blk.h */#define LOCAL_END_REQUEST	/* Don't generate end_request in blk.h */#include <linux/blk.h>void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup);/* * This is used for (nearly) all data transfers from/to the IDE interface * FIXME for 2.5, to a pointer pass verses memcpy........ */void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount);void ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount);/* * This is used for (nearly) all ATAPI data transfers from/to the IDE interface * FIXME for 2.5, to a pointer pass verses memcpy........ */void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount);void atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount);/* * This is used on exit from the driver, to designate the next irq handler * and also to start the safety timer. */void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);/* * Error reporting, in human readable form (luxurious, but a memory hog). */byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat);/* * ide_error() takes action based on the error returned by the controller. * The caller should return immediately after invoking this. */ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);/* * Issue a simple drive command * The drive must be selected beforehand. */void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler);/* * ide_fixstring() cleans up and (optionally) byte-swaps a text string, * removing leading/trailing blanks and compressing internal blanks. * It is primarily used to tidy up the model name/number fields as * returned by the WIN_[P]IDENTIFY commands. */void ide_fixstring (byte *s, const int bytecount, const int byteswap);/* * This routine busy-waits for the drive status to be not "busy". * It then checks the status for all of the "good" bits and none * of the "bad" bits, and if all is okay it returns 0.  All other * cases return 1 after doing "*startstop = ide_error()", and the * caller should return the updated value of "startstop" in this case. * "startstop" is unchanged when the function returns 0; */int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, byte good, byte bad, unsigned long timeout);int ide_wait_noerr (ide_drive_t *drive, byte good, byte bad, unsigned long timeout);/* * This routine is called from the partition-table code in genhd.c * to "convert" a drive to a logical geometry with fewer than 1024 cyls. */int ide_xlate_1024 (kdev_t, int, int, const char *);/* * Convert kdev_t structure into ide_drive_t * one. */ide_drive_t *get_info_ptr (kdev_t i_rdev);/* * Return the current idea about the total capacity of this drive. */unsigned long current_capacity (ide_drive_t *drive);/* * Start a reset operation for an IDE interface. * The caller should return immediately after invoking this. */ide_startstop_t ide_do_reset (ide_drive_t *);/* * Re-Start an operation for an IDE interface. * The caller should return immediately after invoking this. */ide_startstop_t restart_request (ide_drive_t *);/* * This function is intended to be used prior to invoking ide_do_drive_cmd(). */void ide_init_drive_cmd (struct request *rq);/* * "action" parameter type for ide_do_drive_cmd() below. */typedef enum {	ide_wait,	/* insert rq at end of list, and wait for it */	ide_next,	/* insert rq immediately after current request */	ide_preempt,	/* insert rq in front of current request */	ide_end		/* insert rq at end of list, but don't wait for it */} ide_action_t;/* * This function issues a special IDE device request * onto the request queue. * * If action is ide_wait, then the rq is queued at the end of the * request queue, and the function sleeps until it has been processed. * This is for use when invoked from an ioctl handler. * * If action is ide_preempt, then the rq is queued at the head of * the request queue, displacing the currently-being-processed * request and this function returns immediately without waiting * for the new rq to be completed.  This is VERY DANGEROUS, and is * intended for careful use by the ATAPI tape/cdrom driver code. * * If action is ide_next, then the rq is queued immediately after * the currently-being-processed-request (if any), and the function * returns without waiting for the new rq to be completed.  As above, * This is VERY DANGEROUS, and is intended for careful use by the * ATAPI tape/cdrom driver code. * * If action is ide_end, then the rq is queued at the end of the * request queue, and the function returns immediately without waiting * for the new rq to be completed. This is again intended for careful * use by the ATAPI tape/cdrom driver code. */int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t action);/* * Clean up after success/failure of an explicit drive cmd. * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD). */void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err);/* * Issue ATA command and wait for completion. */int ide_wait_cmd (ide_drive_t *drive, int cmd, int nsect, int feature, int sectors, byte *buf);int ide_wait_cmd_task (ide_drive_t *drive, byte *buf);void ide_delay_50ms (void);int system_bus_clock(void);byte ide_auto_reduce_xfer (ide_drive_t *drive);int ide_driveid_update (ide_drive_t *drive);int ide_ata66_check (ide_drive_t *drive, byte cmd, byte nsect, byte feature);int ide_config_drive_speed (ide_drive_t *drive, byte speed);byte eighty_ninty_three (ide_drive_t *drive);int set_transfer (ide_drive_t *drive, byte cmd, byte nsect, byte feature);/* * ide_system_bus_speed() returns what we think is the system VESA/PCI * bus speed (in MHz).  This is used for calculating interface PIO timings. * The default is 40 for known PCI systems, 50 otherwise. * The "idebus=xx" parameter can be used to override this value. */int ide_system_bus_speed (void);/* * ide_multwrite() transfers a block of up to mcount sectors of data * to a drive as part of a disk multwrite operation. */int ide_multwrite (ide_drive_t *drive, unsigned int mcount);/* * ide_stall_queue() can be used by a drive to give excess bandwidth back * to the hwgroup by sleeping for timeout jiffies. */void ide_stall_queue (ide_drive_t *drive, unsigned long timeout);/* * ide_get_queue() returns the queue which corresponds to a given device. */request_queue_t *ide_get_queue (kdev_t dev);/* * CompactFlash cards and their brethern pretend to be removable hard disks, * but they never have a slave unit, and they don't have doorlock mechanisms. * This test catches them, and is invoked elsewhere when setting appropriate config bits. */int drive_is_flashcard (ide_drive_t *drive);int ide_spin_wait_hwgroup (ide_drive_t *drive);void ide_timer_expiry (unsigned long data);void ide_intr (int irq, void *dev_id, struct pt_regs *regs);void do_ide_request (request_queue_t * q);void ide_init_subdrivers (void);#ifndef _IDE_Cextern struct block_device_operations ide_fops[];extern ide_proc_entry_t generic_subdriver_entries[];#endif#ifdef _IDE_C#ifdef CONFIG_BLK_DEV_IDEint ideprobe_init (void);#endif /* CONFIG_BLK_DEV_IDE */#ifdef CONFIG_BLK_DEV_IDEDISKint idedisk_init (void);#endif /* CONFIG_BLK_DEV_IDEDISK */#ifdef CONFIG_BLK_DEV_IDECDint ide_cdrom_init (void);#endif /* CONFIG_BLK_DEV_IDECD */#ifdef CONFIG_BLK_DEV_IDETAPEint idetape_init (void);#endif /* CONFIG_BLK_DEV_IDETAPE */#ifdef CONFIG_BLK_DEV_IDEFLOPPYint idefloppy_init (void);#endif /* CONFIG_BLK_DEV_IDEFLOPPY */#ifdef CONFIG_BLK_DEV_IDESCSIint idescsi_init (void);#endif /* CONFIG_BLK_DEV_IDESCSI */#endif /* _IDE_C */int ide_register_module (ide_module_t *module);void ide_unregister_module (ide_module_t *module);ide_drive_t *ide_scan_devices (byte media, const char *name, ide_driver_t *driver, int n);int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int version);int ide_unregister_subdriver (ide_drive_t *drive);int ide_replace_subdriver(ide_drive_t *drive, const char *driver);#ifdef CONFIG_BLK_DEV_IDEPCI#define ON_BOARD		1#define NEVER_BOARD		0#ifdef CONFIG_BLK_DEV_OFFBOARD#  define OFF_BOARD		ON_BOARD#else /* CONFIG_BLK_DEV_OFFBOARD */#  define OFF_BOARD		NEVER_BOARD#endif /* CONFIG_BLK_DEV_OFFBOARD */unsigned long ide_find_free_region (unsigned short size) __init;void ide_scan_pcibus (int scan_direction) __init;#endif#ifdef CONFIG_BLK_DEV_IDEDMA#define BAD_DMA_DRIVE		0#define GOOD_DMA_DRIVE		1int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func);void ide_destroy_dmatable (ide_drive_t *drive);ide_startstop_t ide_dma_intr (ide_drive_t *drive);int check_drive_lists (ide_drive_t *drive, int good_bad);int report_drive_dmaing (ide_drive_t *drive);int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive);int ide_release_dma (ide_hwif_t *hwif);void ide_setup_dma (ide_hwif_t *hwif, unsigned long dmabase, unsigned int num_ports) __init;unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif, int extra, const char *name) __init;#endifvoid hwif_unregister (ide_hwif_t *hwif);#endif /* _IDE_H */

⌨️ 快捷键说明

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