Changeset 4f5caea in mainline
- Timestamp:
- 2009-06-13T09:17:33Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5481d1bb
- Parents:
- 1806e5d
- Location:
- uspace/srv/bd/ata_bd
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
r1806e5d r4f5caea 53 53 #include <bool.h> 54 54 55 #include "ata_bd.h" 56 55 57 #define NAME "ata_bd" 56 57 enum {58 CTL_READ_START = 0,59 CTL_WRITE_START = 1,60 };61 62 enum {63 STATUS_FAILURE = 064 };65 66 enum {67 MAX_DISKS = 268 };69 70 typedef union {71 /* Read */72 struct {73 uint8_t data_port;74 uint8_t error;75 uint8_t sector_count;76 uint8_t sector_number;77 uint8_t cylinder_low;78 uint8_t cylinder_high;79 uint8_t drive_head;80 uint8_t status;81 };82 83 /* Write */84 struct {85 uint8_t pad0[7];86 uint8_t command;87 };88 } ata_cmd_t;89 90 typedef union {91 /* Read */92 struct {93 uint8_t pad0[6];94 uint8_t alt_status;95 uint8_t drive_address;96 };97 98 /* Write */99 struct {100 uint8_t pad1[6];101 uint8_t device_control;102 uint8_t pad2;103 };104 } ata_ctl_t;105 106 enum devctl_bits {107 DCR_SRST = 0x04, /**< Software Reset */108 DCR_nIEN = 0x02 /**< Interrupt Enable (negated) */109 };110 111 enum status_bits {112 SR_BSY = 0x80, /**< Busy */113 SR_DRDY = 0x40, /**< Drive Ready */114 SR_DWF = 0x20, /**< Drive Write Fault */115 SR_DSC = 0x10, /**< Drive Seek Complete */116 SR_DRQ = 0x08, /**< Data Request */117 SR_CORR = 0x04, /**< Corrected Data */118 SR_IDX = 0x02, /**< Index */119 SR_ERR = 0x01 /**< Error */120 };121 122 enum drive_head_bits {123 DHR_DRV = 0x10124 };125 126 enum error_bits {127 ER_BBK = 0x80, /**< Bad Block Detected */128 ER_UNC = 0x40, /**< Uncorrectable Data Error */129 ER_MC = 0x20, /**< Media Changed */130 ER_IDNF = 0x10, /**< ID Not Found */131 ER_MCR = 0x08, /**< Media Change Request */132 ER_ABRT = 0x04, /**< Aborted Command */133 ER_TK0NF = 0x02, /**< Track 0 Not Found */134 ER_AMNF = 0x01 /**< Address Mark Not Found */135 };136 137 typedef struct {138 bool present;139 unsigned heads;140 unsigned cylinders;141 unsigned sectors;142 uint64_t blocks;143 } disk_t;144 58 145 59 static const size_t block_size = 512;
Note:
See TracChangeset
for help on using the changeset viewer.