Changeset fe97c5e in mainline
- Timestamp:
- 2015-06-28T17:11:59Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dca8fe5
- Parents:
- fb1007ef
- Location:
- uspace/drv/nic/ar9271
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/ar9271.c
rfb1007ef rfe97c5e 772 772 size_t chunk_size = min(remain_size, MAX_TRANSFER_SIZE); 773 773 memcpy(buffer, current_data, chunk_size); 774 int rc = usb_control_request_set(&usb_device->ctrl_pipe, 774 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 775 int rc = usb_control_request_set(ctrl_pipe, 775 776 USB_REQUEST_TYPE_VENDOR, 776 777 USB_REQUEST_RECIPIENT_DEVICE, … … 799 800 * device side buffer which we will check in htc_check_ready function. 800 801 */ 801 int rc = usb_control_request_set(&usb_device->ctrl_pipe, 802 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 803 int rc = usb_control_request_set(ctrl_pipe, 802 804 USB_REQUEST_TYPE_VENDOR, 803 805 USB_REQUEST_RECIPIENT_DEVICE, … … 829 831 { 830 832 /* USB framework initialization. */ 831 usb_device_t *usb_device = calloc(1, sizeof(usb_device_t));832 if (usb_device == NULL) {833 usb_log_error("USB device structure allocation failed.\n");834 return NULL;835 }836 837 833 const char *err_msg = NULL; 838 int rc = usb_device_init(usb_device, dev, endpoints, &err_msg); 839 if (rc != EOK) { 840 free(usb_device); 834 int rc = usb_device_create_ddf(dev, endpoints, &err_msg); 835 if (rc != EOK) { 841 836 usb_log_error("Failed to create USB device: %s, " 842 837 "ERR_NUM = %d\n", err_msg, rc); … … 847 842 ar9271_t *ar9271 = calloc(1, sizeof(ar9271_t)); 848 843 if (!ar9271) { 849 free(usb_device);850 844 usb_log_error("Failed to allocate memory for device " 851 845 "structure.\n"); … … 855 849 ar9271->ddf_dev = dev; 856 850 857 rc = ar9271_init(ar9271, usb_device );851 rc = ar9271_init(ar9271, usb_device_get(dev)); 858 852 if (rc != EOK) { 859 853 free(ar9271); 860 free(usb_device);861 854 usb_log_error("Failed to initialize AR9271 structure: %d\n", 862 855 rc); -
uspace/drv/nic/ar9271/ath_usb.c
rfb1007ef rfe97c5e 98 98 { 99 99 ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data; 100 usb_pipe_t *pipe = 101 &ath_usb->usb_device->pipes[ath_usb->output_ctrl_pipe_number].pipe;102 100 usb_pipe_t *pipe = &usb_device_get_mapped_ep( 101 ath_usb->usb_device, ath_usb->output_ctrl_pipe_number)->pipe; 102 103 103 return usb_pipe_write(pipe, buffer, buffer_size); 104 104 } … … 118 118 { 119 119 ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data; 120 usb_pipe_t *pipe = 121 &ath_usb->usb_device->pipes[ath_usb->input_ctrl_pipe_number].pipe;122 120 usb_pipe_t *pipe = &usb_device_get_mapped_ep( 121 ath_usb->usb_device, ath_usb->input_ctrl_pipe_number)->pipe; 122 123 123 return usb_pipe_read(pipe, buffer, buffer_size, transferred_size); 124 124 } … … 141 141 memcpy(complete_buffer + sizeof(ath_usb_data_header_t), 142 142 buffer, buffer_size); 143 143 144 144 ath_usb_data_header_t *data_header = 145 145 (ath_usb_data_header_t *) complete_buffer; 146 146 data_header->length = host2uint16_t_le(buffer_size); 147 147 data_header->tag = host2uint16_t_le(TX_TAG); 148 148 149 149 ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data; 150 usb_pipe_t *pipe = 151 &ath_usb->usb_device->pipes[ath_usb->output_data_pipe_number].pipe;152 150 usb_pipe_t *pipe = &usb_device_get_mapped_ep( 151 ath_usb->usb_device, ath_usb->output_data_pipe_number)->pipe; 152 153 153 int ret_val = usb_pipe_write(pipe, complete_buffer, 154 154 complete_buffer_size); 155 155 156 156 free(complete_buffer); 157 157 158 158 return ret_val; 159 159 } … … 173 173 { 174 174 ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data; 175 usb_pipe_t *pipe = 176 &ath_usb->usb_device->pipes[ath_usb->input_data_pipe_number].pipe; 177 178 return usb_pipe_read(pipe, buffer, buffer_size, 179 transferred_size); 175 usb_pipe_t *pipe = &usb_device_get_mapped_ep( 176 ath_usb->usb_device, ath_usb->input_data_pipe_number)->pipe; 177 178 return usb_pipe_read(pipe, buffer, buffer_size, transferred_size); 180 179 }
Note:
See TracChangeset
for help on using the changeset viewer.