Changeset 361e61b in mainline for uspace/drv/uhci-hcd/iface.c


Ignore:
Timestamp:
2011-03-21T14:23:15Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
55e388a1
Parents:
c32688d (diff), 48fe0c9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge with development

File:
1 edited

Legend:

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

    rc32688d r361e61b  
    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 driver hc interface implementation
    3333 */
    3434#include <ddf/driver.h>
     
    4040
    4141#include "iface.h"
    42 #include "uhci.h"
    43 #include "utils/device_keeper.h"
     42#include "uhci_hc.h"
    4443
    4544/** Reserve default address interface function
     
    5352{
    5453        assert(fun);
    55         uhci_t *hc = fun_to_uhci(fun);
     54        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    5655        assert(hc);
    5756        usb_log_debug("Default address request with speed %d.\n", speed);
     
    6867{
    6968        assert(fun);
    70         uhci_t *hc = fun_to_uhci(fun);
     69        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    7170        assert(hc);
    7271        usb_log_debug("Default address release.\n");
     
    8685{
    8786        assert(fun);
    88         uhci_t *hc = fun_to_uhci(fun);
     87        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    8988        assert(hc);
    9089        assert(address);
     
    109108{
    110109        assert(fun);
    111         uhci_t *hc = fun_to_uhci(fun);
     110        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    112111        assert(hc);
    113112        usb_log_debug("Address bind %d-%d.\n", address, handle);
     
    125124{
    126125        assert(fun);
    127         uhci_t *hc = fun_to_uhci(fun);
     126        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    128127        assert(hc);
    129128        usb_log_debug("Address release %d.\n", address);
     
    148147{
    149148        assert(fun);
    150         uhci_t *hc = fun_to_uhci(fun);
     149        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    151150        assert(hc);
    152151        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    161160                return ENOMEM;
    162161        batch_interrupt_out(batch);
     162        const int ret = uhci_hc_schedule(hc, batch);
     163        if (ret != EOK) {
     164                batch_dispose(batch);
     165                return ret;
     166        }
    163167        return EOK;
    164168}
     
    180184{
    181185        assert(fun);
    182         uhci_t *hc = fun_to_uhci(fun);
     186        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    183187        assert(hc);
    184188        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    192196                return ENOMEM;
    193197        batch_interrupt_in(batch);
     198        const int ret = uhci_hc_schedule(hc, batch);
     199        if (ret != EOK) {
     200                batch_dispose(batch);
     201                return ret;
     202        }
    194203        return EOK;
    195204}
     
    211220{
    212221        assert(fun);
    213         uhci_t *hc = fun_to_uhci(fun);
     222        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    214223        assert(hc);
    215224        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    224233                return ENOMEM;
    225234        batch_bulk_out(batch);
     235        const int ret = uhci_hc_schedule(hc, batch);
     236        if (ret != EOK) {
     237                batch_dispose(batch);
     238                return ret;
     239        }
    226240        return EOK;
    227241}
     
    243257{
    244258        assert(fun);
    245         uhci_t *hc = fun_to_uhci(fun);
     259        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    246260        assert(hc);
    247261        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    255269                return ENOMEM;
    256270        batch_bulk_in(batch);
     271        const int ret = uhci_hc_schedule(hc, batch);
     272        if (ret != EOK) {
     273                batch_dispose(batch);
     274                return ret;
     275        }
    257276        return EOK;
    258277}
     
    277296{
    278297        assert(fun);
    279         uhci_t *hc = fun_to_uhci(fun);
    280         assert(hc);
    281         usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
    282         usb_log_debug("Control WRITE %d:%d %zu(%zu).\n",
    283             target.address, target.endpoint, size, max_packet_size);
     298        uhci_hc_t *hc = fun_to_uhci_hc(fun);
     299        assert(hc);
     300        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     301        usb_log_debug("Control WRITE (%d) %d:%d %zu(%zu).\n",
     302            speed, target.address, target.endpoint, size, max_packet_size);
    284303
    285304        if (setup_size != 8)
     
    293312        device_keeper_reset_if_need(&hc->device_manager, target, setup_data);
    294313        batch_control_write(batch);
     314        const int ret = uhci_hc_schedule(hc, batch);
     315        if (ret != EOK) {
     316                batch_dispose(batch);
     317                return ret;
     318        }
    295319        return EOK;
    296320}
     
    315339{
    316340        assert(fun);
    317         uhci_t *hc = fun_to_uhci(fun);
    318         assert(hc);
    319         usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
    320 
    321         usb_log_debug("Control READ %d:%d %zu(%zu).\n",
    322             target.address, target.endpoint, size, max_packet_size);
     341        uhci_hc_t *hc = fun_to_uhci_hc(fun);
     342        assert(hc);
     343        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     344
     345        usb_log_debug("Control READ(%d) %d:%d %zu(%zu).\n",
     346            speed, target.address, target.endpoint, size, max_packet_size);
    323347        batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
    324348            max_packet_size, speed, data, size, setup_data, setup_size, callback,
     
    327351                return ENOMEM;
    328352        batch_control_read(batch);
    329         return EOK;
    330 }
    331 /*----------------------------------------------------------------------------*/
    332 usbhc_iface_t uhci_iface = {
     353        const int ret = uhci_hc_schedule(hc, batch);
     354        if (ret != EOK) {
     355                batch_dispose(batch);
     356                return ret;
     357        }
     358        return EOK;
     359}
     360/*----------------------------------------------------------------------------*/
     361usbhc_iface_t uhci_hc_iface = {
    333362        .reserve_default_address = reserve_default_address,
    334363        .release_default_address = release_default_address,
Note: See TracChangeset for help on using the changeset viewer.