Changeset d93ff502 in mainline for uspace/drv/uhci/uhci.c
- Timestamp:
- 2011-01-28T14:59:50Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 10f479ae
- Parents:
- de0e6b3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci/uhci.c
rde0e6b3 rd93ff502 11 11 static int uhci_init_transfer_lists(transfer_list_t list[]); 12 12 static int uhci_clean_finished(void *arg); 13 static inline int uhci_add_transfer(14 device_t *dev,15 usb_target_t target,16 usb_transfer_type_t transfer_type,17 usb_packet_id pid,18 void *buffer, size_t size,19 usbhc_iface_transfer_out_callback_t callback_out,20 usbhc_iface_transfer_in_callback_t callback_in,21 void *arg );22 13 23 14 int uhci_init(device_t *device, void *regs) … … 36 27 37 28 /* create instance */ 38 uhci_t *instance = malloc( sizeof(uhci_t));29 uhci_t *instance = malloc(sizeof(uhci_t)); 39 30 int ret = instance ? EOK : ENOMEM; 40 31 CHECK_RET_FREE_INSTANCE("Failed to allocate uhci driver instance.\n"); … … 44 35 /* init address keeper(libusb) */ 45 36 usb_address_keeping_init(&instance->address_manager, USB11_ADDRESS_MAX); 37 uhci_print_verbose("Initialized address manager.\n"); 46 38 47 39 /* allow access to hc control registers */ … … 50 42 CHECK_RET_FREE_INSTANCE("Failed to gain access to registers at %p.\n", io); 51 43 instance->registers = io; 44 uhci_print_verbose("Device registers accessible.\n"); 52 45 53 46 /* init transfer lists */ 54 47 ret = uhci_init_transfer_lists(instance->transfers); 55 48 CHECK_RET_FREE_INSTANCE("Failed to initialize transfer lists.\n"); 49 uhci_print_verbose("Transfer lists initialized.\n"); 56 50 57 51 /* init root hub */ … … 60 54 CHECK_RET_FREE_INSTANCE("Failed to initialize root hub driver.\n"); 61 55 56 uhci_print_verbose("Initializing frame list.\n"); 62 57 instance->frame_list = 63 m alloc32(sizeof(link_pointer_t) * UHCI_FRAME_LIST_COUNT);58 memallign32(sizeof(link_pointer_t) * UHCI_FRAME_LIST_COUNT, 4096); 64 59 if (instance->frame_list == NULL) { 65 60 uhci_print_error("Failed to allocate frame list pointer.\n"); … … 87 82 device->driver_data = instance; 88 83 return EOK; 89 }90 /*----------------------------------------------------------------------------*/91 int uhci_in(92 device_t *dev,93 usb_target_t target,94 usb_transfer_type_t transfer_type,95 void *buffer, size_t size,96 usbhc_iface_transfer_in_callback_t callback, void *arg97 )98 {99 uhci_print_info( "transfer IN [%d.%d (%s); %zu]\n",100 target.address, target.endpoint,101 usb_str_transfer_type(transfer_type),102 size);103 return uhci_add_transfer(104 dev, target, transfer_type, USB_PID_IN, buffer, size, NULL, callback, arg);105 }106 /*----------------------------------------------------------------------------*/107 int uhci_out(108 device_t *dev,109 usb_target_t target,110 usb_transfer_type_t transfer_type,111 void *buffer, size_t size,112 usbhc_iface_transfer_out_callback_t callback, void *arg113 )114 {115 uhci_print_info( "transfer OUT [%d.%d (%s); %zu]\n",116 target.address, target.endpoint,117 usb_str_transfer_type(transfer_type),118 size);119 return uhci_add_transfer(120 dev, target, transfer_type, USB_PID_OUT, buffer, size, callback, NULL, arg);121 }122 /*----------------------------------------------------------------------------*/123 int uhci_setup(124 device_t *dev,125 usb_target_t target,126 usb_transfer_type_t transfer_type,127 void *buffer, size_t size,128 usbhc_iface_transfer_out_callback_t callback, void *arg129 )130 {131 uhci_print_info( "transfer SETUP [%d.%d (%s); %zu]\n",132 target.address, target.endpoint,133 usb_str_transfer_type(transfer_type),134 size);135 uhci_print_info("Setup packet content: %x %x.\n", ((uint8_t*)buffer)[0],136 ((uint8_t*)buffer)[1]);137 return uhci_add_transfer( dev,138 target, transfer_type, USB_PID_SETUP, buffer, size, callback, NULL, arg);139 140 84 } 141 85 /*----------------------------------------------------------------------------*/ … … 173 117 } 174 118 /*----------------------------------------------------------------------------*/ 175 static inline int uhci_add_transfer(119 int uhci_transfer( 176 120 device_t *dev, 177 121 usb_target_t target, 178 122 usb_transfer_type_t transfer_type, 123 bool toggle, 179 124 usb_packet_id pid, 180 125 void *buffer, size_t size, … … 248 193 instance->transfers[i].last = instance->transfers[i].first; 249 194 } 250 251 195 async_usleep(1000000); 252 196 }
Note:
See TracChangeset
for help on using the changeset viewer.