ApertureOS
priv_ata_pio.h
Go to the documentation of this file.
1 #ifndef _PRIV_ATA_PIO_DRIVER_H_
2 #define _PRIV_ATA_PIO_DRIVER_H_
3 
4 #include "types.h"
5 #include "utils/native.h"
6 #include "managers.h"
7 #include "drivers.h"
8 
9 #define IDE_CTRL_A_BASE 0x1F0
10 #define IDE_CTRL_B_BASE 0x170
11 
12 #define IDE_MASTER 0xA0
13 #define IDE_SLAVE 0xB0
14 
15 #define STATUS_BUSY 0x80
16 #define STATUS_DRQ 0x08
17 #define STATUS_ERR 0x01
18 
19 #define DATA_PORT(x) ((x+0))
20 #define FEAT_ERR_PORT(x) ((x+1))
21 #define SECTOR_COUNT_PORT(x) ((x+2))
22 #define LBA_LO_PORT(x) ((x+3))
23 #define LBA_MID_PORT(x) ((x+4))
24 #define LBA_HI_PORT(x) ((x+5))
25 #define DRIVE_PORT(x) ((x+6)) //Disk Select
26 #define CMD_REG_STATUS_PORT(x) ((x+7))
27 #define SPECIAL_STATUS_PORT(x) (x + 0x206)
28 
29 #define DRIVE_DIAG_CMD 0x90
30 #define FORMAT_TRACK_CMD 0x50
31 #define IDENTIFY_DRIVE_CMD 0xEC
32 #define INITIALIZE_DRIVE_CMD 0x91
33 #define NOP_CMD 0x00
34 #define READ_BUFFER_CMD 0xE4
35 #define READ_BUFFER_DMA_R_CMD 0xC8
36 #define READ_BUFFER_DMA_CMD 0xC9
37 #define READ_LONG_R_CMD 0x22
38 #define READ_LONG_CMD 0x23
39 #define READ_MULTIPLE_CMD 0xC4
40 #define READ_SECTORS_R_CMD 0x20
41 #define READ_SECTORS_CMD 0x21
42 #define READ_SECTORS_EXT 0x24
43 #define READ_VER_SECTORS_R_CMD 0x40
44 #define READ_VER_SECTORS_CMD 0x41
45 #define RECALIBRATE_CMD 0x10
46 #define SEEK_CMD 0x70
47 #define SET_FEATURES_CMD 0xEF
48 #define SET_MULTIPLE_MODE_CMD 0xC6
49 #define WRITE_BUFFER_CMD 0xE8
50 #define WRITE_DMA_R_CMD 0xCA
51 #define WRITE_DMA_CMD 0xCB
52 #define WRITE_LONG_R_CMD 0x32
53 #define WRITE_LONG_CMD 0x33
54 #define WRITE_SECTORS_EXT 0x34
55 #define WRITE_MULTIPLE_CMD 0xC5
56 #define WRITE_SAME_CMD 0xE9
57 #define WRITE_SECTORS_R_CMD 0x30
58 #define WRITE_SECTORS_CMD 0x31
59 #define WRITE_VERIFY_CMD 0x3C
60 
61 #define CHECK_PWR_MODE_CMD 0x98
62 #define IDLE_CMD 0x97
63 #define IDLE_IMM_CMD 0x95
64 #define SLEEP_CMD 0x99
65 #define STANDBY_CMD 0x96
66 #define STANDBY_IMM_CMD 0x94
67 
68 #endif