Ignore:
Timestamp:
2011-06-01T08:43:42Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d6c1f1
Parents:
9e2e715 (diff), e51a514 (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:

Huuuuuge merge from development - all the work actually :)

File:
1 moved

Legend:

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

    r9e2e715 reb522e8  
    3333 */
    3434
    35 #include <ipc/ipc.h>
    3635#include <async.h>
    3736#include <errno.h>
    3837
    39 #include "driver.h"
    40 #include "resource.h"
     38#include "ops/hw_res.h"
     39#include "ddf/driver.h"
    4140
    42 static void remote_res_get_resources(device_t *, void *, ipc_callid_t,
     41static void remote_hw_res_get_resource_list(ddf_fun_t *, void *, ipc_callid_t,
    4342    ipc_call_t *);
    44 static void remote_res_enable_interrupt(device_t *, void *, ipc_callid_t,
     43static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_callid_t,
    4544    ipc_call_t *);
    4645
    47 static remote_iface_func_ptr_t remote_res_iface_ops [] = {
    48         &remote_res_get_resources,
    49         &remote_res_enable_interrupt
     46static remote_iface_func_ptr_t remote_hw_res_iface_ops [] = {
     47        &remote_hw_res_get_resource_list,
     48        &remote_hw_res_enable_interrupt
    5049};
    5150
    52 remote_iface_t remote_res_iface = {
    53         .method_count = sizeof(remote_res_iface_ops) /
     51remote_iface_t remote_hw_res_iface = {
     52        .method_count = sizeof(remote_hw_res_iface_ops) /
    5453            sizeof(remote_iface_func_ptr_t),
    55         .methods = remote_res_iface_ops
     54        .methods = remote_hw_res_iface_ops
    5655};
    5756
    58 static void remote_res_enable_interrupt(device_t *dev, void *iface,
     57static void remote_hw_res_enable_interrupt(ddf_fun_t *fun, void *ops,
    5958    ipc_callid_t callid, ipc_call_t *call)
    6059{
    61         resource_iface_t *ires = (resource_iface_t *) iface;
     60        hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
    6261       
    63         if (NULL == ires->enable_interrupt)
    64                 ipc_answer_0(callid, ENOTSUP);
    65         else if (ires->enable_interrupt(dev))
    66                 ipc_answer_0(callid, EOK);
     62        if (hw_res_ops->enable_interrupt == NULL)
     63                async_answer_0(callid, ENOTSUP);
     64        else if (hw_res_ops->enable_interrupt(fun))
     65                async_answer_0(callid, EOK);
    6766        else
    68                 ipc_answer_0(callid, EREFUSED);
     67                async_answer_0(callid, EREFUSED);
    6968}
    7069
    71 static void remote_res_get_resources(device_t *dev, void *iface,
     70static void remote_hw_res_get_resource_list(ddf_fun_t *fun, void *ops,
    7271    ipc_callid_t callid, ipc_call_t *call)
    7372{
    74         resource_iface_t *ires = (resource_iface_t *) iface;
    75         if (NULL == ires->get_resources) {
    76                 ipc_answer_0(callid, ENOTSUP);
     73        hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
     74
     75        if (hw_res_ops->get_resource_list == NULL) {
     76                async_answer_0(callid, ENOTSUP);
    7777                return;
    7878        }
    7979       
    80         hw_resource_list_t *hw_resources = ires->get_resources(dev);
    81         if (NULL == hw_resources){
    82                 ipc_answer_0(callid, ENOENT);
     80        hw_resource_list_t *hw_resources = hw_res_ops->get_resource_list(fun);
     81        if (hw_resources == NULL){
     82                async_answer_0(callid, ENOENT);
    8383                return;
    84         }       
     84        }
    8585       
    86         ipc_answer_1(callid, EOK, hw_resources->count);
     86        async_answer_1(callid, EOK, hw_resources->count);
    8787
    8888        size_t len;
    8989        if (!async_data_read_receive(&callid, &len)) {
    90                 /* protocol error - the recipient is not accepting data */
     90                /* Protocol error - the recipient is not accepting data */
    9191                return;
    9292        }
Note: See TracChangeset for help on using the changeset viewer.