Changeset ffa2c8ef in mainline for uspace/lib/drv


Ignore:
Timestamp:
2011-01-29T11:36:08Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46b881c
Parents:
64d2b10
Message:

do not intermix low-level IPC methods with async framework methods

Location:
uspace/lib/drv
Files:
5 edited

Legend:

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

    r64d2b10 rffa2c8ef  
    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

    r64d2b10 rffa2c8ef  
    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

    r64d2b10 rffa2c8ef  
    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/include/dev_iface.h

    r64d2b10 rffa2c8ef  
    3636#define LIBDRV_DEV_IFACE_H_
    3737
     38#include <ipc/common.h>
    3839#include <ipc/dev_iface.h>
    3940
  • uspace/lib/drv/include/driver.h

    r64d2b10 rffa2c8ef  
    3636#define LIBDRV_DRIVER_H_
    3737
     38#include <kernel/ddi/irq.h>
    3839#include <adt/list.h>
    39 #include <ipc/ipc.h>
    4040#include <devman.h>
    4141#include <ipc/devman.h>
Note: See TracChangeset for help on using the changeset viewer.