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

📄 ide.h

📁 linux得一些常用命令,以及linux环境下的c编程
💻 H
📖 第 1 页 / 共 3 页
字号:
#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);int drive_is_ready (ide_drive_t *drive);/* * 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;/* * temporarily mapping a (possible) highmem bio */#define ide_rq_offset(rq) (((rq)->hard_cur_sectors - (rq)->current_nr_sectors) << 9)extern inline void *ide_map_buffer(struct request *rq, unsigned long *flags){	return bh_kmap_irq(rq->bh, flags) + ide_rq_offset(rq);}extern inline void ide_unmap_buffer(char *buffer, unsigned long *flags){	bh_kunmap_irq(buffer, flags);}/* * 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). * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK). */void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err);/* * Issue ATA command and wait for completion. use for implementing commands in kernel */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); typedef struct ide_task_s {	task_ioreg_t		tfRegister[8];	task_ioreg_t		hobRegister[8];	ide_reg_valid_t		tf_out_flags;	ide_reg_valid_t		tf_in_flags;	int			data_phase;	int			command_type;	ide_pre_handler_t	*prehandler;	ide_handler_t		*handler;	ide_post_handler_t	*posthandler;	void			*special;	/* valid_t generally */	struct request		*rq;		/* copy of request */	unsigned long		block;		/* copy of block */} ide_task_t;typedef struct pkt_task_s {	task_ioreg_t		tfRegister[8];	int			data_phase;	int			command_type;	ide_handler_t		*handler;	void			*special;	struct request		*rq;		/* copy of request */	unsigned long		block;		/* copy of block */} pkt_task_t;/* * taskfile io for disks for now... */ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task);/* * Builds request from ide_ioctl */void do_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile, ide_handler_t *handler);/* * Special Flagged Register Validation Caller */// ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task);ide_startstop_t set_multmode_intr (ide_drive_t *drive);ide_startstop_t set_geometry_intr (ide_drive_t *drive);ide_startstop_t recal_intr (ide_drive_t *drive);ide_startstop_t task_no_data_intr (ide_drive_t *drive);ide_startstop_t task_in_intr (ide_drive_t *drive);ide_startstop_t task_mulin_intr (ide_drive_t *drive);ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq);ide_startstop_t task_out_intr (ide_drive_t *drive);ide_startstop_t task_mulout_intr (ide_drive_t *drive);void ide_init_drive_taskfile (struct request *rq);int ide_wait_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile, byte *buf);int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *cmd, byte *buf);ide_pre_handler_t * ide_pre_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile);ide_handler_t * ide_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile);/* Expects args is a full set of TF registers and parses the command type */int ide_cmd_type_parser (ide_task_t *args);int ide_taskfile_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);#ifdef CONFIG_PKT_TASK_IOCTLint pkt_taskfile_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);#endif /* CONFIG_PKT_TASK_IOCTL */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, ide_task_t *args);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, ide_task_t *args);/* * 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[];#endifint ide_reinit_drive (ide_drive_t *drive);#ifdef _IDE_C#ifdef CONFIG_BLK_DEV_IDEint ideprobe_init (void);#endif /* CONFIG_BLK_DEV_IDE */#ifdef CONFIG_BLK_DEV_IDEDISKint idedisk_reinit (ide_drive_t *drive);int idedisk_init (void);#endif /* CONFIG_BLK_DEV_IDEDISK */#ifdef CONFIG_BLK_DEV_IDECDint ide_cdrom_reinit (ide_drive_t *drive);int ide_cdrom_init (void);#endif /* CONFIG_BLK_DEV_IDECD */#ifdef CONFIG_BLK_DEV_IDETAPEint idetape_reinit (ide_drive_t *drive);int idetape_init (void);#endif /* CONFIG_BLK_DEV_IDETAPE */#ifdef CONFIG_BLK_DEV_IDEFLOPPYint idefloppy_reinit (ide_drive_t *drive);int idefloppy_init (void);#endif /* CONFIG_BLK_DEV_IDEFLOPPY */#ifdef CONFIG_BLK_DEV_IDESCSIint idescsi_reinit (ide_drive_t *drive);int 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);void export_ide_init_queue (ide_drive_t *drive);byte export_probe_for_drive (ide_drive_t *drive);#endif /* _IDE_H */

⌨️ 快捷键说明

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