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

📄 ata.h

📁 本程序是在ucos ii 下的一个读写硬盘的C源程序。可供在他人开发嵌入式系统的读写硬盘时参考。
💻 H
字号:
/***********************************************
module: ata.h
notice: copyright(c)2001 Mike
***********************************************/

#ifndef ATA_H
#define ATA_H

	/*CONTROL WORD: */
	#define DEVICE0           0x00
	#define DEVICE1           0x01
	#define PIO_MODE0         0x00
	#define PIO_MODE1         0x02
	#define ATA_RESET         0x04
	#define CHIP_SRST         0x88
	#define DMA_STOP          0x80
	#define DMA_WRITE         0x01
	#define DMA_READ          0x00
	#define PIO_STOP          0x80
	#define PIO_WRITE         0x01
	#define PIO_READ          0x00
	#define CHIP_MODE_DEFAULT 0x00


	/*  data sructure definition  */
	typedef struct {
		unsigned char feature;
		unsigned char sector_count;
		unsigned char sector_number;
		unsigned char cylinder_high;
		unsigned char cylinder_low;
		unsigned char device_head;
		unsigned char command;
	} device_reg_set_t;

    /*  function declare  */
    void set_pio_write(void);
    void set_pio_read(void);
    unsigned char read_ata_reg(unsigned char);
    void write_ata_reg(unsigned char,unsigned char);
    void wait_pio_ready(void);
    void wait_device_int();
    void ata_select_dev(void);
    int ata_pio_in(device_reg_set_t *);
    int ata_pio_out(device_reg_set_t *,unsigned int);
    int pio_block_in(device_reg_set_t *);
    int pio_block_out(volatile device_reg_set_t *);
    int non_data_com(device_reg_set_t *);
    void init_chip_param();

#endif

⌨️ 快捷键说明

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