Changeset c2be0e5 in mainline
- Timestamp:
- 2011-04-02T18:56:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a8fa88d, ccbcd895
- Parents:
- 2c617b0
- Location:
- uspace/drv/ohci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hc.c
r2c617b0 rc2be0e5 79 79 assert(instance); 80 80 int ret = EOK; 81 #define CHECK_RET_RETURN(ret, message...) \ 82 if (ret != EOK) { \ 83 usb_log_error(message); \ 84 return ret; \ 85 } else (void)0 81 86 82 87 ret = pio_enable((void*)regs, reg_size, (void**)&instance->registers); 83 if (ret != EOK) {84 usb_log_error("Failed to gain access to device registers.\n");85 return ret;86 } 88 CHECK_RET_RETURN(ret, 89 "Failed(%d) to gain access to device registers: %s.\n", 90 ret, str_error(ret)); 91 87 92 instance->ddf_instance = fun; 88 93 usb_device_keeper_init(&instance->manager); 94 ret = bandwidth_init(&instance->bandwidth, BANDWIDTH_AVAILABLE_USB11, 95 bandwidth_count_usb11); 96 CHECK_RET_RETURN(ret, "Failed to initialize bandwidth allocator: %s.\n", 97 ret, str_error(ret)); 89 98 90 99 if (!interrupts) { … … 185 194 assert((instance->registers->command_status & CS_HCR) == 0); 186 195 /* hc is now in suspend state */ 196 /* TODO: init HCCA block */ 197 /* TODO: init queues */ 198 /* TODO: enable queues */ 199 /* TODO: enable interrupts */ 200 /* TODO: set periodic start to 90% */ 187 201 188 202 instance->registers->control &= (C_HCFS_OPERATIONAL << C_HCFS_SHIFT); -
uspace/drv/ohci/hc.h
r2c617b0 rc2be0e5 42 42 #include <usb/usb.h> 43 43 #include <usb/host/device_keeper.h> 44 #include <usb/host/bandwidth.h> 44 45 #include <usbhc_iface.h> 45 46 … … 54 55 ddf_fun_t *ddf_instance; 55 56 usb_device_keeper_t manager; 57 bandwidth_t bandwidth; 56 58 fid_t interrupt_emulator; 57 59 } hc_t; -
uspace/drv/ohci/iface.c
r2c617b0 rc2be0e5 151 151 size_t max_packet_size, unsigned int interval) 152 152 { 153 UNSUPPORTED("register_endpoint"); 154 155 return ENOTSUP; 153 assert(fun); 154 hc_t *hc = fun_to_hc(fun); 155 assert(hc); 156 if (address == hc->rh.address) 157 return EOK; 158 const usb_speed_t speed = 159 usb_device_keeper_get_speed(&hc->manager, address); 160 const size_t size = max_packet_size; 161 usb_log_debug("Register endpoint %d:%d %s %s(%d) %zu(%zu) %u.\n", 162 address, endpoint, usb_str_transfer_type(transfer_type), 163 usb_str_speed(speed), direction, size, max_packet_size, interval); 164 return bandwidth_reserve(&hc->bandwidth, address, endpoint, direction, 165 speed, transfer_type, max_packet_size, size, interval); 156 166 } 157 167 /*----------------------------------------------------------------------------*/ … … 168 178 usb_endpoint_t endpoint, usb_direction_t direction) 169 179 { 170 UNSUPPORTED("unregister_endpoint"); 180 assert(fun); 181 hc_t *hc = fun_to_hc(fun); 182 assert(hc); 183 usb_log_debug("Unregister endpoint %d:%d %d.\n", 184 address, endpoint, direction); 185 return bandwidth_release(&hc->bandwidth, address, endpoint, direction); 171 186 172 187 return ENOTSUP;
Note:
See TracChangeset
for help on using the changeset viewer.