ata.h

来自「本程序是在ucos ii 下的一个读写硬盘的C源程序。可供在他人开发嵌入式系统的」· C头文件 代码 · 共 52 行

H
52
字号
/***********************************************
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 + =
减小字号Ctrl + -
显示快捷键?