Ignore:
Timestamp:
2014-09-12T13:22:33Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b20126
Parents:
8db09e4 (diff), 105d8d6 (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

File:
1 moved

Legend:

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

    r8db09e4 r15d0046  
    11/*
    2  * Copyright (c) 2011 Petr Koupy
     2 * Copyright (c) 2014 Martin Decky
    33 * All rights reserved.
    44 *
     
    3333 */
    3434
     35#include <async.h>
    3536#include <errno.h>
    36 #include <async.h>
     37#include <io/pixel.h>
    3738#include <macros.h>
     39#include <device/led_dev.h>
     40#include <ops/led_dev.h>
     41#include <ddf/driver.h>
    3842
    39 #include "ops/graph_dev.h"
    40 #include "graph_iface.h"
    41 #include "ddf/driver.h"
     43static void remote_led_color_set(ddf_fun_t *, void *, ipc_callid_t,
     44    ipc_call_t *);
    4245
    43 typedef enum {
    44         GRAPH_DEV_CONNECT = 0
    45 } graph_dev_method_t;
    46 
    47 int graph_dev_connect(async_sess_t *sess)
    48 {
    49         async_exch_t *exch = async_exchange_begin(sess);
    50         int ret = async_req_1_0(exch, DEV_IFACE_ID(GRAPH_DEV_IFACE), GRAPH_DEV_CONNECT);
    51         async_exchange_end(exch);
    52 
    53         return ret;
    54 }
    55 
    56 static void remote_graph_connect(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    57 
    58 static const remote_iface_func_ptr_t remote_graph_dev_iface_ops[] = {
    59         [GRAPH_DEV_CONNECT] = remote_graph_connect
     46/** Remote LED interface operations */
     47static const remote_iface_func_ptr_t remote_led_dev_iface_ops[] = {
     48        [LED_DEV_COLOR_SET] = remote_led_color_set
    6049};
    6150
    62 const remote_iface_t remote_graph_dev_iface = {
    63         .method_count = ARRAY_SIZE(remote_graph_dev_iface_ops),
    64         .methods = remote_graph_dev_iface_ops
     51/** Remote LED interface structure
     52 *
     53 * Interface for processing requests from remote clients
     54 * addressed by the LED interface.
     55 *
     56 */
     57const remote_iface_t remote_led_dev_iface = {
     58        .method_count = ARRAY_SIZE(remote_led_dev_iface_ops),
     59        .methods = remote_led_dev_iface_ops
    6560};
    6661
    67 static void remote_graph_connect(ddf_fun_t *fun, void *ops, ipc_callid_t callid,
     62/** Process the color_set() request from the remote client
     63 *
     64 * @param fun The function to which the data are written
     65 * @param ops The local ops structure
     66 *
     67 */
     68static void remote_led_color_set(ddf_fun_t *fun, void *ops, ipc_callid_t callid,
    6869    ipc_call_t *call)
    6970{
    70         graph_dev_ops_t *graph_dev_ops = (graph_dev_ops_t *) ops;
    71 
    72         if (!graph_dev_ops->connect || !ddf_fun_data_get(fun)) {
     71        led_dev_ops_t *led_dev_ops = (led_dev_ops_t *) ops;
     72        pixel_t color = DEV_IPC_GET_ARG1(*call);
     73       
     74        if (!led_dev_ops->color_set) {
    7375                async_answer_0(callid, ENOTSUP);
    7476                return;
    7577        }
    76 
    77         (*graph_dev_ops->connect)(ddf_fun_data_get(fun), callid, call, NULL);
     78       
     79        int rc = (*led_dev_ops->color_set)(fun, color);
     80        async_answer_0(callid, rc);
    7881}
    7982
Note: See TracChangeset for help on using the changeset viewer.