A update
This commit is contained in:
40
include/drivers/ide.h
Normal file
40
include/drivers/ide.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef _IDE_H
|
||||
#define _IDE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define ATA_PRIMARY_IO 0x1F0
|
||||
#define ATA_PRIMARY_CTRL 0x3F6
|
||||
#define ATA_MASTER 0x00
|
||||
#define ATA_SLAVE 0x10
|
||||
|
||||
#define ATA_REG_DATA 0x00
|
||||
#define ATA_REG_ERROR 0x01
|
||||
#define ATA_REG_SECCOUNT0 0x02
|
||||
#define ATA_REG_LBA0 0x03
|
||||
#define ATA_REG_LBA1 0x04
|
||||
#define ATA_REG_LBA2 0x05
|
||||
#define ATA_REG_LBA3 0x06 // LBA48 higher bits
|
||||
#define ATA_REG_LBA4 0x07 // LBA48 higher bits
|
||||
#define ATA_REG_LBA5 0x08 // LBA48 higher bits
|
||||
#define ATA_REG_HDDEVSEL 0x06
|
||||
#define ATA_REG_COMMAND 0x07
|
||||
#define ATA_REG_STATUS 0x07
|
||||
|
||||
#define ATA_CMD_READ_SECTORS 0x20
|
||||
#define ATA_CMD_WRITE_SECTORS 0x30
|
||||
#define ATA_CMD_READ_SECTORS_EXT 0x24
|
||||
#define ATA_CMD_WRITE_SECTORS_EXT 0x34
|
||||
|
||||
#define ATA_SR_BSY 0x80
|
||||
#define ATA_SR_DRDY 0x40
|
||||
#define ATA_SR_DRQ 0x08
|
||||
#define ATA_SR_ERR 0x01
|
||||
|
||||
void ide_initialize(void);
|
||||
int32_t ide_identify(uint8_t drive, uint16_t* buffer);
|
||||
int32_t ide_read48(uint8_t drive, uint64_t lba, uint8_t sector_count, void* buffer);
|
||||
int32_t ide_write48(uint8_t drive, uint64_t lba, uint8_t sector_count, const void* buffer);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user