xref: /minix3/minix/drivers/usb/usb_storage/bulk.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /*
2*433d6423SLionel Sambuc  * "Bulk only transfer" related implementation
3*433d6423SLionel Sambuc  */
4*433d6423SLionel Sambuc 
5*433d6423SLionel Sambuc #include <assert.h>
6*433d6423SLionel Sambuc #include <string.h>			/* memset */
7*433d6423SLionel Sambuc 
8*433d6423SLionel Sambuc #include "common.h"
9*433d6423SLionel Sambuc #include "bulk.h"
10*433d6423SLionel Sambuc 
11*433d6423SLionel Sambuc /*===========================================================================*
12*433d6423SLionel Sambuc  *    init_cbw                                                               *
13*433d6423SLionel Sambuc  *===========================================================================*/
14*433d6423SLionel Sambuc void
init_cbw(mass_storage_cbw * cbw,unsigned int tag)15*433d6423SLionel Sambuc init_cbw(mass_storage_cbw * cbw, unsigned int tag)
16*433d6423SLionel Sambuc {
17*433d6423SLionel Sambuc 	assert(NULL != cbw);
18*433d6423SLionel Sambuc 
19*433d6423SLionel Sambuc 	/* Clearing "Command Block Wrapper" */
20*433d6423SLionel Sambuc 	memset(cbw, 0, sizeof(*cbw));
21*433d6423SLionel Sambuc 
22*433d6423SLionel Sambuc 	/* Filling Command Block Wrapper */
23*433d6423SLionel Sambuc 	cbw->dCBWSignature = CBW_SIGNATURE;
24*433d6423SLionel Sambuc 	cbw->dCBWTag = tag;
25*433d6423SLionel Sambuc 	cbw->bCBWLUN = 0;
26*433d6423SLionel Sambuc }
27*433d6423SLionel Sambuc 
28*433d6423SLionel Sambuc 
29*433d6423SLionel Sambuc /*===========================================================================*
30*433d6423SLionel Sambuc  *    init_csw                                                               *
31*433d6423SLionel Sambuc  *===========================================================================*/
32*433d6423SLionel Sambuc void
init_csw(mass_storage_csw * csw)33*433d6423SLionel Sambuc init_csw(mass_storage_csw * csw)
34*433d6423SLionel Sambuc {
35*433d6423SLionel Sambuc 	assert(NULL != csw);
36*433d6423SLionel Sambuc 
37*433d6423SLionel Sambuc 	/* Clearing "Command Status Wrapper" so we can receive data into it */
38*433d6423SLionel Sambuc 	memset(csw, 0, sizeof(*csw));
39*433d6423SLionel Sambuc }
40