📄 storage.h
字号:
/* * Copyright (c) 2007, Benedikt Sauter <sauter@ixbat.de> * All rights reserved. * * Short descripton of file: * * * 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 following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the FH Augsburg nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS 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. */void usb_storage_probe();void usb_storage_check();/* CSW Status Definitions */#define CSW_CMD_PASSED 0x00#define CSW_CMD_FAILED 0x01#define CSW_PHASE_ERROR 0x02/* SCSI Commands */#define SCSI_TEST_UNIT_READY 0x00#define SCSI_REQUEST_SENSE 0x03#define SCSI_FORMAT_UNIT 0x04#define SCSI_INQUIRY 0x12#define SCSI_MODE_SELECT6 0x15#define SCSI_MODE_SENSE6 0x1A#define SCSI_START_STOP_UNIT 0x1B#define SCSI_MEDIA_REMOVAL 0x1E#define SCSI_READ_FORMAT_CAPACITIES 0x23#define SCSI_READ_CAPACITY 0x25#define SCSI_READ10 0x28#define SCSI_WRITE10 0x2A#define SCSI_VERIFY10 0x2F#define SCSI_MODE_SELECT10 0x55#define SCSI_MODE_SENSE10 0x5Atypedef struct usb_storage_cbw_t usb_storage_cbw;struct usb_storage_cbw_t { u32 dCBWSignature; u32 dCBWTag; u32 dCBWDataTransferLength; u8 bCWDFlags; u8 bCBWLun; u8 bCBWCBLength; u8 CBWCB[16];};typedef struct usb_storage_csw_t usb_storage_csw;struct usb_storage_csw_t { u32 dCSWSignature; u32 dCSWTag; u32 dCSWDataResidue; u8 bCSWStatus;};void usb_storage_init();u8 usb_storage_open(u8 device);u8 usb_storage_read_capacity(u8 device);u8 usb_storage_inquiry(u8 device);u8 usb_storage_read_sector(u8 device, u32 sector, char * buf);u8 usb_storage_write_sector(u8 device, u32 sector, char * buf);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -