Changeset e6b32a8 in mainline
- Timestamp:
- 2011-07-15T20:41:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2aceec5
- Parents:
- 7190bbc
- Location:
- uspace/drv/bus/usb/usbmast
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/bo_trans.c
r7190bbc re6b32a8 58 58 * @param tag Command block wrapper tag (automatically compared 59 59 * with answer) 60 * @param lun LUN61 60 * @param cmd Command block 62 61 * @param cmd_size Command block size in bytes … … 68 67 * @return Error code 69 68 */ 70 static int usb_massstor_cmd(usbmast_fun_t *mfun, uint32_t tag, uint8_t lun,71 const void *cmd, size_t cmd_size, usb_direction_t ddir, void *dbuf,72 size_t dbuf_size, size_t*xferred_size)69 static int usb_massstor_cmd(usbmast_fun_t *mfun, uint32_t tag, const void *cmd, 70 size_t cmd_size, usb_direction_t ddir, void *dbuf, size_t dbuf_size, 71 size_t *xferred_size) 73 72 { 74 73 int rc; … … 79 78 /* Prepare CBW - command block wrapper */ 80 79 usb_massstor_cbw_t cbw; 81 usb_massstor_cbw_prepare(&cbw, tag, dbuf_size, ddir, lun, cmd_size,82 cmd );80 usb_massstor_cbw_prepare(&cbw, tag, dbuf_size, ddir, mfun->lun, 81 cmd_size, cmd); 83 82 84 83 /* Send the CBW. */ … … 170 169 * @param tag Command block wrapper tag (automatically compared with 171 170 * answer) 172 * @param lun LUN173 171 * @param cmd CDB (Command Descriptor) 174 172 * @param cmd_size CDB length in bytes … … 179 177 * @return Error code 180 178 */ 181 int usb_massstor_data_in(usbmast_fun_t *mfun, uint32_t tag, uint8_t lun,182 const void *cmd,size_t cmd_size, void *dbuf, size_t dbuf_size, size_t *proc_size)183 { 184 return usb_massstor_cmd(mfun, tag, lun,cmd, cmd_size, USB_DIRECTION_IN,179 int usb_massstor_data_in(usbmast_fun_t *mfun, uint32_t tag, const void *cmd, 180 size_t cmd_size, void *dbuf, size_t dbuf_size, size_t *proc_size) 181 { 182 return usb_massstor_cmd(mfun, tag, cmd, cmd_size, USB_DIRECTION_IN, 185 183 dbuf, dbuf_size, proc_size); 186 184 } … … 191 189 * @param tag Command block wrapper tag (automatically compared with 192 190 * answer) 193 * @param lun LUN194 191 * @param cmd CDB (Command Descriptor) 195 192 * @param cmd_size CDB length in bytes … … 200 197 * @return Error code 201 198 */ 202 int usb_massstor_data_out(usbmast_fun_t *mfun, uint32_t tag, uint8_t lun, 203 const void *cmd, size_t cmd_size, const void *data, size_t data_size, 204 size_t *proc_size) 205 { 206 return usb_massstor_cmd(mfun, tag, lun, cmd, cmd_size, USB_DIRECTION_OUT, 199 int usb_massstor_data_out(usbmast_fun_t *mfun, uint32_t tag, const void *cmd, 200 size_t cmd_size, const void *data, size_t data_size, size_t *proc_size) 201 { 202 return usb_massstor_cmd(mfun, tag, cmd, cmd_size, USB_DIRECTION_OUT, 207 203 (void *) data, data_size, proc_size); 208 204 } -
uspace/drv/bus/usb/usbmast/bo_trans.h
r7190bbc re6b32a8 47 47 #define BULK_OUT_EP 1 48 48 49 extern int usb_massstor_data_in(usbmast_fun_t *, uint32_t, uint8_t,50 const void *,size_t, void *, size_t, size_t *);51 extern int usb_massstor_data_out(usbmast_fun_t *, uint32_t, uint8_t,52 const void *,size_t, const void *, size_t, size_t *);49 extern int usb_massstor_data_in(usbmast_fun_t *, uint32_t, const void *, 50 size_t, void *, size_t, size_t *); 51 extern int usb_massstor_data_out(usbmast_fun_t *, uint32_t, const void *, 52 size_t, const void *, size_t, size_t *); 53 53 extern int usb_massstor_reset(usbmast_fun_t *); 54 54 extern void usb_massstor_reset_recovery(usbmast_fun_t *); -
uspace/drv/bus/usb/usbmast/main.c
r7190bbc re6b32a8 102 102 103 103 msfun->usb_dev = dev; 104 msfun->lun = 0; 104 105 105 106 fun = ddf_fun_create(dev->ddf_dev, fun_exposed, fun_name); -
uspace/drv/bus/usb/usbmast/scsi_ms.c
r7190bbc re6b32a8 78 78 cdb.alloc_len = host2uint16_t_be(sizeof(inq_data)); 79 79 80 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0,(uint8_t *) &cdb,80 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb, 81 81 sizeof(cdb), &inq_data, sizeof(inq_data), &response_len); 82 82 … … 135 135 cdb.alloc_len = min(size, SCSI_SENSE_DATA_MAX_SIZE); 136 136 137 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0,(uint8_t *) &cdb,137 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb, 138 138 sizeof(cdb), buf, size, &data_len); 139 139 … … 172 172 cdb.op_code = SCSI_CMD_READ_CAPACITY_10; 173 173 174 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0,(uint8_t *) &cdb,174 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb, 175 175 sizeof(cdb), &data, sizeof(data), &data_len); 176 176 … … 220 220 cdb.xfer_len = host2uint32_t_be(nblocks); 221 221 222 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0,(uint8_t *) &cdb,222 rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb, 223 223 sizeof(cdb), buf, nblocks * mfun->block_size, &data_len); 224 224 … … 265 265 cdb.xfer_len = host2uint32_t_be(nblocks); 266 266 267 rc = usb_massstor_data_out(mfun, 0xDEADBEEF, 0,(uint8_t *) &cdb,267 rc = usb_massstor_data_out(mfun, 0xDEADBEEF, (uint8_t *) &cdb, 268 268 sizeof(cdb), data, nblocks * mfun->block_size, &sent_len); 269 269 -
uspace/drv/bus/usb/usbmast/usbmast.h
r7190bbc re6b32a8 47 47 /** DDF function */ 48 48 ddf_fun_t *ddf_fun; 49 /** LUN */ 50 unsigned lun; 49 51 /** Total number of blocks. */ 50 52 uint64_t nblocks;
Note:
See TracChangeset
for help on using the changeset viewer.