Ignore:
File:
1 edited

Legend:

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

    r17ceb72 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.
    8388 */
    8489int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, void *regs, size_t reg_size)
     
    125130}
    126131/*----------------------------------------------------------------------------*/
    127 /** Initialize UHCI hc hw resources.
     132/** Initializes UHCI hcd hw resources.
    128133 *
    129134 * @param[in] instance UHCI structure to use.
    130  * For magic values see UHCI Design Guide
    131135 */
    132136void uhci_hc_init_hw(uhci_hc_t *instance)
     
    150154
    151155        /* Enable all interrupts, but resume interrupt */
    152         pio_write_16(&instance->registers->usbintr,
    153             UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET);
     156//      pio_write_16(&instance->registers->usbintr,
     157//          UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET);
    154158
    155159        uint16_t status = pio_read_16(&registers->usbcmd);
     
    162166}
    163167/*----------------------------------------------------------------------------*/
    164 /** Initialize UHCI hc memory structures.
     168/** Initializes UHCI hcd memory structures.
    165169 *
    166170 * @param[in] instance UHCI structure to use.
    167171 * @return Error code
    168172 * @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)
    174173 */
    175174int uhci_hc_init_mem_structures(uhci_hc_t *instance)
     
    230229}
    231230/*----------------------------------------------------------------------------*/
    232 /** Initialize UHCI hc transfer lists.
     231/** Initializes UHCI hcd transfer lists.
    233232 *
    234233 * @param[in] instance UHCI structure to use.
    235234 * @return Error code
    236235 * @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.
    240236 */
    241237int uhci_hc_init_transfer_lists(uhci_hc_t *instance)
     
    297293}
    298294/*----------------------------------------------------------------------------*/
    299 /** Schedule batch for execution.
     295/** Schedules batch for execution.
    300296 *
    301297 * @param[in] instance UHCI structure to use.
    302298 * @param[in] batch Transfer batch to schedule.
    303299 * @return Error code
    304  *
    305  * Checks for bandwidth availability and appends the batch to the proper queue.
    306300 */
    307301int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch)
     
    318312                return ENOTSUP;
    319313        }
    320         /* TODO: check available bandwidth here */
     314        /* TODO: check available bandwith here */
    321315
    322316        transfer_list_t *list =
     
    328322}
    329323/*----------------------------------------------------------------------------*/
    330 /** Take action based on the interrupt cause.
     324/** Takes action based on the interrupt cause.
    331325 *
    332326 * @param[in] instance UHCI structure to use.
    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)
     327 * @param[in] status Value of the stsatus regiser at the time of interrupt.
    339328 */
    340329void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status)
     
    353342/** Polling function, emulates interrupts.
    354343 *
    355  * @param[in] arg UHCI hc structure to use.
    356  * @return EOK (should never return)
     344 * @param[in] arg UHCI structure to use.
     345 * @return EOK
    357346 */
    358347int uhci_hc_interrupt_emulator(void* arg)
     
    377366 *
    378367 * @param[in] arg UHCI structure to use.
    379  * @return EOK (should never return)
     368 * @return EOK
    380369 */
    381370int uhci_hc_debug_checker(void *arg)
     
    441430}
    442431/*----------------------------------------------------------------------------*/
    443 /** Check transfer packets, for USB validity
     432/** Checks transfer packets, for USB validity
    444433 *
    445434 * @param[in] low_speed Transfer speed.
    446435 * @param[in] transfer Transer type
    447436 * @param[in] size Maximum size of used packets
    448  * @return True if transaction is allowed by USB specs, false otherwise
     437 * @return EOK
    449438 */
    450439bool allowed_usb_packet(
Note: See TracChangeset for help on using the changeset viewer.