Changeset 70c12d6 in mainline for uspace/drv/usbmast/mast.c
- Timestamp:
- 2011-05-11T19:20:06Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cf002dbf
- Parents:
- 19387b61
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbmast/mast.c
r19387b61 r70c12d6 40 40 #include <str_error.h> 41 41 #include <usb/debug.h> 42 #include <usb/request.h> 42 43 43 44 bool usb_mast_verbose = true; … … 63 64 * @return Error code. 64 65 */ 65 int usb_massstor_data_in(usb_pipe_t *bulk_in_pipe, usb_pipe_t *bulk_out_pipe, 66 int usb_massstor_data_in(usb_device_t *dev, 67 size_t bulk_in_pipe_index, size_t bulk_out_pipe_index, 66 68 uint32_t tag, uint8_t lun, void *cmd, size_t cmd_size, 67 69 void *in_buffer, size_t in_buffer_size, size_t *received_size) … … 69 71 int rc; 70 72 size_t act_size; 73 usb_pipe_t *bulk_in_pipe = dev->pipes[bulk_in_pipe_index].pipe; 74 usb_pipe_t *bulk_out_pipe = dev->pipes[bulk_out_pipe_index].pipe; 71 75 72 76 /* Prepare CBW - command block wrapper */ … … 135 139 } 136 140 141 int usb_massstor_reset(usb_device_t *dev) 142 { 143 return usb_control_request_set(&dev->ctrl_pipe, 144 USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE, 145 0xFF, 0, dev->interface_no, NULL, 0); 146 } 147 148 void usb_massstor_reset_recovery(usb_device_t *dev, 149 size_t bulk_in_idx, size_t bulk_out_idx) 150 { 151 /* We would ignore errors here because if this fails 152 * we are doomed anyway and any following transaction would fail. 153 */ 154 usb_massstor_reset(dev); 155 usb_pipe_clear_halt(&dev->ctrl_pipe, dev->pipes[bulk_in_idx].pipe); 156 usb_pipe_clear_halt(&dev->ctrl_pipe, dev->pipes[bulk_out_idx].pipe); 157 } 158 159 int usb_massstor_get_max_lun(usb_device_t *dev) 160 { 161 uint8_t max_lun; 162 size_t data_recv_len; 163 int rc = usb_control_request_get(&dev->ctrl_pipe, 164 USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE, 165 0xFE, 0, dev->interface_no, &max_lun, 1, &data_recv_len); 166 if (rc != EOK) { 167 return rc; 168 } 169 if (data_recv_len != 1) { 170 return EEMPTY; 171 } 172 return (int) max_lun; 173 } 174 137 175 /** 138 176 * @}
Note:
See TracChangeset
for help on using the changeset viewer.