From: Youngjae Cho Date: Mon, 31 Jul 2023 07:17:45 +0000 (+0900) Subject: plugin-api: deviced: Add skeleton header for power module X-Git-Tag: accepted/tizen/unified/20230803.174812~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F296528%2F7;p=platform%2Fcore%2Fsystem%2Flibsyscommon.git plugin-api: deviced: Add skeleton header for power module syscommon-plugin-deviced-common-interface.h - Define common types and macros that can be commonly utilized over the whole modules, by both core and plugin. - Added enum deviced_resource_type so that all modules can share the enum. This is because the enum must be unique for each module. syscommon-plugin-deviced-power.h - Contain plugin-api functions that invoking plugin functions from the deviced core. syscommon-plugin-deviced-power-interface.h - Contain types and macros that can be utilized by both core and plugin. Change-Id: Iab8bc083a3610b720222df284f880d961fb75188 Signed-off-by: Youngjae Cho --- diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-common-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-common-interface.h new file mode 100644 index 0000000..53b4118 --- /dev/null +++ b/src/plugin-api/deviced/include/syscommon-plugin-deviced-common-interface.h @@ -0,0 +1,42 @@ +/** + * MIT License + * + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __SYSCOMMON_PLUGIN_DEVICED_COMMON_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_COMMON_INTERFACE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +enum deviced_resource_type { + DEVICED_RESOURCE_TYPE_UNKNOWN, + DEVICED_RESOURCE_TYPE_POWER, + DEVICED_RESOURCE_TYPE_END, +}; + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSCOMMON_PLUGIN_DEVICED_COMMON_INTERFACE_H__ */ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h new file mode 100644 index 0000000..010639b --- /dev/null +++ b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h @@ -0,0 +1,79 @@ +/** + * MIT License + * + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEVICED_POWER_ATTR_SET_UINT64_4_CURRENT_STATE (1ULL << 0) +#define DEVICED_POWER_ATTR_UINT64_CURRENT_STATE (1ULL << 1) +#define DEVICED_POWER_ATTR_INT_WAKEUP_REASON (1ULL << 2) + +enum { + DEVICED_POWER_STATE_MIN_INDEX, + DEVICED_POWER_STATE_START_INDEX = DEVICED_POWER_STATE_MIN_INDEX, + DEVICED_POWER_STATE_NORMAL_INDEX, + DEVICED_POWER_STATE_SLEEP_INDEX, + DEVICED_POWER_STATE_POWEROFF_INDEX, + DEVICED_POWER_STATE_REBOOT_INDEX, + DEVICED_POWER_STATE_EXIT_INDEX, + DEVICED_POWER_STATE_MAX_INDEX, + + DEVICED_POWER_TRANSIENT_STATE_MIN_INDEX, + DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY_INDEX = DEVICED_POWER_TRANSIENT_STATE_MIN_INDEX, + DEVICED_POWER_TRANSIENT_STATE_RESUMING_INDEX, + DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE_INDEX, + DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY_INDEX, + DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_INDEX, + DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE_INDEX, + DEVICED_POWER_TRANSIENT_STATE_MAX_INDEX, +}; + +#define DEVICED_POWER_STATE_UNDEFINED (0) + +#define DEVICED_POWER_STATE_START (1ULL << DEVICED_POWER_STATE_START_INDEX) +#define DEVICED_POWER_STATE_NORMAL (1ULL << DEVICED_POWER_STATE_NORMAL_INDEX) +#define DEVICED_POWER_STATE_SLEEP (1ULL << DEVICED_POWER_STATE_SLEEP_INDEX) +#define DEVICED_POWER_STATE_POWEROFF (1ULL << DEVICED_POWER_STATE_POWEROFF_INDEX) +#define DEVICED_POWER_STATE_REBOOT (1ULL << DEVICED_POWER_STATE_REBOOT_INDEX) +#define DEVICED_POWER_STATE_EXIT (1ULL << DEVICED_POWER_STATE_EXIT_INDEX) +#define DEVICED_POWER_STATE_ALL ((1ULL << DEVICED_POWER_STATE_MAX_INDEX) - (1ULL << DEVICED_POWER_STATE_MIN_INDEX)) + +#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_RESUMING (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE_INDEX) + +#define DEVICED_POWER_STATE_INDEX(state) (__builtin_ctzll(state)) + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ */ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power.h new file mode 100644 index 0000000..0ae2223 --- /dev/null +++ b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power.h @@ -0,0 +1,36 @@ +/** + * MIT License + * + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __SYSCOMMON_PLUGIN_DEVICED_POWER_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_POWER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSCOMMON_PLUGIN_DEVICED_POWER_H__ */