diff options
Diffstat (limited to 'power_hal')
-rwxr-xr-x | power_hal/LICENSE | 177 | ||||
-rwxr-xr-x | power_hal/Makefile | 66 | ||||
-rwxr-xr-x | power_hal/README.md | 3 | ||||
-rwxr-xr-x | power_hal/hal_api/power_hal.h | 572 | ||||
-rwxr-xr-x | power_hal/src/power_hal.cpp | 97 |
5 files changed, 915 insertions, 0 deletions
diff --git a/power_hal/LICENSE b/power_hal/LICENSE new file mode 100755 index 0000000..f433b1a --- /dev/null +++ b/power_hal/LICENSE @@ -0,0 +1,177 @@ + + 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 diff --git a/power_hal/Makefile b/power_hal/Makefile new file mode 100755 index 0000000..b0a0c28 --- /dev/null +++ b/power_hal/Makefile @@ -0,0 +1,66 @@ +# +# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. +# +# 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. +# + +######### installed program/file ################ +TARGET := libpower_hal.so + +HEADER := hal_api/power_hal.h + +######### include paths/files ################### +CXXFLAGS += -I./hal_api/ +CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include +#CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include/stub +CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h + +######### compile options ####################### +CXXFLAGS += -Wall -fPIC + +######### link options ########################## +LDFLAGS += -shared +LDFLAGS += -Wl,--no-as-needed +LDFLAGS += -Wl,--no-undefined +LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib + +RPATH := /usr/agl/lib + +######### linked library ######################## +LIBS += -Wl,-Bdynamic -lstdc++ +#LIBS += -Wl,-Bdynamic -lCommUSB + +######### source files ########################## +VPATH := src +OBJS := power_hal.o + +######### make targets ########################## +all: $(TARGET) + @echo $@ done. + +$(TARGET): $(OBJS) + $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET) + @echo $@ done. + +######### make cleans ########################### +GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno)) + +clean: + rm -f $(OBJS) $(TARGET) $(GCNO_FILES) + @echo $@ done. + +######### make installs ######################### +install: + install -d -m 0755 $(DESTDIR)/usr/lib + install -m 0755 $(TARGET) $(DESTDIR)/usr/lib + @echo $@ done. diff --git a/power_hal/README.md b/power_hal/README.md new file mode 100755 index 0000000..6841186 --- /dev/null +++ b/power_hal/README.md @@ -0,0 +1,3 @@ +power_hal library +================== +Power HAL implementation library for AGL Reference Board. diff --git a/power_hal/hal_api/power_hal.h b/power_hal/hal_api/power_hal.h new file mode 100755 index 0000000..f1acc42 --- /dev/null +++ b/power_hal/hal_api/power_hal.h @@ -0,0 +1,572 @@ +/* + * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/** + * @file power_hal.h + * @brief Interface and struct define for power_hal + */ + +#ifndef HAL_API_POWER_HAL_H_ +#define HAL_API_POWER_HAL_H_ + +#include <native_service/frameworkunified_types.h> + +/** @addtogroup system_manager + * @{ + */ +/** @addtogroup power_hal + * @ingroup system_manager + * @{ + */ +/** @}*/ // end of power_hal +/** @}*/ // end of system_manager + +/** @addtogroup power_supply_manager_shadow + * @{ + */ +/** @addtogroup power_hal + * @ingroup power_supply_manager_shadow + * @{ + */ + +/** + * \~english Definition of program update is not occured + */ +#define PWR_PROGUPDATE_STATE_NONE (0x0) + +/** + * \~english Bit position of program update + */ +#define PWR_PROGUPDATE_STATE_UPDATED (0x01) + +/** + * \~english Bit position of map update + */ +#define PWR_PROGUPDATE_STATE_MAP_UPDATED (0x02) + +/** + * \~english Bit position of map difference update + */ +#define PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED (0x04) + +/** + * \~english None reset state + */ +#define PWR_DATA_RESET_STATE_NONE 0 + +/** + * \~english Reset state for initialization of user information + */ +#define PWR_DATA_RESET_STATE_USER 1 + +/** + * \~english Reset state for factory initialization + */ +#define PWR_DATA_RESET_STATE_FACTORY 2 + +/* + * @~english + * @brief Command ID power_hal -> User + */ +/*! @~english power_hal command receive notification */ +#define CID_PWR_CMD_RCV 0x0103 + +/*! @~english power_hal command send result notification */ +#define CID_PWR_CMD_SND_STS 0x0104 + +/** + * \~english DRAM backup status + */ +enum PsmSysupDramT { + /** + * \~english normal value + */ + PSM_SYSUP_DRAM_NORMAL, + + /** + * \~english abnormal Soft Reset(software abnormality) + */ + PSM_SYSUP_DRAM_SFTERRSR, + + /** + * \~english need to discard backup dram + */ + PSM_SYSUP_DRAM_DISCARD, + + /** + * \~english max value + */ + PSM_SYSUP_DRAM_MAX, +}; + +/** + * \~english Start Status + */ +enum PsmStartStatusT { + /** + * \~english cold start + */ + PSM_START_STATUS_FACTRESET, + + /** + * \~english hot start + */ + PSM_START_STATUS_NORMAL, + + /** + * \~english max value + */ + PSM_START_STATUS_MAX, +}; + +/** + * \~english Communication state + */ +enum PsmComStsT { + /** + * \~english Communication normal + */ + PSM_COM_STS_NORMAL, + + /** + * \~english Communication abnormal + */ + PSM_COM_STS_ABNORMAL, + + /** + * \~english max value + */ + PSM_COM_STS_MAX, +}; + +/** + * \~english DRAM power supply abnormality check result + */ +enum PsmDramStsT { + /** + * \~english DRAM power supply abnormality check result normal + */ + PSM_DRAM_STS_NORMAL, + + /** + * \~english DRAM power supply abnormality check result abnormal + */ + PSM_DRAM_STS_ABNORMAL, + + /** + * \~english max value + */ + PSM_DRAM_STS_MAX, +}; + +/** + * \~english ACC customize setting. + */ +enum PsmAccCustomizeT { + /** + * \~english ACC customize setting OFF. + */ + PSM_ACC_CUSTOMIZE_OFF, + /** + * \~english ACC customize setting ON. + */ + PSM_ACC_CUSTOMIZE_ON +}; + +/** + * \~english Reset history recording flag. + */ +#define PSM_RESET_HISTORY (0x10000000) + +/** + * \~english Reset(Start-up) factor. + */ +enum PsmFactorT { + /** + * \~english none + */ + PSM_FACTOR_NONE, + /** + * \~english Restart due to AGL. + */ + PSM_FACTOR_AGL, + /** + * \~english Restart due to Tier1. + */ + PSM_FACTOR_TIER1, + /** + * \~english Restart due to user. + */ + PSM_FACTOR_USER, + /** + * \~english Restart due to AGL(Need to record reset history). + */ + PSM_FACTOR_AGL_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_AGL), + /** + * \~english Restart due to Tier1(Need to record reset history). + */ + PSM_FACTOR_TIER1_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_TIER1), + /** + * \~english Restart due to user(Need to record reset history). + */ + PSM_FACTOR_USER_WITH_HISTORY = (PSM_RESET_HISTORY | PSM_FACTOR_USER) +}; + +/** + * \~english Reset information type. + */ +enum PowerHalResetInfoId { + /** + * \~english Count of error log. + */ + AGL_ERRLOG_COUNTER = 0, + /** + * \~english Abnormal reset count detected by AGL. + */ + AGL_RESET_COUNTER, + /** + * \~english State of program update. + */ + AGL_PROGUPDATE_STATE, + /** + * \~english Data reset state. + */ + AGL_DATARESET_STATE, + /** + * \~english Flag of abnormal reset. + */ + AGL_ILLRESET_FLAG, + /** + * \~english Max of reset information type. + */ + AGL_RESERVED_LIMIT = 32 +}; + +/** + * \ingroup PsmNaviResetPower + * \~english @par Brief + * API to do navi reset that is forced reset if end sequence of MainSoC is not completed. + * \~english @param [in] h_app Handle for Application + * \~english @param [in] reset_factor Reset factor + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do navi reset process. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmNaviResetPower(HANDLE h_app, PsmFactorT reset_factor); + +/** + * \ingroup PsmClrRamJudgeFlgPower + * \~english @par Brief + * API to do ram judge flag clear + * \~english @param [in] h_app Handle for Application + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do ram judge flag clear process. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmClrRamJudgeFlgPower(HANDLE h_app); + +/** + * \ingroup PsmGetDramBackupStatusPower + * \~english @par Brief + * API to do get dram backup status + * \~english @param [in] h_app Handle for Application + * \~english @param [out] p_dram1 DRAM1 BackUp Status + * \~english @param [out] p_dram2 DRAM2 BackUp Status + * \~english @param [out] p_dram3 DRAM3 BackUp Status + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do get dram backup status process. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmGetDramBackupStatusPower(HANDLE h_app, PsmSysupDramT *p_dram1, PsmSysupDramT *p_dram2, PsmSysupDramT *p_dram3); + +/** + * \ingroup PsmGetStartStatusPower + * \~english @par Brief + * API to do get start status + * \~english @param [in] h_app Handle for Application + * \~english @param [out] p_start_sts start status + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do get startup state process. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmGetStartStatusPower(HANDLE h_app, PsmStartStatusT *p_start_sts); + +/** + * \ingroup PsmGetSyscomStatusPower + * \~english @par Brief + * API to do get communication status between mainsoc-sys + * \~english @param [in] h_app Handle for Application + * \~english @param [out] p_com_sts communication status between mainsoc-sys + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do get communication status between mainsoc-sys process. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmGetSyscomStatusPower(HANDLE h_app, PsmComStsT *p_com_sts); + +/** + * \ingroup PsmGetDramPowerSupplyAbnormalityCheckResultPower + * \~english @par Brief + * API to do get dram power supply abnormality check result + * \~english @param [in] h_app Handle for Application + * \~english @param [out] p_dram_sts DRAM power supply abnormality check result + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do get dram power supply abnormality check result process. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmGetDramPowerSupplyAbnormalityCheckResultPower(HANDLE h_app, PsmDramStsT *p_dram_sts); + +/** + * \ingroup PsmGetAccCustomizeSetting + * \~english @par Brief + * API to do get ACC customize setting + * \~english @param [in] h_app Handle for Application + * \~english @param [out] p_acc_customize ACC customize Setting + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do get ACC customize setting. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmGetAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT* p_acc_customize); + +/** + * \ingroup PsmChgAccCustomizeSetting + * \~english @par Brief + * API to do change ACC customize setting + * \~english @param [in] h_app Handle for Application + * \~english @param [in] acc_customize ACC customize Setting + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do set ACC customize setting. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmChgAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT acc_customize); + +/** + * \ingroup PsmGetStartupFactor + * \~english @par Brief + * API to do get start-up factor. + * \~english @param [in] h_app Handle for Application + * \~english @param [out] p_startup_factor Start-up factor + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * \~english @par Detail + * - do get Start-up factor. + * - After the API call, start-up factor is clear. + * - The API can only be used by 1 process + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +int PsmGetStartupFactor(HANDLE h_app, PsmFactorT* p_startup_factor); + +/** + * \ingroup PowerHalSetResetInfo + * \~english @par Brief + * API to do set reset information. + * \~english @param [in] id Reset information type. + * \~english @param [in] val setting value. + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * - Save error to non-volatile memory. [-1] + * \~english @par Detail + * - Do set value to Reset information type(\ref PowerHalResetInfoId). \n + * \ref AGL_PROGUPDATE_STATE is not applicable(Only get value used by \ref PowerHalGetResetInfo). \n + * Domains of each reset information type are as below. \n + * \ref AGL_ERRLOG_COUNTER : 0 <= val <= UINT32_MAX \n + * \ref AGL_RESET_COUNTER : 0 <= val <= UINT32_MAX \n + * \ref AGL_DATARESET_STATE : It is set as below in each state of data reset. \n + * None reset state == \ref PWR_DATA_RESET_STATE_NONE \n + * Reset state for initialization of user information == \ref PWR_DATA_RESET_STATE_USER \n + * Reset state for factory initialization == \ref PWR_DATA_RESET_STATE_FACTORY \n + * \ref AGL_ILLRESET_FLAG : val = 0 or 1 (Abnormal reset is 1) + * - When the API is success, setting value is saved as non-volatile data. + * - Non-volatile memory is allocated \ref AGL_RESERVED_LIMIT for extendability. + * - Values setting by the API are saved when it is cold start(is_batterydiscon is true of PsmSysMcEVSysResUpChkPrmT notified from power_hal). + * - The API is completed within 1msec after the API is called. + * - The API can only be used by 1 process. + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * PowerHalGetResetInfo + */ +int PowerHalSetResetInfo(enum PowerHalResetInfoId id, uint32_t val); + +/** + * \ingroup PowerHalGetResetInfo + * \~english @par Brief + * API to do get setting value of reset information . + * \~english @param [in] id Reset information type. + * \~english @param [out] val Buffer of value. + * \~english @retval 0 : Ok + * \~english @retval -1 : Failed + * \~english @par Prerequisite + * - None + * \~english @par Change of internal state + * - Change of internal state according to the API does not occur. + * \~english @par Conditions of processing failure + * - Internal IO error. [-1] + * - Read fail of value. [-1] + * \~english @par Detail + * - Do get value from each reset information type(\ref PowerHalResetInfoId). + * - Value of \ref AGL_PROGUPDATE_STATE, low 3bits are assigned as below, \n + * and corresponding bit is set if state is updating. \n + * Low 1bit(\ref PWR_PROGUPDATE_STATE_UPDATED) : Program update \n + * Low 2bit(\ref PWR_PROGUPDATE_STATE_MAP_UPDATED) : Map update \n + * Low 3bit(\ref PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED) : Map difference update \n + * - The API is completed within 1msec after the API is called. + * - Completeness of data getting by the API is assured by lower layer than power_hal, \n + * and return -1 as internal IO error when it is occurred abnormal error. + * - The API can only be used by 1 process. + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * PowerHalSetResetInfo + */ +int PowerHalGetResetInfo(enum PowerHalResetInfoId id, uint32_t *val); + +/** @}*/ // end of power_hal +/** @}*/ // end of power_supply_manager_shadow + +#endif // HAL_API_POWER_HAL_H_ diff --git a/power_hal/src/power_hal.cpp b/power_hal/src/power_hal.cpp new file mode 100755 index 0000000..aba2d1e --- /dev/null +++ b/power_hal/src/power_hal.cpp @@ -0,0 +1,97 @@ +/* + * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. + * + * 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 "power_hal.h" + +int PsmNaviResetPower(HANDLE h_app, PsmFactorT reset_factor) { + if (NULL == h_app) { + return -1; + } + + return 0; +} + +int PsmClrRamJudgeFlgPower(HANDLE h_app) { + if (NULL == h_app) { + return -1; + } + + return 0; +} + +int PsmGetDramBackupStatusPower(HANDLE h_app, PsmSysupDramT *p_dram1, PsmSysupDramT *p_dram2, PsmSysupDramT *p_dram3) { + if (NULL == h_app) { + return -1; + } + + return 0; +} + +int PsmGetStartStatusPower(HANDLE h_app, PsmStartStatusT *p_start_sts) { + if (NULL == h_app) { + return -1; + } + + return 0; +} + +int PsmGetSyscomStatusPower(HANDLE h_app, PsmComStsT *p_com_sts) { + if (NULL == h_app) { + return -1; + } + + return 0; +} + +int PsmGetDramPowerSupplyAbnormalityCheckResultPower(HANDLE h_app, PsmDramStsT *p_dram_sts) { + if (NULL == h_app) { + return -1; + } + + return 0; +} + +int PsmGetAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT* p_acc_customize) { + if (NULL == h_app) { + return -1; + } + *p_acc_customize = PSM_ACC_CUSTOMIZE_ON; + return 0; +} + +int PsmChgAccCustomizeSetting(HANDLE h_app, PsmAccCustomizeT acc_customize) { + if (NULL == h_app) { + return -1; + } + + return 0; +} + +int PsmGetStartupFactor(HANDLE h_app, PsmFactorT* p_startup_factor) { + if (NULL == h_app) { + return -1; + } + *p_startup_factor = PSM_FACTOR_NONE; + return 0; +} + +int PowerHalSetResetInfo(enum PowerHalResetInfoId id, uint32_t val) { + return 0; +} + +int PowerHalGetResetInfo(enum PowerHalResetInfoId id, uint32_t *val) { + return 0; +} |