Ignore:
File:
1 edited

Legend:

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

    ra7e2f0d 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 driver hc interface implementation
    3333 */
    3434#include <ddf/driver.h>
     
    4040
    4141#include "iface.h"
    42 #include "uhci.h"
     42#include "uhci_hc.h"
    4343#include "utils/device_keeper.h"
    4444
     
    5353{
    5454        assert(fun);
    55         uhci_t *hc = fun_to_uhci(fun);
     55        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    5656        assert(hc);
    5757        usb_log_debug("Default address request with speed %d.\n", speed);
     
    6868{
    6969        assert(fun);
    70         uhci_t *hc = fun_to_uhci(fun);
     70        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    7171        assert(hc);
    7272        usb_log_debug("Default address release.\n");
     
    8686{
    8787        assert(fun);
    88         uhci_t *hc = fun_to_uhci(fun);
     88        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    8989        assert(hc);
    9090        assert(address);
     
    109109{
    110110        assert(fun);
    111         uhci_t *hc = fun_to_uhci(fun);
     111        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    112112        assert(hc);
    113113        usb_log_debug("Address bind %d-%d.\n", address, handle);
     
    125125{
    126126        assert(fun);
    127         uhci_t *hc = fun_to_uhci(fun);
     127        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    128128        assert(hc);
    129129        usb_log_debug("Address release %d.\n", address);
     
    148148{
    149149        assert(fun);
    150         uhci_t *hc = fun_to_uhci(fun);
     150        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    151151        assert(hc);
    152152        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    161161                return ENOMEM;
    162162        batch_interrupt_out(batch);
     163        const int ret = uhci_hc_schedule(hc, batch);
     164        if (ret != EOK) {
     165                batch_dispose(batch);
     166                return ret;
     167        }
    163168        return EOK;
    164169}
     
    180185{
    181186        assert(fun);
    182         uhci_t *hc = fun_to_uhci(fun);
     187        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    183188        assert(hc);
    184189        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    192197                return ENOMEM;
    193198        batch_interrupt_in(batch);
     199        const int ret = uhci_hc_schedule(hc, batch);
     200        if (ret != EOK) {
     201                batch_dispose(batch);
     202                return ret;
     203        }
    194204        return EOK;
    195205}
     
    211221{
    212222        assert(fun);
    213         uhci_t *hc = fun_to_uhci(fun);
     223        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    214224        assert(hc);
    215225        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    224234                return ENOMEM;
    225235        batch_bulk_out(batch);
     236        const int ret = uhci_hc_schedule(hc, batch);
     237        if (ret != EOK) {
     238                batch_dispose(batch);
     239                return ret;
     240        }
    226241        return EOK;
    227242}
     
    243258{
    244259        assert(fun);
    245         uhci_t *hc = fun_to_uhci(fun);
     260        uhci_hc_t *hc = fun_to_uhci_hc(fun);
    246261        assert(hc);
    247262        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     
    255270                return ENOMEM;
    256271        batch_bulk_in(batch);
     272        const int ret = uhci_hc_schedule(hc, batch);
     273        if (ret != EOK) {
     274                batch_dispose(batch);
     275                return ret;
     276        }
    257277        return EOK;
    258278}
     
    277297{
    278298        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);
     299        uhci_hc_t *hc = fun_to_uhci_hc(fun);
     300        assert(hc);
     301        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     302        usb_log_debug("Control WRITE (%d) %d:%d %zu(%zu).\n",
     303            speed, target.address, target.endpoint, size, max_packet_size);
    284304
    285305        if (setup_size != 8)
     
    293313        device_keeper_reset_if_need(&hc->device_manager, target, setup_data);
    294314        batch_control_write(batch);
     315        const int ret = uhci_hc_schedule(hc, batch);
     316        if (ret != EOK) {
     317                batch_dispose(batch);
     318                return ret;
     319        }
    295320        return EOK;
    296321}
     
    315340{
    316341        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);
     342        uhci_hc_t *hc = fun_to_uhci_hc(fun);
     343        assert(hc);
     344        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     345
     346        usb_log_debug("Control READ(%d) %d:%d %zu(%zu).\n",
     347            speed, target.address, target.endpoint, size, max_packet_size);
    323348        batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
    324349            max_packet_size, speed, data, size, setup_data, setup_size, callback,
     
    327352                return ENOMEM;
    328353        batch_control_read(batch);
    329         return EOK;
    330 }
    331 /*----------------------------------------------------------------------------*/
    332 usbhc_iface_t uhci_iface = {
     354        const int ret = uhci_hc_schedule(hc, batch);
     355        if (ret != EOK) {
     356                batch_dispose(batch);
     357                return ret;
     358        }
     359        return EOK;
     360}
     361/*----------------------------------------------------------------------------*/
     362usbhc_iface_t uhci_hc_iface = {
    333363        .reserve_default_address = reserve_default_address,
    334364        .release_default_address = release_default_address,
Note: See TracChangeset for help on using the changeset viewer.