1*433d6423SLionel Sambuc /* 2*433d6423SLionel Sambuc * "Bulk only transfer" related externally visible info 3*433d6423SLionel Sambuc */ 4*433d6423SLionel Sambuc 5*433d6423SLionel Sambuc #ifndef _BULK_H_ 6*433d6423SLionel Sambuc #define _BULK_H_ 7*433d6423SLionel Sambuc 8*433d6423SLionel Sambuc /*---------------------------* 9*433d6423SLionel Sambuc * declared types * 10*433d6423SLionel Sambuc *---------------------------*/ 11*433d6423SLionel Sambuc #define BULK_PACKED __attribute__((__packed__)) 12*433d6423SLionel Sambuc 13*433d6423SLionel Sambuc #define CBW_SIGNATURE (0x43425355) 14*433d6423SLionel Sambuc #define CBW_FLAGS_OUT (0x00) 15*433d6423SLionel Sambuc #define CBW_FLAGS_IN (0x80) 16*433d6423SLionel Sambuc #define CBW_CB_LENGTH (16) 17*433d6423SLionel Sambuc 18*433d6423SLionel Sambuc /* Command Block Wrapper */ 19*433d6423SLionel Sambuc typedef struct BULK_PACKED mass_storage_cbw { 20*433d6423SLionel Sambuc uint32_t dCBWSignature; 21*433d6423SLionel Sambuc uint32_t dCBWTag; 22*433d6423SLionel Sambuc uint32_t dCBWDataTransferLength; 23*433d6423SLionel Sambuc uint8_t bCBWFlags; 24*433d6423SLionel Sambuc uint8_t bCBWLUN; /* 4 bits */ 25*433d6423SLionel Sambuc uint8_t bCDBLength; /* 5 bits */ 26*433d6423SLionel Sambuc uint8_t CBWCB[CBW_CB_LENGTH]; 27*433d6423SLionel Sambuc } 28*433d6423SLionel Sambuc mass_storage_cbw; 29*433d6423SLionel Sambuc 30*433d6423SLionel Sambuc #define CSW_SIGNATURE (0x53425355) 31*433d6423SLionel Sambuc #define CSW_STATUS_GOOD (0x0) 32*433d6423SLionel Sambuc #define CSWS_TATUS_FAILED (0x1) 33*433d6423SLionel Sambuc #define CSW_STATUS_PHASE (0x2) 34*433d6423SLionel Sambuc 35*433d6423SLionel Sambuc /* Command Status Wrapper */ 36*433d6423SLionel Sambuc typedef struct BULK_PACKED mass_storage_csw { 37*433d6423SLionel Sambuc uint32_t dCSWSignature; 38*433d6423SLionel Sambuc uint32_t dCSWTag; 39*433d6423SLionel Sambuc uint32_t dCSWDataResidue; 40*433d6423SLionel Sambuc uint8_t bCSWStatus; 41*433d6423SLionel Sambuc } 42*433d6423SLionel Sambuc mass_storage_csw; 43*433d6423SLionel Sambuc 44*433d6423SLionel Sambuc #undef BULK_PACKED 45*433d6423SLionel Sambuc 46*433d6423SLionel Sambuc /*---------------------------* 47*433d6423SLionel Sambuc * declared functions * 48*433d6423SLionel Sambuc *---------------------------*/ 49*433d6423SLionel Sambuc void init_cbw(mass_storage_cbw *, unsigned int); 50*433d6423SLionel Sambuc void init_csw(mass_storage_csw *); 51*433d6423SLionel Sambuc 52*433d6423SLionel Sambuc #endif /* !_BULK_H_ */ 53