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