Changeset 46577995 in mainline for uspace/drv/bus/usb/ehci
- Timestamp:
- 2018-01-04T20:50:52Z (8 years ago)
- Children:
- e211ea04
- Parents:
- facacc71
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
- Location:
- uspace/drv/bus/usb/ehci
- Files:
-
- 13 edited
-
ehci_endpoint.c (modified) (1 diff)
-
ehci_endpoint.h (modified) (1 diff)
-
ehci_rh.c (modified) (12 diffs)
-
ehci_rh.h (modified) (1 diff)
-
endpoint_list.c (modified) (1 diff)
-
endpoint_list.h (modified) (1 diff)
-
hc.c (modified) (8 diffs)
-
hc.h (modified) (2 diffs)
-
hw_struct/transfer_descriptor.c (modified) (1 diff)
-
hw_struct/transfer_descriptor.h (modified) (1 diff)
-
main.c (modified) (4 diffs)
-
res.c (modified) (4 diffs)
-
res.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_endpoint.c
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
rfacacc71 r46577995 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
Note:
See TracChangeset
for help on using the changeset viewer.
