3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #ifndef __DEVICE_INTERNAL_H__
20 #define __DEVICE_INTERNAL_H__
23 #include "device-node.h"
25 #ifndef __CONSTRUCTOR__
26 #define __CONSTRUCTOR__ __attribute__ ((constructor))
29 #ifndef __DESTRUCTOR__
30 #define __DESTRUCTOR__ __attribute__ ((destructor))
33 #define FEATURE_DEVICE_NODE_DLOG
34 #ifdef FEATURE_DEVICE_NODE_DLOG
35 #define LOG_TAG "DEVICE_NODE"
37 #define _I(fmt, args...) SLOGI(fmt, ##args)
38 #define _D(fmt, args...) SLOGD(fmt, ##args)
39 #define _E(fmt, args...) SLOGE(fmt, ##args)
41 #define _I(x, ...) do { } while (0)
42 #define _D(x, ...) do { } while (0)
43 #define _E(x, ...) do { } while (0)
46 #define DEVMAN_PLUGIN_PATH "/usr/lib/libslp_devman_plugin.so"
48 #define DEF_SYS(node) default_plugin.OEM_sys_##node
49 #define DEF_GET(node) default_plugin.OEM_sys_get_##node
50 #define DEF_SET(node) default_plugin.OEM_sys_set_##node
52 #define OEM_SYS(node) oem_intf->OEM_sys_##node
53 #define OEM_GET(node) oem_intf->OEM_sys_get_##node
54 #define OEM_SET(node) oem_intf->OEM_sys_set_##node
56 #define PLUGIN_SYS(node, ...) \
57 (oem_intf && OEM_SYS(node) ? OEM_SYS(node)(__VA_ARGS__) : \
58 DEF_SYS(node) ? DEF_SYS(node)(__VA_ARGS__) : -ENOTSUP)
59 #define PLUGIN_GET(node, ...) \
60 (oem_intf && OEM_GET(node) ? OEM_GET(node)(__VA_ARGS__) : \
61 DEF_GET(node) ? DEF_GET(node)(__VA_ARGS__) : -ENOTSUP)
62 #define PLUGIN_SET(node, ...) \
63 (oem_intf && OEM_SET(node) ? OEM_SET(node)(__VA_ARGS__) : \
64 DEF_SET(node) ? DEF_SET(node)(__VA_ARGS__) : -ENOTSUP)
67 enum device_type type;
69 int (*set_prop) (int property, int val);
70 int (*get_prop) (int property, int *val);
73 void add_device(const enum device_type *devtype);
74 void remove_device(const enum device_type *devtype);
76 extern const OEM_sys_devman_plugin_interface *oem_intf;
77 extern const OEM_sys_devman_plugin_interface default_plugin;
79 #endif /* __DEVICE_INTERNAL_H__ */