Changeset 17ceb72 in mainline for uspace/drv/uhci-hcd/uhci_hc.c
- Timestamp:
- 2011-03-14T01:39:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6298d80
- Parents:
- 3bd96bb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/uhci_hc.c
r3bd96bb r17ceb72 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup usb28 /** @addtogroup drvusbuhcihc 29 29 * @{ 30 30 */ 31 31 /** @file 32 * @brief UHCI driver32 * @brief UHCI Host controller driver routines 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 */69 61 /*----------------------------------------------------------------------------*/ 70 62 static int uhci_hc_init_transfer_lists(uhci_hc_t *instance); … … 78 70 bool low_speed, usb_transfer_type_t transfer, size_t size); 79 71 /*----------------------------------------------------------------------------*/ 80 /** Initialize sUHCI hcd driver structure72 /** Initialize UHCI hcd driver structure 81 73 * 82 74 * @param[in] instance Memory place to initialize. … … 86 78 * @return Error code. 87 79 * @note Should be called only once on any structure. 80 * 81 * Initializes memory structures, starts up hw, and launches debugger and 82 * interrupt fibrils. 88 83 */ 89 84 int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, void *regs, size_t reg_size) … … 130 125 } 131 126 /*----------------------------------------------------------------------------*/ 132 /** Initialize s UHCI hcdhw resources.127 /** Initialize UHCI hc hw resources. 133 128 * 134 129 * @param[in] instance UHCI structure to use. 130 * For magic values see UHCI Design Guide 135 131 */ 136 132 void uhci_hc_init_hw(uhci_hc_t *instance) … … 154 150 155 151 /* Enable all interrupts, but resume interrupt */ 156 //pio_write_16(&instance->registers->usbintr,157 //UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET);152 pio_write_16(&instance->registers->usbintr, 153 UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET); 158 154 159 155 uint16_t status = pio_read_16(®isters->usbcmd); … … 166 162 } 167 163 /*----------------------------------------------------------------------------*/ 168 /** Initialize s UHCI hcdmemory structures.164 /** Initialize UHCI hc memory structures. 169 165 * 170 166 * @param[in] instance UHCI structure to use. 171 167 * @return Error code 172 168 * @note Should be called only once on any structure. 169 * 170 * Structures: 171 * - interrupt code (I/O addressses are customized per instance) 172 * - transfer lists (queue heads need to be accessible by the hw) 173 * - frame list page (needs to be one UHCI hw accessible 4K page) 173 174 */ 174 175 int uhci_hc_init_mem_structures(uhci_hc_t *instance) … … 229 230 } 230 231 /*----------------------------------------------------------------------------*/ 231 /** Initialize s UHCI hcdtransfer lists.232 /** Initialize UHCI hc transfer lists. 232 233 * 233 234 * @param[in] instance UHCI structure to use. 234 235 * @return Error code 235 236 * @note Should be called only once on any structure. 237 * 238 * Initializes transfer lists and sets them in one chain to support proper 239 * USB scheduling. Sets pointer table for quick access. 236 240 */ 237 241 int uhci_hc_init_transfer_lists(uhci_hc_t *instance) … … 293 297 } 294 298 /*----------------------------------------------------------------------------*/ 295 /** Schedule sbatch for execution.299 /** Schedule batch for execution. 296 300 * 297 301 * @param[in] instance UHCI structure to use. 298 302 * @param[in] batch Transfer batch to schedule. 299 303 * @return Error code 304 * 305 * Checks for bandwidth availability and appends the batch to the proper queue. 300 306 */ 301 307 int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch) … … 312 318 return ENOTSUP; 313 319 } 314 /* TODO: check available bandwi th here */320 /* TODO: check available bandwidth here */ 315 321 316 322 transfer_list_t *list = … … 322 328 } 323 329 /*----------------------------------------------------------------------------*/ 324 /** Take saction based on the interrupt cause.330 /** Take action based on the interrupt cause. 325 331 * 326 332 * @param[in] instance UHCI structure to use. 327 * @param[in] status Value of the stsatus regiser at the time of interrupt. 333 * @param[in] status Value of the status register at the time of interrupt. 334 * 335 * Interrupt might indicate: 336 * - transaction completed, either by triggering IOC, SPD, or an error 337 * - some kind of device error 338 * - resume from suspend state (not implemented) 328 339 */ 329 340 void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status) … … 342 353 /** Polling function, emulates interrupts. 343 354 * 344 * @param[in] arg UHCI structure to use.345 * @return EOK 355 * @param[in] arg UHCI hc structure to use. 356 * @return EOK (should never return) 346 357 */ 347 358 int uhci_hc_interrupt_emulator(void* arg) … … 366 377 * 367 378 * @param[in] arg UHCI structure to use. 368 * @return EOK 379 * @return EOK (should never return) 369 380 */ 370 381 int uhci_hc_debug_checker(void *arg) … … 430 441 } 431 442 /*----------------------------------------------------------------------------*/ 432 /** Check stransfer packets, for USB validity443 /** Check transfer packets, for USB validity 433 444 * 434 445 * @param[in] low_speed Transfer speed. 435 446 * @param[in] transfer Transer type 436 447 * @param[in] size Maximum size of used packets 437 * @return EOK448 * @return True if transaction is allowed by USB specs, false otherwise 438 449 */ 439 450 bool allowed_usb_packet(
Note:
See TracChangeset
for help on using the changeset viewer.