Changeset bb0eab1 in mainline for uspace/srv/bd/ata_bd/ata_hw.h


Ignore:
Timestamp:
2011-02-01T07:27:32Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
aa893e0
Parents:
0d247f5
Message:

Use structures and constants instead of magic numbers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/ata_bd/ata_hw.h

    r0d247f5 rbb0eab1  
    241241};
    242242
     243/** ATA packet command codes. */
     244enum ata_pkt_command {
     245        PCMD_INQUIRY            = 0x12,
     246        PCMD_READ_12            = 0xa8
     247};
     248
     249/** ATAPI Inquiry command */
     250typedef struct {
     251        uint8_t opcode;         /**< Operation code (PCMD_INQUIRY) */
     252        uint8_t _res0;
     253        uint8_t _res1;
     254        uint8_t _res2;
     255        uint8_t alloc_len;      /**< Allocation length */
     256        uint8_t _res3;
     257        uint8_t _res4;
     258        uint8_t _res5;
     259        uint32_t _res6;
     260} __attribute__ ((packed)) ata_pcmd_inquiry_t;
     261
     262/** ATAPI Read(12) command */
     263typedef struct {
     264        uint8_t opcode;         /**< Operation code (PCMD_READ_12) */
     265        uint8_t _res0;
     266        uint32_t ba;            /**< Starting block address */
     267        uint32_t nblocks;       /**< Number of blocks to transfer */
     268        uint8_t _res1;
     269        uint8_t _res2;
     270} __attribute__ ((packed)) ata_pcmd_read_12_t;
     271
     272/** Data returned from Inquiry command (mandatory part) */
     273typedef struct {
     274        uint8_t pdev_type;      /** Reserved, Peripheral device type */
     275        uint8_t rmb;            /** RMB, Reserved */
     276        uint8_t std_version;    /** ISO version, ECMA version, ANSI version */
     277        uint8_t atapi_ver_rdf;  /** ATAPI version, Response data format */
     278        uint8_t additional_len; /** Additional length */
     279        uint8_t _res0;
     280        uint8_t _res1;
     281        uint8_t _res2;
     282        uint8_t vendor_id[8];   /** Vendor ID */
     283        uint8_t product_id[8];  /** Product ID */
     284        uint8_t product_rev[4]; /** Product revision level */
     285} ata_inquiry_data_t;
     286
     287/** Extract value of ata_inquiry_data_t.pdev_type */
     288#define INQUIRY_PDEV_TYPE(val) ((val) & 0x1f)
     289
     290/** Values for ata_inquiry_data_t.pdev_type */
     291enum ata_pdev_type {
     292        PDEV_TYPE_CDROM         = 0x05
     293};
     294
    243295#endif
    244296
Note: See TracChangeset for help on using the changeset viewer.