Changeset 17aca1c in mainline for uspace/lib/drv/generic


Ignore:
Timestamp:
2011-02-04T20:56:52Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0397e5a4, e29e09cf
Parents:
e778543 (diff), 0b37882 (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 mainline changes

Location:
uspace/lib/drv/generic
Files:
5 edited

Legend:

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

    re778543 r17aca1c  
    186186                pseudocode = &default_pseudocode;
    187187       
    188         int res = ipc_register_irq(irq, dev->handle, ctx->id, pseudocode);
     188        int res = register_irq(irq, dev->handle, ctx->id, pseudocode);
    189189        if (res != EOK) {
    190190                remove_interrupt_context(&interrupt_contexts, ctx);
     
    199199        interrupt_context_t *ctx = find_interrupt_context(&interrupt_contexts,
    200200            dev, irq);
    201         int res = ipc_unregister_irq(irq, dev->handle);
     201        int res = unregister_irq(irq, dev->handle);
    202202       
    203203        if (ctx != NULL) {
     
    272272        }
    273273       
    274         ipc_answer_0(iid, res);
     274        async_answer_0(iid, res);
    275275}
    276276
     
    278278{
    279279        /* Accept connection */
    280         ipc_answer_0(iid, EOK);
     280        async_answer_0(iid, EOK);
    281281       
    282282        bool cont = true;
     
    293293                        break;
    294294                default:
    295                         ipc_answer_0(callid, ENOENT);
     295                        async_answer_0(callid, ENOENT);
    296296                }
    297297        }
     
    316316                printf("%s: driver_connection_gen error - no device with handle"
    317317                    " %" PRIun " was found.\n", driver->name, handle);
    318                 ipc_answer_0(iid, ENOENT);
     318                async_answer_0(iid, ENOENT);
    319319                return;
    320320        }
     
    331331                ret = (*dev->ops->open)(dev);
    332332       
    333         ipc_answer_0(iid, ret);
     333        async_answer_0(iid, ret);
    334334        if (ret != EOK)
    335335                return;
     
    347347                        if (dev->ops != NULL && dev->ops->close != NULL)
    348348                                (*dev->ops->close)(dev);
    349                         ipc_answer_0(callid, EOK);
     349                        async_answer_0(callid, EOK);
    350350                        return;
    351351                default:
     
    368368                                    "invalid interface id %d.",
    369369                                    driver->name, iface_idx);
    370                                 ipc_answer_0(callid, ENOTSUP);
     370                                async_answer_0(callid, ENOTSUP);
    371371                                break;
    372372                        }
     
    381381                                printf("device with handle %" PRIun " has no interface "
    382382                                    "with id %d.\n", handle, iface_idx);
    383                                 ipc_answer_0(callid, ENOTSUP);
     383                                async_answer_0(callid, ENOTSUP);
    384384                                break;
    385385                        }
     
    400400                                printf("%s: driver_connection_gen error - "
    401401                                    "invalid interface method.", driver->name);
    402                                 ipc_answer_0(callid, ENOTSUP);
     402                                async_answer_0(callid, ENOTSUP);
    403403                                break;
    404404                        }
     
    446446        default:
    447447                /* No such interface */
    448                 ipc_answer_0(iid, ENOENT);
     448                async_answer_0(iid, ENOENT);
    449449        }
    450450}
  • uspace/lib/drv/generic/remote_char_dev.c

    re778543 r17aca1c  
    3333 */
    3434
    35 #include <ipc/ipc.h>
    3635#include <async.h>
    3736#include <errno.h>
     
    8180        if (!async_data_read_receive(&cid, &len)) {
    8281                /* TODO handle protocol error. */
    83                 ipc_answer_0(callid, EINVAL);
     82                async_answer_0(callid, EINVAL);
    8483                return;
    8584        }
     
    8786        if (!char_dev_ops->read) {
    8887                async_data_read_finalize(cid, NULL, 0);
    89                 ipc_answer_0(callid, ENOTSUP);
     88                async_answer_0(callid, ENOTSUP);
    9089                return;
    9190        }
     
    10099                /* Some error occured. */
    101100                async_data_read_finalize(cid, buf, 0);
    102                 ipc_answer_0(callid, ret);
     101                async_answer_0(callid, ret);
    103102                return;
    104103        }
     
    106105        /* The operation was successful, return the number of data read. */
    107106        async_data_read_finalize(cid, buf, ret);
    108         ipc_answer_1(callid, EOK, ret);
     107        async_answer_1(callid, EOK, ret);
    109108}
    110109
     
    128127        if (!async_data_write_receive(&cid, &len)) {
    129128                /* TODO handle protocol error. */
    130                 ipc_answer_0(callid, EINVAL);
     129                async_answer_0(callid, EINVAL);
    131130                return;
    132131        }
     
    134133        if (!char_dev_ops->write) {
    135134                async_data_write_finalize(cid, NULL, 0);
    136                 ipc_answer_0(callid, ENOTSUP);
     135                async_answer_0(callid, ENOTSUP);
    137136                return;
    138137        }
     
    148147        if (ret < 0) {
    149148                /* Some error occured. */
    150                 ipc_answer_0(callid, ret);
     149                async_answer_0(callid, ret);
    151150        } else {
    152151                /*
     
    154153                 * written.
    155154                 */
    156                 ipc_answer_1(callid, EOK, ret);
     155                async_answer_1(callid, EOK, ret);
    157156        }
    158157}
  • uspace/lib/drv/generic/remote_hw_res.c

    re778543 r17aca1c  
    3333 */
    3434
    35 #include <ipc/ipc.h>
    3635#include <async.h>
    3736#include <errno.h>
     
    6261       
    6362        if (hw_res_ops->enable_interrupt == NULL)
    64                 ipc_answer_0(callid, ENOTSUP);
     63                async_answer_0(callid, ENOTSUP);
    6564        else if (hw_res_ops->enable_interrupt(dev))
    66                 ipc_answer_0(callid, EOK);
     65                async_answer_0(callid, EOK);
    6766        else
    68                 ipc_answer_0(callid, EREFUSED);
     67                async_answer_0(callid, EREFUSED);
    6968}
    7069
     
    7574
    7675        if (hw_res_ops->get_resource_list == NULL) {
    77                 ipc_answer_0(callid, ENOTSUP);
     76                async_answer_0(callid, ENOTSUP);
    7877                return;
    7978        }
     
    8180        hw_resource_list_t *hw_resources = hw_res_ops->get_resource_list(dev);
    8281        if (hw_resources == NULL){
    83                 ipc_answer_0(callid, ENOENT);
     82                async_answer_0(callid, ENOENT);
    8483                return;
    8584        }
    8685       
    87         ipc_answer_1(callid, EOK, hw_resources->count);
     86        async_answer_1(callid, EOK, hw_resources->count);
    8887
    8988        size_t len;
  • uspace/lib/drv/generic/remote_usb.c

    re778543 r17aca1c  
    3333 */
    3434
    35 #include <ipc/ipc.h>
    3635#include <async.h>
    3736#include <errno.h>
     
    6463
    6564        if (usb_iface->get_hc_handle == NULL) {
    66                 ipc_answer_0(callid, ENOTSUP);
     65                async_answer_0(callid, ENOTSUP);
    6766                return;
    6867        }
     
    7170        int rc = usb_iface->get_hc_handle(device, &handle);
    7271        if (rc != EOK) {
    73                 ipc_answer_0(callid, rc);
     72                async_answer_0(callid, rc);
    7473        }
    7574
    76         ipc_answer_1(callid, EOK, (sysarg_t) handle);
     75        async_answer_1(callid, EOK, (sysarg_t) handle);
    7776}
    7877
  • uspace/lib/drv/generic/remote_usbhc.c

    re778543 r17aca1c  
    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.