Changeset 5a6cc679 in mainline for uspace/drv/bus/usb
- Timestamp:
- 2018-01-31T02:21:24Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a0a9cc2
- Parents:
- 132ab5d1
- Location:
- uspace/drv/bus/usb
- Files:
-
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_bus.h
r132ab5d1 r5a6cc679 72 72 void ehci_bus_prepare_ops(void); 73 73 74 int ehci_bus_init(ehci_bus_t *, hc_t *);74 errno_t ehci_bus_init(ehci_bus_t *, hc_t *); 75 75 76 76 /** Get and convert assigned ehci_endpoint_t structure -
uspace/drv/bus/usb/ehci/ehci_rh.c
r132ab5d1 r5a6cc679 99 99 * initializes internal virtual hub. 100 100 */ 101 int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,101 errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs, 102 102 fibril_mutex_t *guard, const char *name) 103 103 { … … 141 141 * status change requests might be postponed until there is something to report. 142 142 */ 143 int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch)143 errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch) 144 144 { 145 145 assert(instance); … … 184 184 * processing of a postponed request. 185 185 */ 186 int ehci_rh_interrupt(ehci_rh_t *instance)186 errno_t ehci_rh_interrupt(ehci_rh_t *instance) 187 187 { 188 188 fibril_mutex_lock(instance->guard); … … 231 231 * @return Error code. 232 232 */ 233 static int req_get_status(usbvirt_device_t *device,233 static errno_t req_get_status(usbvirt_device_t *device, 234 234 const usb_device_request_setup_packet_t *setup_packet, 235 235 uint8_t *data, size_t *act_size) … … 254 254 * @return Error code. 255 255 */ 256 static int req_clear_hub_feature(usbvirt_device_t *device,256 static errno_t req_clear_hub_feature(usbvirt_device_t *device, 257 257 const usb_device_request_setup_packet_t *setup_packet, 258 258 uint8_t *data, size_t *act_size) … … 282 282 * @return Error code. 283 283 */ 284 static int req_get_port_status(usbvirt_device_t *device,284 static errno_t req_get_port_status(usbvirt_device_t *device, 285 285 const usb_device_request_setup_packet_t *setup_packet, 286 286 uint8_t *data, size_t *act_size) … … 325 325 } ehci_rh_job_t; 326 326 327 static int stop_reset(void *arg)327 static errno_t stop_reset(void *arg) 328 328 { 329 329 ehci_rh_job_t *job = arg; … … 354 354 } 355 355 356 static int stop_resume(void *arg)356 static errno_t stop_resume(void *arg) 357 357 { 358 358 ehci_rh_job_t *job = arg; … … 367 367 } 368 368 369 static int delayed_job(int (*func)(void*), ehci_rh_t *rh, unsigned port)369 static errno_t delayed_job(errno_t (*func)(void*), ehci_rh_t *rh, unsigned port) 370 370 { 371 371 ehci_rh_job_t *job = malloc(sizeof(*job)); … … 393 393 * @return Error code. 394 394 */ 395 static int req_clear_port_feature(usbvirt_device_t *device,395 static errno_t req_clear_port_feature(usbvirt_device_t *device, 396 396 const usb_device_request_setup_packet_t *setup_packet, 397 397 uint8_t *data, size_t *act_size) … … 472 472 * @return Error code. 473 473 */ 474 static int req_set_port_feature(usbvirt_device_t *device,474 static errno_t req_set_port_feature(usbvirt_device_t *device, 475 475 const usb_device_request_setup_packet_t *setup_packet, 476 476 uint8_t *data, size_t *act_size) … … 521 521 * only need 1 byte. 522 522 */ 523 static int req_status_change_handler(usbvirt_device_t *device,523 static errno_t req_status_change_handler(usbvirt_device_t *device, 524 524 usb_endpoint_t endpoint, usb_transfer_type_t tr_type, 525 525 void *buffer, size_t buffer_size, size_t *actual_size) -
uspace/drv/bus/usb/ehci/ehci_rh.h
r132ab5d1 r5a6cc679 79 79 } ehci_rh_t; 80 80 81 int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,81 errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs, 82 82 fibril_mutex_t *guard, const char *name); 83 int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);84 int ehci_rh_interrupt(ehci_rh_t *instance);83 errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch); 84 errno_t ehci_rh_interrupt(ehci_rh_t *instance); 85 85 86 86 /** Get EHCI rh address. -
uspace/drv/bus/usb/ehci/endpoint_list.c
r132ab5d1 r5a6cc679 50 50 * Allocates memory for internal ed_t structure. 51 51 */ 52 int endpoint_list_init(endpoint_list_t *instance, const char *name)52 errno_t endpoint_list_init(endpoint_list_t *instance, const char *name) 53 53 { 54 54 assert(instance); -
uspace/drv/bus/usb/ehci/endpoint_list.h
r132ab5d1 r5a6cc679 68 68 } 69 69 70 int endpoint_list_init(endpoint_list_t *instance, const char *name);70 errno_t endpoint_list_init(endpoint_list_t *instance, const char *name); 71 71 void endpoint_list_chain(endpoint_list_t *instance, const endpoint_list_t *next); 72 72 void endpoint_list_append_ep(endpoint_list_t *instance, ehci_endpoint_t *ep); -
uspace/drv/bus/usb/ehci/hc.c
r132ab5d1 r5a6cc679 89 89 }; 90 90 91 static int hc_init_memory(hc_t *instance);91 static errno_t hc_init_memory(hc_t *instance); 92 92 93 93 /** Generate IRQ code. … … 99 99 * @return Error code. 100 100 */ 101 int hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)101 errno_t hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq) 102 102 { 103 103 assert(code); … … 151 151 * @return Error code 152 152 */ 153 int hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)153 errno_t hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res) 154 154 { 155 155 hc_t *instance = hcd_to_hc(hcd); … … 160 160 return EINVAL; 161 161 162 int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],162 errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0], 163 163 (void **)&instance->caps); 164 164 if (ret != EOK) { … … 265 265 } 266 266 267 int ehci_hc_status(bus_t *bus_base, uint32_t *status)267 errno_t ehci_hc_status(bus_t *bus_base, uint32_t *status) 268 268 { 269 269 assert(bus_base); … … 289 289 * @return Error code. 290 290 */ 291 int ehci_hc_schedule(usb_transfer_batch_t *batch)291 errno_t ehci_hc_schedule(usb_transfer_batch_t *batch) 292 292 { 293 293 assert(batch); … … 477 477 * @return Error code. 478 478 */ 479 int hc_init_memory(hc_t *instance)479 errno_t hc_init_memory(hc_t *instance) 480 480 { 481 481 assert(instance); 482 482 usb_log_debug2("HC(%p): Initializing Async list(%p).", instance, 483 483 &instance->async_list); 484 int ret = endpoint_list_init(&instance->async_list, "ASYNC");484 errno_t ret = endpoint_list_init(&instance->async_list, "ASYNC"); 485 485 if (ret != EOK) { 486 486 usb_log_error("HC(%p): Failed to setup ASYNC list: %s", -
uspace/drv/bus/usb/ehci/hc.h
r132ab5d1 r5a6cc679 100 100 101 101 /* Boottime operations */ 102 extern int hc_add(hc_device_t *, const hw_res_list_parsed_t *);103 extern int hc_start(hc_device_t *);104 extern int hc_setup_roothub(hc_device_t *);105 extern int hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *);106 extern int hc_gone(hc_device_t *);102 extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *); 103 extern errno_t hc_start(hc_device_t *); 104 extern errno_t hc_setup_roothub(hc_device_t *); 105 extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *); 106 extern errno_t hc_gone(hc_device_t *); 107 107 108 108 /** Runtime operations */ 109 109 extern void ehci_hc_interrupt(bus_t *, uint32_t); 110 extern int ehci_hc_status(bus_t *, uint32_t *);111 extern int ehci_hc_schedule(usb_transfer_batch_t *);110 extern errno_t ehci_hc_status(bus_t *, uint32_t *); 111 extern errno_t ehci_hc_schedule(usb_transfer_batch_t *); 112 112 113 113 #endif -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c
r132ab5d1 r5a6cc679 44 44 45 45 46 int td_error(const td_t *td)46 errno_t td_error(const td_t *td) 47 47 { 48 48 assert(td); -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h
r132ab5d1 r5a6cc679 97 97 } 98 98 99 int td_error(const td_t *td);99 errno_t td_error(const td_t *td); 100 100 101 101 void td_init(td_t *td, uintptr_t next_phys, uintptr_t buf, usb_direction_t dir, -
uspace/drv/bus/usb/ehci/res.c
r132ab5d1 r5a6cc679 63 63 * @return Error code. 64 64 */ 65 static int disable_extended_caps(async_sess_t *parent_sess, unsigned eecp)65 static errno_t disable_extended_caps(async_sess_t *parent_sess, unsigned eecp) 66 66 { 67 67 /* nothing to do */ … … 71 71 /* Read the first EEC. i.e. Legacy Support register */ 72 72 uint32_t usblegsup; 73 int ret = pci_config_space_read_32(parent_sess,73 errno_t ret = pci_config_space_read_32(parent_sess, 74 74 eecp + USBLEGSUP_OFFSET, &usblegsup); 75 75 if (ret != EOK) { … … 173 173 } 174 174 175 int disable_legacy(hc_device_t *hcd)175 errno_t disable_legacy(hc_device_t *hcd) 176 176 { 177 177 hc_t *hc = hcd_to_hc(hcd); … … 182 182 183 183 usb_log_debug("Disabling EHCI legacy support."); 184 185 184 186 185 const uint32_t hcc_params = EHCI_RD(hc->caps->hccparams); -
uspace/drv/bus/usb/ehci/res.h
r132ab5d1 r5a6cc679 38 38 typedef struct hc_device hc_device_t; 39 39 40 extern int disable_legacy(hc_device_t *);40 extern errno_t disable_legacy(hc_device_t *); 41 41 42 42 #endif -
uspace/drv/bus/usb/ohci/endpoint_list.c
r132ab5d1 r5a6cc679 51 51 * Allocates memory for internal ed_t structure. 52 52 */ 53 int endpoint_list_init(endpoint_list_t *instance, const char *name)53 errno_t endpoint_list_init(endpoint_list_t *instance, const char *name) 54 54 { 55 55 assert(instance); -
uspace/drv/bus/usb/ohci/endpoint_list.h
r132ab5d1 r5a6cc679 71 71 } 72 72 73 int endpoint_list_init(endpoint_list_t *instance, const char *name);73 errno_t endpoint_list_init(endpoint_list_t *instance, const char *name); 74 74 void endpoint_list_set_next( 75 75 const endpoint_list_t *instance, const endpoint_list_t *next); -
uspace/drv/bus/usb/ohci/hc.c
r132ab5d1 r5a6cc679 90 90 }; 91 91 92 static int hc_init_transfer_lists(hc_t *instance);93 static int hc_init_memory(hc_t *instance);92 static errno_t hc_init_transfer_lists(hc_t *instance); 93 static errno_t hc_init_memory(hc_t *instance); 94 94 95 95 /** Generate IRQ code. … … 102 102 * @return Error code. 103 103 */ 104 int hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)104 errno_t hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq) 105 105 { 106 106 assert(code); … … 151 151 * @return Error code 152 152 */ 153 int hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)153 errno_t hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res) 154 154 { 155 155 hc_t *instance = hcd_to_hc(hcd); … … 159 159 return EINVAL; 160 160 161 int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],161 errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0], 162 162 (void **) &instance->registers); 163 163 if (ret != EOK) { … … 263 263 } 264 264 265 int ohci_hc_status(bus_t *bus_base, uint32_t *status)265 errno_t ohci_hc_status(bus_t *bus_base, uint32_t *status) 266 266 { 267 267 assert(bus_base); … … 285 285 * @return Error code. 286 286 */ 287 int ohci_hc_schedule(usb_transfer_batch_t *batch)287 errno_t ohci_hc_schedule(usb_transfer_batch_t *batch) 288 288 { 289 289 assert(batch); … … 547 547 * @return Error code 548 548 */ 549 int hc_init_transfer_lists(hc_t *instance)549 errno_t hc_init_transfer_lists(hc_t *instance) 550 550 { 551 551 assert(instance); … … 553 553 do { \ 554 554 const char *name = usb_str_transfer_type(type); \ 555 const int ret = endpoint_list_init(&instance->lists[type], name); \555 const errno_t ret = endpoint_list_init(&instance->lists[type], name); \ 556 556 if (ret != EOK) { \ 557 557 usb_log_error("Failed to setup %s endpoint list: %s.", \ … … 581 581 * @return Error code. 582 582 */ 583 int hc_init_memory(hc_t *instance)583 errno_t hc_init_memory(hc_t *instance) 584 584 { 585 585 assert(instance); … … 587 587 memset(&instance->rh, 0, sizeof(instance->rh)); 588 588 /* Init queues */ 589 int ret = hc_init_transfer_lists(instance);589 errno_t ret = hc_init_transfer_lists(instance); 590 590 if (ret != EOK) { 591 591 return ret; -
uspace/drv/bus/usb/ohci/hc.h
r132ab5d1 r5a6cc679 89 89 } 90 90 91 extern int hc_add(hc_device_t *, const hw_res_list_parsed_t *);92 extern int hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *);93 extern int hc_gain_control(hc_device_t *);94 extern int hc_start(hc_device_t *);95 extern int hc_setup_roothub(hc_device_t *);96 extern int hc_gone(hc_device_t *);91 extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *); 92 extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *); 93 extern errno_t hc_gain_control(hc_device_t *); 94 extern errno_t hc_start(hc_device_t *); 95 extern errno_t hc_setup_roothub(hc_device_t *); 96 extern errno_t hc_gone(hc_device_t *); 97 97 98 98 extern void hc_enqueue_endpoint(hc_t *, const endpoint_t *); 99 99 extern void hc_dequeue_endpoint(hc_t *, const endpoint_t *); 100 100 101 extern int ohci_hc_schedule(usb_transfer_batch_t *);102 extern int ohci_hc_status(bus_t *, uint32_t *);101 extern errno_t ohci_hc_schedule(usb_transfer_batch_t *); 102 extern errno_t ohci_hc_status(bus_t *, uint32_t *); 103 103 extern void ohci_hc_interrupt(bus_t *, uint32_t); 104 104 -
uspace/drv/bus/usb/ohci/hw_struct/completion_codes.h
r132ab5d1 r5a6cc679 54 54 }; 55 55 56 inline static int cc_to_rc(unsigned int cc)56 inline static errno_t cc_to_rc(unsigned int cc) 57 57 { 58 58 switch (cc) { -
uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h
r132ab5d1 r5a6cc679 119 119 * @return Error code. 120 120 */ 121 static inline int td_error(const td_t *instance)121 static inline errno_t td_error(const td_t *instance) 122 122 { 123 123 assert(instance); -
uspace/drv/bus/usb/ohci/ohci_bus.h
r132ab5d1 r5a6cc679 65 65 } ohci_bus_t; 66 66 67 int ohci_bus_init(ohci_bus_t *, hc_t *);67 errno_t ohci_bus_init(ohci_bus_t *, hc_t *); 68 68 void ohci_ep_toggle_reset(endpoint_t *); 69 69 -
uspace/drv/bus/usb/ohci/ohci_rh.c
r132ab5d1 r5a6cc679 109 109 * initializes internal virtual hub. 110 110 */ 111 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs,111 errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, 112 112 fibril_mutex_t *guard, const char *name) 113 113 { … … 176 176 * status change requests might be postponed until there is something to report. 177 177 */ 178 int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch)178 errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch) 179 179 { 180 180 assert(instance); … … 214 214 * processing of a postponed request. 215 215 */ 216 int ohci_rh_interrupt(ohci_rh_t *instance)216 errno_t ohci_rh_interrupt(ohci_rh_t *instance) 217 217 { 218 218 fibril_mutex_lock(instance->guard); … … 259 259 * @return Error code. 260 260 */ 261 static int req_get_status(usbvirt_device_t *device,261 static errno_t req_get_status(usbvirt_device_t *device, 262 262 const usb_device_request_setup_packet_t *setup_packet, 263 263 uint8_t *data, size_t *act_size) … … 282 282 * @return Error code. 283 283 */ 284 static int req_clear_hub_feature(usbvirt_device_t *device,284 static errno_t req_clear_hub_feature(usbvirt_device_t *device, 285 285 const usb_device_request_setup_packet_t *setup_packet, 286 286 uint8_t *data, size_t *act_size) … … 312 312 * @return Error code. 313 313 */ 314 static int req_get_port_status(usbvirt_device_t *device,314 static errno_t req_get_port_status(usbvirt_device_t *device, 315 315 const usb_device_request_setup_packet_t *setup_packet, 316 316 uint8_t *data, size_t *act_size) … … 336 336 * @return Error code. 337 337 */ 338 static int req_clear_port_feature(usbvirt_device_t *device,338 static errno_t req_clear_port_feature(usbvirt_device_t *device, 339 339 const usb_device_request_setup_packet_t *setup_packet, 340 340 uint8_t *data, size_t *act_size) … … 400 400 * @return Error code. 401 401 */ 402 static int req_set_port_feature(usbvirt_device_t *device,402 static errno_t req_set_port_feature(usbvirt_device_t *device, 403 403 const usb_device_request_setup_packet_t *setup_packet, 404 404 uint8_t *data, size_t *act_size) … … 451 451 * only need 1 byte. 452 452 */ 453 static int req_status_change_handler(usbvirt_device_t *device,453 static errno_t req_status_change_handler(usbvirt_device_t *device, 454 454 usb_endpoint_t endpoint, usb_transfer_type_t tr_type, 455 455 void *buffer, size_t buffer_size, size_t *actual_size) -
uspace/drv/bus/usb/ohci/ohci_rh.h
r132ab5d1 r5a6cc679 66 66 } ohci_rh_t; 67 67 68 int ohci_rh_init(ohci_rh_t *, ohci_regs_t *, fibril_mutex_t *, const char *);69 int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch);70 int ohci_rh_interrupt(ohci_rh_t *instance);68 errno_t ohci_rh_init(ohci_rh_t *, ohci_regs_t *, fibril_mutex_t *, const char *); 69 errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch); 70 errno_t ohci_rh_interrupt(ohci_rh_t *instance); 71 71 72 72 /** Get OHCI rh address. -
uspace/drv/bus/usb/uhci/hc.c
r132ab5d1 r5a6cc679 97 97 98 98 static void hc_init_hw(const hc_t *instance); 99 static int hc_init_mem_structures(hc_t *instance);100 static int hc_init_transfer_lists(hc_t *instance);101 102 static int hc_debug_checker(void *arg);99 static errno_t hc_init_mem_structures(hc_t *instance); 100 static errno_t hc_init_transfer_lists(hc_t *instance); 101 102 static errno_t hc_debug_checker(void *arg); 103 103 104 104 … … 110 110 * @return Error code. 111 111 */ 112 int hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)112 errno_t hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq) 113 113 { 114 114 assert(code); … … 207 207 * interrupt fibrils. 208 208 */ 209 int hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)209 errno_t hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res) 210 210 { 211 211 hc_t *instance = hcd_to_hc(hcd); … … 218 218 219 219 /* allow access to hc control registers */ 220 int ret = pio_enable_range(&hw_res->io_ranges.ranges[0],220 errno_t ret = pio_enable_range(&hw_res->io_ranges.ranges[0], 221 221 (void **) &instance->registers); 222 222 if (ret != EOK) { … … 327 327 } 328 328 329 static int endpoint_register(endpoint_t *ep)329 static errno_t endpoint_register(endpoint_t *ep) 330 330 { 331 331 hc_t * const hc = bus_to_hc(endpoint_get_bus(ep)); 332 332 333 const int err = usb2_bus_endpoint_register(&hc->bus_helper, ep);333 const errno_t err = usb2_bus_endpoint_register(&hc->bus_helper, ep); 334 334 if (err) 335 335 return err; … … 449 449 * - frame list page (needs to be one UHCI hw accessible 4K page) 450 450 */ 451 int hc_init_mem_structures(hc_t *instance)451 errno_t hc_init_mem_structures(hc_t *instance) 452 452 { 453 453 assert(instance); … … 468 468 469 469 /* Init transfer lists */ 470 int ret = hc_init_transfer_lists(instance);470 errno_t ret = hc_init_transfer_lists(instance); 471 471 if (ret != EOK) { 472 472 usb_log_error("Failed to initialize transfer lists."); … … 498 498 * USB scheduling. Sets pointer table for quick access. 499 499 */ 500 int hc_init_transfer_lists(hc_t *instance)500 errno_t hc_init_transfer_lists(hc_t *instance) 501 501 { 502 502 assert(instance); 503 503 #define SETUP_TRANSFER_LIST(type, name) \ 504 504 do { \ 505 int ret = transfer_list_init(&instance->transfers_##type, name); \505 errno_t ret = transfer_list_init(&instance->transfers_##type, name); \ 506 506 if (ret != EOK) { \ 507 507 usb_log_error("Failed to setup %s transfer list: %s.", \ … … 550 550 } 551 551 552 static int hc_status(bus_t *bus, uint32_t *status)552 static errno_t hc_status(bus_t *bus, uint32_t *status) 553 553 { 554 554 hc_t *instance = bus_to_hc(bus); … … 571 571 * @return Error code 572 572 */ 573 static int hc_schedule(usb_transfer_batch_t *batch)573 static errno_t hc_schedule(usb_transfer_batch_t *batch) 574 574 { 575 575 uhci_transfer_batch_t *uhci_batch = uhci_transfer_batch_get(batch); … … 586 586 return ENOTSUP; 587 587 588 int err;588 errno_t err; 589 589 if ((err = uhci_transfer_batch_prepare(uhci_batch))) 590 590 return err; … … 598 598 * @return EOK (should never return) 599 599 */ 600 int hc_debug_checker(void *arg)600 errno_t hc_debug_checker(void *arg) 601 601 { 602 602 hc_t *instance = arg; -
uspace/drv/bus/usb/uhci/hc.h
r132ab5d1 r5a6cc679 157 157 int hc_unschedule_batch(usb_transfer_batch_t *); 158 158 159 extern int hc_add(hc_device_t *, const hw_res_list_parsed_t *);160 extern int hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *);161 extern int hc_start(hc_device_t *);162 extern int hc_setup_roothub(hc_device_t *);163 extern int hc_gone(hc_device_t *);159 extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *); 160 extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *); 161 extern errno_t hc_start(hc_device_t *); 162 extern errno_t hc_setup_roothub(hc_device_t *); 163 extern errno_t hc_gone(hc_device_t *); 164 164 165 165 #endif -
uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c
r132ab5d1 r5a6cc679 119 119 * @return Error code. 120 120 */ 121 int td_status(const td_t *instance)121 errno_t td_status(const td_t *instance) 122 122 { 123 123 assert(instance); -
uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h
r132ab5d1 r5a6cc679 102 102 const void *buffer, const td_t *next); 103 103 104 int td_status(const td_t *instance);104 errno_t td_status(const td_t *instance); 105 105 106 106 void td_print_status(const td_t *instance); -
uspace/drv/bus/usb/uhci/main.c
r132ab5d1 r5a6cc679 49 49 #define NAME "uhci" 50 50 51 static int disable_legacy(hc_device_t *);51 static errno_t disable_legacy(hc_device_t *); 52 52 53 53 static const hc_driver_t uhci_driver = { … … 67 67 * @return Error code. 68 68 */ 69 static int disable_legacy(hc_device_t *hcd)69 static errno_t disable_legacy(hc_device_t *hcd) 70 70 { 71 71 assert(hcd); -
uspace/drv/bus/usb/uhci/transfer_list.c
r132ab5d1 r5a6cc679 55 55 * Allocates memory for internal qh_t structure. 56 56 */ 57 int transfer_list_init(transfer_list_t *instance, const char *name)57 errno_t transfer_list_init(transfer_list_t *instance, const char *name) 58 58 { 59 59 assert(instance); -
uspace/drv/bus/usb/uhci/transfer_list.h
r132ab5d1 r5a6cc679 57 57 58 58 void transfer_list_fini(transfer_list_t *); 59 int transfer_list_init(transfer_list_t *, const char *);59 errno_t transfer_list_init(transfer_list_t *, const char *); 60 60 void transfer_list_set_next(transfer_list_t *, transfer_list_t *); 61 int transfer_list_add_batch(transfer_list_t *, uhci_transfer_batch_t *);61 errno_t transfer_list_add_batch(transfer_list_t *, uhci_transfer_batch_t *); 62 62 void transfer_list_remove_batch(transfer_list_t *, uhci_transfer_batch_t *); 63 63 void transfer_list_check_finished(transfer_list_t *); -
uspace/drv/bus/usb/uhci/uhci_rh.c
r132ab5d1 r5a6cc679 79 79 * @return Error code, EOK on success. 80 80 */ 81 int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)81 errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name) 82 82 { 83 83 assert(instance); … … 99 99 * not have to be. 100 100 */ 101 int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)101 errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch) 102 102 { 103 103 assert(instance); … … 189 189 * it is usefull for debuging purposes only. 190 190 */ 191 static int req_get_port_state(usbvirt_device_t *device,191 static errno_t req_get_port_state(usbvirt_device_t *device, 192 192 const usb_device_request_setup_packet_t *setup_packet, 193 193 uint8_t *data, size_t *act_size) … … 224 224 * @note: reset change status needs to be handled in sw. 225 225 */ 226 static int req_get_port_status(usbvirt_device_t *device,226 static errno_t req_get_port_status(usbvirt_device_t *device, 227 227 const usb_device_request_setup_packet_t *setup_packet, 228 228 uint8_t *data, size_t *act_size) … … 263 263 * @return Error code. 264 264 */ 265 static int req_clear_port_feature(usbvirt_device_t *device,265 static errno_t req_clear_port_feature(usbvirt_device_t *device, 266 266 const usb_device_request_setup_packet_t *setup_packet, 267 267 uint8_t *data, size_t *act_size) … … 336 336 * @return Error code. 337 337 */ 338 static int req_set_port_feature(usbvirt_device_t *device,338 static errno_t req_set_port_feature(usbvirt_device_t *device, 339 339 const usb_device_request_setup_packet_t *setup_packet, 340 340 uint8_t *data, size_t *act_size) … … 398 398 * only need 1 byte. 399 399 */ 400 static int req_status_change_handler(usbvirt_device_t *device,400 static errno_t req_status_change_handler(usbvirt_device_t *device, 401 401 usb_endpoint_t endpoint, usb_transfer_type_t tr_type, 402 402 void *buffer, size_t buffer_size, size_t *actual_size) -
uspace/drv/bus/usb/uhci/uhci_rh.h
r132ab5d1 r5a6cc679 56 56 } uhci_rh_t; 57 57 58 int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name);59 int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch);58 errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name); 59 errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch); 60 60 61 61 /** Get UHCI rh address. -
uspace/drv/bus/usb/usbflbk/main.c
r132ab5d1 r5a6cc679 46 46 * @return Error code. 47 47 */ 48 static int usbfallback_device_add(usb_device_t *dev)48 static errno_t usbfallback_device_add(usb_device_t *dev) 49 49 { 50 50 usb_log_info("Pretending to control %s `%s'.", … … 59 59 * @return Error code. 60 60 */ 61 static int usbfallback_device_gone(usb_device_t *dev)61 static errno_t usbfallback_device_gone(usb_device_t *dev) 62 62 { 63 63 assert(dev); -
uspace/drv/bus/usb/usbhub/port.c
r132ab5d1 r5a6cc679 101 101 * Routine for adding a new device in USB2. 102 102 */ 103 static int enumerate_device_usb2(usb_hub_port_t *port, async_exch_t *exch)104 { 105 int err;103 static errno_t enumerate_device_usb2(usb_hub_port_t *port, async_exch_t *exch) 104 { 105 errno_t err; 106 106 107 107 port_log(debug, port, "Requesting default address."); … … 145 145 * Routine for adding a new device in USB 3. 146 146 */ 147 static int enumerate_device_usb3(usb_hub_port_t *port, async_exch_t *exch)148 { 149 int err;147 static errno_t enumerate_device_usb3(usb_hub_port_t *port, async_exch_t *exch) 148 { 149 errno_t err; 150 150 151 151 port_log(debug, port, "Issuing a warm reset."); … … 170 170 } 171 171 172 static int enumerate_device(usb_port_t *port_base)172 static errno_t enumerate_device(usb_port_t *port_base) 173 173 { 174 174 usb_hub_port_t *port = get_hub_port(port_base); … … 181 181 } 182 182 183 const int err = port->hub->speed == USB_SPEED_SUPER183 const errno_t err = port->hub->speed == USB_SPEED_SUPER 184 184 ? enumerate_device_usb3(port, exch) 185 185 : enumerate_device_usb2(port, exch); -
uspace/drv/bus/usb/usbhub/usbhub.c
r132ab5d1 r5a6cc679 99 99 }; 100 100 101 static int usb_set_first_configuration(usb_device_t *);102 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *);101 static errno_t usb_set_first_configuration(usb_device_t *); 102 static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *); 103 103 static void usb_hub_over_current(const usb_hub_dev_t *, usb_hub_status_t); 104 static int usb_hub_polling_init(usb_hub_dev_t *, usb_endpoint_mapping_t *);104 static errno_t usb_hub_polling_init(usb_hub_dev_t *, usb_endpoint_mapping_t *); 105 105 static void usb_hub_global_interrupt(const usb_hub_dev_t *); 106 106 107 107 static bool usb_hub_polling_error_callback(usb_device_t *dev, 108 int err_code, void *arg)108 errno_t err_code, void *arg) 109 109 { 110 110 assert(dev); … … 125 125 * @return error code 126 126 */ 127 int usb_hub_device_add(usb_device_t *usb_dev)127 errno_t usb_hub_device_add(usb_device_t *usb_dev) 128 128 { 129 129 int err; … … 198 198 } 199 199 200 static int usb_hub_cleanup(usb_hub_dev_t *hub)200 static errno_t usb_hub_cleanup(usb_hub_dev_t *hub) 201 201 { 202 202 free(hub->polling.buffer); … … 228 228 * @return error code 229 229 */ 230 int usb_hub_device_remove(usb_device_t *usb_dev)230 errno_t usb_hub_device_remove(usb_device_t *usb_dev) 231 231 { 232 232 assert(usb_dev); … … 249 249 * @return error code 250 250 */ 251 int usb_hub_device_gone(usb_device_t *usb_dev)251 errno_t usb_hub_device_gone(usb_device_t *usb_dev) 252 252 { 253 253 assert(usb_dev); … … 270 270 * @param mapping The mapping of Status Change Endpoint 271 271 */ 272 static int usb_hub_polling_init(usb_hub_dev_t *hub_dev,272 static errno_t usb_hub_polling_init(usb_hub_dev_t *hub_dev, 273 273 usb_endpoint_mapping_t *mapping) 274 274 { 275 int err;275 errno_t err; 276 276 usb_polling_t *polling = &hub_dev->polling; 277 277 … … 369 369 * @return error code 370 370 */ 371 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)371 static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev) 372 372 { 373 373 assert(hub_dev); … … 382 382 usb_hub_descriptor_header_t descriptor; 383 383 size_t received_size; 384 int opResult = usb_request_get_descriptor(control_pipe,384 errno_t opResult = usb_request_get_descriptor(control_pipe, 385 385 USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE, 386 386 desc_type, 0, 0, &descriptor, … … 436 436 * @return error code 437 437 */ 438 static int usb_set_first_configuration(usb_device_t *usb_device)438 static errno_t usb_set_first_configuration(usb_device_t *usb_device) 439 439 { 440 440 assert(usb_device); … … 462 462 /* Set configuration. Use the configuration that was in 463 463 * usb_device->descriptors.configuration i.e. The first one. */ 464 int opResult = usb_request_set_configuration(464 errno_t opResult = usb_request_set_configuration( 465 465 usb_device_get_default_pipe(usb_device), 466 466 config_descriptor->configuration_number); … … 500 500 /* Over-current condition is gone, it is safe to turn the ports on. */ 501 501 for (size_t port = 0; port < hub_dev->port_count; ++port) { 502 const int ret = usb_hub_set_port_feature(hub_dev, port,502 const errno_t ret = usb_hub_set_port_feature(hub_dev, port, 503 503 USB_HUB_FEATURE_PORT_POWER); 504 504 if (ret != EOK) { … … 637 637 /* NOTE: We can't use standard USB GET_STATUS request, because 638 638 * hubs reply is 4byte instead of 2 */ 639 const int opResult = usb_pipe_control_read(control_pipe,639 const errno_t opResult = usb_pipe_control_read(control_pipe, 640 640 &get_hub_status_request, sizeof(get_hub_status_request), 641 641 &status, sizeof(usb_hub_status_t), &rcvd_size); … … 655 655 usb_hub_over_current(hub_dev, status); 656 656 /* Ack change in hub OC flag */ 657 const int ret = usb_request_clear_feature(657 const errno_t ret = usb_request_clear_feature( 658 658 control_pipe, USB_REQUEST_TYPE_CLASS, 659 659 USB_REQUEST_RECIPIENT_DEVICE, … … 679 679 * Just ACK the change. 680 680 */ 681 const int ret = usb_request_clear_feature(681 const errno_t ret = usb_request_clear_feature( 682 682 control_pipe, USB_REQUEST_TYPE_CLASS, 683 683 USB_REQUEST_RECIPIENT_DEVICE, -
uspace/drv/bus/usb/usbhub/usbhub.h
r132ab5d1 r5a6cc679 78 78 extern const usb_endpoint_description_t *usb_hub_endpoints []; 79 79 80 int usb_hub_device_add(usb_device_t *);81 int usb_hub_device_remove(usb_device_t *);82 int usb_hub_device_gone(usb_device_t *);80 errno_t usb_hub_device_add(usb_device_t *); 81 errno_t usb_hub_device_remove(usb_device_t *); 82 errno_t usb_hub_device_gone(usb_device_t *); 83 83 84 int usb_hub_set_depth(const usb_hub_dev_t *);85 int usb_hub_get_port_status(const usb_hub_dev_t *, size_t, usb_port_status_t *);86 int usb_hub_set_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t);87 int usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t);84 errno_t usb_hub_set_depth(const usb_hub_dev_t *); 85 errno_t usb_hub_get_port_status(const usb_hub_dev_t *, size_t, usb_port_status_t *); 86 errno_t usb_hub_set_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t); 87 errno_t usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t); 88 88 89 89 bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t, void *); 90 90 91 int usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *, usb_port_t *);92 int usb_hub_release_default_address(usb_hub_dev_t *, async_exch_t *);91 errno_t usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *, usb_port_t *); 92 errno_t usb_hub_release_default_address(usb_hub_dev_t *, async_exch_t *); 93 93 94 94 #endif -
uspace/drv/bus/usb/usbmid/explore.c
r132ab5d1 r5a6cc679 66 66 * @param list List where to add the interfaces. 67 67 */ 68 static int create_interfaces(const uint8_t *config_descriptor,68 static errno_t create_interfaces(const uint8_t *config_descriptor, 69 69 size_t config_descriptor_size, list_t *list, usb_device_t *usb_dev) 70 70 { … … 111 111 112 112 usbmid_interface_t *iface = NULL; 113 const int rc = usbmid_spawn_interface_child(usb_dev, &iface,113 const errno_t rc = usbmid_spawn_interface_child(usb_dev, &iface, 114 114 &usb_device_descriptors(usb_dev)->device, interface); 115 115 if (rc != EOK) { … … 134 134 * @return Whether to accept this device. 135 135 */ 136 int usbmid_explore_device(usb_device_t *dev)136 errno_t usbmid_explore_device(usb_device_t *dev) 137 137 { 138 138 assert(dev); … … 157 157 158 158 /* Select the first configuration */ 159 int rc = usb_request_set_configuration(usb_device_get_default_pipe(dev),159 errno_t rc = usb_request_set_configuration(usb_device_get_default_pipe(dev), 160 160 config_descriptor->configuration_number); 161 161 if (rc != EOK) { -
uspace/drv/bus/usb/usbmid/main.c
r132ab5d1 r5a6cc679 49 49 * @return Error code. 50 50 */ 51 static int usbmid_device_add(usb_device_t *dev)51 static errno_t usbmid_device_add(usb_device_t *dev) 52 52 { 53 53 usb_log_info("Taking care of new MID `%s'.", usb_device_get_name(dev)); … … 82 82 * @return Error code. 83 83 */ 84 static int usbmid_device_remove(usb_device_t *dev)84 static errno_t usbmid_device_remove(usb_device_t *dev) 85 85 { 86 86 assert(dev); … … 89 89 90 90 /* Remove ctl function */ 91 int ret = ddf_fun_unbind(usb_mid->ctl_fun);91 errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun); 92 92 if (ret != EOK) { 93 93 usb_log_error("Failed to unbind USB MID ctl function: %s.", … … 103 103 104 104 /* Tell the child to go offline. */ 105 int pret = ddf_fun_offline(iface->fun);105 errno_t pret = ddf_fun_offline(iface->fun); 106 106 if (pret != EOK) { 107 107 usb_log_warning("Failed to turn off child `%s': %s", … … 118 118 * @return Error code. 119 119 */ 120 static int usbmid_device_gone(usb_device_t *dev)120 static errno_t usbmid_device_gone(usb_device_t *dev) 121 121 { 122 122 assert(dev); … … 127 127 128 128 /* Remove ctl function */ 129 int ret = ddf_fun_unbind(usb_mid->ctl_fun);129 errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun); 130 130 if (ret != EOK) { 131 131 usb_log_error("Failed to unbind USB MID ctl function: %s.", … … 149 149 } 150 150 151 static int usbmid_function_offline(ddf_fun_t *fun)151 static errno_t usbmid_function_offline(ddf_fun_t *fun) 152 152 { 153 153 usb_device_t *usb_dev = ddf_dev_data_get(ddf_fun_get_dev(fun)); -
uspace/drv/bus/usb/usbmid/usbmid.c
r132ab5d1 r5a6cc679 52 52 * @return Error code. 53 53 */ 54 static int usb_iface_description(ddf_fun_t *fun, usb_device_desc_t *desc)54 static errno_t usb_iface_description(ddf_fun_t *fun, usb_device_desc_t *desc) 55 55 { 56 56 usbmid_interface_t *iface = ddf_fun_data_get(fun); … … 64 64 65 65 usb_device_desc_t tmp_desc; 66 const int ret = usb_get_my_description(exch, &tmp_desc);66 const errno_t ret = usb_get_my_description(exch, &tmp_desc); 67 67 68 68 if (ret == EOK && desc) { … … 86 86 }; 87 87 88 int usbmid_interface_destroy(usbmid_interface_t *mid_iface)88 errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface) 89 89 { 90 90 assert(mid_iface); 91 91 assert_link_not_used(&mid_iface->link); 92 const int ret = ddf_fun_unbind(mid_iface->fun);92 const errno_t ret = ddf_fun_unbind(mid_iface->fun); 93 93 if (ret != EOK) { 94 94 return ret; … … 106 106 * @return Error code. 107 107 */ 108 int usbmid_spawn_interface_child(usb_device_t *parent,108 errno_t usbmid_spawn_interface_child(usb_device_t *parent, 109 109 usbmid_interface_t **iface_ret, 110 110 const usb_standard_device_descriptor_t *device_descriptor, … … 113 113 ddf_fun_t *child = NULL; 114 114 char *child_name = NULL; 115 int rc;115 errno_t rc; 116 116 117 117 /* -
uspace/drv/bus/usb/usbmid/usbmid.h
r132ab5d1 r5a6cc679 62 62 } usb_mid_t; 63 63 64 extern int usbmid_explore_device(usb_device_t *);65 extern int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **,64 extern errno_t usbmid_explore_device(usb_device_t *); 65 extern errno_t usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **, 66 66 const usb_standard_device_descriptor_t *, 67 67 const usb_standard_interface_descriptor_t *); 68 68 extern void usbmid_dump_descriptors(uint8_t *, size_t); 69 extern int usbmid_interface_destroy(usbmid_interface_t *mid_iface);69 extern errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface); 70 70 71 71 static inline usbmid_interface_t * usbmid_interface_from_link(link_t *item) -
uspace/drv/bus/usb/vhc/conndev.c
r132ab5d1 r5a6cc679 75 75 } 76 76 77 int data_request_rc;78 int opening_request_rc;77 errno_t data_request_rc; 78 errno_t opening_request_rc; 79 79 async_wait_for(data_request, &data_request_rc); 80 80 async_wait_for(opening_request, &opening_request_rc); … … 102 102 103 103 if (callback) { 104 int rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);104 errno_t rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle); 105 105 if (rc != EOK) { 106 106 async_answer_0(icallid, rc); -
uspace/drv/bus/usb/vhc/devconn.c
r132ab5d1 r5a6cc679 49 49 } 50 50 51 static int vhc_virtdev_plug_generic(vhc_data_t *vhc,51 static errno_t vhc_virtdev_plug_generic(vhc_data_t *vhc, 52 52 async_sess_t *sess, usbvirt_device_t *virtdev, 53 53 uintptr_t *handle, bool connect, usb_address_t address) … … 85 85 } 86 86 87 int vhc_virtdev_plug(vhc_data_t *vhc, async_sess_t *sess, uintptr_t *handle)87 errno_t vhc_virtdev_plug(vhc_data_t *vhc, async_sess_t *sess, uintptr_t *handle) 88 88 { 89 89 return vhc_virtdev_plug_generic(vhc, sess, NULL, handle, true, 0); 90 90 } 91 91 92 int vhc_virtdev_plug_local(vhc_data_t *vhc, usbvirt_device_t *dev, uintptr_t *handle)92 errno_t vhc_virtdev_plug_local(vhc_data_t *vhc, usbvirt_device_t *dev, uintptr_t *handle) 93 93 { 94 94 return vhc_virtdev_plug_generic(vhc, NULL, dev, handle, true, 0); 95 95 } 96 96 97 int vhc_virtdev_plug_hub(vhc_data_t *vhc, usbvirt_device_t *dev,97 errno_t vhc_virtdev_plug_hub(vhc_data_t *vhc, usbvirt_device_t *dev, 98 98 uintptr_t *handle, usb_address_t address) 99 99 { -
uspace/drv/bus/usb/vhc/hub/hub.c
r132ab5d1 r5a6cc679 63 63 static void set_port_status_change(hub_port_t *, hub_status_change_t); 64 64 static void clear_port_status_change(hub_port_t *, uint16_t); 65 static int set_port_state_delayed_fibril(void *);65 static errno_t set_port_state_delayed_fibril(void *); 66 66 static void set_port_state_delayed(hub_t *, size_t, suseconds_t, 67 67 hub_port_state_t, hub_port_state_t); … … 163 163 * @return Error code. 164 164 */ 165 int hub_disconnect_device(hub_t *hub, void *device)165 errno_t hub_disconnect_device(hub_t *hub, void *device) 166 166 { 167 167 size_t index = hub_find_device(hub, device); … … 461 461 * @return Always EOK. 462 462 */ 463 static int set_port_state_delayed_fibril(void *arg)463 static errno_t set_port_state_delayed_fibril(void *arg) 464 464 { 465 465 struct delay_port_state_change *change -
uspace/drv/bus/usb/vhc/hub/hub.h
r132ab5d1 r5a6cc679 102 102 void hub_init(hub_t *); 103 103 size_t hub_connect_device(hub_t *, void *); 104 int hub_disconnect_device(hub_t *, void *);104 errno_t hub_disconnect_device(hub_t *, void *); 105 105 size_t hub_find_device(hub_t *, void *); 106 106 void hub_acquire(hub_t *); -
uspace/drv/bus/usb/vhc/hub/virthub.c
r132ab5d1 r5a6cc679 147 147 * @return Error code. 148 148 */ 149 int virthub_init(usbvirt_device_t *dev, const char* name)149 errno_t virthub_init(usbvirt_device_t *dev, const char* name) 150 150 { 151 151 if (dev == NULL) { … … 197 197 * @return Error code. 198 198 */ 199 int virthub_disconnect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn)199 errno_t virthub_disconnect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn) 200 200 { 201 201 assert(dev != NULL); -
uspace/drv/bus/usb/vhc/hub/virthub.h
r132ab5d1 r5a6cc679 80 80 extern hub_descriptor_t hub_descriptor; 81 81 82 int virthub_init(usbvirt_device_t *, const char *name);82 errno_t virthub_init(usbvirt_device_t *, const char *name); 83 83 int virthub_connect_device(usbvirt_device_t *, vhc_virtdev_t *); 84 int virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *);84 errno_t virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *); 85 85 bool virthub_is_device_enabled(usbvirt_device_t *, vhc_virtdev_t *); 86 86 void virthub_get_status(usbvirt_device_t *, char *, size_t); -
uspace/drv/bus/usb/vhc/hub/virthubops.c
r132ab5d1 r5a6cc679 63 63 64 64 /** Callback for data request. */ 65 static int req_on_status_change_pipe(usbvirt_device_t *dev,65 static errno_t req_on_status_change_pipe(usbvirt_device_t *dev, 66 66 usb_endpoint_t endpoint, usb_transfer_type_t tr_type, 67 67 void *buffer, size_t buffer_size, size_t *actual_size) … … 109 109 * @return Error code. 110 110 */ 111 static int req_clear_hub_feature(usbvirt_device_t *dev,111 static errno_t req_clear_hub_feature(usbvirt_device_t *dev, 112 112 const usb_device_request_setup_packet_t *request, uint8_t *data, 113 113 size_t *act_size) … … 123 123 * @return Error code. 124 124 */ 125 static int req_clear_port_feature(usbvirt_device_t *dev,126 const usb_device_request_setup_packet_t *request, uint8_t *data, 127 size_t *act_size) 128 { 129 int rc;125 static errno_t req_clear_port_feature(usbvirt_device_t *dev, 126 const usb_device_request_setup_packet_t *request, uint8_t *data, 127 size_t *act_size) 128 { 129 errno_t rc; 130 130 size_t port = request->index - 1; 131 131 usb_hub_class_feature_t feature = request->value; … … 203 203 * @return Error code. 204 204 */ 205 static int req_get_bus_state(usbvirt_device_t *dev,205 static errno_t req_get_bus_state(usbvirt_device_t *dev, 206 206 const usb_device_request_setup_packet_t *request, uint8_t *data, 207 207 size_t *act_size) … … 217 217 * @return Error code. 218 218 */ 219 static int req_get_descriptor(usbvirt_device_t *dev,219 static errno_t req_get_descriptor(usbvirt_device_t *dev, 220 220 const usb_device_request_setup_packet_t *request, uint8_t *data, 221 221 size_t *act_size) … … 238 238 * @return Error code. 239 239 */ 240 static int req_get_hub_status(usbvirt_device_t *dev,240 static errno_t req_get_hub_status(usbvirt_device_t *dev, 241 241 const usb_device_request_setup_packet_t *request, uint8_t *data, 242 242 size_t *act_size) … … 257 257 * @return Error code. 258 258 */ 259 static int req_get_port_status(usbvirt_device_t *dev,259 static errno_t req_get_port_status(usbvirt_device_t *dev, 260 260 const usb_device_request_setup_packet_t *request, uint8_t *data, 261 261 size_t *act_size) … … 282 282 * @return Error code. 283 283 */ 284 static int req_set_hub_feature(usbvirt_device_t *dev,284 static errno_t req_set_hub_feature(usbvirt_device_t *dev, 285 285 const usb_device_request_setup_packet_t *request, uint8_t *data, 286 286 size_t *act_size) … … 296 296 * @return Error code. 297 297 */ 298 static int req_set_port_feature(usbvirt_device_t *dev,299 const usb_device_request_setup_packet_t *request, uint8_t *data, 300 size_t *act_size) 301 { 302 int rc = ENOTSUP;298 static errno_t req_set_port_feature(usbvirt_device_t *dev, 299 const usb_device_request_setup_packet_t *request, uint8_t *data, 300 size_t *act_size) 301 { 302 errno_t rc = ENOTSUP; 303 303 size_t port = request->index - 1; 304 304 usb_hub_class_feature_t feature = request->value; -
uspace/drv/bus/usb/vhc/main.c
r132ab5d1 r5a6cc679 50 50 }; 51 51 52 static int vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun)52 static errno_t vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun) 53 53 { 54 54 assert(dev); … … 64 64 } 65 65 ddf_fun_set_ops(*fun, &vhc_ops); 66 const int ret = ddf_fun_bind(*fun);66 const errno_t ret = ddf_fun_bind(*fun); 67 67 if (ret != EOK) { 68 68 ddf_fun_destroy(*fun); … … 73 73 } 74 74 75 static int vhc_dev_add(ddf_dev_t *dev)75 static errno_t vhc_dev_add(ddf_dev_t *dev) 76 76 { 77 77 /* Initialize generic structures */ 78 int ret = hcd_ddf_setup_hc(dev, sizeof(vhc_data_t));78 errno_t ret = hcd_ddf_setup_hc(dev, sizeof(vhc_data_t)); 79 79 if (ret != EOK) { 80 80 usb_log_error("Failed to init HCD structures: %s.", -
uspace/drv/bus/usb/vhc/transfer.c
r132ab5d1 r5a6cc679 61 61 } 62 62 63 static int process_transfer_local(usb_transfer_batch_t *batch,63 static errno_t process_transfer_local(usb_transfer_batch_t *batch, 64 64 usbvirt_device_t *dev, size_t *actual_data_size) 65 65 { 66 int rc;66 errno_t rc; 67 67 68 68 const usb_direction_t dir = batch->dir; … … 97 97 } 98 98 99 static int process_transfer_remote(usb_transfer_batch_t *batch,99 static errno_t process_transfer_remote(usb_transfer_batch_t *batch, 100 100 async_sess_t *sess, size_t *actual_data_size) 101 101 { 102 int rc;102 errno_t rc; 103 103 104 104 const usb_direction_t dir = batch->dir; … … 146 146 147 147 static void execute_transfer_callback_and_free(vhc_transfer_t *transfer, 148 size_t data_transfer_size, int outcome)148 size_t data_transfer_size, errno_t outcome) 149 149 { 150 150 assert(outcome != ENAK); … … 192 192 }; 193 193 194 int vhc_init(vhc_data_t *instance)194 errno_t vhc_init(vhc_data_t *instance) 195 195 { 196 196 assert(instance); … … 203 203 } 204 204 205 int vhc_schedule(usb_transfer_batch_t *batch)205 errno_t vhc_schedule(usb_transfer_batch_t *batch) 206 206 { 207 207 assert(batch); … … 233 233 } 234 234 235 int vhc_transfer_queue_processor(void *arg)235 errno_t vhc_transfer_queue_processor(void *arg) 236 236 { 237 237 vhc_virtdev_t *dev = arg; … … 248 248 fibril_mutex_unlock(&dev->guard); 249 249 250 int rc = EOK;250 errno_t rc = EOK; 251 251 size_t data_transfer_size = 0; 252 252 if (dev->dev_sess) { -
uspace/drv/bus/usb/vhc/vhcd.h
r132ab5d1 r5a6cc679 90 90 ipc_call_t *icall); 91 91 92 int vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *);93 int vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);94 int vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address);92 errno_t vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *); 93 errno_t vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *); 94 errno_t vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address); 95 95 void vhc_virtdev_unplug(vhc_data_t *, uintptr_t); 96 96 97 int vhc_init(vhc_data_t *);98 int vhc_schedule(usb_transfer_batch_t *);99 int vhc_transfer_queue_processor(void *arg);97 errno_t vhc_init(vhc_data_t *); 98 errno_t vhc_schedule(usb_transfer_batch_t *); 99 errno_t vhc_transfer_queue_processor(void *arg); 100 100 101 101 #endif
Note:
See TracChangeset
for help on using the changeset viewer.