Changeset 7813516 in mainline for uspace/drv/bus/usb/ohci/hc.c


Ignore:
Timestamp:
2014-01-01T01:19:10Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7191992
Parents:
d1df381
Message:

uhci,ohci,ehci: Use all hw resources to initialize HC

File:
1 edited

Legend:

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

    rd1df381 r7813516  
    148148 *
    149149 * @param[in] instance Memory place for the structure.
    150  * @param[in] regs Device's I/O registers range.
     150 * @param[in] regs Device's resources
    151151 * @param[in] interrupts True if w interrupts should be used
    152152 * @return Error code
    153153 */
    154 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts)
    155 {
    156         assert(instance);
    157 
    158         int ret = pio_enable_range(regs, (void **) &instance->registers);
     154int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
     155{
     156        assert(instance);
     157        assert(hw_res);
     158        if (hw_res->mem_ranges.count != 1 ||
     159            hw_res->mem_ranges.ranges[0].size < sizeof(ohci_regs_t))
     160            return EINVAL;
     161
     162        int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
     163            (void **) &instance->registers);
    159164        if (ret != EOK) {
    160                 usb_log_error("Failed to gain access to device registers: %s.\n",
     165                usb_log_error("Failed to gain access to registers: %s.\n",
    161166                    str_error(ret));
    162167                return ret;
    163168        }
     169        usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.\n",
     170            hw_res->mem_ranges.ranges[0].address.absolute,
     171            hw_res->mem_ranges.ranges[0].size);
    164172
    165173        list_initialize(&instance->pending_batches);
     
    186194        return EOK;
    187195}
     196
     197/** Safely dispose host controller internal structures
     198 *
     199 * @param[in] instance Host controller structure to use.
     200 */
     201void hc_fini(hc_t *instance)
     202{
     203        assert(instance);
     204        /* TODO: implement*/
     205};
    188206
    189207void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
Note: See TracChangeset for help on using the changeset viewer.