Changeset b7fd2a0 in mainline for uspace/drv/bus/usb
- Timestamp:
- 2018-01-13T03:10:29Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- Location:
- uspace/drv/bus/usb
- Files:
-
- 52 edited
-
ehci/ehci_endpoint.c (modified) (1 diff)
-
ehci/ehci_endpoint.h (modified) (1 diff)
-
ehci/ehci_rh.c (modified) (12 diffs)
-
ehci/ehci_rh.h (modified) (1 diff)
-
ehci/endpoint_list.c (modified) (1 diff)
-
ehci/endpoint_list.h (modified) (1 diff)
-
ehci/hc.c (modified) (8 diffs)
-
ehci/hc.h (modified) (2 diffs)
-
ehci/hw_struct/transfer_descriptor.c (modified) (1 diff)
-
ehci/hw_struct/transfer_descriptor.h (modified) (1 diff)
-
ehci/main.c (modified) (4 diffs)
-
ehci/res.c (modified) (4 diffs)
-
ehci/res.h (modified) (1 diff)
-
ohci/endpoint_list.c (modified) (1 diff)
-
ohci/endpoint_list.h (modified) (1 diff)
-
ohci/hc.c (modified) (10 diffs)
-
ohci/hc.h (modified) (2 diffs)
-
ohci/hw_struct/completion_codes.h (modified) (1 diff)
-
ohci/hw_struct/transfer_descriptor.h (modified) (1 diff)
-
ohci/main.c (modified) (4 diffs)
-
ohci/ohci_endpoint.c (modified) (1 diff)
-
ohci/ohci_endpoint.h (modified) (1 diff)
-
ohci/ohci_rh.c (modified) (9 diffs)
-
ohci/ohci_rh.h (modified) (1 diff)
-
uhci/hc.c (modified) (10 diffs)
-
uhci/hc.h (modified) (1 diff)
-
uhci/hw_struct/transfer_descriptor.c (modified) (1 diff)
-
uhci/hw_struct/transfer_descriptor.h (modified) (1 diff)
-
uhci/main.c (modified) (5 diffs)
-
uhci/transfer_list.c (modified) (1 diff)
-
uhci/transfer_list.h (modified) (1 diff)
-
uhci/uhci_rh.c (modified) (7 diffs)
-
uhci/uhci_rh.h (modified) (1 diff)
-
usbflbk/main.c (modified) (2 diffs)
-
usbhub/port.c (modified) (20 diffs)
-
usbhub/port.h (modified) (1 diff)
-
usbhub/usbhub.c (modified) (16 diffs)
-
usbhub/usbhub.h (modified) (1 diff)
-
usbmid/explore.c (modified) (4 diffs)
-
usbmid/main.c (modified) (7 diffs)
-
usbmid/usbmid.c (modified) (5 diffs)
-
usbmid/usbmid.h (modified) (1 diff)
-
vhc/conndev.c (modified) (2 diffs)
-
vhc/devconn.c (modified) (2 diffs)
-
vhc/hub/hub.c (modified) (3 diffs)
-
vhc/hub/hub.h (modified) (1 diff)
-
vhc/hub/virthub.c (modified) (2 diffs)
-
vhc/hub/virthub.h (modified) (1 diff)
-
vhc/hub/virthubops.c (modified) (9 diffs)
-
vhc/main.c (modified) (3 diffs)
-
vhc/transfer.c (modified) (7 diffs)
-
vhc/vhcd.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_endpoint.c
r36f0738 rb7fd2a0 77 77 * @return Error code. 78 78 */ 79 int ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep)79 errno_t ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep) 80 80 { 81 81 assert(ep); -
uspace/drv/bus/usb/ehci/ehci_endpoint.h
r36f0738 rb7fd2a0 51 51 } ehci_endpoint_t; 52 52 53 int ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep);53 errno_t ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep); 54 54 void ehci_endpoint_fini(hcd_t *hcd, endpoint_t *ep); 55 55 -
uspace/drv/bus/usb/ehci/ehci_rh.c
r36f0738 rb7fd2a0 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 const char *name) 103 103 { … … 140 140 * status change requests might be postponed until there is something to report. 141 141 */ 142 int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch)142 errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch) 143 143 { 144 144 assert(instance); … … 175 175 * processing of a postponed request. 176 176 */ 177 int ehci_rh_interrupt(ehci_rh_t *instance)177 errno_t ehci_rh_interrupt(ehci_rh_t *instance) 178 178 { 179 179 //TODO atomic swap needed … … 217 217 * @return Error code. 218 218 */ 219 static int req_get_status(usbvirt_device_t *device,219 static errno_t req_get_status(usbvirt_device_t *device, 220 220 const usb_device_request_setup_packet_t *setup_packet, 221 221 uint8_t *data, size_t *act_size) … … 240 240 * @return Error code. 241 241 */ 242 static int req_clear_hub_feature(usbvirt_device_t *device,242 static errno_t req_clear_hub_feature(usbvirt_device_t *device, 243 243 const usb_device_request_setup_packet_t *setup_packet, 244 244 uint8_t *data, size_t *act_size) … … 268 268 * @return Error code. 269 269 */ 270 static int req_get_port_status(usbvirt_device_t *device,270 static errno_t req_get_port_status(usbvirt_device_t *device, 271 271 const usb_device_request_setup_packet_t *setup_packet, 272 272 uint8_t *data, size_t *act_size) … … 311 311 } ehci_rh_job_t; 312 312 313 static int stop_reset(void *arg)313 static errno_t stop_reset(void *arg) 314 314 { 315 315 ehci_rh_job_t *job = arg; … … 340 340 } 341 341 342 static int stop_resume(void *arg)342 static errno_t stop_resume(void *arg) 343 343 { 344 344 ehci_rh_job_t *job = arg; … … 353 353 } 354 354 355 static int delayed_job(int (*func)(void*), ehci_rh_t *rh, unsigned port)355 static errno_t delayed_job(errno_t (*func)(void*), ehci_rh_t *rh, unsigned port) 356 356 { 357 357 ehci_rh_job_t *job = malloc(sizeof(*job)); … … 379 379 * @return Error code. 380 380 */ 381 static int req_clear_port_feature(usbvirt_device_t *device,381 static errno_t req_clear_port_feature(usbvirt_device_t *device, 382 382 const usb_device_request_setup_packet_t *setup_packet, 383 383 uint8_t *data, size_t *act_size) … … 458 458 * @return Error code. 459 459 */ 460 static int req_set_port_feature(usbvirt_device_t *device,460 static errno_t req_set_port_feature(usbvirt_device_t *device, 461 461 const usb_device_request_setup_packet_t *setup_packet, 462 462 uint8_t *data, size_t *act_size) … … 507 507 * only need 1 byte. 508 508 */ 509 static int req_status_change_handler(usbvirt_device_t *device,509 static errno_t req_status_change_handler(usbvirt_device_t *device, 510 510 usb_endpoint_t endpoint, usb_transfer_type_t tr_type, 511 511 void *buffer, size_t buffer_size, size_t *actual_size) -
uspace/drv/bus/usb/ehci/ehci_rh.h
r36f0738 rb7fd2a0 67 67 } ehci_rh_t; 68 68 69 int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,69 errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs, 70 70 const char *name); 71 int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);72 int ehci_rh_interrupt(ehci_rh_t *instance);71 errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch); 72 errno_t ehci_rh_interrupt(ehci_rh_t *instance); 73 73 74 74 /** Get EHCI rh address. -
uspace/drv/bus/usb/ehci/endpoint_list.c
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 90 90 91 91 static void hc_start(hc_t *instance); 92 static int hc_init_memory(hc_t *instance);92 static errno_t hc_init_memory(hc_t *instance); 93 93 94 94 /** Generate IRQ code. … … 100 100 * @return Error code. 101 101 */ 102 int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)102 errno_t ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq) 103 103 { 104 104 assert(code); … … 132 132 ehci_caps_regs_t *caps = NULL; 133 133 134 int ret = pio_enable_range(®s, (void**)&caps);134 errno_t ret = pio_enable_range(®s, (void**)&caps); 135 135 if (ret != EOK) { 136 136 free(code->ranges); … … 159 159 * @return Error code 160 160 */ 161 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)161 errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts) 162 162 { 163 163 assert(instance); … … 168 168 return EINVAL; 169 169 170 int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],170 errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0], 171 171 (void **)&instance->caps); 172 172 if (ret != EOK) { … … 273 273 } 274 274 275 int ehci_hc_status(hcd_t *hcd, uint32_t *status)275 errno_t ehci_hc_status(hcd_t *hcd, uint32_t *status) 276 276 { 277 277 assert(hcd); … … 294 294 * @return Error code. 295 295 */ 296 int ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)296 errno_t ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch) 297 297 { 298 298 assert(hcd); … … 445 445 * @return Error code. 446 446 */ 447 int hc_init_memory(hc_t *instance)447 errno_t hc_init_memory(hc_t *instance) 448 448 { 449 449 assert(instance); 450 450 usb_log_debug2("HC(%p): Initializing Async list(%p).", instance, 451 451 &instance->async_list); 452 int ret = endpoint_list_init(&instance->async_list, "ASYNC");452 errno_t ret = endpoint_list_init(&instance->async_list, "ASYNC"); 453 453 if (ret != EOK) { 454 454 usb_log_error("HC(%p): Failed to setup ASYNC list: %s", -
uspace/drv/bus/usb/ehci/hc.h
r36f0738 rb7fd2a0 82 82 } hc_t; 83 83 84 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts);84 errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts); 85 85 void hc_fini(hc_t *instance); 86 86 … … 88 88 void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep); 89 89 90 int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);90 errno_t ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq); 91 91 92 92 void ehci_hc_interrupt(hcd_t *hcd, uint32_t status); 93 int ehci_hc_status(hcd_t *hcd, uint32_t *status);94 int ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);93 errno_t ehci_hc_status(hcd_t *hcd, uint32_t *status); 94 errno_t ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch); 95 95 #endif 96 96 /** -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c
r36f0738 rb7fd2a0 45 45 46 46 47 int td_error(const td_t *td)47 errno_t td_error(const td_t *td) 48 48 { 49 49 assert(td); -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h
r36f0738 rb7fd2a0 90 90 } 91 91 92 int td_error(const td_t *td);92 errno_t td_error(const td_t *td); 93 93 94 94 void td_init(td_t *td, const td_t *next, usb_direction_t dir, const void * buf, -
uspace/drv/bus/usb/ehci/main.c
r36f0738 rb7fd2a0 52 52 #define NAME "ehci" 53 53 54 static int ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);54 static errno_t ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 55 55 static void ehci_driver_fini(hcd_t *); 56 56 … … 72 72 73 73 74 static int ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res,74 static errno_t ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, 75 75 bool irq) 76 76 { … … 82 82 return ENOMEM; 83 83 84 const int ret = hc_init(instance, res, irq);84 const errno_t ret = hc_init(instance, res, irq); 85 85 if (ret == EOK) { 86 86 hcd_set_implementation(hcd, instance, &ehci_hc_driver.ops); … … 107 107 * @return Error code. 108 108 */ 109 static int ehci_dev_add(ddf_dev_t *device)109 static errno_t ehci_dev_add(ddf_dev_t *device) 110 110 { 111 111 usb_log_debug("ehci_dev_add() called\n"); -
uspace/drv/bus/usb/ehci/res.c
r36f0738 rb7fd2a0 62 62 * @return Error code. 63 63 */ 64 static int disable_extended_caps(async_sess_t *parent_sess, unsigned eecp)64 static errno_t disable_extended_caps(async_sess_t *parent_sess, unsigned eecp) 65 65 { 66 66 /* nothing to do */ … … 70 70 /* Read the first EEC. i.e. Legacy Support register */ 71 71 uint32_t usblegsup; 72 int ret = pci_config_space_read_32(parent_sess,72 errno_t ret = pci_config_space_read_32(parent_sess, 73 73 eecp + USBLEGSUP_OFFSET, &usblegsup); 74 74 if (ret != EOK) { … … 172 172 } 173 173 174 int disable_legacy(ddf_dev_t *device)174 errno_t disable_legacy(ddf_dev_t *device) 175 175 { 176 176 assert(device); … … 184 184 hw_res_list_parsed_t res; 185 185 hw_res_list_parsed_init(&res); 186 int ret = hw_res_get_list_parsed(parent_sess, &res, 0);186 errno_t ret = hw_res_get_list_parsed(parent_sess, &res, 0); 187 187 if (ret != EOK) { 188 188 usb_log_error("Failed to get resource list: %s\n", -
uspace/drv/bus/usb/ehci/res.h
r36f0738 rb7fd2a0 39 39 #include <device/hw_res_parsed.h> 40 40 41 extern int disable_legacy(ddf_dev_t *);41 extern errno_t disable_legacy(ddf_dev_t *); 42 42 43 43 #endif -
uspace/drv/bus/usb/ohci/endpoint_list.c
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 91 91 static void hc_gain_control(hc_t *instance); 92 92 static void hc_start(hc_t *instance); 93 static int hc_init_transfer_lists(hc_t *instance);94 static int hc_init_memory(hc_t *instance);93 static errno_t hc_init_transfer_lists(hc_t *instance); 94 static errno_t hc_init_memory(hc_t *instance); 95 95 96 96 /** Generate IRQ code. … … 103 103 * @return Error code. 104 104 */ 105 int ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)105 errno_t ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq) 106 106 { 107 107 assert(code); … … 152 152 * @return Error code 153 153 */ 154 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)154 errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts) 155 155 { 156 156 assert(instance); … … 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->registers); 164 164 if (ret != EOK) { … … 269 269 } 270 270 271 int ohci_hc_status(hcd_t *hcd, uint32_t *status)271 errno_t ohci_hc_status(hcd_t *hcd, uint32_t *status) 272 272 { 273 273 assert(hcd); … … 289 289 * @return Error code. 290 290 */ 291 int ohci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)291 errno_t ohci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch) 292 292 { 293 293 assert(hcd); … … 518 518 * @return Error code 519 519 */ 520 int hc_init_transfer_lists(hc_t *instance)520 errno_t hc_init_transfer_lists(hc_t *instance) 521 521 { 522 522 assert(instance); … … 524 524 do { \ 525 525 const char *name = usb_str_transfer_type(type); \ 526 const int ret = endpoint_list_init(&instance->lists[type], name); \526 const errno_t ret = endpoint_list_init(&instance->lists[type], name); \ 527 527 if (ret != EOK) { \ 528 528 usb_log_error("Failed to setup %s endpoint list: %s.\n", \ … … 552 552 * @return Error code. 553 553 */ 554 int hc_init_memory(hc_t *instance)554 errno_t hc_init_memory(hc_t *instance) 555 555 { 556 556 assert(instance); … … 558 558 memset(&instance->rh, 0, sizeof(instance->rh)); 559 559 /* Init queues */ 560 const int ret = hc_init_transfer_lists(instance);560 const errno_t ret = hc_init_transfer_lists(instance); 561 561 if (ret != EOK) { 562 562 return ret; -
uspace/drv/bus/usb/ohci/hc.h
r36f0738 rb7fd2a0 80 80 } hc_t; 81 81 82 extern int hc_init(hc_t *, const hw_res_list_parsed_t *, bool);82 extern errno_t hc_init(hc_t *, const hw_res_list_parsed_t *, bool); 83 83 extern void hc_fini(hc_t *); 84 84 … … 86 86 extern void hc_dequeue_endpoint(hc_t *, const endpoint_t *); 87 87 88 int ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);88 errno_t ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq); 89 89 90 90 extern void ohci_hc_interrupt(hcd_t *, uint32_t); 91 extern int ohci_hc_status(hcd_t *, uint32_t *);92 extern int ohci_hc_schedule(hcd_t *, usb_transfer_batch_t *);91 extern errno_t ohci_hc_status(hcd_t *, uint32_t *); 92 extern errno_t ohci_hc_schedule(hcd_t *, usb_transfer_batch_t *); 93 93 94 94 #endif -
uspace/drv/bus/usb/ohci/hw_struct/completion_codes.h
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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/main.c
r36f0738 rb7fd2a0 47 47 48 48 #define NAME "ohci" 49 static int ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);49 static errno_t ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 50 50 static void ohci_driver_fini(hcd_t *); 51 51 … … 66 66 67 67 68 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)68 static errno_t ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 69 69 { 70 70 assert(hcd); … … 75 75 return ENOMEM; 76 76 77 const int ret = hc_init(instance, res, irq);77 const errno_t ret = hc_init(instance, res, irq); 78 78 if (ret == EOK) { 79 79 hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops); … … 100 100 * @return Error code. 101 101 */ 102 static int ohci_dev_add(ddf_dev_t *device)102 static errno_t ohci_dev_add(ddf_dev_t *device) 103 103 { 104 104 usb_log_debug("ohci_dev_add() called\n"); -
uspace/drv/bus/usb/ohci/ohci_endpoint.c
r36f0738 rb7fd2a0 72 72 * @return Error code. 73 73 */ 74 int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep)74 errno_t ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep) 75 75 { 76 76 assert(ep); -
uspace/drv/bus/usb/ohci/ohci_endpoint.h
r36f0738 rb7fd2a0 53 53 } ohci_endpoint_t; 54 54 55 int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep);55 errno_t ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep); 56 56 void ohci_endpoint_fini(hcd_t *hcd, endpoint_t *ep); 57 57 -
uspace/drv/bus/usb/ohci/ohci_rh.c
r36f0738 rb7fd2a0 109 109 * initializes internal virtual hub. 110 110 */ 111 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name)111 errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name) 112 112 { 113 113 assert(instance); … … 174 174 * status change requests might be postponed until there is something to report. 175 175 */ 176 int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch)176 errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch) 177 177 { 178 178 assert(instance); … … 205 205 * processing of a postponed request. 206 206 */ 207 int ohci_rh_interrupt(ohci_rh_t *instance)207 errno_t ohci_rh_interrupt(ohci_rh_t *instance) 208 208 { 209 209 //TODO atomic swap needed … … 245 245 * @return Error code. 246 246 */ 247 static int req_get_status(usbvirt_device_t *device,247 static errno_t req_get_status(usbvirt_device_t *device, 248 248 const usb_device_request_setup_packet_t *setup_packet, 249 249 uint8_t *data, size_t *act_size) … … 268 268 * @return Error code. 269 269 */ 270 static int req_clear_hub_feature(usbvirt_device_t *device,270 static errno_t req_clear_hub_feature(usbvirt_device_t *device, 271 271 const usb_device_request_setup_packet_t *setup_packet, 272 272 uint8_t *data, size_t *act_size) … … 298 298 * @return Error code. 299 299 */ 300 static int req_get_port_status(usbvirt_device_t *device,300 static errno_t req_get_port_status(usbvirt_device_t *device, 301 301 const usb_device_request_setup_packet_t *setup_packet, 302 302 uint8_t *data, size_t *act_size) … … 322 322 * @return Error code. 323 323 */ 324 static int req_clear_port_feature(usbvirt_device_t *device,324 static errno_t req_clear_port_feature(usbvirt_device_t *device, 325 325 const usb_device_request_setup_packet_t *setup_packet, 326 326 uint8_t *data, size_t *act_size) … … 386 386 * @return Error code. 387 387 */ 388 static int req_set_port_feature(usbvirt_device_t *device,388 static errno_t req_set_port_feature(usbvirt_device_t *device, 389 389 const usb_device_request_setup_packet_t *setup_packet, 390 390 uint8_t *data, size_t *act_size) … … 437 437 * only need 1 byte. 438 438 */ 439 static int req_status_change_handler(usbvirt_device_t *device,439 static errno_t req_status_change_handler(usbvirt_device_t *device, 440 440 usb_endpoint_t endpoint, usb_transfer_type_t tr_type, 441 441 void *buffer, size_t buffer_size, size_t *actual_size) -
uspace/drv/bus/usb/ohci/ohci_rh.h
r36f0738 rb7fd2a0 65 65 } ohci_rh_t; 66 66 67 int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name);68 int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch);69 int ohci_rh_interrupt(ohci_rh_t *instance);67 errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name); 68 errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch); 69 errno_t ohci_rh_interrupt(ohci_rh_t *instance); 70 70 71 71 /** Get OHCI rh address. -
uspace/drv/bus/usb/uhci/hc.c
r36f0738 rb7fd2a0 94 94 95 95 static void hc_init_hw(const hc_t *instance); 96 static int hc_init_mem_structures(hc_t *instance);97 static int hc_init_transfer_lists(hc_t *instance);98 99 static int hc_debug_checker(void *arg);96 static errno_t hc_init_mem_structures(hc_t *instance); 97 static errno_t hc_init_transfer_lists(hc_t *instance); 98 99 static errno_t hc_debug_checker(void *arg); 100 100 101 101 … … 107 107 * @return Error code. 108 108 */ 109 int uhci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)109 errno_t uhci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq) 110 110 { 111 111 assert(code); … … 216 216 * interrupt fibrils. 217 217 */ 218 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)218 errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts) 219 219 { 220 220 assert(instance); … … 228 228 229 229 /* allow access to hc control registers */ 230 int ret = pio_enable_range(&hw_res->io_ranges.ranges[0],230 errno_t ret = pio_enable_range(&hw_res->io_ranges.ranges[0], 231 231 (void **) &instance->registers); 232 232 if (ret != EOK) { … … 318 318 * - frame list page (needs to be one UHCI hw accessible 4K page) 319 319 */ 320 int hc_init_mem_structures(hc_t *instance)320 errno_t hc_init_mem_structures(hc_t *instance) 321 321 { 322 322 assert(instance); … … 330 330 331 331 /* Init transfer lists */ 332 int ret = hc_init_transfer_lists(instance);332 errno_t ret = hc_init_transfer_lists(instance); 333 333 if (ret != EOK) { 334 334 usb_log_error("Failed to initialize transfer lists.\n"); … … 359 359 * USB scheduling. Sets pointer table for quick access. 360 360 */ 361 int hc_init_transfer_lists(hc_t *instance)361 errno_t hc_init_transfer_lists(hc_t *instance) 362 362 { 363 363 assert(instance); 364 364 #define SETUP_TRANSFER_LIST(type, name) \ 365 365 do { \ 366 int ret = transfer_list_init(&instance->transfers_##type, name); \366 errno_t ret = transfer_list_init(&instance->transfers_##type, name); \ 367 367 if (ret != EOK) { \ 368 368 usb_log_error("Failed to setup %s transfer list: %s.\n", \ … … 411 411 } 412 412 413 int uhci_hc_status(hcd_t *hcd, uint32_t *status)413 errno_t uhci_hc_status(hcd_t *hcd, uint32_t *status) 414 414 { 415 415 assert(hcd); … … 435 435 * Checks for bandwidth availability and appends the batch to the proper queue. 436 436 */ 437 int uhci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)437 errno_t uhci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch) 438 438 { 439 439 assert(hcd); … … 464 464 * @return EOK (should never return) 465 465 */ 466 int hc_debug_checker(void *arg)466 errno_t hc_debug_checker(void *arg) 467 467 { 468 468 hc_t *instance = arg; -
uspace/drv/bus/usb/uhci/hc.h
r36f0738 rb7fd2a0 124 124 } hc_t; 125 125 126 extern int hc_init(hc_t *, const hw_res_list_parsed_t *, bool);126 extern errno_t hc_init(hc_t *, const hw_res_list_parsed_t *, bool); 127 127 extern void hc_fini(hc_t *); 128 128 129 extern int uhci_hc_gen_irq_code(irq_code_t *, const hw_res_list_parsed_t *, int *);129 extern errno_t uhci_hc_gen_irq_code(irq_code_t *, const hw_res_list_parsed_t *, int *); 130 130 131 131 extern void uhci_hc_interrupt(hcd_t *, uint32_t); 132 extern int uhci_hc_status(hcd_t *, uint32_t *);133 extern int uhci_hc_schedule(hcd_t *, usb_transfer_batch_t *);132 extern errno_t uhci_hc_status(hcd_t *, uint32_t *); 133 extern errno_t uhci_hc_schedule(hcd_t *, usb_transfer_batch_t *); 134 134 135 135 #endif -
uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 49 49 #define NAME "uhci" 50 50 51 static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);51 static errno_t uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 52 52 static void uhci_driver_fini(hcd_t *); 53 static int disable_legacy(ddf_dev_t *);53 static errno_t disable_legacy(ddf_dev_t *); 54 54 55 55 static const ddf_hc_driver_t uhci_hc_driver = { … … 67 67 }; 68 68 69 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)69 static errno_t uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 70 70 { 71 71 assert(hcd); … … 76 76 return ENOMEM; 77 77 78 const int ret = hc_init(instance, res, irq);78 const errno_t ret = hc_init(instance, res, irq); 79 79 if (ret == EOK) { 80 80 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops); … … 101 101 * @return Error code. 102 102 */ 103 static int disable_legacy(ddf_dev_t *device)103 static errno_t disable_legacy(ddf_dev_t *device) 104 104 { 105 105 assert(device); … … 119 119 * @return Error code. 120 120 */ 121 static int uhci_dev_add(ddf_dev_t *device)121 static errno_t uhci_dev_add(ddf_dev_t *device) 122 122 { 123 123 usb_log_debug2("uhci_dev_add() called\n"); -
uspace/drv/bus/usb/uhci/transfer_list.c
r36f0738 rb7fd2a0 56 56 * Allocates memory for internal qh_t structure. 57 57 */ 58 int transfer_list_init(transfer_list_t *instance, const char *name)58 errno_t transfer_list_init(transfer_list_t *instance, const char *name) 59 59 { 60 60 assert(instance); -
uspace/drv/bus/usb/uhci/transfer_list.h
r36f0738 rb7fd2a0 57 57 58 58 void transfer_list_fini(transfer_list_t *instance); 59 int transfer_list_init(transfer_list_t *instance, const char *name);59 errno_t transfer_list_init(transfer_list_t *instance, const char *name); 60 60 void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next); 61 61 void transfer_list_add_batch( -
uspace/drv/bus/usb/uhci/uhci_rh.c
r36f0738 rb7fd2a0 78 78 * @return Error code, EOK on success. 79 79 */ 80 int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)80 errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name) 81 81 { 82 82 assert(instance); … … 98 98 * not have to be. 99 99 */ 100 int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)100 errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch) 101 101 { 102 102 assert(instance); … … 193 193 * it is usefull for debuging purposes only. 194 194 */ 195 static int req_get_port_state(usbvirt_device_t *device,195 static errno_t req_get_port_state(usbvirt_device_t *device, 196 196 const usb_device_request_setup_packet_t *setup_packet, 197 197 uint8_t *data, size_t *act_size) … … 228 228 * @note: reset change status needs to be handled in sw. 229 229 */ 230 static int req_get_port_status(usbvirt_device_t *device,230 static errno_t req_get_port_status(usbvirt_device_t *device, 231 231 const usb_device_request_setup_packet_t *setup_packet, 232 232 uint8_t *data, size_t *act_size) … … 267 267 * @return Error code. 268 268 */ 269 static int req_clear_port_feature(usbvirt_device_t *device,269 static errno_t req_clear_port_feature(usbvirt_device_t *device, 270 270 const usb_device_request_setup_packet_t *setup_packet, 271 271 uint8_t *data, size_t *act_size) … … 340 340 * @return Error code. 341 341 */ 342 static int req_set_port_feature(usbvirt_device_t *device,342 static errno_t req_set_port_feature(usbvirt_device_t *device, 343 343 const usb_device_request_setup_packet_t *setup_packet, 344 344 uint8_t *data, size_t *act_size) … … 402 402 * only need 1 byte. 403 403 */ 404 static int req_status_change_handler(usbvirt_device_t *device,404 static errno_t req_status_change_handler(usbvirt_device_t *device, 405 405 usb_endpoint_t endpoint, usb_transfer_type_t tr_type, 406 406 void *buffer, size_t buffer_size, size_t *actual_size) -
uspace/drv/bus/usb/uhci/uhci_rh.h
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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'.\n", … … 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
r36f0738 rb7fd2a0 54 54 }; 55 55 56 static int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub);56 static errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub); 57 57 static void usb_hub_port_reset_completed(usb_hub_port_t *port, 58 58 usb_hub_dev_t *hub, usb_port_status_t status); 59 static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status);60 static int add_device_phase1_worker_fibril(void *arg);61 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,59 static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status); 60 static errno_t add_device_phase1_worker_fibril(void *arg); 61 static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub, 62 62 usb_speed_t speed); 63 63 64 int usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub)64 errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub) 65 65 { 66 66 assert(port); … … 77 77 * @return Operation result 78 78 */ 79 int usb_hub_port_clear_feature(79 errno_t usb_hub_port_clear_feature( 80 80 usb_hub_port_t *port, usb_hub_class_feature_t feature) 81 81 { … … 99 99 * @return Operation result 100 100 */ 101 int usb_hub_port_set_feature(101 errno_t usb_hub_port_set_feature( 102 102 usb_hub_port_t *port, usb_hub_class_feature_t feature) 103 103 { … … 143 143 144 144 usb_port_status_t status = 0; 145 const int opResult = get_port_status(port, &status);145 const errno_t opResult = get_port_status(port, &status); 146 146 if (opResult != EOK) { 147 147 usb_log_error("(%p-%u): Failed to get port status: %s.\n", hub, … … 158 158 159 159 /* ACK the change */ 160 const int opResult = usb_hub_port_clear_feature(port,160 const errno_t opResult = usb_hub_port_clear_feature(port, 161 161 USB_HUB_FEATURE_C_PORT_CONNECTION); 162 162 if (opResult != EOK) { … … 167 167 168 168 if (connected) { 169 const int opResult = create_add_device_fibril(port, hub,169 const errno_t opResult = create_add_device_fibril(port, hub, 170 170 usb_port_speed(status)); 171 171 if (opResult != EOK) { … … 191 191 port->port_number); 192 192 usb_hub_port_device_gone(port, hub); 193 const int rc = usb_hub_port_clear_feature(port,193 const errno_t rc = usb_hub_port_clear_feature(port, 194 194 USB_HUB_FEATURE_C_PORT_ENABLE); 195 195 if (rc != EOK) { … … 206 206 " NOT happen as we do not support suspend state!", hub, 207 207 port->port_number); 208 const int rc = usb_hub_port_clear_feature(port,208 const errno_t rc = usb_hub_port_clear_feature(port, 209 209 USB_HUB_FEATURE_C_PORT_SUSPEND); 210 210 if (rc != EOK) { … … 224 224 * mode. USB system software is responsible for powering port 225 225 * back on when the over-current condition is gone */ 226 const int rc = usb_hub_port_clear_feature(port,226 const errno_t rc = usb_hub_port_clear_feature(port, 227 227 USB_HUB_FEATURE_C_PORT_OVER_CURRENT); 228 228 if (rc != EOK) { … … 232 232 } 233 233 if (!(status & ~USB_HUB_PORT_STATUS_OC)) { 234 const int rc = usb_hub_port_set_feature(234 const errno_t rc = usb_hub_port_set_feature( 235 235 port, USB_HUB_FEATURE_PORT_POWER); 236 236 if (rc != EOK) { … … 260 260 * @param hub hub representation 261 261 */ 262 int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub)262 errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub) 263 263 { 264 264 assert(port); … … 267 267 if (!exch) 268 268 return ENOMEM; 269 const int rc = usb_device_remove(exch, port->port_number);269 const errno_t rc = usb_device_remove(exch, port->port_number); 270 270 usb_device_bus_exchange_end(exch); 271 271 if (rc == EOK) … … 304 304 305 305 /* Clear the port reset change. */ 306 int rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET);306 errno_t rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET); 307 307 if (rc != EOK) { 308 308 usb_log_error("(%p-%u): Failed to clear port reset change: %s.", … … 317 317 * @return Error code. 318 318 */ 319 static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status)319 static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status) 320 320 { 321 321 assert(port); … … 333 333 usb_port_status_t status_tmp; 334 334 335 const int rc = usb_pipe_control_read(port->control_pipe,335 const errno_t rc = usb_pipe_control_read(port->control_pipe, 336 336 &request, sizeof(usb_device_request_setup_packet_t), 337 337 &status_tmp, sizeof(status_tmp), &recv_size); … … 351 351 } 352 352 353 static int port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable)353 static errno_t port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable) 354 354 { 355 355 if (enable) { 356 int rc =356 errno_t rc = 357 357 usb_hub_port_set_feature(port, USB_HUB_FEATURE_PORT_RESET); 358 358 if (rc != EOK) { … … 383 383 * @return 0 Always. 384 384 */ 385 int add_device_phase1_worker_fibril(void *arg)385 errno_t add_device_phase1_worker_fibril(void *arg) 386 386 { 387 387 struct add_device_phase1 *params = arg; 388 388 assert(params); 389 389 390 int ret = EOK;390 errno_t ret = EOK; 391 391 usb_hub_dev_t *hub = params->hub; 392 392 usb_hub_port_t *port = params->port; … … 434 434 usb_log_error("(%p-%u): Failed to enumerate device: %s", hub, 435 435 port->port_number, str_error(ret)); 436 const int ret = port_enable(port, hub, false);436 const errno_t ret = port_enable(port, hub, false); 437 437 if (ret != EOK) { 438 438 usb_log_warning("(%p-%u)Failed to disable port (%s), " … … 440 440 port->port_number, str_error(ret)); 441 441 } else { 442 const int ret = usb_release_default_address(exch);442 const errno_t ret = usb_release_default_address(exch); 443 443 if (ret != EOK) 444 444 usb_log_warning("(%p-%u): Failed to release " … … 475 475 * @return Error code. 476 476 */ 477 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,477 static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub, 478 478 usb_speed_t speed) 479 479 { -
uspace/drv/bus/usb/usbhub/port.h
r36f0738 rb7fd2a0 83 83 } 84 84 85 int usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub);86 int usb_hub_port_clear_feature(85 errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub); 86 errno_t usb_hub_port_clear_feature( 87 87 usb_hub_port_t *port, usb_hub_class_feature_t feature); 88 int usb_hub_port_set_feature(88 errno_t usb_hub_port_set_feature( 89 89 usb_hub_port_t *port, usb_hub_class_feature_t feature); 90 90 void usb_hub_port_reset_fail(usb_hub_port_t *port); -
uspace/drv/bus/usb/usbhub/usbhub.c
r36f0738 rb7fd2a0 81 81 }; 82 82 83 static int usb_set_first_configuration(usb_device_t *usb_device);84 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev);83 static errno_t usb_set_first_configuration(usb_device_t *usb_device); 84 static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev); 85 85 static void usb_hub_over_current(const usb_hub_dev_t *hub_dev, 86 86 usb_hub_status_t status); … … 97 97 * @return error code 98 98 */ 99 int usb_hub_device_add(usb_device_t *usb_dev)99 errno_t usb_hub_device_add(usb_device_t *usb_dev) 100 100 { 101 101 assert(usb_dev); … … 114 114 115 115 /* Set hub's first configuration. (There should be only one) */ 116 int opResult = usb_set_first_configuration(usb_dev);116 errno_t opResult = usb_set_first_configuration(usb_dev); 117 117 if (opResult != EOK) { 118 118 usb_log_error("Could not set hub configuration: %s\n", … … 174 174 * @return error code 175 175 */ 176 int usb_hub_device_remove(usb_device_t *usb_dev)176 errno_t usb_hub_device_remove(usb_device_t *usb_dev) 177 177 { 178 178 return ENOTSUP; … … 184 184 * @return error code 185 185 */ 186 int usb_hub_device_gone(usb_device_t *usb_dev)186 errno_t usb_hub_device_gone(usb_device_t *usb_dev) 187 187 { 188 188 assert(usb_dev); … … 202 202 203 203 for (size_t port = 0; port < hub->port_count; ++port) { 204 const int ret = usb_hub_port_fini(&hub->ports[port], hub);204 const errno_t ret = usb_hub_port_fini(&hub->ports[port], hub); 205 205 if (ret != EOK) 206 206 return ret; … … 208 208 free(hub->ports); 209 209 210 const int ret = ddf_fun_unbind(hub->hub_fun);210 const errno_t ret = ddf_fun_unbind(hub->hub_fun); 211 211 if (ret != EOK) { 212 212 usb_log_error("(%p) Failed to unbind '%s' function: %s.", … … 266 266 * @return error code 267 267 */ 268 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)268 static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev) 269 269 { 270 270 assert(hub_dev); … … 277 277 usb_hub_descriptor_header_t descriptor; 278 278 size_t received_size; 279 int opResult = usb_request_get_descriptor(control_pipe,279 errno_t opResult = usb_request_get_descriptor(control_pipe, 280 280 USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE, 281 281 USB_DESCTYPE_HUB, 0, 0, &descriptor, … … 317 317 for (unsigned int port = 0; port < hub_dev->port_count; ++port) { 318 318 usb_log_debug("(%p): Powering port %u.", hub_dev, port); 319 const int ret = usb_hub_port_set_feature(319 const errno_t ret = usb_hub_port_set_feature( 320 320 &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER); 321 321 … … 343 343 * @return error code 344 344 */ 345 static int usb_set_first_configuration(usb_device_t *usb_device)345 static errno_t usb_set_first_configuration(usb_device_t *usb_device) 346 346 { 347 347 assert(usb_device); … … 369 369 /* Set configuration. Use the configuration that was in 370 370 * usb_device->descriptors.configuration i.e. The first one. */ 371 const int opResult = usb_request_set_configuration(371 const errno_t opResult = usb_request_set_configuration( 372 372 usb_device_get_default_pipe(usb_device), 373 373 config_descriptor->configuration_number); … … 406 406 /* Over-current condition is gone, it is safe to turn the ports on. */ 407 407 for (size_t port = 0; port < hub_dev->port_count; ++port) { 408 const int ret = usb_hub_port_set_feature(408 const errno_t ret = usb_hub_port_set_feature( 409 409 &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER); 410 410 if (ret != EOK) { … … 438 438 /* NOTE: We can't use standard USB GET_STATUS request, because 439 439 * hubs reply is 4byte instead of 2 */ 440 const int opResult = usb_pipe_control_read(control_pipe,440 const errno_t opResult = usb_pipe_control_read(control_pipe, 441 441 &get_hub_status_request, sizeof(get_hub_status_request), 442 442 &status, sizeof(usb_hub_status_t), &rcvd_size); … … 456 456 usb_hub_over_current(hub_dev, status); 457 457 /* Ack change in hub OC flag */ 458 const int ret = usb_request_clear_feature(458 const errno_t ret = usb_request_clear_feature( 459 459 control_pipe, USB_REQUEST_TYPE_CLASS, 460 460 USB_REQUEST_RECIPIENT_DEVICE, … … 480 480 * Just ACK the change. 481 481 */ 482 const int ret = usb_request_clear_feature(482 const errno_t ret = usb_request_clear_feature( 483 483 control_pipe, USB_REQUEST_TYPE_CLASS, 484 484 USB_REQUEST_RECIPIENT_DEVICE, -
uspace/drv/bus/usb/usbhub/usbhub.h
r36f0738 rb7fd2a0 83 83 extern const usb_endpoint_description_t hub_status_change_endpoint_description; 84 84 85 extern int usb_hub_device_add(usb_device_t *);86 extern int usb_hub_device_remove(usb_device_t *);87 extern int usb_hub_device_gone(usb_device_t *);85 extern errno_t usb_hub_device_add(usb_device_t *); 86 extern errno_t usb_hub_device_remove(usb_device_t *); 87 extern errno_t usb_hub_device_gone(usb_device_t *); 88 88 89 89 extern bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t, -
uspace/drv/bus/usb/usbmid/explore.c
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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'.\n", usb_device_get_name(dev)); … … 61 61 * @return Error code. 62 62 */ 63 static int usbmid_device_remove(usb_device_t *dev)63 static errno_t usbmid_device_remove(usb_device_t *dev) 64 64 { 65 65 assert(dev); … … 68 68 69 69 /* Remove ctl function */ 70 int ret = ddf_fun_unbind(usb_mid->ctl_fun);70 errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun); 71 71 if (ret != EOK) { 72 72 usb_log_error("Failed to unbind USB MID ctl function: %s.\n", … … 87 87 88 88 /* Tell the child to go off-line. */ 89 int pret = ddf_fun_offline(iface->fun);89 errno_t pret = ddf_fun_offline(iface->fun); 90 90 if (pret != EOK) { 91 91 usb_log_warning("Failed to turn off child `%s': %s\n", … … 110 110 * @return Error code. 111 111 */ 112 static int usbmid_device_gone(usb_device_t *dev)112 static errno_t usbmid_device_gone(usb_device_t *dev) 113 113 { 114 114 assert(dev); … … 119 119 120 120 /* Remove ctl function */ 121 int ret = ddf_fun_unbind(usb_mid->ctl_fun);121 errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun); 122 122 if (ret != EOK) { 123 123 usb_log_error("Failed to unbind USB MID ctl function: %s.\n", … … 137 137 ddf_fun_get_name(iface->fun)); 138 138 139 const int pret = usbmid_interface_destroy(iface);139 const errno_t pret = usbmid_interface_destroy(iface); 140 140 if (pret != EOK) { 141 141 usb_log_error("Failed to remove child `%s': %s\n", -
uspace/drv/bus/usb/usbmid/usbmid.c
r36f0738 rb7fd2a0 51 51 * @return Error code. 52 52 */ 53 static int usb_iface_device_handle(ddf_fun_t *fun, devman_handle_t *handle)53 static errno_t usb_iface_device_handle(ddf_fun_t *fun, devman_handle_t *handle) 54 54 { 55 55 assert(fun); … … 61 61 62 62 /** Callback for DDF USB get interface. */ 63 static int usb_iface_iface_no(ddf_fun_t *fun, int *iface_no)63 static errno_t usb_iface_iface_no(ddf_fun_t *fun, int *iface_no) 64 64 { 65 65 usbmid_interface_t *iface = ddf_fun_data_get(fun); … … 83 83 }; 84 84 85 int usbmid_interface_destroy(usbmid_interface_t *mid_iface)85 errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface) 86 86 { 87 87 assert(mid_iface); 88 88 assert_link_not_used(&mid_iface->link); 89 const int ret = ddf_fun_unbind(mid_iface->fun);89 const errno_t ret = ddf_fun_unbind(mid_iface->fun); 90 90 if (ret != EOK) { 91 91 return ret; … … 103 103 * @return Error code. 104 104 */ 105 int usbmid_spawn_interface_child(usb_device_t *parent,105 errno_t usbmid_spawn_interface_child(usb_device_t *parent, 106 106 usbmid_interface_t **iface_ret, 107 107 const usb_standard_device_descriptor_t *device_descriptor, … … 110 110 ddf_fun_t *child = NULL; 111 111 char *child_name = NULL; 112 int rc;112 errno_t rc; 113 113 114 114 /* -
uspace/drv/bus/usb/usbmid/usbmid.h
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 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
r36f0738 rb7fd2a0 49 49 }; 50 50 51 static int vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun)51 static errno_t vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun) 52 52 { 53 53 assert(dev); … … 63 63 } 64 64 ddf_fun_set_ops(*fun, &vhc_ops); 65 const int ret = ddf_fun_bind(*fun);65 const errno_t ret = ddf_fun_bind(*fun); 66 66 if (ret != EOK) { 67 67 ddf_fun_destroy(*fun); … … 77 77 }; 78 78 79 static int vhc_dev_add(ddf_dev_t *dev)79 static errno_t vhc_dev_add(ddf_dev_t *dev) 80 80 { 81 81 /* Initialize virtual structure */ 82 82 ddf_fun_t *ctl_fun = NULL; 83 int ret = vhc_control_node(dev, &ctl_fun);83 errno_t ret = vhc_control_node(dev, &ctl_fun); 84 84 if (ret != EOK) { 85 85 usb_log_error("Failed to setup control node.\n"); -
uspace/drv/bus/usb/vhc/transfer.c
r36f0738 rb7fd2a0 58 58 } 59 59 60 static int process_transfer_local(usb_transfer_batch_t *batch,60 static errno_t process_transfer_local(usb_transfer_batch_t *batch, 61 61 usbvirt_device_t *dev, size_t *actual_data_size) 62 62 { 63 int rc;63 errno_t rc; 64 64 65 65 const usb_direction_t dir = usb_transfer_batch_direction(batch); … … 94 94 } 95 95 96 static int process_transfer_remote(usb_transfer_batch_t *batch,96 static errno_t process_transfer_remote(usb_transfer_batch_t *batch, 97 97 async_sess_t *sess, size_t *actual_data_size) 98 98 { 99 int rc;99 errno_t rc; 100 100 101 101 const usb_direction_t dir = usb_transfer_batch_direction(batch); … … 143 143 144 144 static void execute_transfer_callback_and_free(vhc_transfer_t *transfer, 145 size_t data_transfer_size, int outcome)145 size_t data_transfer_size, errno_t outcome) 146 146 { 147 147 assert(outcome != ENAK); … … 154 154 } 155 155 156 int vhc_init(vhc_data_t *instance)156 errno_t vhc_init(vhc_data_t *instance) 157 157 { 158 158 assert(instance); … … 163 163 } 164 164 165 int vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)165 errno_t vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch) 166 166 { 167 167 assert(hcd); … … 199 199 } 200 200 201 int vhc_transfer_queue_processor(void *arg)201 errno_t vhc_transfer_queue_processor(void *arg) 202 202 { 203 203 vhc_virtdev_t *dev = arg; … … 214 214 fibril_mutex_unlock(&dev->guard); 215 215 216 int rc = EOK;216 errno_t rc = EOK; 217 217 size_t data_transfer_size = 0; 218 218 if (dev->dev_sess) { -
uspace/drv/bus/usb/vhc/vhcd.h
r36f0738 rb7fd2a0 71 71 ipc_call_t *icall); 72 72 73 int vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *);74 int vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);75 int vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address);73 errno_t vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *); 74 errno_t vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *); 75 errno_t vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address); 76 76 void vhc_virtdev_unplug(vhc_data_t *, uintptr_t); 77 77 78 int vhc_init(vhc_data_t *instance);79 int vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);80 int vhc_transfer_queue_processor(void *arg);78 errno_t vhc_init(vhc_data_t *instance); 79 errno_t vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch); 80 errno_t vhc_transfer_queue_processor(void *arg); 81 81 82 82 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
