Changeset 0feaae4 in mainline for uspace/lib/scsi


Ignore:
Timestamp:
2011-07-02T17:21:50Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
239e7e10
Parents:
2429e4a
Message:

Factor out standard SCSI code from usbmast to a separate SCSI library.

Location:
uspace/lib/scsi
Files:
2 added
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/scsi/include/scsi/spc.h

    r2429e4a r0feaae4  
    11/*
    2  * Copyright (c) 2011 Vojtech Horky
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup drvusbmast
     29/** @addtogroup libscsi
    3030 * @{
    3131 */
    32 /** @file
    33  * SCSI related structures.
     32/**
     33 * @file SCSI Primary Commands.
    3434 */
    3535
    36 #ifndef USB_USBMAST_SCSI_H_
    37 #define USB_USBMAST_SCSI_H_
     36#ifndef LIBSCSI_SPC_H_
     37#define LIBSCSI_SPC_H_
    3838
    39 #include <sys/types.h>
    40 #include <usb/usb.h>
     39#include <stdint.h>
    4140
     41/** SCSI command codes defined in SCSI-SPC */
     42enum scsi_cmd_spc {
     43        SCSI_CMD_INQUIRY        = 0x12
     44};
     45
     46/** SCSI Inquiry command */
    4247typedef struct {
     48        /** Operation code (12h, SCSI_CMD_INQUIRY) */
    4349        uint8_t op_code;
    44         uint8_t lun_evpd;
     50        /** Reserved:7-2, obsolete:1, evpd:0 */
     51        uint8_t evpd;
     52        /* Page Code */
    4553        uint8_t page_code;
    46         uint16_t alloc_length;
    47         uint8_t ctrl;
    48 } __attribute__((packed)) scsi_cmd_inquiry_t;
     54        /* Allocation Length */
     55        uint16_t alloc_len;
     56        /* Control */
     57        uint8_t control;
     58} __attribute__((packed)) scsi_cdb_inquiry_t;
     59
     60/** SCSI peripheral device type */
     61enum scsi_device_type {
     62        SCSI_DEV_BLOCK          = 0x00,
     63        SCSI_DEV_STREAM         = 0x01,
     64        SCSI_DEV_CD_DVD         = 0x05,
     65        SCSI_DEV_CHANGER        = 0x08,
     66        SCSI_DEV_ENCLOSURE      = 0x0d,
     67        SCSI_DEV_OSD            = 0x11,
     68
     69        SCSI_DEV_LIMIT          = 0x20
     70};
     71
     72extern const char *scsi_dev_type_str[SCSI_DEV_LIMIT];
     73extern const char *scsi_get_dev_type_str(unsigned);
    4974
    5075#endif
    5176
    52 /**
    53  * @}
     77/** @}
    5478 */
Note: See TracChangeset for help on using the changeset viewer.