📄 sbc.h
字号:
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2008, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ----------------------------------------------------------------------------
*/
//------------------------------------------------------------------------------
/// \unit
/// !Purpose
///
/// SCSI definitions.
///
/// !Usage
///
/// -# After command block received, Access and decode the SCSI command block
/// with SBCCommand structure.
//------------------------------------------------------------------------------
#ifndef SBC_H
#define SBC_H
//------------------------------------------------------------------------------
// Definitions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \page "SBC Operation Codes"
/// This page lists operation codes of commands described in the SBC-3
/// standard.
///
/// \note That most commands are actually defined in other standards,
/// like SPC-4. Optional commands are not included here.
///
/// \see sbc3r07.pdf - Section 5.1 - Table 12
/// \see spc4r06.pdf
/// \see SBCCommand
///
/// !Codes
/// - SBC_INQUIRY
/// - SBC_READ_10
/// - SBC_READ_CAPACITY_10
/// - SBC_REQUEST_SENSE
/// - SBC_TEST_UNIT_READY
/// - SBC_WRITE_10
///
/// !Optional Codes but required by Windows
/// - SBC_PREVENT_ALLOW_MEDIUM_REMOVAL
/// - SBC_MODE_SENSE_6
/// - SBC_VERIFY_10
/// Request information regarding parameters of the target and Logical Unit.
#define SBC_INQUIRY 0x12
/// Request the transfer data to the host.
#define SBC_READ_10 0x28
/// Request capacities of the currently installed medium.
#define SBC_READ_CAPACITY_10 0x25
/// Request that the device server transfer sense data.
#define SBC_REQUEST_SENSE 0x03
/// Check if the LUN is ready
#define SBC_TEST_UNIT_READY 0x00
/// Request that the device write the data transferred by the host.
#define SBC_WRITE_10 0x2A
/// Request that the target enable or disable the removal of the medium in
/// the Logical Unit.
#define SBC_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
/// Report parameters.
#define SBC_MODE_SENSE_6 0x1A
/// Request that the %device verify the data on the medium.
#define SBC_VERIFY_10 0x2F
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \page "SBC Periph. Qualifiers"
/// This page lists the peripheral qualifier values specified in the INQUIRY
/// data
/// \see spc4r06.pdf - Section 6.4.2 - Table 83
/// \see SBCInquiryData
///
/// !Qualifiers
/// - SBC_PERIPHERAL_DEVICE_CONNECTED
/// - SBC_PERIPHERAL_DEVICE_NOT_CONNECTED
/// - SBC_PERIPHERAL_DEVICE_NOT_SUPPORTED
#define SBC_PERIPHERAL_DEVICE_CONNECTED 0x00
#define SBC_PERIPHERAL_DEVICE_NOT_CONNECTED 0x01
#define SBC_PERIPHERAL_DEVICE_NOT_SUPPORTED 0x03
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \page "SBC Periph. Types"
/// This page lists peripheral device types specified in the INQUIRY data
/// \see spc4r06.pdf - Section 6.4.2 - Table 84
/// \see SBCInquiryData
///
/// !Types
/// - SBC_DIRECT_ACCESS_BLOCK_DEVICE
/// - SBC_SEQUENTIAL_ACCESS_DEVICE
/// - SBC_PRINTER_DEVICE
/// - SBC_PROCESSOR_DEVICE
/// - SBC_WRITE_ONCE_DEVICE
/// - SBC_CD_DVD_DEVICE
/// - SBC_SCANNER_DEVICE
/// - SBC_OPTICAL_MEMORY_DEVICE
/// - SBC_MEDIA_CHANGER_DEVICE
/// - SBC_COMMUNICATION_DEVICE
/// - SBC_STORAGE_ARRAY_CONTROLLER_DEVICE
/// - SBC_ENCLOSURE_SERVICES_DEVICE
/// - SBC_SIMPLIFIED_DIRECT_ACCESS_DEVICE
/// - SBC_OPTICAL_CARD_READER_WRITER_DEVICE
/// - SBC_BRIDGE_CONTROLLER_COMMANDS
/// - SBC_OBJECT_BASED_STORAGE_DEVICE
#define SBC_DIRECT_ACCESS_BLOCK_DEVICE 0x00
#define SBC_SEQUENTIAL_ACCESS_DEVICE 0x01
#define SBC_PRINTER_DEVICE 0x02
#define SBC_PROCESSOR_DEVICE 0x03
#define SBC_WRITE_ONCE_DEVICE 0x04
#define SBC_CD_DVD_DEVICE 0x05
#define SBC_SCANNER_DEVICE 0x06
#define SBC_OPTICAL_MEMORY_DEVICE 0x07
#define SBC_MEDIA_CHANGER_DEVICE 0x08
#define SBC_COMMUNICATION_DEVICE 0x09
#define SBC_STORAGE_ARRAY_CONTROLLER_DEVICE 0x0C
#define SBC_ENCLOSURE_SERVICES_DEVICE 0x0D
#define SBC_SIMPLIFIED_DIRECT_ACCESS_DEVICE 0x0E
#define SBC_OPTICAL_CARD_READER_WRITER_DEVICE 0x0F
#define SBC_BRIDGE_CONTROLLER_COMMANDS 0x10
#define SBC_OBJECT_BASED_STORAGE_DEVICE 0x11
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \brief Version value for the SBC-3 specification
/// \see spc4r06.pdf - Section 6.4.2 - Table 85
#define SBC_SPC_VERSION_4 0x06
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \brief Values for the TPGS field returned in INQUIRY data
/// \see spc4r06.pdf - Section 6.4.2 - Table 86
#define SBC_TPGS_NONE 0x0
#define SBC_TPGS_ASYMMETRIC 0x1
#define SBC_TPGS_SYMMETRIC 0x2
#define SBC_TPGS_BOTH 0x3
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \brief Version descriptor value for the SBC-3 specification
/// \see spc4r06.pdf - Section 6.4.2 - Table 87
#define SBC_VERSION_DESCRIPTOR_SBC_3 0x04C0
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \page "SBC Sense Response Codes"
/// This page lists sense data response codes returned in REQUEST SENSE data
/// \see spc4r06.pdf - Section 4.5.1 - Table 12
///
/// !Codes
/// - SBC_SENSE_DATA_FIXED_CURRENT
/// - SBC_SENSE_DATA_FIXED_DEFERRED
/// - SBC_SENSE_DATA_DESCRIPTOR_CURRENT
/// - SBC_SENSE_DATA_DESCRIPTOR_DEFERRED
#define SBC_SENSE_DATA_FIXED_CURRENT 0x70
#define SBC_SENSE_DATA_FIXED_DEFERRED 0x71
#define SBC_SENSE_DATA_DESCRIPTOR_CURRENT 0x72
#define SBC_SENSE_DATA_DESCRIPTOR_DEFERRED 0x73
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// \page "SBC Sense Keys"
/// This page lists sense key values returned in the REQUEST SENSE data
/// \see spc4r06.pdf - Section 4.5.6 - Table 27
///
/// !Keys
/// - SBC_SENSE_KEY_NO_SENSE
/// - SBC_SENSE_KEY_RECOVERED_ERROR
/// - SBC_SENSE_KEY_NOT_READY
/// - SBC_SENSE_KEY_MEDIUM_ERROR
/// - SBC_SENSE_KEY_HARDWARE_ERROR
/// - SBC_SENSE_KEY_ILLEGAL_REQUEST
/// - SBC_SENSE_KEY_UNIT_ATTENTION
/// - SBC_SENSE_KEY_DATA_PROTECT
/// - SBC_SENSE_KEY_BLANK_CHECK
/// - SBC_SENSE_KEY_VENDOR_SPECIFIC
/// - SBC_SENSE_KEY_COPY_ABORTED
/// - SBC_SENSE_KEY_ABORTED_COMMAND
/// - SBC_SENSE_KEY_VOLUME_OVERFLOW
/// - SBC_SENSE_KEY_MISCOMPARE
/// No specific sense key. Successful command.
#define SBC_SENSE_KEY_NO_SENSE 0x00
/// Command completed succesfully with some recovery action by the %device.
#define SBC_SENSE_KEY_RECOVERED_ERROR 0x01
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -