Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/uhci_hc.c

    rff34e5a ra9f91cd  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup drvusbuhcihc
     28/** @addtogroup usb
    2929 * @{
    3030 */
    3131/** @file
    32  * @brief UHCI Host controller driver routines
     32 * @brief UHCI driver
    3333 */
    3434#include <errno.h>
     
    5959        }
    6060};
     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 */
    6169/*----------------------------------------------------------------------------*/
    6270static int uhci_hc_init_transfer_lists(uhci_hc_t *instance);
     
    7078    bool low_speed, usb_transfer_type_t transfer, size_t size);
    7179/*----------------------------------------------------------------------------*/
    72 /** Initialize UHCI hcd driver structure
     80/** Initializes UHCI hcd driver structure
    7381 *
    7482 * @param[in] instance Memory place to initialize.
     
    7886 * @return Error code.
    7987 * @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 */
     89int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, void *regs, size_t reg_size)
    8690{
    8791        assert(reg_size >= sizeof(regs_t));
     
    96100        } else (void) 0
    97101
    98         instance->hw_interrupts = interrupts;
    99102        /* Setup UHCI function. */
    100103        instance->ddf_instance = fun;
     
    115118
    116119        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);
    122123
    123124        instance->debug_checker = fibril_create(uhci_hc_debug_checker, instance);
     
    129130}
    130131/*----------------------------------------------------------------------------*/
    131 /** Initialize UHCI hc hw resources.
     132/** Initializes UHCI hcd hw resources.
    132133 *
    133134 * @param[in] instance UHCI structure to use.
    134  * For magic values see UHCI Design Guide
    135135 */
    136136void uhci_hc_init_hw(uhci_hc_t *instance)
     
    153153        pio_write_32(&registers->flbaseadd, pa);
    154154
    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);
    160158
    161159        uint16_t status = pio_read_16(&registers->usbcmd);
     
    168166}
    169167/*----------------------------------------------------------------------------*/
    170 /** Initialize UHCI hc memory structures.
     168/** Initializes UHCI hcd memory structures.
    171169 *
    172170 * @param[in] instance UHCI structure to use.
    173171 * @return Error code
    174172 * @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)
    180173 */
    181174int uhci_hc_init_mem_structures(uhci_hc_t *instance)
     
    236229}
    237230/*----------------------------------------------------------------------------*/
    238 /** Initialize UHCI hc transfer lists.
     231/** Initializes UHCI hcd transfer lists.
    239232 *
    240233 * @param[in] instance UHCI structure to use.
    241234 * @return Error code
    242235 * @note Should be called only once on any structure.
    243  *
    244  * Initializes transfer lists and sets them in one chain to support proper
    245  * USB scheduling. Sets pointer table for quick access.
    246236 */
    247237int uhci_hc_init_transfer_lists(uhci_hc_t *instance)
     
    303293}
    304294/*----------------------------------------------------------------------------*/
    305 /** Schedule batch for execution.
     295/** Schedules batch for execution.
    306296 *
    307297 * @param[in] instance UHCI structure to use.
    308298 * @param[in] batch Transfer batch to schedule.
    309299 * @return Error code
    310  *
    311  * Checks for bandwidth availability and appends the batch to the proper queue.
    312300 */
    313301int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch)
     
    324312                return ENOTSUP;
    325313        }
    326         /* TODO: check available bandwidth here */
     314        /* TODO: check available bandwith here */
    327315
    328316        transfer_list_t *list =
     
    334322}
    335323/*----------------------------------------------------------------------------*/
    336 /** Take action based on the interrupt cause.
     324/** Takes action based on the interrupt cause.
    337325 *
    338326 * @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.
    345328 */
    346329void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status)
     
    359342/** Polling function, emulates interrupts.
    360343 *
    361  * @param[in] arg UHCI hc structure to use.
    362  * @return EOK (should never return)
     344 * @param[in] arg UHCI structure to use.
     345 * @return EOK
    363346 */
    364347int uhci_hc_interrupt_emulator(void* arg)
     
    383366 *
    384367 * @param[in] arg UHCI structure to use.
    385  * @return EOK (should never return)
     368 * @return EOK
    386369 */
    387370int uhci_hc_debug_checker(void *arg)
     
    447430}
    448431/*----------------------------------------------------------------------------*/
    449 /** Check transfer packets, for USB validity
     432/** Checks transfer packets, for USB validity
    450433 *
    451434 * @param[in] low_speed Transfer speed.
    452435 * @param[in] transfer Transer type
    453436 * @param[in] size Maximum size of used packets
    454  * @return True if transaction is allowed by USB specs, false otherwise
     437 * @return EOK
    455438 */
    456439bool allowed_usb_packet(
Note: See TracChangeset for help on using the changeset viewer.