Changeset 8e7c9fe in mainline for uspace/lib/drv/generic/remote_led_dev.c
- Timestamp:
- 2014-09-12T03:45:25Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c53b58e
- Parents:
- 3eb0c85 (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_led_dev.c
r3eb0c85 r8e7c9fe 1 1 /* 2 * Copyright (c) 201 1 Petr Koupy2 * Copyright (c) 2014 Martin Decky 3 3 * All rights reserved. 4 4 * … … 33 33 */ 34 34 35 #include <async.h> 35 36 #include <errno.h> 36 #include < async.h>37 #include <io/pixel.h> 37 38 #include <macros.h> 39 #include <device/led_dev.h> 40 #include <ops/led_dev.h> 41 #include <ddf/driver.h> 38 42 39 #include "ops/graph_dev.h" 40 #include "graph_iface.h" 41 #include "ddf/driver.h" 43 static void remote_led_color_set(ddf_fun_t *, void *, ipc_callid_t, 44 ipc_call_t *); 42 45 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 */ 47 static const remote_iface_func_ptr_t remote_led_dev_iface_ops[] = { 48 [LED_DEV_COLOR_SET] = remote_led_color_set 60 49 }; 61 50 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 */ 57 const remote_iface_t remote_led_dev_iface = { 58 .method_count = ARRAY_SIZE(remote_led_dev_iface_ops), 59 .methods = remote_led_dev_iface_ops 65 60 }; 66 61 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 */ 68 static void remote_led_color_set(ddf_fun_t *fun, void *ops, ipc_callid_t callid, 68 69 ipc_call_t *call) 69 70 { 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) { 73 75 async_answer_0(callid, ENOTSUP); 74 76 return; 75 77 } 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); 78 81 } 79 82
Note:
See TracChangeset
for help on using the changeset viewer.