diff options
author | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:48:36 +0900 |
---|---|---|
committer | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:48:36 +0900 |
commit | 6f12e23a842ea27382a7ec444f6f09166935ff7c (patch) | |
tree | 9a5247d9a16a4bb0e1e8cd8540ed7e9a16e29df3 | |
download | libslp-pm-tizen_2.3.tar.gz libslp-pm-tizen_2.3.tar.bz2 libslp-pm-tizen_2.3.zip |
Initialize Tizen 2.3submit/tizen_2.3/20140531.0917352.3a_releasetizen_2.3
35 files changed, 1807 insertions, 0 deletions
@@ -0,0 +1,2 @@ +Jinkun Jang <jinkun.jang@samsung.com>
+DongGi Jang <dg0402.jang@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..189c8e5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,37 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(pmapi C) + + +SET(SRCS pm.c) +SET(HEADERS pmapi.h pmapi_managed.h SLP_pm_PG.h) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "\${prefix}") +SET(LIBDIR "\${prefix}/lib") +SET(INCLUDEDIR "\${prefix}/include") +SET(VERSION 1.2) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) + +FOREACH(flag ${pkg_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") + +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION}) + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + +FOREACH(hfile ${HEADERS}) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include) +ENDFOREACH(hfile) diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 new file mode 100644 index 0000000..9c13a9b --- /dev/null +++ b/LICENSE.APLv2 @@ -0,0 +1,204 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/SLP_pm_PG.h b/SLP_pm_PG.h new file mode 100644 index 0000000..2dfd57c --- /dev/null +++ b/SLP_pm_PG.h @@ -0,0 +1,141 @@ +/* + * libslp-pm + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: DongGi Jang <dg0402.jang@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + + +/** + * + * @ingroup SLP_PG + * @defgroup SLP_PG_PM Power Manager + * @{ + +<h1 class="pg">Introduction</h1> + +<h2 class="pg">Purpose</h2> +The purpose of this document is to describe how applications can use Power Manager APIs to save system power consumption. +This document gives programming guidelines to application engineers. + +<h2 class="pg">Scope</h2> +The scope of this document is limited to Power Manager API usage. + +<br> +<h1 class="pg">Power Manager Architecture</h1> +The Power Manager (PM) consists of a client API library and a Power Manager daemon. + +<h3 class="pg" align="center">Power Manager Architecture</h3> +@image html SLP_pm_PG_architecture.png +<br> +Power Manager daemon controls a kernel power management module and peripheral device drivers to save system power consumption. +It manages the system power states and makes state transitions according to the events. <br> +There are four power states ? Normal (i.e. LCD on), LCD dimming, LCD off and Sleep. + +<h3 class="pg" align="center">Power Manager State Diagram</h3> +@image html SLP_pm_PG_state_diagram.png + +Applications can put conditions on specific state transitions. For example, Video Player applications do not want the Power Manager +to allow the LCD to be in a dimming state or to turn off the LCD backlight. +For this purpose, Video Player applications can use Power Manager APIs to send the condition to Power Manager. + +<h1 class="pg">Power Manager Features</h1> +- There are four power states, Normal(i.e. LCD on), LCD dimming, LCD off and Sleep. +- If there is no user input for a certain time, PM changes the state of PM to a state that has lower power consumption. +- When user input or another system interrupt occurs, PM rolls the state back immediately. +- However, some applications may want PM not to change the state, for example music players that do not want to suspend, +can sustain PM in the state required by using the pm_lock_power_state() API. + +<h1 class="pg">Power Manager Funtions</h1> + +<h2 class="pg">Power Manager API Introduction</h2> +<i><b>API : pm_lock_state</b></i> +<br><b>Parameter In :</b> unsigned int state, unsigned int flag, unsigned int timeout +<br><b>Return :</b> int +<br><b>Functionality :</b> This API is used to lock a particular power-state as the current power-state.<br> +The parameter state specifies the power state which you want to lock LCD_NORMAL, LCD_DIM, LCD_OFF. \n +The second parameter Flag is set if you want to go the requested lock state directly.\n +The third parameter timeout specifies lock-timeout in milliseconds. +If the value 0 is selected, the power state remains locked until pm_unlock_state is called.<br> +This function returns 0 on success and a negative value (-1) on failure. +<br><br> +<i><b>API : pm_unlock_state</b></i> +<br><b>Parameter In :</b> unsigned int state, unsigned int flag +<br><b>Return :</b> int +<br><b>Functionality :</b> This API is used to Unlock the power state.<br> +The parameter state specifies the power state which you want to unlock .Some examples are LCD_NORMAL, LCD_DIM, LCD_OFF.<br> +The second parameter flag is set if you want to go to the requested state directly after unlocking. <br> +PM_SLEEP_MARGIN - If the current status is lcd off, power-manager reset timer to 5 second. If the current status is not lcd off, power-manager uses the existing timer. <br> +PM_RESET_TIMER - Power-manager resets timer. (lcd normal : reset timer to predfined value which is set in setting module, lcd dim or off : reset timer to 5 seconds)<br> +PM_KEEP_TIMER - Power-manager uses the existing timer (if timer is already expired, pwoer-manager changes the status) <br> +This is valid only when the current state transition was blocked by the locking and this function call releases the blocking.<br> +This function returns 0 on success and a negative value (-1) on failure. +<br><br> +<i><b>API : pm_change_state</b></i> +<br><b>Parameter In :</b> unsigned int (power state) +<br><b>Return :</b> int +<br><b>Functionality :</b> This API is used to change the power manager state by force.<br> +This function returns 0 on success, -1 if failed. + +<b>Power state:</b> +@code +// POWER STATES +#define LCD_NORMAL 0x1 // NORMAL state +#define LCD_DIM 0x2 // LCD dimming state +#define LCD_OFF 0x4 // LCD off state +#define SUSPEND 0x8 // Sleep state +@endcode + +<h2 class="pg">Sample Code</h2> +@code +#include <pmapi.h> +int main() +{ + int result; + + // Lock current state as LCD_NORMAL + result = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0); + if( result < 0 ) { + printf("[ERROR] return value result =%d, \n",result); + } + else + printf("[SUCCESS]return value result =%d \n",result); + + // Do something here + + //Un-lock NORMAL state so that power state change can occur with system-events + + result = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER); + if( result < 0 ) { + printf("[ERROR] return value result =%d, \n",result); + } + else + printf("[SUCCESS]return value result =%d \n",result); + + // change the state into LCD ON + result = pm_change_state(LCD_NORMAL); + if( result < 0 ) + printf("[ERROR] return value result =%d, \n",result); + else + printf("[SUCCESS]return value result =%d \n",result); + + return 0; +} +@endcode + + @} +**/ diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..98ebeff --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +export TET_INSTALL_PATH=/scratchbox/tetware # local tetware path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..6720da0 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,19 @@ +#!/bin/sh +export TET_INSTALL_PATH=/mnt/nfs/tetware +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/tet_code b/TC/tet_code new file mode 100755 index 0000000..a2cf6c1 --- /dev/null +++ b/TC/tet_code @@ -0,0 +1,12 @@ +# TET reserved codes +0 "PASS" +1 "FAIL" +2 "UNRESOLVED" +3 "NOTINUSE" +4 "UNSUPPORTED" +5 "UNTESTED" +6 "UNINITIATED" +7 "NORESULT" + +# Test suite additional codes +33 "INSPECT" diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100755 index 0000000..43cbc9b --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/unit/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100755 index 0000000..6192c78 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,3 @@ +TET_OUTPUT_CAPTURE=False +TET_BUILD_TOOL=make +TET_PASS_TC_NAME=True diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100755 index 0000000..c66eda4 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,2 @@ +TET_OUTPUT_CAPTURE=False +TET_CLEAN_TOOL=make clean diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100755 index 0000000..0d9d39a --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1 @@ +TET_OUTPUT_CAPTURE=False diff --git a/TC/unit/Makefile b/TC/unit/Makefile new file mode 100644 index 0000000..8474034 --- /dev/null +++ b/TC/unit/Makefile @@ -0,0 +1,24 @@ +CC ?= gcc + +TARGETS = utc_SystemFW_pm_change_state_func \ + utc_SystemFW_pm_lock_state_func \ + utc_SystemFW_pm_unlock_state_func \ + +PKGS = pmapi + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +all: $(TARGETS) + +$(TARGETS): %: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TARGETS) diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh new file mode 100755 index 0000000..54f482d --- /dev/null +++ b/TC/unit/tc_gen.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +TMPSTR=$0 +SCRIPT=${TMPSTR##*/} + +if [ $# -lt 2 ]; then + echo "Usage) $SCRIPT module_name api_name" + exit 1 +fi + +MODULE=$1 +API=$2 +TEMPLATE=utc_MODULE_API_func.c.in +TESTCASE=utc_${MODULE}_${API}_func + +sed -e ' + s^@API@^'"$API"'^g + s^@MODULE@^'"$MODULE"'^g + ' $TEMPLATE > $TESTCASE.c + +if [ ! -e "$TESTCASE.c" ]; then + echo "Failed" + exit 1 +fi +echo "Testcase file is $TESTCASE.c" +echo "Done" +echo "please put \"$TESTCASE\" as Target in Makefile" +echo "please put \"/unit/$TESTCASE\" in tslist" diff --git a/TC/unit/tslist b/TC/unit/tslist new file mode 100644 index 0000000..4b93156 --- /dev/null +++ b/TC/unit/tslist @@ -0,0 +1,3 @@ +/unit/utc_SystemFW_pm_change_state_func +/unit/utc_SystemFW_pm_lock_state_func +/unit/utc_SystemFW_pm_unlock_state_func diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in new file mode 100644 index 0000000..b235fa3 --- /dev/null +++ b/TC/unit/utc_MODULE_API_func.c.in @@ -0,0 +1,64 @@ +#include <tet_api.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_@MODULE@_@API@_func_01(void); +static void utc_@MODULE@_@API@_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX }, + { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of @API@() + */ +static void utc_@MODULE@_@API@_func_01(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (r) { + tet_infoline("@API@() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init @API@() + */ +static void utc_@MODULE@_@API@_func_02(void) +{ + int r = 0; + +/* + r = @API@(...); +*/ + if (r) { + tet_infoline("@API@() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_pm_change_state_func.c b/TC/unit/utc_SystemFW_pm_change_state_func.c new file mode 100644 index 0000000..ebdcedc --- /dev/null +++ b/TC/unit/utc_SystemFW_pm_change_state_func.c @@ -0,0 +1,63 @@ +#include <tet_api.h> +#include <pmapi.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_pm_change_state_func_01(void); +static void utc_SystemFW_pm_change_state_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_pm_change_state_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_pm_change_state_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of pm_change_state() + */ +static void utc_SystemFW_pm_change_state_func_01(void) +{ + int ret_val = 0; + + ret_val = pm_change_state(LCD_NORMAL); + if(ret_val < 0) { + tet_infoline("pm_change_state() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init pm_change_state() + */ +static void utc_SystemFW_pm_change_state_func_02(void) +{ + int r = 0; + + r = pm_change_state(-1); + + if (r>=0) { + tet_infoline("pm_change_state() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_pm_lock_state_func.c b/TC/unit/utc_SystemFW_pm_lock_state_func.c new file mode 100644 index 0000000..cdf5edf --- /dev/null +++ b/TC/unit/utc_SystemFW_pm_lock_state_func.c @@ -0,0 +1,65 @@ +#include <tet_api.h> +#include <pmapi.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_pm_lock_state_func_01(void); +static void utc_SystemFW_pm_lock_state_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_pm_lock_state_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_pm_lock_state_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of pm_lock_state() + */ +static void utc_SystemFW_pm_lock_state_func_01(void) +{ + int ret_val = 0; + + //Lock State as LCD_DIM for infinite time + ret_val = pm_lock_state(LCD_DIM, GOTO_STATE_NOW, 0); + pm_unlock_state (LCD_DIM ,GOTO_STATE_NOW); + if(ret_val < 0) { + tet_infoline("pm_lock_state() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init pm_lock_state() + */ +static void utc_SystemFW_pm_lock_state_func_02(void) +{ + int r = 0; + + r = pm_lock_state(-1, GOTO_STATE_NOW, 0); + + if (r>=0) { + tet_infoline("pm_lock_state() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_SystemFW_pm_unlock_state_func.c b/TC/unit/utc_SystemFW_pm_unlock_state_func.c new file mode 100644 index 0000000..3dc187a --- /dev/null +++ b/TC/unit/utc_SystemFW_pm_unlock_state_func.c @@ -0,0 +1,72 @@ +#include <tet_api.h> +#include <pmapi.h> + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_SystemFW_pm_unlock_state_func_01(void); +static void utc_SystemFW_pm_unlock_state_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_SystemFW_pm_unlock_state_func_01, POSITIVE_TC_IDX }, + { utc_SystemFW_pm_unlock_state_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of pm_unlock_state() + */ +static void utc_SystemFW_pm_unlock_state_func_01(void) +{ + int ret_val = 0; + + //Lock State as LCD_DIM for infinite time + ret_val = pm_lock_state(LCD_DIM, GOTO_STATE_NOW, 0); + if(ret_val < 0) + { + tet_infoline("\nSystem Fwk : call to pm_lock_state for unlock failed \n"); + } + + + //Unlock previously locked state + ret_val = pm_unlock_state(LCD_DIM,GOTO_STATE_NOW); + if(ret_val < 0) { + tet_infoline("pm_unlock_state() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init pm_unlock_state() + */ +static void utc_SystemFW_pm_unlock_state_func_02(void) +{ + int r = 0; + + r = pm_unlock_state(-1 ,GOTO_STATE_NOW); + + if (r>=0) { + tet_infoline("pm_unlock_state() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/debian/changelog b/debian/changelog new file mode 100755 index 0000000..7183bd0 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,380 @@ +libslp-pm (1.2.4-23) unstable; urgency=low + + * pm_change_state is moved to managed API. + * Git: slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-23 + + -- Seunghun Pi <sh.pi@samsung.com> Fri, 07 Aug 2012 11:11:27 +0900 + +libslp-pm (1.2.4-21) unstable; urgency=low + + * Add parameters for pm_lock_state() : HOLD_KEY_BLOCK + * Git: slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-21 + + -- Seunghun Pi <sh.pi@samsung.com> Sun, 29 Jul 2012 16:17:27 +0900 + +libslp-pm (1.2.4-20) unstable; urgency=low + + * source clean up (remove unnecessary comments, and so on) + * Git: slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-20 + + -- Jinkun Jang <jinkun.jang@samsung.com> Tue, 06 Dec 2011 16:39:27 +0900 + +libslp-pm (1.2.4-19) unstable; urgency=low + + * remove unnecessary API for DVFS (move DVFS APIs to system-server) + * change boiler plate + * Git: 165.213.180.234:slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-19 + + -- Jinkun Jang <jinkun.jang@samsung.com> Mon, 05 Dec 2011 12:29:27 +0900 + +libslp-pm (1.2.4-18) unstable; urgency=low + + * Modify Makefile of TC units + * Git: 165.213.180.234:slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-18 + + -- DongGi Jang <dg0402.jang@samsung.com> Thu, 06 Oct 2011 13:29:27 +0900 + +libslp-pm (1.2.4-17) unstable; urgency=low + + * code cleaup(indent) + * Git: 165.213.180.234:slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-17 + + -- Jinkun.Jang <jinkun.jang@samsung.com> Tue, 02 Jul 2011 12:18:08 +0900 + +libslp-pm (1.2.4-16) unstable; urgency=low + + * add new defined values for pm_unlock_state() + * Git: 165.213.180.234:slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-16 + + -- Jinkun.Jang <jinkun.jang@samsung.com> Wed, 02 Mar 2011 12:18:08 +0900 + +libslp-pm (1.2.4-15) unstable; urgency=low + + * update TC + * Git: 165.213.180.234:slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-15 + + -- Jinkun.Jang <jinkun.jang@samsung.com> Tue, 04 Jan 2011 16:48:08 +0900 + +libslp-pm (1.2.4-14) unstable; urgency=low + + * update TC + * Git: 165.213.180.234:slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-14 + + -- Jinkun.Jang <jinkun.jang@samsung.com> Tue, 21 Dec 2010 20:48:08 +0900 + +libslp-pm (1.2.4-13) unstable; urgency=low + + * add checking parameter + * Git: 165.213.180.234:slp/pkgs/l/libslp-pm + * Tag: libslp-pm_1.2.4-13 + + -- Jinkun.Jang <jinkun.jang@samsung.com> Wed, 08 Dec 2010 20:48:08 +0900 + +libslp-pm (1.2.4-12) unstable; urgency=low + + * update TC + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-12 + + -- Jinkun Jang <jinkun.jang@samsung.com> Thu, 02 Dec 2010 10:26:27 +0900 + +libslp-pm (1.2.4-11) unstable; urgency=low + + * update PG + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-11 + + -- Jinkun Jang <jinkun.jang@samsung.com> Thu, 18 Nov 2010 15:51:59 +0900 + +libslp-pm (1.2.4-10) unstable; urgency=low + + * add power off state same with sleep + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-10 + + -- Jinkun Jang <jinkun.jang@samsung.com> Wed, 03 Nov 2010 19:26:01 +0900 + +libslp-pm (1.2.4-9) unstable; urgency=low + + * add copyright + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-9 + + -- Jinkun Jang <jinkun.jang@samsung.com> Wed, 27 Oct 2010 13:52:42 +0900 + +libslp-pm (1.2.4-8) unstable; urgency=low + + * add programming guide + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-8 + + -- Jinkun Jang <jinkun.jang@samsung.com> Wed, 13 Oct 2010 15:47:22 +0900 + +libslp-pm (1.2.4-7) unstable; urgency=low + + * add TC + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-7 + + -- Jinkun Jang <jinkun.jang@samsung.com> Tue, 05 Oct 2010 23:23:48 +0900 + +libslp-pm (1.2.4-6) unstable; urgency=low + + * update doxigen for pm_unlock_state() + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-6 + + -- Jinkun Jang <jinkun.jang@samsung.com> Mon, 13 Sep 2010 11:59:24 +0900 + +libslp-pm (1.2.4-5) unstable; urgency=low + + * modify header files for doxygen + * Git: 165.213.180.234:/git/slp/pkgs/libslp-pm + * Tag: libslp-pm_1.2.4-5 + + -- Jinkun Jang <jinkun.jang@samsung.com> Wed, 01 Sep 2010 17:03:03 +0900 + +libslp-pm (1.2.4-4) unstable; urgency=low + + * change maintainer + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm_1.2.4-4 + + -- Jinkun Jang <jinkun.jang@samsung.com> Thu, 08 Jul 2010 15:45:06 +0900 + +libslp-pm (1.2.4-3) unstable; urgency=low + + * add get/attach/detach function on pm state (changed) + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm_1.2.4-3 + + -- Wonil Choi <wonil22.choi@samsung.com> Thu, 24 Jun 2010 20:39:49 +0900 + +libslp-pm (1.2.4-2) unstable; urgency=low + + * change printing logs + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm_1.2.4-2 + + -- Wonil Choi <wonil22.choi@samsung.com> Tue, 15 Jun 2010 21:05:51 +0900 + +libslp-pm (1.2.4-1) unstable; urgency=low + + * remove deprecated APIs + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm_1.2.4-1 + + -- Wonil Choi <wonil22.choi@samsung.com> Thu, 03 Jun 2010 19:58:26 +0900 + +libslp-pm (1.2.3-2) unstable; urgency=low + + * remove a script file for DAC + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm_1.2.3-2 + + -- Wonil Choi <wonil22.choi@samsung.com> Wed, 12 May 2010 15:52:38 +0900 + +libslp-pm (1.2.3-1) unstable; urgency=low + + * add deprecate warnings to pm_control() + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm_1.2.3-1 + + -- Wonil Choi <wonil22.choi@samsung.com> Thu, 06 May 2010 09:02:41 +0900 + +libslp-pm (1.2.2-4) unstable; urgency=low + + * add a script file for DAC + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm-0_1.2.2-4 + + -- Wonil Choi <wonil22.choi@samsung.com> Mon, 19 Apr 2010 18:17:57 +0900 + +libslp-pm (1.2.2-3) unstable; urgency=low + + * increasing package version + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm-0_1.2.2-3 + + -- Wonil Choi <wonil22.choi@samsung.com> Wed, 14 Apr 2010 19:16:32 +0900 + +libslp-pm (1.2.2-2) unstable; urgency=low + + * remove applog in the .pc file + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm-0_1.2.2-2 + + -- Wonil Choi <wonil22.choi@samsung.com> Wed, 14 Apr 2010 10:39:31 +0900 + +libslp-pm (1.2.2-1) unstable; urgency=low + + * remove applog.h + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/libslp-pm-0 + * Tag: libslp-pm-0_1.2.2-1 + + -- Wonil Choi <wonil22.choi@samsung.com> Tue, 13 Apr 2010 18:07:22 +0900 + +libslp-pm (1.2.1-2) unstable; urgency=low + + * corrected wrong comments + + -- Wonil Choi <wonil22.choi@samsung.com> Mon, 29 Mar 2010 11:41:28 +0900 + +libslp-pm (1.2.1-1) unstable; urgency=low + + * remove unused (deprecated) codes + + -- Wonil Choi <wonil22.choi@samsung.com> Thu, 25 Mar 2010 16:43:19 +0900 + +libslp-pm (1.2.0-8) unstable; urgency=low + + * Toolchain Upgrade + + -- Wonil Choi <wonil22.choi@samsung.com> Thu, 25 Mar 2010 16:39:22 +0900 + +libslp-pm (1.2.0-7) unstable; urgency=low + + * add dbg pkg + + -- Wonil Choi <wonil22.choi@samsung.com> Tue, 02 Mar 2010 20:35:09 +0900 + +libslp-pm (1.2.0-6) unstable; urgency=low + + * remove a copy for old so + + -- Wonil Choi <wonil22.choi@samsung.com> Tue, 02 Mar 2010 18:53:59 +0900 + +libslp-pm (1.2.0-5) unstable; urgency=low + + * modified doxygen comments + + -- Wonil Choi <wonil22.choi@samsung.com> Fri, 19 Feb 2010 16:48:39 +0900 + +libslp-pm (1.2.0-4) unstable; urgency=low + + * fix i686 build break + + -- Wonil Choi <wonil22.choi@samsung.com> Thu, 18 Feb 2010 13:30:29 +0900 + +libslp-pm (1.2.0-2) unstable; urgency=low + + * so.1.1 temporary added + + -- Wonil Choi <wonil22.choi@samsung.com> Thu, 18 Feb 2010 13:09:50 +0900 + +libslp-pm (1.2.0-1) unstable; urgency=low + + * modified API name and parameter + + -- Wonil Choi <wonil22.choi@samsung.com> Wed, 17 Feb 2010 17:15:40 +0900 + +libslp-pm (1.1.1-2) unstable; urgency=low + + * add the so version to the library extention + + -- Wonil Choi <wonil22.choi@samsung.com> Mon, 01 Feb 2010 10:12:59 +0900 + +libslp-pm (1.1.1-1) unstable; urgency=low + + * add old pmcontrol() for SDK + + -- Wonil Choi <wonil22.choi@samsung.com> Sat, 30 Jan 2010 13:44:45 +0900 + +libslp-pm (1.1.0-2) unstable; urgency=low + + * add pmcontrol.h to dev pkg + + -- Wonil Choi <wonil22.choi@samsung.com> Fri, 29 Jan 2010 16:03:28 +0900 + +libslp-pm (1.1.0-1) unstable; urgency=low + + * change names - remove SLP + + -- Wonil Choi <wonil22.choi@samsung.com> Tue, 26 Jan 2010 17:54:13 +0900 + +libslp-pm (1.0.4-4) unstable; urgency=low + + * update doxygen tags for SDK + + -- root <wonil22.choi@samsung.com> Sat, 23 Jan 2010 23:51:34 +0900 + +libslp-pm (1.0.4-3) unstable; urgency=low + + * add doxygen tags for SDK + + -- root <wonil22.choi@samsung.com> Sat, 23 Jan 2010 21:47:57 +0900 + +libslp-pm (1.0.4-2) unstable; urgency=low + + * update debug pkg + + -- Wonil Choi <wonil22.choi@samsung.com> Fri, 22 Jan 2010 12:18:24 +0900 + +libslp-pm (1.0.4-1) unstable; urgency=low + + * i686 bug fix + + -- Wonil Choi <wonil22.choi@samsung.com> Fri, 08 Jan 2010 11:07:45 +0900 + +libslp-pm (1.0.3-1) unstable; urgency=low + + * added dvfs condition + + -- Wonil Choi <wonil22.choi@samsung.com> Tue, 05 Jan 2010 20:45:48 +0900 + +libslp-pm (1.0.2-1) unstable; urgency=low + + * implemented SLP_pm_state_change() function + + -- Wonil Choi <wonil22.choi@samsung.com> Tue, 22 Dec 2009 19:25:54 +0900 + +libslp-pm (1.0.1-1) unstable; urgency=low + + * Bug fix - return value is 0 for success. And add new function. + + -- Wonil Choi <wonil22.choi@samsung.com> Fri, 18 Dec 2009 20:25:03 +0900 + +libslp-pm (1.0-6) unstable; urgency=low + + * fix build script + + -- Suchang Woo <suchang.woo@samsung.com> Mon, 30 Nov 2009 20:20:08 +0900 + +libslp-pm (1.0-5) unstable; urgency=low + + * remove project name(X1) + + -- Suchang Woo <suchang.woo@samsung.com> Fri, 20 Nov 2009 17:17:17 +0900 + +libslp-pm (1.0-4) unstable; urgency=low + + * rename prefix + + -- Suchang Woo <suchang.woo@samsung.com> Fri, 20 Nov 2009 16:20:30 +0900 + +libslp-pm (1.0-3) unstable; urgency=low + + * change copyright + + -- Suchang Woo <suchang.woo@samsung.com> Tue, 17 Nov 2009 15:49:17 +0900 + +libslp-pm (1.0-2) unstable; urgency=low + + * uncomment dh_makeshlibs + + -- Suchang Woo <suchang.woo@samsung.com> Mon, 16 Nov 2009 11:06:21 +0900 + +libslp-pm (1.0-1) unstable; urgency=low + + * Initial Release. + + -- Suchang Woo <suchang.woo@samsung.com> Thu, 12 Nov 2009 22:19:58 +0900 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..f0d7b8f --- /dev/null +++ b/debian/control @@ -0,0 +1,28 @@ +Source: libslp-pm +Section: libs +Priority: extra +Maintainer: Jonghoon Han <jonghoon.han@samsung.com> Jinkun Jang <jinkun.jang@samsung.com> DongGi Jang <dg0402.jang@samsung.com> +Uploaders: Jinkun Jang <jinkun.jang@samsung.com> +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: libslp-pm-dev +Section: libs +Architecture: any +Depends: libslp-pm-0 (= ${Source-Version}) +Description: Samsung Linux platform power manager client library + Samsung Linux platform power manager client library + +Package: libslp-pm-0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Samsung Linux platform power manager client library + Samsung Linux platform power manager client library + +Package: libslp-pm-0-dbg +Section: debug +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-pm-0 (= ${Source-Version}) +Description: Samsung Linux platform power manager client library (unstripped) + Samsung Linux platform power manager client library (unstripped) diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..a0f0008 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +CMakeLists.txt diff --git a/debian/libslp-pm-0.install.in b/debian/libslp-pm-0.install.in new file mode 100644 index 0000000..daeeae9 --- /dev/null +++ b/debian/libslp-pm-0.install.in @@ -0,0 +1 @@ +@PREFIX@/lib/lib*.so* diff --git a/debian/libslp-pm-dev.install.in b/debian/libslp-pm-dev.install.in new file mode 100644 index 0000000..37b3bd4 --- /dev/null +++ b/debian/libslp-pm-dev.install.in @@ -0,0 +1,2 @@ +@PREFIX@/include/*.h +@PREFIX@/lib/pkgconfig/*.pc diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..8b10ede --- /dev/null +++ b/debian/rules @@ -0,0 +1,128 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS ?= -Wall -g +CXXFLAGS ?= -Wall -g +LDFLAGS ?= +PREFIX ?= /usr +DATADIR ?= /opt + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + CFLAGS += -O2 + CXXFLAGS += -O2 +endif + +LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed + +CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + mkdir -p $(CMAKE_TMP_DIR); + cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + cd $(CMAKE_TMP_DIR) && $(MAKE) + #docbook-to-man debian/wavplayer.sgml > wavplayer.1 + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + done + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -cd $(CMAKE_TMP_DIR) && $(MAKE) clean + rm -rf $(CMAKE_TMP_DIR) + + rm -rf CMakeCache.txt + rm -rf CMakeFiles + rm -rf cmake_install.cmake + rm -rf Makefile + rm -rf install_manifest.txt + rm -rf *.so + rm -rf debian/libpmapi-0-dbg + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/wavplayer. + cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + # cp $(CMAKE_TMP_DIR)/libpmapi.so.1.2 $(CURDIR)/debian/tmp/usr/lib/libpmapi.so.1.1 + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs +# dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link +# dh_strip + dh_strip --dbg-package=libslp-pm-0-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/image/SLP_pm_PG_architecture.png b/image/SLP_pm_PG_architecture.png Binary files differnew file mode 100755 index 0000000..046c121 --- /dev/null +++ b/image/SLP_pm_PG_architecture.png diff --git a/image/SLP_pm_PG_state_diagram.png b/image/SLP_pm_PG_state_diagram.png Binary files differnew file mode 100755 index 0000000..bf07b79 --- /dev/null +++ b/image/SLP_pm_PG_state_diagram.png diff --git a/libslp-pm.manifest b/libslp-pm.manifest new file mode 100644 index 0000000..41a9320 --- /dev/null +++ b/libslp-pm.manifest @@ -0,0 +1,6 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> + diff --git a/packaging/libslp-pm.spec b/packaging/libslp-pm.spec new file mode 100755 index 0000000..21d644c --- /dev/null +++ b/packaging/libslp-pm.spec @@ -0,0 +1,62 @@ +Name: libslp-pm +Summary: Power manager library +Version: 1.2.4 +Release: 2.1 +Group: TO_BE/FILLED_IN +License: Apache-2.0 +Source0: libslp-pm-%{version}.tar.bz2 +BuildRequires: cmake + + +%description +Samsung Linux platform power manager client library + + + +%package devel +Summary: SLP power manager client (devel) +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: libslp-pm + +%description devel +SLP power manager client library (devel) + + +%prep +%setup -q + + +%build +%cmake . + + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +mkdir -p %{buildroot}%{_datadir}/license +cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + + +%files +%defattr(-,root,root,-) +%manifest libslp-pm.manifest +%{_libdir}/libpmapi.so.1.2 +%{_datadir}/license/%{name} + +%files devel +%defattr(-,root,root,-) +%{_includedir}/pmapi.h +%{_includedir}/pmapi_managed.h +%{_includedir}/SLP_pm_PG.h +%{_libdir}/pkgconfig/pmapi.pc +%{_libdir}/libpmapi.so + @@ -0,0 +1,138 @@ +/* + * libslp-pm + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: DongGi Jang <dg0402.jang@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <unistd.h> +#include <stdio.h> +#include <errno.h> +#include <linux/limits.h> + +#include "pmapi.h" +#include "pm.h" + +#define SOCK_PATH "/tmp/pm_sock" +#define SHIFT_UNLOCK 4 +#define SHIFT_UNLOCK_PARAMETER 12 +#define SHIFT_CHANGE_STATE 8 +#define SHIFT_HOLD_KEY_BLOCK 16 +#define TIMEOUT_RESET_BIT 0x80 + +struct pwr_msg { + pid_t pid; + unsigned int cond; + unsigned int timeout; +}; + +static int send_msg(unsigned int s_bits, unsigned int timeout) +{ + int rc = 0; + int sock; + struct pwr_msg p; + struct sockaddr_un remote; + + p.pid = getpid(); + p.cond = s_bits; + p.timeout = timeout; + + sock = socket(AF_UNIX, SOCK_DGRAM, 0); + if (sock == -1) { + ERR("pm socket() failed"); + return -1; + } + + remote.sun_family = AF_UNIX; + if(strlen(SOCK_PATH) >= sizeof(remote.sun_path)) { + ERR("socket path is vey long"); + return -1; + } + strncpy(remote.sun_path, SOCK_PATH, sizeof(remote.sun_path)); + + rc = sendto(sock, (void *)&p, sizeof(p), 0, (struct sockaddr *)&remote, + sizeof(struct sockaddr_un)); + if (rc == -1) { + ERR("pm socket sendto() failed"); + } else + rc = 0; + + close(sock); + return rc; +} + +API int pm_change_state(unsigned int s_bits) +{ + /* s_bits is LCD_NORMAL 0x1, LCD_DIM 0x2, LCD_OFF 0x4, SUSPEND 0x8 + * Stage change to NORMAL 0x100 + * Stage change to LCDDIM 0x200 + * Stage change to LCDOFF 0x400 + * Stage change to SLEEP 0x800 + * */ + switch (s_bits) { + case LCD_NORMAL: + case LCD_DIM: + case LCD_OFF: + case SUSPEND: + case POWER_OFF: + break; + default: + return -1; + } + return send_msg(s_bits << SHIFT_CHANGE_STATE, 0); +} + +API int pm_lock_state(unsigned int s_bits, unsigned int flag, + unsigned int timeout) +{ + switch (s_bits) { + case LCD_NORMAL: + case LCD_DIM: + case LCD_OFF: + break; + default: + return -1; + } + if (flag & GOTO_STATE_NOW) + /* if the flag is true, go to the locking state directly */ + s_bits = s_bits | (s_bits << SHIFT_CHANGE_STATE); + if (flag & HOLD_KEY_BLOCK) + s_bits = s_bits | (1 << SHIFT_HOLD_KEY_BLOCK); + + return send_msg(s_bits, timeout); +} + +API int pm_unlock_state(unsigned int s_bits, unsigned int flag) +{ + switch (s_bits) { + case LCD_NORMAL: + case LCD_DIM: + case LCD_OFF: + break; + default: + return -1; + } + + s_bits = (s_bits << SHIFT_UNLOCK); + s_bits = (s_bits | (flag << SHIFT_UNLOCK_PARAMETER)); + return send_msg(s_bits, 0); +} + @@ -0,0 +1,38 @@ +/* + * libslp-pm + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: DongGi Jang <dg0402.jang@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + + +#ifndef __POWER_MANAGER_LIBRARY_I_H__ +#define __POWER_MANAGER_LIBRARY_I_H__ + +#ifndef API +#define API __attribute__ ((visibility("default"))) +#endif + +#if defined(ENABLE_DLOG_OUT) +# define LOG_TAG "PMAPI" +# include <dlog.h> +# define ERR SLOGE +#else +# define ERR perror +#endif + +#endif /* __POWER_MANAGER_LIBRARY_I_H__ */ @@ -0,0 +1,188 @@ +/* + * libslp-pm + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: DongGi Jang <dg0402.jang@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + + +#ifndef __POWER_MANAGER_LIBRARY_H__ +#define __POWER_MANAGER_LIBRARY_H__ + +#include "pmapi_managed.h" + +/** + * @defgroup POWER_MANAGER Power manager library + * @ingroup SYSTEM_FRAMEWORK + * @brief Power manager control API library + * + * @open + * @addtogroup POWER_MANAGER + * @{ + * This library provides APIs to lock/unlock the power state of the system. + * Power Manager controls the power state as following. + * @image html power-manager-fsm.bmp "Fig. 1 State Diagram of Power Manager + * <br> If there is no user input for a certain time, PM changes the power state + * that has lower power consumption. <br> When the user input or other system interrupt occurs, + * PM rolls the state back immediately.<br> If applications or other frameworks want to stop + * enter the specific state of power manager, use pm_lock_state() and pm_unlock_state() + * <br> Be careful! A caller process should unlock the power state after locking without timeout. + * <br> If you want to stay the LCD normal state, you can use + * @li @c pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0) + * <p><br> After finishing your job with locking, call + * @li @c pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER) + * <p><br> Additionally, you can use the timeout for lock the state. + * If timeout is set, caller process doesn't need to call the unlock API. + * But the process should be alive. + * If caller process is dead, lock condition would be drop by the power manager. + * <p><br> Here is sample codes + * @code + +#include "pmapi.h" +int main(int argc, char** argv) +{ + int result; + + printf("=========================================\n"); + printf("= Lock / Unlock to transit a power manager state =\n"); + printf("=========================================\n"); + + result = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW,0); //Lock on lcd-off until explicit unlock. + if (!result) + printf("SUCCESS"); + else + printf("FAILED"); + + // DO something. + + result = pm_unlock_state(LCD_NORMAL,PM_RESET_TIMER); //Unlock + if (!result) + printf("SUCCESS"); + else + printf("FAILED"); + + result = pm_lock_state(LCD_OFF,STAY_CUR_STATE, 5000); // Lock on lcd-off during 5 seconds. + if (!result) + printf("SUCCESS"); + else + printf("FAILED"); + + // DO something. + sleep(10); + + return 0; +} + * @endcode + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define LCD_NORMAL 0x1 /**< NORMAL state */ +#define LCD_DIM 0x2 /**< LCD dimming state */ +#define LCD_OFF 0x4 /**< LCD off state */ +#define SUSPEND 0x8 /**< Sleep state */ +#define POWER_OFF 0x16 /**< Sleep state */ +#define SETALL (LCD_DIM | LCD_OFF | LCD_NORMAL) /*< select all state - not supported yet */ + +/* parameters for pm_lock_state() */ +#define STAY_CUR_STATE 0x0 +#define GOTO_STATE_NOW 0x1 +#define HOLD_KEY_BLOCK 0x2 + +/* paramters for pm_unlcok_state() - details are described at 162 line */ +#define PM_SLEEP_MARGIN 0x0 /**< keep guard time for unlock */ +#define PM_RESET_TIMER 0x1 /**< reset timer for unlock */ +#define PM_KEEP_TIMER 0x2 /**< keep timer for unlock */ + +/** + * @fn int pm_lock_state (unsigned int state, + * unsigned int flag, + * unsigned int timeout); + * @brief This API is used to lock a particular power-state as the current power-state.\n + * The parameter state specifies the power state which you want to lock LCD_NORMAL, LCD_DIM, LCD_OFF. \n + * The second parameter Flag is set if you want to go the requested lock state directly.\n + * The third parameter timeout specifies lock-timeout in milliseconds. + * If the value 0 is selected, the power state remains locked until pm_unlock_state is called. + * @param[in] state target power state which you want to lock - LCD_NORMAL, LCD_DIM, LCD_OFF + * @param[in] flag set if you want to go the lock state directly + * GOTO_STATE_NOW - State is changed directly you want to lock. + * STAY_CUR_STATE - State is not changed directly and phone stay current state until timeout expired. + * (Default if there is no value in flag.) + * HOLD_KEY_BLOCK - Hold key is blocked during locking LCD_NORMAL or LCD_DIM. + * Then LCD state transition to LCD_OFF is blocked. + * If this flag is not set, phone state is lcd off after pressing hold key. + * GOTO_STATE_NOW and STAY_CUR_STATE can't be applied at the same time. + * @param[in] timeout lock-timeout in miliseconds. + * 0 is always lock until calling pm_unlock_state + * If you call this function with same state in duplicate, + * only last one will be processed and others are ignored. + * @return 0 on success, -1 if failed + * @see pm_unlock_state(), pm_change_state() + * @par Example + * @code + * ... + * // Lock current state as LCD_NORMAL + * result = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, SET_TIMEOUT); + * if( result < 0 ) + * printf("[ERROR] return value result =%d, \n",result); + * else + * printf("[SUCCESS]return value result =%d \n",result); + * ... + * @endcode + */ + int pm_lock_state(unsigned int, unsigned int, unsigned int); + +/** + * @fn int pm_unlock_state (unsigned int state, + * unsigned int flag) + * @brief This API is used to Unlock the power state. \n + * The parameter state specifies the power state which you want to unlock . + * Some examples are LCD_NORMAL, LCD_DIM, LCD_OFF.\n + * The second parameter flag is set if you want to go to the requested state directly after unlocking. (NOT SUPPOERTED YET) + * This is valid only when the current state transition was blocked by the locking and this function call releases the blocking. + * @param[in] state target power state which you want to unlock + * @param[in] flag set timer which is going to the next state after unlocking + * PM_SLEEP_MARGIN - If the current status is lcd off, pm reset timer to 5 second. If the current status is not lcd off, pm pm uses the existing timer. + * PM_RESET_TIMER - Power-manager resets timer. (lcd normal : reset timer to predfined value which is set in setting module, lcd dim or off : reset timer to 5 seconds) + * PM_KEEP_TIMER - Power-manager uses the existing timer (if timer is already expired, pm changes the status) <br> + * @return 0 on success, -1 if failed + * @see pn_lock_state(), pm_change_state() + * @par Example + * @code + * ... + * //Un-lock NORMAL state so that power state change can occur with system-events + * result = pm_unlock_state(LCD_NORMAL,PM_RESET_TIMER); + * if( result < 0 ) + * printf("[ERROR] return value result =%d, \n",result); + * else + * printf("[SUCCESS]return value result =%d \n",result); + * ... + * @endcode + */ + int pm_unlock_state(unsigned int, unsigned int); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* __POWER_MANAGER_LIBRARY_H__ */ diff --git a/pmapi.pc.in b/pmapi.pc.in new file mode 100644 index 0000000..f32c72f --- /dev/null +++ b/pmapi.pc.in @@ -0,0 +1,13 @@ +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: libpmapi +Description: power manager library +Version: @VERSION@ +Requires: +Libs: -L${libdir} -lpmapi +Cflags: -I${includedir} diff --git a/pmapi_managed.h b/pmapi_managed.h new file mode 100644 index 0000000..4deb80d --- /dev/null +++ b/pmapi_managed.h @@ -0,0 +1,52 @@ +/* + * libslp-pm + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seunghun Pi <sh.pi@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + + +#ifndef __POWER_MANAGER_LIBRARY_MANAGED_H__ +#define __POWER_MANAGER_LIBRARY_MANAGED_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @fn int pm_change_state(unsigned int state); + * @brief This API is used to change the power manager state by force. + * @param[in] state power manager state - LCD_NORMAL, LCD_DIM, LCD_OFF + * @return 0 on success, -1 if failed. + * @see pm_lock_state(), pm_unlock_state() + * @pat Example + * @code + * ... + * result = pm_change_state(LCD_OFF); + * if( result < 0 ) + * printf("[ERROR] return value result =%d, \n",result); + * else + * printf("[SUCCESS]return value result =%d \n",result); + * ... + * @endcode + */ + int pm_change_state(unsigned int); + +#ifdef __cplusplus +} +#endif +#endif /* __POWER_MANAGER_LIBRARY_MANAGED_H__ */ |