Changes in uspace/drv/uhci-hcd/uhci_hc.c [ff34e5a:a9f91cd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/uhci_hc.c
rff34e5a ra9f91cd 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup drvusbuhcihc28 /** @addtogroup usb 29 29 * @{ 30 30 */ 31 31 /** @file 32 * @brief UHCI Host controller driver routines32 * @brief UHCI driver 33 33 */ 34 34 #include <errno.h> … … 59 59 } 60 60 }; 61 62 /** Gets USB address of the calling device. 63 * 64 * @param[in] fun UHCI hc function. 65 * @param[in] handle Handle of the device seeking address. 66 * @param[out] address Place to store found address. 67 * @return Error code. 68 */ 61 69 /*----------------------------------------------------------------------------*/ 62 70 static int uhci_hc_init_transfer_lists(uhci_hc_t *instance); … … 70 78 bool low_speed, usb_transfer_type_t transfer, size_t size); 71 79 /*----------------------------------------------------------------------------*/ 72 /** Initialize UHCI hcd driver structure80 /** Initializes UHCI hcd driver structure 73 81 * 74 82 * @param[in] instance Memory place to initialize. … … 78 86 * @return Error code. 79 87 * @note Should be called only once on any structure. 80 * 81 * Initializes memory structures, starts up hw, and launches debugger and 82 * interrupt fibrils. 83 */ 84 int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, 85 void *regs, size_t reg_size, bool interrupts) 88 */ 89 int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, void *regs, size_t reg_size) 86 90 { 87 91 assert(reg_size >= sizeof(regs_t)); … … 96 100 } else (void) 0 97 101 98 instance->hw_interrupts = interrupts;99 102 /* Setup UHCI function. */ 100 103 instance->ddf_instance = fun; … … 115 118 116 119 uhci_hc_init_hw(instance); 117 if (!interrupts) { 118 instance->cleaner = 119 fibril_create(uhci_hc_interrupt_emulator, instance); 120 fibril_add_ready(instance->cleaner); 121 } 120 instance->cleaner = 121 fibril_create(uhci_hc_interrupt_emulator, instance); 122 fibril_add_ready(instance->cleaner); 122 123 123 124 instance->debug_checker = fibril_create(uhci_hc_debug_checker, instance); … … 129 130 } 130 131 /*----------------------------------------------------------------------------*/ 131 /** Initialize UHCI hchw resources.132 /** Initializes UHCI hcd hw resources. 132 133 * 133 134 * @param[in] instance UHCI structure to use. 134 * For magic values see UHCI Design Guide135 135 */ 136 136 void uhci_hc_init_hw(uhci_hc_t *instance) … … 153 153 pio_write_32(®isters->flbaseadd, pa); 154 154 155 if (instance->hw_interrupts) { 156 /* Enable all interrupts, but resume interrupt */ 157 pio_write_16(&instance->registers->usbintr, 158 UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET); 159 } 155 /* Enable all interrupts, but resume interrupt */ 156 // pio_write_16(&instance->registers->usbintr, 157 // UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET); 160 158 161 159 uint16_t status = pio_read_16(®isters->usbcmd); … … 168 166 } 169 167 /*----------------------------------------------------------------------------*/ 170 /** Initialize UHCI hcmemory structures.168 /** Initializes UHCI hcd memory structures. 171 169 * 172 170 * @param[in] instance UHCI structure to use. 173 171 * @return Error code 174 172 * @note Should be called only once on any structure. 175 *176 * Structures:177 * - interrupt code (I/O addressses are customized per instance)178 * - transfer lists (queue heads need to be accessible by the hw)179 * - frame list page (needs to be one UHCI hw accessible 4K page)180 173 */ 181 174 int uhci_hc_init_mem_structures(uhci_hc_t *instance) … … 236 229 } 237 230 /*----------------------------------------------------------------------------*/ 238 /** Initialize UHCI hctransfer lists.231 /** Initializes UHCI hcd transfer lists. 239 232 * 240 233 * @param[in] instance UHCI structure to use. 241 234 * @return Error code 242 235 * @note Should be called only once on any structure. 243 *244 * Initializes transfer lists and sets them in one chain to support proper245 * USB scheduling. Sets pointer table for quick access.246 236 */ 247 237 int uhci_hc_init_transfer_lists(uhci_hc_t *instance) … … 303 293 } 304 294 /*----------------------------------------------------------------------------*/ 305 /** Schedule batch for execution.295 /** Schedules batch for execution. 306 296 * 307 297 * @param[in] instance UHCI structure to use. 308 298 * @param[in] batch Transfer batch to schedule. 309 299 * @return Error code 310 *311 * Checks for bandwidth availability and appends the batch to the proper queue.312 300 */ 313 301 int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch) … … 324 312 return ENOTSUP; 325 313 } 326 /* TODO: check available bandwi dth here */314 /* TODO: check available bandwith here */ 327 315 328 316 transfer_list_t *list = … … 334 322 } 335 323 /*----------------------------------------------------------------------------*/ 336 /** Take action based on the interrupt cause.324 /** Takes action based on the interrupt cause. 337 325 * 338 326 * @param[in] instance UHCI structure to use. 339 * @param[in] status Value of the status register at the time of interrupt. 340 * 341 * Interrupt might indicate: 342 * - transaction completed, either by triggering IOC, SPD, or an error 343 * - some kind of device error 344 * - resume from suspend state (not implemented) 327 * @param[in] status Value of the stsatus regiser at the time of interrupt. 345 328 */ 346 329 void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status) … … 359 342 /** Polling function, emulates interrupts. 360 343 * 361 * @param[in] arg UHCI hcstructure to use.362 * @return EOK (should never return)344 * @param[in] arg UHCI structure to use. 345 * @return EOK 363 346 */ 364 347 int uhci_hc_interrupt_emulator(void* arg) … … 383 366 * 384 367 * @param[in] arg UHCI structure to use. 385 * @return EOK (should never return)368 * @return EOK 386 369 */ 387 370 int uhci_hc_debug_checker(void *arg) … … 447 430 } 448 431 /*----------------------------------------------------------------------------*/ 449 /** Check transfer packets, for USB validity432 /** Checks transfer packets, for USB validity 450 433 * 451 434 * @param[in] low_speed Transfer speed. 452 435 * @param[in] transfer Transer type 453 436 * @param[in] size Maximum size of used packets 454 * @return True if transaction is allowed by USB specs, false otherwise437 * @return EOK 455 438 */ 456 439 bool allowed_usb_packet(
Note:
See TracChangeset
for help on using the changeset viewer.