source: mainline/uspace/lib/drv/generic/remote_led_dev.c@ 9bfa8c8

Last change on this file since 9bfa8c8 was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 4 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2014 Martin Decky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/** @addtogroup libdrv
8 * @{
9 */
10/** @file
11 */
12
13#include <async.h>
14#include <errno.h>
15#include <io/pixel.h>
16#include <macros.h>
17#include <device/led_dev.h>
18#include <ops/led_dev.h>
19#include <ddf/driver.h>
20
21static void remote_led_color_set(ddf_fun_t *, void *, ipc_call_t *);
22
23/** Remote LED interface operations */
24static const remote_iface_func_ptr_t remote_led_dev_iface_ops[] = {
25 [LED_DEV_COLOR_SET] = remote_led_color_set
26};
27
28/** Remote LED interface structure
29 *
30 * Interface for processing requests from remote clients
31 * addressed by the LED interface.
32 *
33 */
34const remote_iface_t remote_led_dev_iface = {
35 .method_count = ARRAY_SIZE(remote_led_dev_iface_ops),
36 .methods = remote_led_dev_iface_ops
37};
38
39/** Process the color_set() request from the remote client
40 *
41 * @param fun The function to which the data are written
42 * @param ops The local ops structure
43 *
44 */
45static void remote_led_color_set(ddf_fun_t *fun, void *ops, ipc_call_t *call)
46{
47 led_dev_ops_t *led_dev_ops = (led_dev_ops_t *) ops;
48 pixel_t color = DEV_IPC_GET_ARG1(*call);
49
50 if (!led_dev_ops->color_set) {
51 async_answer_0(call, ENOTSUP);
52 return;
53 }
54
55 errno_t rc = (*led_dev_ops->color_set)(fun, color);
56 async_answer_0(call, rc);
57}
58
59/**
60 * @}
61 */
Note: See TracBrowser for help on using the repository browser.