Changeset 02cacce in mainline for uspace/drv/ohci/hc.c


Ignore:
Timestamp:
2011-05-18T18:24:22Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
030937e
Parents:
45e0e07
Message:

Doxygen and some minor code-style changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hc.c

    r45e0e07 r02cacce  
    5151static int hc_init_memory(hc_t *instance);
    5252/*----------------------------------------------------------------------------*/
     53/** Announce OHCI root hub to the DDF
     54 *
     55 * @param[in] instance OHCI driver intance
     56 * @param[in] hub_fun DDF fuction representing OHCI root hub
     57 * @return Error code
     58 */
    5359int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun)
    5460{
     
    95101}
    96102/*----------------------------------------------------------------------------*/
     103/** Initialize OHCI hc driver structure
     104 *
     105 * @param[in] instance Memory place for the structure.
     106 * @param[in] regs Address of the memory mapped I/O registers.
     107 * @param[in] reg_size Size of the memory mapped area.
     108 * @param[in] interrupts True if w interrupts should be used
     109 * @return Error code
     110 */
    97111int hc_init(hc_t *instance, uintptr_t regs, size_t reg_size, bool interrupts)
    98112{
     
    136150}
    137151/*----------------------------------------------------------------------------*/
     152/** Create end register endpoint structures
     153 *
     154 * @param[in] instance OHCI driver structure.
     155 * @param[in] address USB address of the device.
     156 * @param[in] endpoint USB endpoint number.
     157 * @param[in] speed Communication speeed of the device.
     158 * @param[in] type Endpoint's transfer type.
     159 * @param[in] direction Endpoint's direction.
     160 * @param[in] mps Maximum packet size the endpoint accepts.
     161 * @param[in] size Maximum allowed buffer size.
     162 * @param[in] interval Time between transfers(interrupt transfers only).
     163 * @return Error code
     164 */
    138165int hc_add_endpoint(
    139166    hc_t *instance, usb_address_t address, usb_endpoint_t endpoint,
     
    193220}
    194221/*----------------------------------------------------------------------------*/
     222/** Dequeue and delete endpoint structures
     223 *
     224 * @param[in] instance OHCI hc driver structure.
     225 * @param[in] address USB address of the device.
     226 * @param[in] endpoint USB endpoint number.
     227 * @param[in] direction Direction of the endpoint.
     228 * @return Error code
     229 */
    195230int hc_remove_endpoint(hc_t *instance, usb_address_t address,
    196231    usb_endpoint_t endpoint, usb_direction_t direction)
     
    243278}
    244279/*----------------------------------------------------------------------------*/
     280/** Get access to endpoint structures
     281 *
     282 * @param[in] instance OHCI hc driver structure.
     283 * @param[in] address USB address of the device.
     284 * @param[in] endpoint USB endpoint number.
     285 * @param[in] direction Direction of the endpoint.
     286 * @param[out] bw Reserved bandwidth.
     287 * @return Error code
     288 */
    245289endpoint_t * hc_get_endpoint(hc_t *instance, usb_address_t address,
    246290    usb_endpoint_t endpoint, usb_direction_t direction, size_t *bw)
     
    254298}
    255299/*----------------------------------------------------------------------------*/
     300/** Add USB transfer to the schedule.
     301 *
     302 * @param[in] instance OHCI hc driver structure.
     303 * @param[in] batch Batch representing the transfer.
     304 * @return Error code.
     305 */
    256306int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch)
    257307{
     
    260310        assert(batch->ep);
    261311
    262         /* check for root hub communication */
     312        /* Check for root hub communication */
    263313        if (batch->ep->address == instance->rh.address) {
    264314                return rh_request(&instance->rh, batch);
     
    268318        list_append(&batch->link, &instance->pending_batches);
    269319        batch_commit(batch);
    270         switch (batch->ep->transfer_type) {
     320
     321        /* Control and bulk schedules need a kick to start working */
     322        switch (batch->ep->transfer_type)
     323        {
    271324        case USB_TRANSFER_CONTROL:
    272325                instance->registers->command_status |= CS_CLF;
     
    278331                break;
    279332        }
    280 
    281333        fibril_mutex_unlock(&instance->guard);
    282334        return EOK;
    283335}
    284336/*----------------------------------------------------------------------------*/
     337/** Interrupt handling routine
     338 *
     339 * @param[in] instance OHCI hc driver structure.
     340 * @param[in] status Value of the status register at the time of interrupt.
     341 */
    285342void hc_interrupt(hc_t *instance, uint32_t status)
    286343{
     
    321378}
    322379/*----------------------------------------------------------------------------*/
     380/** Check status register regularly
     381 *
     382 * @param[in] instance OHCI hc driver structure.
     383 * @return Error code
     384 */
    323385int interrupt_emulator(hc_t *instance)
    324386{
     
    329391                instance->registers->interrupt_status = status;
    330392                hc_interrupt(instance, status);
    331                 async_usleep(50000);
     393                async_usleep(10000);
    332394        }
    333395        return EOK;
    334396}
    335397/*----------------------------------------------------------------------------*/
     398/** Turn off any (BIOS)driver that might be in control of the device.
     399 *
     400 * @param[in] instance OHCI hc driver structure.
     401 */
    336402void hc_gain_control(hc_t *instance)
    337403{
     
    383449}
    384450/*----------------------------------------------------------------------------*/
     451/** OHCI hw initialization routine.
     452 *
     453 * @param[in] instance OHCI hc driver structure.
     454 */
    385455void hc_start_hw(hc_t *instance)
    386456{
     
    450520}
    451521/*----------------------------------------------------------------------------*/
     522/** Initialize schedule queues
     523 *
     524 * @param[in] instance OHCI hc driver structure
     525 * @return Error code
     526 */
    452527int hc_init_transfer_lists(hc_t *instance)
    453528{
     
    465540                endpoint_list_fini(&instance->lists[USB_TRANSFER_BULK]); \
    466541        } \
     542        return ret; \
    467543} while (0)
    468544
     
    478554}
    479555/*----------------------------------------------------------------------------*/
     556/** Initialize memory structures used by the OHCI hcd.
     557 *
     558 * @param[in] instance OHCI hc driver structure.
     559 * @return Error code.
     560 */
    480561int hc_init_memory(hc_t *instance)
    481562{
     
    504585        /* Init interrupt code */
    505586        instance->interrupt_code.cmds = instance->interrupt_commands;
     587        instance->interrupt_code.cmdcount = OHCI_NEEDED_IRQ_COMMANDS;
    506588        {
    507589                /* Read status register */
     
    523605                instance->interrupt_commands[2].srcarg = 2;
    524606
    525                 /* Write clean status register */
     607                /* Write-clean status register */
    526608                instance->interrupt_commands[3].cmd = CMD_MEM_WRITE_A_32;
    527609                instance->interrupt_commands[3].srcarg = 1;
     
    531613                /* Accept interrupt */
    532614                instance->interrupt_commands[4].cmd = CMD_ACCEPT;
    533 
    534                 instance->interrupt_code.cmdcount = OHCI_NEEDED_IRQ_COMMANDS;
    535615        }
    536616
Note: See TracChangeset for help on using the changeset viewer.