Ignore:
Timestamp:
2011-02-11T12:41:11Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d81ef61c
Parents:
78d1525 (diff), 5d4193c (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 from usb/development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhc.c

    r78d1525 rfe1776c2  
    3333 */
    3434
    35 #include <ipc/ipc.h>
    3635#include <async.h>
    3736#include <errno.h>
     
    141140
    142141        if (!usb_iface->tell_address) {
    143                 ipc_answer_0(callid, ENOTSUP);
     142                async_answer_0(callid, ENOTSUP);
    144143                return;
    145144        }
     
    150149        int rc = usb_iface->tell_address(device, handle, &address);
    151150        if (rc != EOK) {
    152                 ipc_answer_0(callid, rc);
     151                async_answer_0(callid, rc);
    153152        } else {
    154                 ipc_answer_1(callid, EOK, address);
     153                async_answer_1(callid, EOK, address);
    155154        }
    156155}
     
    162161        async_transaction_t * trans = (async_transaction_t *)buffer_hash;
    163162        if (trans == NULL) {
    164                 ipc_answer_0(callid, ENOENT);
     163                async_answer_0(callid, ENOENT);
    165164                return;
    166165        }
    167166        if (trans->buffer == NULL) {
    168                 ipc_answer_0(callid, EINVAL);
     167                async_answer_0(callid, EINVAL);
    169168                async_transaction_destroy(trans);
    170169                return;
     
    174173        size_t accepted_size;
    175174        if (!async_data_read_receive(&cid, &accepted_size)) {
    176                 ipc_answer_0(callid, EINVAL);
     175                async_answer_0(callid, EINVAL);
    177176                async_transaction_destroy(trans);
    178177                return;
     
    184183        async_data_read_finalize(cid, trans->buffer, accepted_size);
    185184
    186         ipc_answer_1(callid, EOK, accepted_size);
     185        async_answer_1(callid, EOK, accepted_size);
    187186
    188187        async_transaction_destroy(trans);
     
    195194
    196195        if (!usb_iface->reserve_default_address) {
    197                 ipc_answer_0(callid, ENOTSUP);
     196                async_answer_0(callid, ENOTSUP);
    198197                return;
    199198        }
     
    201200        int rc = usb_iface->reserve_default_address(device);
    202201
    203         ipc_answer_0(callid, rc);
     202        async_answer_0(callid, rc);
    204203}
    205204
     
    210209
    211210        if (!usb_iface->release_default_address) {
    212                 ipc_answer_0(callid, ENOTSUP);
     211                async_answer_0(callid, ENOTSUP);
    213212                return;
    214213        }
     
    216215        int rc = usb_iface->release_default_address(device);
    217216
    218         ipc_answer_0(callid, rc);
     217        async_answer_0(callid, rc);
    219218}
    220219
     
    225224
    226225        if (!usb_iface->request_address) {
    227                 ipc_answer_0(callid, ENOTSUP);
     226                async_answer_0(callid, ENOTSUP);
    228227                return;
    229228        }
     
    232231        int rc = usb_iface->request_address(device, &address);
    233232        if (rc != EOK) {
    234                 ipc_answer_0(callid, rc);
     233                async_answer_0(callid, rc);
    235234        } else {
    236                 ipc_answer_1(callid, EOK, (sysarg_t) address);
     235                async_answer_1(callid, EOK, (sysarg_t) address);
    237236        }
    238237}
     
    244243
    245244        if (!usb_iface->bind_address) {
    246                 ipc_answer_0(callid, ENOTSUP);
     245                async_answer_0(callid, ENOTSUP);
    247246                return;
    248247        }
     
    253252        int rc = usb_iface->bind_address(device, address, handle);
    254253
    255         ipc_answer_0(callid, rc);
     254        async_answer_0(callid, rc);
    256255}
    257256
     
    262261
    263262        if (!usb_iface->release_address) {
    264                 ipc_answer_0(callid, ENOTSUP);
     263                async_answer_0(callid, ENOTSUP);
    265264                return;
    266265        }
     
    270269        int rc = usb_iface->release_address(device, address);
    271270
    272         ipc_answer_0(callid, rc);
     271        async_answer_0(callid, rc);
    273272}
    274273
     
    279278        async_transaction_t *trans = (async_transaction_t *)arg;
    280279
    281         ipc_answer_0(trans->caller, outcome);
     280        async_answer_0(trans->caller, outcome);
    282281
    283282        async_transaction_destroy(trans);
     
    290289
    291290        if (outcome != USB_OUTCOME_OK) {
    292                 ipc_answer_0(trans->caller, outcome);
     291                async_answer_0(trans->caller, outcome);
    293292                async_transaction_destroy(trans);
    294293                return;
     
    296295
    297296        trans->size = actual_size;
    298         ipc_answer_1(trans->caller, USB_OUTCOME_OK, (sysarg_t)trans);
     297        async_answer_1(trans->caller, USB_OUTCOME_OK, (sysarg_t)trans);
    299298}
    300299
     
    311310{
    312311        if (!transfer_func) {
    313                 ipc_answer_0(callid, ENOTSUP);
     312                async_answer_0(callid, ENOTSUP);
    314313                return;
    315314        }
     
    329328
    330329                if (rc != EOK) {
    331                         ipc_answer_0(callid, rc);
     330                        async_answer_0(callid, rc);
    332331                        return;
    333332                }
     
    339338                        free(buffer);
    340339                }
    341                 ipc_answer_0(callid, ENOMEM);
     340                async_answer_0(callid, ENOMEM);
    342341                return;
    343342        }
     
    350349
    351350        if (rc != EOK) {
    352                 ipc_answer_0(callid, rc);
     351                async_answer_0(callid, rc);
    353352                async_transaction_destroy(trans);
    354353        }
     
    367366{
    368367        if (!transfer_func) {
    369                 ipc_answer_0(callid, ENOTSUP);
     368                async_answer_0(callid, ENOTSUP);
    370369                return;
    371370        }
     
    379378        async_transaction_t *trans = async_transaction_create(callid);
    380379        if (trans == NULL) {
    381                 ipc_answer_0(callid, ENOMEM);
     380                async_answer_0(callid, ENOMEM);
    382381                return;
    383382        }
     
    389388
    390389        if (rc != EOK) {
    391                 ipc_answer_0(callid, rc);
     390                async_answer_0(callid, rc);
    392391                async_transaction_destroy(trans);
    393392        }
     
    414413                case USB_DIRECTION_IN:
    415414                        if (!transfer_in_func) {
    416                                 ipc_answer_0(callid, ENOTSUP);
     415                                async_answer_0(callid, ENOTSUP);
    417416                                return;
    418417                        }
     
    420419                case USB_DIRECTION_OUT:
    421420                        if (!transfer_out_func) {
    422                                 ipc_answer_0(callid, ENOTSUP);
     421                                async_answer_0(callid, ENOTSUP);
    423422                                return;
    424423                        }
     
    436435        async_transaction_t *trans = async_transaction_create(callid);
    437436        if (trans == NULL) {
    438                 ipc_answer_0(callid, ENOMEM);
     437                async_answer_0(callid, ENOMEM);
    439438                return;
    440439        }
     
    456455
    457456        if (rc != EOK) {
    458                 ipc_answer_0(callid, rc);
     457                async_answer_0(callid, rc);
    459458                async_transaction_destroy(trans);
    460459        }
     
    549548
    550549        if (!usb_iface->control_write) {
    551                 ipc_answer_0(callid, ENOTSUP);
     550                async_answer_0(callid, ENOTSUP);
    552551                return;
    553552        }
     
    568567            1, USB_MAX_PAYLOAD_SIZE, 0, &setup_packet_len);
    569568        if (rc != EOK) {
    570                 ipc_answer_0(callid, rc);
     569                async_answer_0(callid, rc);
    571570                return;
    572571        }
     
    574573            1, USB_MAX_PAYLOAD_SIZE, 0, &data_buffer_len);
    575574        if (rc != EOK) {
    576                 ipc_answer_0(callid, rc);
     575                async_answer_0(callid, rc);
    577576                free(setup_packet);
    578577                return;
     
    581580        async_transaction_t *trans = async_transaction_create(callid);
    582581        if (trans == NULL) {
    583                 ipc_answer_0(callid, ENOMEM);
     582                async_answer_0(callid, ENOMEM);
    584583                free(setup_packet);
    585584                free(data_buffer);
     
    596595
    597596        if (rc != EOK) {
    598                 ipc_answer_0(callid, rc);
     597                async_answer_0(callid, rc);
    599598                async_transaction_destroy(trans);
    600599        }
     
    609608
    610609        if (!usb_iface->control_read) {
    611                 ipc_answer_0(callid, ENOTSUP);
     610                async_answer_0(callid, ENOTSUP);
    612611                return;
    613612        }
     
    627626            1, USB_MAX_PAYLOAD_SIZE, 0, &setup_packet_len);
    628627        if (rc != EOK) {
    629                 ipc_answer_0(callid, rc);
     628                async_answer_0(callid, rc);
    630629                return;
    631630        }
     
    633632        async_transaction_t *trans = async_transaction_create(callid);
    634633        if (trans == NULL) {
    635                 ipc_answer_0(callid, ENOMEM);
     634                async_answer_0(callid, ENOMEM);
    636635                free(setup_packet);
    637636                return;
     
    641640        trans->buffer = malloc(data_len);
    642641        if (trans->buffer == NULL) {
    643                 ipc_answer_0(callid, ENOMEM);
     642                async_answer_0(callid, ENOMEM);
    644643                async_transaction_destroy(trans);
    645644                return;
     
    652651
    653652        if (rc != EOK) {
    654                 ipc_answer_0(callid, rc);
     653                async_answer_0(callid, rc);
    655654                async_transaction_destroy(trans);
    656655        }
Note: See TracChangeset for help on using the changeset viewer.