Ignore:
File:
1 edited

Legend:

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

    ra9f91cd r17ceb72  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup usb
     28/** @addtogroup drvusbuhcihc
    2929 * @{
    3030 */
    3131/** @file
    32  * @brief UHCI driver
     32 * @brief UHCI Host controller driver routines
    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  */
    6961/*----------------------------------------------------------------------------*/
    7062static int uhci_hc_init_transfer_lists(uhci_hc_t *instance);
     
    7870    bool low_speed, usb_transfer_type_t transfer, size_t size);
    7971/*----------------------------------------------------------------------------*/
    80 /** Initializes UHCI hcd driver structure
     72/** Initialize UHCI hcd driver structure
    8173 *
    8274 * @param[in] instance Memory place to initialize.
     
    8678 * @return Error code.
    8779 * @note Should be called only once on any structure.
     80 *
     81 * Initializes memory structures, starts up hw, and launches debugger and
     82 * interrupt fibrils.
    8883 */
    8984int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, void *regs, size_t reg_size)
     
    130125}
    131126/*----------------------------------------------------------------------------*/
    132 /** Initializes UHCI hcd hw resources.
     127/** Initialize UHCI hc hw resources.
    133128 *
    134129 * @param[in] instance UHCI structure to use.
     130 * For magic values see UHCI Design Guide
    135131 */
    136132void uhci_hc_init_hw(uhci_hc_t *instance)
     
    154150
    155151        /* 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);
    158154
    159155        uint16_t status = pio_read_16(&registers->usbcmd);
     
    166162}
    167163/*----------------------------------------------------------------------------*/
    168 /** Initializes UHCI hcd memory structures.
     164/** Initialize UHCI hc memory structures.
    169165 *
    170166 * @param[in] instance UHCI structure to use.
    171167 * @return Error code
    172168 * @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)
    173174 */
    174175int uhci_hc_init_mem_structures(uhci_hc_t *instance)
     
    229230}
    230231/*----------------------------------------------------------------------------*/
    231 /** Initializes UHCI hcd transfer lists.
     232/** Initialize UHCI hc transfer lists.
    232233 *
    233234 * @param[in] instance UHCI structure to use.
    234235 * @return Error code
    235236 * @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.
    236240 */
    237241int uhci_hc_init_transfer_lists(uhci_hc_t *instance)
     
    293297}
    294298/*----------------------------------------------------------------------------*/
    295 /** Schedules batch for execution.
     299/** Schedule batch for execution.
    296300 *
    297301 * @param[in] instance UHCI structure to use.
    298302 * @param[in] batch Transfer batch to schedule.
    299303 * @return Error code
     304 *
     305 * Checks for bandwidth availability and appends the batch to the proper queue.
    300306 */
    301307int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch)
     
    312318                return ENOTSUP;
    313319        }
    314         /* TODO: check available bandwith here */
     320        /* TODO: check available bandwidth here */
    315321
    316322        transfer_list_t *list =
     
    322328}
    323329/*----------------------------------------------------------------------------*/
    324 /** Takes action based on the interrupt cause.
     330/** Take action based on the interrupt cause.
    325331 *
    326332 * @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)
    328339 */
    329340void uhci_hc_interrupt(uhci_hc_t *instance, uint16_t status)
     
    342353/** Polling function, emulates interrupts.
    343354 *
    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)
    346357 */
    347358int uhci_hc_interrupt_emulator(void* arg)
     
    366377 *
    367378 * @param[in] arg UHCI structure to use.
    368  * @return EOK
     379 * @return EOK (should never return)
    369380 */
    370381int uhci_hc_debug_checker(void *arg)
     
    430441}
    431442/*----------------------------------------------------------------------------*/
    432 /** Checks transfer packets, for USB validity
     443/** Check transfer packets, for USB validity
    433444 *
    434445 * @param[in] low_speed Transfer speed.
    435446 * @param[in] transfer Transer type
    436447 * @param[in] size Maximum size of used packets
    437  * @return EOK
     448 * @return True if transaction is allowed by USB specs, false otherwise
    438449 */
    439450bool allowed_usb_packet(
Note: See TracChangeset for help on using the changeset viewer.