17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*d29f5a71Szhigang lu - Sun Microsystems - Beijing China * Common Development and Distribution License (the "License"). 6*d29f5a71Szhigang lu - Sun Microsystems - Beijing China * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*d29f5a71Szhigang lu - Sun Microsystems - Beijing China * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_BULKONLY_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_BULKONLY_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate /* 357c478bd9Sstevel@tonic-gate * usb_bulkonly.h: This header file provides the data structures 367c478bd9Sstevel@tonic-gate * and variable definitions for the mass storage bulk only protocol. 377c478bd9Sstevel@tonic-gate * (See Universal Serial Bus Mass Storage Class Bulk-Only Transport rev 1.0) 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* Reset value to be passed */ 417c478bd9Sstevel@tonic-gate #define BULK_ONLY_RESET 0xFF 427c478bd9Sstevel@tonic-gate /* Bulk Class specific req */ 437c478bd9Sstevel@tonic-gate /* Bulk Class specific GET_Max_LUN bmRequest value */ 447c478bd9Sstevel@tonic-gate #define BULK_ONLY_GET_MAXLUN_BMREQ \ 457c478bd9Sstevel@tonic-gate (USB_DEV_REQ_DEV_TO_HOST | USB_DEV_REQ_TYPE_CLASS | \ 467c478bd9Sstevel@tonic-gate USB_DEV_REQ_RCPT_IF) 477c478bd9Sstevel@tonic-gate /* Bulk Class specific GET_Max_LUN bRequest value */ 487c478bd9Sstevel@tonic-gate #define BULK_ONLY_GET_MAXLUN_REQ 0xFE 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate /* 517c478bd9Sstevel@tonic-gate * Command Block Wrapper: 527c478bd9Sstevel@tonic-gate * The CBW is used to transfer commands to the device. 537c478bd9Sstevel@tonic-gate */ 547c478bd9Sstevel@tonic-gate #define CBW_SIGNATURE 0x43425355 /* "USBC" */ 557c478bd9Sstevel@tonic-gate #define CBW_DIR_IN 0x80 /* CBW from device to the host */ 567c478bd9Sstevel@tonic-gate #define CBW_DIR_OUT 0x00 /* CBW from host to the device */ 577c478bd9Sstevel@tonic-gate #define CBW_CDB_LEN 16 /* CDB Len to 10 byte cmds */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate #define USB_BULK_CBWCMD_LEN 0x1F 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate #define CBW_MSB(x) ((x) & 0xFF) /* Swap msb */ 627c478bd9Sstevel@tonic-gate #define CBW_MID1(x) ((x) >> 8 & 0xFF) 637c478bd9Sstevel@tonic-gate #define CBW_MID2(x) ((x) >> 16 & 0xFF) 647c478bd9Sstevel@tonic-gate #define CBW_LSB(x) ((x) >> 24 & 0xFF) 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * Command Status Wrapper: 687c478bd9Sstevel@tonic-gate * The device shall not execute any subsequent command until the 697c478bd9Sstevel@tonic-gate * associated CSW from the previous command has been successfully 707c478bd9Sstevel@tonic-gate * transported. 717c478bd9Sstevel@tonic-gate * 727c478bd9Sstevel@tonic-gate * All CSW transfers shall be ordered withe LSB first. 737c478bd9Sstevel@tonic-gate */ 747c478bd9Sstevel@tonic-gate typedef struct usb_bulk_csw { 757c478bd9Sstevel@tonic-gate uchar_t csw_dCSWSignature0; /* Signature */ 767c478bd9Sstevel@tonic-gate uchar_t csw_dCSWSignature1; 777c478bd9Sstevel@tonic-gate uchar_t csw_dCSWSignature2; 787c478bd9Sstevel@tonic-gate uchar_t csw_dCSWSignature3; 797c478bd9Sstevel@tonic-gate uchar_t csw_dCSWTag3; /* random tag */ 807c478bd9Sstevel@tonic-gate uchar_t csw_dCSWTag2; 817c478bd9Sstevel@tonic-gate uchar_t csw_dCSWTag1; 827c478bd9Sstevel@tonic-gate uchar_t csw_dCSWTag0; 837c478bd9Sstevel@tonic-gate uchar_t csw_dCSWDataResidue0; /* data not transferred */ 847c478bd9Sstevel@tonic-gate uchar_t csw_dCSWDataResidue1; 857c478bd9Sstevel@tonic-gate uchar_t csw_dCSWDataResidue2; 867c478bd9Sstevel@tonic-gate uchar_t csw_dCSWDataResidue3; 877c478bd9Sstevel@tonic-gate uchar_t csw_bCSWStatus; /* command status */ 887c478bd9Sstevel@tonic-gate } usb_bulk_csw_t; 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #define CSW_SIGNATURE 0x53425355 /* "SBSU" */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #define CSW_STATUS_GOOD 0x0 /* Good status */ 937c478bd9Sstevel@tonic-gate #define CSW_STATUS_FAILED 0x1 /* Command failed */ 947c478bd9Sstevel@tonic-gate #define CSW_STATUS_PHASE_ERROR 0x2 /* Phase error */ 957c478bd9Sstevel@tonic-gate #define CSW_LEN 0xD /* CSW Command Len */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* Vendor specific command needed for specific Bulk Only devices */ 987c478bd9Sstevel@tonic-gate #define IOMEGA_CMD_CARTRIDGE_PROTECT 0x0C 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1017c478bd9Sstevel@tonic-gate } 1027c478bd9Sstevel@tonic-gate #endif 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_BULKONLY_H */ 105