Changes in uspace/drv/bus/usb/ohci/main.c [920d0fc:fccf289] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/main.c
r920d0fc rfccf289 33 33 * Main routines of OHCI driver. 34 34 */ 35 36 #include <assert.h> 35 37 #include <ddf/driver.h> 36 38 #include <errno.h> 39 #include <io/log.h> 37 40 #include <str_error.h> 38 41 39 42 #include <usb/debug.h> 43 #include <usb/host/ddf_helpers.h> 40 44 41 #include " ohci.h"45 #include "hc.h" 42 46 43 47 #define NAME "ohci" 48 49 static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 50 { 51 assert(hcd); 52 assert(hcd->driver.data == NULL); 53 54 hc_t *instance = malloc(sizeof(hc_t)); 55 if (!instance) 56 return ENOMEM; 57 58 const int ret = hc_init(instance, res, irq); 59 if (ret == EOK) 60 hcd_set_implementation(hcd, instance, ohci_hc_schedule, 61 ohci_endpoint_init, ohci_endpoint_fini, ohci_hc_interrupt, 62 ohci_hc_status); 63 return ret; 64 } 65 66 static void ohci_driver_fini(hcd_t *hcd) 67 { 68 assert(hcd); 69 if (hcd->driver.data) 70 hc_fini(hcd->driver.data); 71 72 free(hcd->driver.data); 73 hcd_set_implementation(hcd, NULL, NULL, NULL, NULL, NULL, NULL); 74 } 44 75 45 76 /** Initializes a new ddf driver instance of OHCI hcd. … … 53 84 assert(device); 54 85 55 int ret = device_setup_ohci(device); 86 const int ret = ddf_hcd_device_setup_all(device, USB_SPEED_FULL, 87 BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11, 88 ddf_hcd_gen_irq_handler, ohci_hc_gen_irq_code, 89 ohci_driver_init, ohci_driver_fini); 56 90 if (ret != EOK) { 57 91 usb_log_error("Failed to initialize OHCI driver: %s.\n", 58 92 str_error(ret)); 59 return ret;60 93 } 61 usb_log_info("Controlling new OHCI device '%s'.\n", ddf_dev_get_name(device)); 94 usb_log_info("Controlling new OHCI device '%s'.\n", 95 ddf_dev_get_name(device)); 62 96 63 return EOK;97 return ret; 64 98 } 65 99 66 static driver_ops_t ohci_driver_ops = {100 static const driver_ops_t ohci_driver_ops = { 67 101 .dev_add = ohci_dev_add, 68 102 }; 69 103 70 static driver_t ohci_driver = {104 static const driver_t ohci_driver = { 71 105 .name = NAME, 72 106 .driver_ops = &ohci_driver_ops
Note:
See TracChangeset
for help on using the changeset viewer.