Changeset 3bd96bb in mainline


Ignore:
Timestamp:
2011-03-13T23:23:42Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
17ceb72
Parents:
f123909
Message:

Move scheduling to iface functions

Location:
uspace/drv/uhci-hcd
Files:
3 edited

Legend:

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

    rf123909 r3bd96bb  
    4545#define DEFAULT_ERROR_COUNT 3
    4646
    47 static int batch_schedule(batch_t *instance);
    48 
    4947static void batch_control(batch_t *instance,
    5048    usb_packet_id data_stage, usb_packet_id status_stage);
     
    5452static void batch_call_in_and_dispose(batch_t *instance);
    5553static void batch_call_out_and_dispose(batch_t *instance);
    56 static void batch_dispose(batch_t *instance);
    5754
    5855
     
    203200        instance->next_step = batch_call_out_and_dispose;
    204201        usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance);
    205         batch_schedule(instance);
    206202}
    207203/*----------------------------------------------------------------------------*/
     
    216212        instance->next_step = batch_call_in_and_dispose;
    217213        usb_log_debug("Batch(%p) CONTROL READ initialized.\n", instance);
    218         batch_schedule(instance);
    219214}
    220215/*----------------------------------------------------------------------------*/
     
    229224        instance->next_step = batch_call_in_and_dispose;
    230225        usb_log_debug("Batch(%p) INTERRUPT IN initialized.\n", instance);
    231         batch_schedule(instance);
    232226}
    233227/*----------------------------------------------------------------------------*/
     
    244238        instance->next_step = batch_call_out_and_dispose;
    245239        usb_log_debug("Batch(%p) INTERRUPT OUT initialized.\n", instance);
    246         batch_schedule(instance);
    247240}
    248241/*----------------------------------------------------------------------------*/
     
    257250        instance->next_step = batch_call_in_and_dispose;
    258251        usb_log_debug("Batch(%p) BULK IN initialized.\n", instance);
    259         batch_schedule(instance);
    260252}
    261253/*----------------------------------------------------------------------------*/
     
    271263        instance->next_step = batch_call_out_and_dispose;
    272264        usb_log_debug("Batch(%p) BULK OUT initialized.\n", instance);
    273         batch_schedule(instance);
    274265}
    275266/*----------------------------------------------------------------------------*/
     
    446437        free(instance);
    447438}
    448 /*----------------------------------------------------------------------------*/
    449 int batch_schedule(batch_t *instance)
    450 {
    451         assert(instance);
    452         uhci_hc_t *hc = fun_to_uhci_hc(instance->fun);
    453         assert(hc);
    454         return uhci_hc_schedule(hc, instance);
    455 }
    456439/**
    457440 * @}
  • uspace/drv/uhci-hcd/batch.h

    rf123909 r3bd96bb  
    7878                );
    7979
     80void batch_dispose(batch_t *instance);
     81
    8082bool batch_is_complete(batch_t *instance);
    8183
  • uspace/drv/uhci-hcd/iface.c

    rf123909 r3bd96bb  
    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}
     
    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}
     
    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}
     
    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}
     
    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}
     
    327352                return ENOMEM;
    328353        batch_control_read(batch);
     354        const int ret = uhci_hc_schedule(hc, batch);
     355        if (ret != EOK) {
     356                batch_dispose(batch);
     357                return ret;
     358        }
    329359        return EOK;
    330360}
Note: See TracChangeset for help on using the changeset viewer.