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