diff options
Diffstat (limited to 'systemservice/rom_access_library')
22 files changed, 0 insertions, 4648 deletions
diff --git a/systemservice/rom_access_library/LICENSE b/systemservice/rom_access_library/LICENSE deleted file mode 100755 index f433b1a..0000000 --- a/systemservice/rom_access_library/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - 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/systemservice/rom_access_library/Makefile.client b/systemservice/rom_access_library/Makefile.client deleted file mode 100755 index adb1845..0000000 --- a/systemservice/rom_access_library/Makefile.client +++ /dev/null @@ -1,19 +0,0 @@ -# -# @copyright Copyright (c) 2016-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. -# - -SUBDIRS += library mock - -include ../system_service.mk diff --git a/systemservice/rom_access_library/library/Makefile b/systemservice/rom_access_library/library/Makefile deleted file mode 100755 index e8c64b2..0000000 --- a/systemservice/rom_access_library/library/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# @copyright Copyright (c) 2016-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. -# - -SUBDIRS := nor rom - -include ../../system_service.mk diff --git a/systemservice/rom_access_library/library/include/rom_access_library_nor.h b/systemservice/rom_access_library/library/include/rom_access_library_nor.h deleted file mode 100755 index 417b78f..0000000 --- a/systemservice/rom_access_library/library/include/rom_access_library_nor.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// @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 rom_access_library_nor.h - * @brief This file include the head file of nor access - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup system_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup rom_access_library - * @ingroup system_service - * @{ - */ - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_ - -#include "system_service/nor_backup.h" - -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_NOR_H_ - -/** @}*/ // end of rom_access_library -/** @}*/ // end of system_service -/** @}*/ // end of BaseSystem diff --git a/systemservice/rom_access_library/library/include/rom_access_library_rom.h b/systemservice/rom_access_library/library/include/rom_access_library_rom.h deleted file mode 100755 index 1e02e6e..0000000 --- a/systemservice/rom_access_library/library/include/rom_access_library_rom.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// @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 rom_access_library_rom.h - * @brief This file include all head file of rom access - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup system_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup rom_access_library - * @ingroup system_service - * @{ - */ - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_ - -#include "system_service/ss_sm_rom_access.h" -#include "system_service/ss_sm_boot_access.h" -#include "system_service/ss_sm_ram_access.h" - -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_ROM_ACCESS_LIBRARY_ROM_H_ - -/** @}*/ // end of rom_access_library -/** @}*/ // end of system_service -/** @}*/ // end of BaseSystem diff --git a/systemservice/rom_access_library/library/include/ss_rom_access_define.h b/systemservice/rom_access_library/library/include/ss_rom_access_define.h deleted file mode 100755 index 689fea2..0000000 --- a/systemservice/rom_access_library/library/include/ss_rom_access_define.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * @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. - */ - - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_ - -#include <errno.h> - -#define ROM_ACCESS_ASERT(x) \ - if (!(x)) { \ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT"); \ - } - -#define ROM_ACCESS_ERRNO(x) \ - if (!(x)) { \ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SS_ASSERT %d:%s", errno, strerror(errno)); \ - } - -#define ROM_ACCESS_STATIC_ASERT(expr) \ - { \ - char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \ - (void)STATIC_ASSERTION_FAILED; \ - } -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_DEFINE_H_ diff --git a/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h b/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h deleted file mode 100755 index e62b5af..0000000 --- a/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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. - */ - -/////////////////////////////////////////////////////////////////////////////// -/// \ingroup tag_SS_RomAccess -/// \brief This file supports AGL application logging. -/// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_ -#include <native_service/ns_logger_if.h> - -#define ZONE_INIT ZONEMASK(10) -#define ZONE_FUNC ZONEMASK(11) -#define ZONE_MEM ZONEMASK(12) -#define ZONE_13 ZONEMASK(13) -#define ZONE_14 ZONEMASK(14) -#define ZONE_15 ZONEMASK(15) -#define ZONE_16 ZONEMASK(16) -#define ZONE_17 ZONEMASK(17) -#define ZONE_18 ZONEMASK(18) -#define ZONE_19 ZONEMASK(19) -#define ZONE_20 ZONEMASK(20) -#define ZONE_21 ZONEMASK(21) -#define ZONE_22 ZONEMASK(22) -#define ZONE_23 ZONEMASK(23) -#define ZONE_24 ZONEMASK(24) -#define ZONE_25 ZONEMASK(25) -#define ZONE_26 ZONEMASK(26) -#define ZONE_27 ZONEMASK(27) -#define ZONE_28 ZONEMASK(28) -#define ZONE_INFO ZONEMASK(29) -// #define ZONE_WARN ZONEMASK(30) -// #define ZONE_ERR ZONEMASK(31) - - -#define ZONE_TEXT_10 "Init" -#define ZONE_TEXT_11 "Function" -#define ZONE_TEXT_12 "Memory" -#define ZONE_TEXT_13 "" -#define ZONE_TEXT_14 "" -#define ZONE_TEXT_15 "" -#define ZONE_TEXT_16 "" -#define ZONE_TEXT_17 "" -#define ZONE_TEXT_18 "" -#define ZONE_TEXT_19 "" -#define ZONE_TEXT_20 "" -#define ZONE_TEXT_21 "" -#define ZONE_TEXT_22 "" -#define ZONE_TEXT_23 "" -#define ZONE_TEXT_24 "" -#define ZONE_TEXT_25 "" -#define ZONE_TEXT_26 "" -#define ZONE_TEXT_27 "" -#define ZONE_TEXT_28 "" -#define ZONE_TEXT_29 "Info" -// These ARE RESERVED AND SHOULDN'T BE TOUCHED -// USE THEM WHEN REALLY NEEDED!!!!! -#define ZONE_TEXT_30 "Warning" -#define ZONE_TEXT_31 "Error" -#define ZONE_WARN ZONEMASK(30) -#define ZONE_ERR ZONEMASK(31) -#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF - -#ifndef FRAMEWORKUNIFIEDLOGOPTIONS -#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER -#endif - -#ifndef FRAMEWORKUNIFIEDLOGAPPZONES -#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, WARN -#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */ - -extern const CHAR kAppName[]; - -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_ROM_ACCESS_IF_ROMACCESSLIBRARYLOG_H_ diff --git a/systemservice/rom_access_library/library/include/ss_sm_checksum.h b/systemservice/rom_access_library/library/include/ss_sm_checksum.h deleted file mode 100755 index 271964c..0000000 --- a/systemservice/rom_access_library/library/include/ss_sm_checksum.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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. - */ - -/////////////////////////////////////////////////////////////////////////////// -/// \ingroup tag_SystemManager -/// \brief This file provides for checksum calculation. -/// -/////////////////////////////////////////////////////////////////////////////// -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_ - -#include <native_service/frameworkunified_types.h> -class CSMChecksum { - public: - CSMChecksum(); - ~CSMChecksum(); - UI_32 cal_checksum(const void* p_buf, size_t buf_size); - - private: -}; -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SS_SM_CHECKSUM_H_ diff --git a/systemservice/rom_access_library/library/include/system_service/nor_backup.h b/systemservice/rom_access_library/library/include/system_service/nor_backup.h deleted file mode 100755 index 8c95a10..0000000 --- a/systemservice/rom_access_library/library/include/system_service/nor_backup.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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 nor_backup.h - * @brief This file provides API for get nor flash information - */ - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup system_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup rom_access_library - * @ingroup system_service - * @{ - */ -#if defined(__cplusplus) -extern "C" { -#endif // __cplusplus - -/** - * \~english Common return value: Normal return value of API - */ -#define RET_DEV_NORMAL 0 - -/** - * \~english Common return value: Parameter error return value of API - */ -#define RET_DEV_ERR_PARAM 3 - -/** - * \~english Common return value: Error of getting device info - */ -#define RET_DEV_ERROR 4 - -/** - * \~english Read API return value: Internal error - */ -#define RET_DEV_RD_ERR_OTHER 1 - -/** - * \~english Read API return value: Acquire buffer error(malloc) - */ -#define RET_DEV_RD_ERR 2 - -/** - * \~english Read API return value: error type 1 - */ -#define RET_DEV_RD_ERR_1 -1 - -/** - * \~english Read API return value: error type 2 - */ -#define RET_DEV_RD_ERR_2 -2 - -/** - * \~english Read API return value: error type 3 - */ -#define RET_DEV_RD_ERR_3 -3 - -/** - * \~english Read API return value: error type 4 - */ -#define RET_DEV_RD_ERR_4 -4 - -/** - * \~english Write API return value: Other error - */ -#define RET_DEV_WT_ERR_OTHER 1 - -/** - * \~english Write API return value: Internal error - */ -#define RET_DEV_WT_ERR 2 - -/**\ingroup mtdn_backup_Read - * \~english @par Brief - * Read data from norflash device. - * \~english @param [in] path_name - * const char* - Device path to read(such as "/dev/mtd1ro") - * \~english @param [in] i_id - * int - Main block ID(0, 2, 4, ...) - * \~english @param [in] i_offset - * int - Data offset - * \~english @param [in] i_size - * int - Data size to read - * \~english @param [in] p_buff - * Void* - Buffer for storing read data - * \~english @retval RET_DEV_NORMAL OK - * \~english @retval RET_DEV_ERROR Get device error - * \~english @retval RET_DEV_ERR_PARAM Parameter error - * \~english @retval RET_DEV_RD_ERR_OTHER Internal error - * \~english @retval RET_DEV_RD_ERR Acquire buffer error(malloc) - * \~english @retval RET_DEV_RD_ERR_1 Error type 1 - * \~english @retval RET_DEV_RD_ERR_2 Error type 2 - * \~english @retval RET_DEV_RD_ERR_3 Error type 3 - * \~english @retval RET_DEV_RD_ERR_4 Error type 4 - * \~english @par Preconditions - * - There is no preconditions for this API. - * \~english @par Change of internal state - * - Change of internal state according to the API does not occur. - * \~english @par Conditions of processing failure - * - Parameter path_name is NULL. [RET_DEV_ERR_PARAM] - * - Parameter p_buff is NULL. [RET_DEV_ERR_PARAM] - * - Value of parameter i_id is less than 0. [RET_DEV_ERR_PARAM] - * - Value of parameter i_offset is less than 0 or value of parameter i_size - * is not greater than 0. [RET_DEV_ERR_PARAM] - * - Device specified by path_name is invalid. [RET_DEV_ERR_PARAM] - * - Sum value of i_offset and i_size is greater than block size - 16byte. - * [RET_DEV_ERR_PARAM] - * - Failed to get device info. [RET_DEV_ERROR] - * - Failed to acquire the send/receive buffer(malloc). [RET_DEV_RD_ERR] - * - Internal IO error(open, read, close, ioctl, lseek, other error). - * [RET_DEV_RD_ERR_OTHER] - * - Check text error of main block and backup block. [RET_DEV_RD_ERR_1] - * - Check text error of main block and checksum error of backup block. - * [RET_DEV_RD_ERR_2] - * - Checksum error of main block and check text error of backup block. - * [RET_DEV_RD_ERR_3] - * - Checksum error of main block and backup block. [RET_DEV_RD_ERR_4] - * \~english @par Detail - * - This API gets data from main or backup block according to specified\n - * norflash device pathname and main block ID. - * \~english @par - * - When this API is executed, read data from main block first. If failed to\n - * read main block, return RET_DEV_RD_ERR_OTHER. If read main block success,\n - * but check main block data error, turn to read data from backup block which\n - * block ID is i_id + 1. - * \~english @par Classification - * Public - * \~english @par Type - * Sync Only - * \~english @see mtdn_backup_Write - */ -int mtdn_backup_Read(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff); - -/**\ingroup mtdn_backup_Write - * \~english @par Brief - * Write data to norflash device. - * \~english @param [in] path_name - * const char* - Device path to write(such as "/dev/mtd") - * \~english @param [in] i_id - * int - Main block ID(0, 2, 4, ...) - * \~english @param [in] i_offset - * int - Data offset - * \~english @param [in] i_size - * int - Data size to write - * \~english @param [in] p_buff - * Void* - Buffer for storing written data - * \~english @retval RET_DEV_NORMAL OK - * \~english @retval RET_DEV_ERROR Get device error - * \~english @retval RET_DEV_ERR_PARAM Parameter error - * \~english @retval RET_DEV_WT_ERR_OTHER Other error - * \~english @retval RET_DEV_WT_ERR Internal error - * \~english @par Preconditions - * - There is no preconditions for this API. - * \~english @par Change of internal state - * - Change of internal state according to the API does not occur. - * \~english @par Conditions of processing failure - * - Parameter path_name is NULL. [RET_DEV_ERR_PARAM] - * - Parameter p_buff is NULL. [RET_DEV_ERR_PARAM] - * - Value of parameter i_id is less than 0. [RET_DEV_ERR_PARAM] - * - Value of parameter i_offset is less than 0 or value of parameter i_size - * is not greater than 0. [RET_DEV_ERR_PARAM] - * - Device specified by path_name is invalid. [RET_DEV_ERR_PARAM] - * - Sum value of i_offset and i_size is greater than block size - 16byte. - * [RET_DEV_ERR_PARAM] - * - Failed to get device info. [RET_DEV_ERROR] - * - Internal processing error(Other error). [RET_DEV_WT_ERR_OTHER] - * - Internal IO error(open, write, close, ioctl, malloc, lseek). - * [RET_DEV_WT_ERR] - * \~english @par Detail - * - This API writes data to main and backup blocks according to specified\n - * norflash device pathname and main block ID. - * \~english @par - * - When this API is executed, p_buff data will be write to main and backup\n - * blocks. If failed to write any block, return RET_DEV_WT_ERR. - * \~english @par Classification - * Public - * \~english @par Type - * Sync Only - * \~english @see mtdn_backup_Read - */ -int mtdn_backup_Write(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff); - -#if defined(__cplusplus) -} -#endif // __cplusplus - -/** @}*/ // end of rom_access_library -/** @}*/ // end of system_service -/** @}*/ // end of BaseSystem -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_NOR_BACKUP_H_ diff --git a/systemservice/rom_access_library/library/include/system_service/rom_access_library.h b/systemservice/rom_access_library/library/include/system_service/rom_access_library.h deleted file mode 100755 index 50e44b1..0000000 --- a/systemservice/rom_access_library/library/include/system_service/rom_access_library.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// @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 rom_access_library.h - * @brief This file include all head file of rom and nor access library - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup system_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup rom_access_library - * @ingroup system_service - * @{ - */ - -#ifndef SYSTEMSERVICE_ROMACCESSLIBRARY_H_ // NOLINT(build/header_guard) -#define SYSTEMSERVICE_ROMACCESSLIBRARY_H_ - -#include "system_service/nor_backup.h" - -#include "system_service/ss_sm_rom_access.h" -#include "system_service/ss_sm_boot_access.h" -#include "system_service/ss_sm_ram_access.h" - -#endif // SYSTEMSERVICE_ROMACCESSLIBRARY_H_ - -/** @}*/ // end of rom_access_library -/** @}*/ // end of system_service -/** @}*/ // end of BaseSystem diff --git a/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h b/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h deleted file mode 100755 index bac051c..0000000 --- a/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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 ss_sm_boot_access.h - * @brief This file provides API for get boot information from nor flash - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup system_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup rom_access_library - * @ingroup system_service - * @{ - */ - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_ - -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_types.h> - -// Top memory map of LINUX management outside domain (SYS area) -// Must not use it other than the model of C language specifications to refer to BOOT - -#define LBM_UINT32 unsigned int -#define LBM_UINT16 uint16_t -#define LBM_UINT8 unsigned char -#define LBM_INT64 int64_t -#define LBM_INT32 unsigned int -#define LBM_INT16 uint16_t -#define LBM_INT8 unsigned char - -// Each domain size -#define LBM_NOR_MIRROR_SIZE 0x10000 // MIRROR area of NOR -#define LBM_DRAM_SIZE 0x10000 // RAM area to share with BOOT in LINUX - -#define LBM_NOR_BOOT_SIZE 128 -#define LBM_NOR_TSKM_SIZE 128 -#define LBM_NOR_VUP_SIZE 1024 -#define LBM_NOR_ANA_SIZE 32 -#define LBM_NOR_VEHI_SIZE 32 -#define LBM_NOR_DEVMGR_SIZE 32 - - -//********* Value of the field **************** -/* SDRAMstart identification */ -#define SYSUP_DRAM_NORMAL (LBM_UINT32)0x4E524E52 /* normal value NRNR*/ -#define SYSUP_DRAM_SFTERRSR (LBM_UINT32)0x73667366 /* abnormal Soft Reset(softwareabnormality) sfsf*/ -#define SYSUP_DRAM_DISCARD (LBM_UINT32)0x44434443 /* need to discard backup DCDC*/ - -/* Start is in a state (navigator initial use)/System start state */ -#define SYSUP_CND_FACTRESET (LBM_UINT16)0x434c /* COLD START */ -#define SYSUP_CND_NORMAL (LBM_UINT16)0x4853 /* HOT START */ - -/* Start mode preservation table level */ -#define SYSUP_MODE_NORMAL (LBM_UINT32)0x4E524E52 /* normal mode */ -#define SYSUP_MODE_VERUP (LBM_UINT32)0x56555655 /* versionup mode */ - -/* Communication state between NAVI-SYS */ -#define SUBCPU_STS_NOMAL (LBM_UINT32)0x00000000 /* Communication normal */ -#define SUBCPU_STS_COMNG (LBM_UINT32)0x88888888 /* Communication abnormal */ - -/* SDRAM power supply abnormality detection */ -#define SDRAM_STS_NOMAL (LBM_UINT32)0x11111111 /* backup power supply is normal */ -#define SDRAM_STS_BUPNG (LBM_UINT32)0x99999999 /* backup power supply is abnormal */ - -/* HWDT Outbreak */ -#define HWDT_STS_NOMAL (LBM_UINT32)0x22222222 /* WDT normal */ -#define HWDT_STS_WDTTO (LBM_UINT32)0xAAAAAAAA /* WDT time-out outbreak */ - -/* SWDT Outbreak */ -#define SWDT_STS_NOMAL HWDT_STS_NOMAL /* SWDT normal */ -#define SWDT_STS_WDTTO HWDT_STS_WDTTO /* SWDT time-out outbreak */ - -/* Start side */ -#define IFS_PROG1_CODE (LBM_UINT8)0xAA /* Side PROG1 */ -#define IFS_PROG2_CODE (LBM_UINT8)0x55 /* Side PROG2 */ - -/* Start infomation ID */ -#define UPTBLE_ID_MAX (LBM_UINT8)0x20 /* LBM_UPTBLINFO Maximum value */ -#define UPTBLE_ID_NORBOOT (LBM_UINT8)0x00 /* NOR-BOOT ID */ -#define UPTBLE_ID_SCRLDR (LBM_UINT8)0x01 /* SecureLoader ID */ -#define UPTBLE_ID_NANDBOOT (LBM_UINT8)0x02 /* NAND-BOOT ID */ -#define UPTBLE_ID_ROOTFS (LBM_UINT8)0x03 /* Rootfs1 ID */ -#define UPTBLE_ID_ROOTFS2 (LBM_UINT8)0x04 /* Rootfs2 ID */ - -/* Start status */ -#define STUP_STS_NORMAL (LBM_UINT32)0x00000000 /* normal status */ -/* Rollback of protectionism is necessary by abnormal reset repetition */ -#define STUP_STS_ERROR_DETEC (LBM_UINT32)0x22222222 -#define STUP_STS_UPDATING (LBM_UINT32)0x33333333 /* updating status */ -/* not for use(will be removed) */ -#define STUP_STS_SIGNVRFY_ERROR (LBM_UINT32)0x11111111 - -/* mdUpdate/sdUpdate */ -#define UPDATE_NOTI_NONE (LBM_UINT32)0x00000000 /* Notify is NOT required. */ -#define UPDATE_NOTI_EXIST (LBM_UINT32)0xEEEEEEEE /* Notify is required. */ - -/* RAM Judge Flag */ -#define RAMJUDGE_STS_NOMAL (LBM_UINT32)0x44444444 /* RAM Judge Port is High */ -#define RAMJUDGE_STS_NG (LBM_UINT32)0xDDDDDDDD /* RAM Judge Port is Low */ - -/* DRAM Self Refresh */ -#define SELF_REFRESH_OK (LBM_UINT32)0x55555555 /* DRAM Self Refresh is OK */ -#define SELF_REFRESH_NG (LBM_UINT32)0xCCCCCCCC /* DRAM Self Refresh is NG */ - -/* Release ROM type */ -#define PRODUCTROM (LBM_UINT32)0x11111111 -#define RELEASEROM (LBM_UINT32)0x22222222 -#define RELEASEROM_REMAIN_USBBOOT (LBM_UINT32)0x44444444 -#define DEBUGROM (LBM_UINT32)0x88888888 - -/* Boot write Nor */ -#define WRITE_NONE (LBM_UINT32)0x00000000 -#define WRITE_DONE (LBM_UINT32)0x11111111 - - -/* opdtLoadSatus */ -#define DEFAULT_OPIMAGE_DRAM_BACKUPED (LBM_UINT32)0x00000000 -#define DEFAULT_OPIMAGE_FROM_EMMC (LBM_UINT32)0xAAAAAAAA -#define SPECIFIC_OPIMAGE_DRAM_BACKUPED (LBM_UINT32)0x11111111 -#define SPECIFIC_OPIMAGE_FROM_EMMC (LBM_UINT32)0xBBBBBBBB - -/* opdtLoadFactor */ -#define SPECIFIC_OPIMAGE_FLAG_NONE (LBM_UINT32)0x00000000 -#define SPECIFIC_OPIMAGE_FILE_NONE (LBM_UINT32)0x11111111 -#define SPECIFIC_OPIMAGE_FILESIZE_0 (LBM_UINT32)0x22222222 -#define SPECIFIC_OPIMAGE_FILE_EXIST (LBM_UINT32)0xEEEEEEEE - - -#pragma pack(push, 4) - -// Memory map of the SYS area of the mem0 - -#define SS_SYS_AREA_BOOT_MAX_SIZE (0x00010000UL) - -#define SS_SYS_AREA_ROM_OFFSET (0x00010000UL) -#define SS_SYS_AREA_ROM_MAX_SIZE (0x00001000UL) - -#define SS_SYS_AREA_RAM_OFFSET (0x00011000UL) -#define SS_SYS_AREA_RAM_MAX_SIZE (0x00001000UL) - -//********* NOR area **************** -typedef struct LBM_boot_wpinfo_t { - LBM_UINT32 currentside; // IFS_PROG*_CODE - LBM_UINT32 stupStsA; // STUP_STS_* - LBM_UINT32 stupStsB; // STUP_STS_* -}LBM_UPTBLINFO; - -typedef struct LBM_boot_t { - LBM_UINT32 sts1; // SYSUP_CND_* - LBM_UINT32 btmode; // SYSUP_MODE_* - LBM_UINT32 sts2; // SYSUP_CND_* - LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX]; - LBM_UINT32 sts3; // SYSUP_CND_* -}LBM_NOR_t; - -//********* DRAM area **************** -typedef struct _tmb_ram_t { - LBM_UINT32 dram1; // SYSUP_DRAM_* - LBM_UINT32 sts; // SYSUP_CND_* - LBM_UINT32 upmode; // SYSUP_MODE_* - LBM_UINT32 dram2; // SYSUP_DRAM_* - LBM_UINT32 syscomSts; // SUBCPU_STS_* - LBM_UINT32 pwSts; // SDRAM_STS_* - LBM_UINT32 hwdtSts; // HWDT_STS_* - LBM_UINT32 dram3; // SYSUP_DRAM_* - LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX]; - LBM_UINT32 sectorNo; // NOR Shared SectorNo - LBM_UINT32 mdUpdate; // UPDATE_NOTI_* LanServer Update Notification - LBM_UINT32 sdUpdate; // UPDATE_NOTI_* SettingService Update Notification - LBM_UINT32 ramjudgeSts; // RAMJUDGE_STS_* - LBM_UINT32 swdtSts; // SWDT_STS_* - LBM_UINT32 dram_self_refresh; // DRAM Self Refresh - LBM_UINT32 releaseNorType; - LBM_UINT32 socCpuType; // H2/E2/M2 - LBM_UINT32 socEsNumber; // ES1x/ES2x/ES3x - LBM_UINT32 spiBootDevice; // NorDeviceID - LBM_UINT32 bootNorWrite; // uboot-api - LBM_UINT32 naviDetFactor; - - LBM_UINT32 emmcTap; //emmcTap - LBM_UINT32 opdtUpdateReq; - LBM_UINT32 opdtLoadSatus; - LBM_UINT32 opdtLoadFactor; - -}LBM_RAM_t; - -#pragma pack(pop) - - -/** -* \~english Access type to the boot information -*/ -typedef enum { - BAI_OPEN_RO, /* \~english Access type for the Read only*/ - BAI_OPEN_RW /* \~english Access type for the Read and Write*/ -}BAI_OPEN_t; - -/** - * @class BOOT_AccessIf - * \~english @brief BOOT_AccessIf - * \~english @par Brief Introduction - * Class to provide the function of BOOT AccessIf - * - */ -class BOOT_AccessIf{ - private: - static void* g_m_plock; - BAI_OPEN_t m_type; - - public: - /** - * \ingroup BOOT_AccessIf - * \~english @par Summary: - * Obtain the access permission to the boot information (secondary storage area). - * \~english @param [in] type - * BAI_OPEN_t - Access type to the boot information\n - * \~english @par - * BAI_OPEN_t - * - BAI_MTD_DEV_RO Access type for the Read only \n - * - BAI_MTD_DEV_RW Access type for the Read and Write - * \~english @retval None - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - None - * \~english @par Classification: - * Public - * \~english @par Type - * None - * \~english @par Detail: - * Obtain the access permission to the boot information \n - * When the access permission is locked, the API waits for Mutex until the access permission is released. \n - * This API is assumed to be called by SystemManager. - * \~english @see ~BOOT_AccessIf, CL_LockMap, CL_LockGet - */ -explicit BOOT_AccessIf(BAI_OPEN_t type); - - /** - * \ingroup ~BOOT_AccessIf - * \~english @par Summary: - * Release the access permission to the boot information (secondary storage area). - * \~english @param None - * \~english @retval None - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - None - * \~english @par Classification: - * Public - * \~english @par Type - * None - * \~english @par Detail: - * Release the access permission to the boot information.\n - * \~english @see BOOT_AccessIf, CL_LockRelease - */ - ~BOOT_AccessIf(); - -/** - * \ingroup getBootInfo - * \~english @par Summary: - * Read the boot information (secondary storage area). - * \~english @param [out] p_boot_info - * LBM_NOR_t * - Destination buffer to read the boot information - * \~english @par - * LBM_NOR_t Structure body - * \~english @code - * typedef struct LBM_boot_t{ - * LBM_UINT32 sts1; //SYSUP_CND_* - * LBM_UINT32 btmode; //SYSUP_MODE_* - * LBM_UINT32 sts2; //SYSUP_CND_* - * LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX]; - * LBM_UINT32 sts3; //SYSUP_CND_* - * }LBM_NOR_t; - * @endcode - * Refer to "ss_boot_map.h" for the parameters to be set to the member of struct LBM_NOR_t. - * \~english @retval eFrameworkunifiedStatusOK Reading success - * \~english @retval eFrameworkunifiedStatusFail Reading failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If p_boot_info is NULL [eFrameworkunifiedStatusFail] - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Copy the boot information stored in the secondary storage area to p_boot_info. \n - * \~english @see setBootInfo - */ - EFrameworkunifiedStatus getBootInfo(LBM_NOR_t* p_boot_info); - - /** - * \ingroup setBootInfo - * \~english @par Summary: - * Write the boot information (secondary storage area). - * \~english @param [in] p_boot_info - * LBM_NOR_t * - Original buffer to write the boot information - * \~english @par - * LBM_NOR_tStructure body - * \~english @code - * typedef struct LBM_boot_t{ - * LBM_UINT32 sts1; //SYSUP_CND_* - * LBM_UINT32 btmode; //SYSUP_MODE_* - * LBM_UINT32 sts2; //SYSUP_CND_* - * LBM_UPTBLINFO upTbl[UPTBLE_ID_MAX]; - * LBM_UINT32 sts3; //SYSUP_CND_* - * }LBM_NOR_t; - * @endcode - * Refer to "ss_boot_map.h" for the parameters to be set to the member of struct LBM_NOR_t. - * \~english @retval eFrameworkunifiedStatusOK Write success - * \~english @retval eFrameworkunifiedStatusFail Write failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If p_boot_info is NULL [eFrameworkunifiedStatusFail] - * - BOOT_AccessIf Opened secondary storage area with BAI_MTD_DEV_RO [eFrameworkunifiedStatusFail] - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Write the boot information stored in p_boot_info to the secondary storage area. \n - * \~english @see getBootInfo - */ - EFrameworkunifiedStatus setBootInfo(LBM_NOR_t* p_boot_info); -}; - -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_BOOT_ACCESS_H_ - -/** @}*/ // end of rom_access_library -/** @}*/ // end of system_service -/** @}*/ // end of BaseSystem diff --git a/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h b/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h deleted file mode 100755 index f96966b..0000000 --- a/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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 ss_sm_ram_access.h - * @brief This file provides API for get ram information from extension memory - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup system_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup rom_access_library - * @ingroup system_service - * @{ - */ - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_ - -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_types.h> - -/** - * \~english max length of ram product private - */ -#define RAM_PRODUCT_PRIVATE_MAX (96) -/** - * \~english max length of order file name - */ -#define SS_SM_ORDER_NAME_MAX (32) - -/** - * \~english System management information - */ -typedef struct { - char signature_in[4]; - BOOL isImmediateReset; - BOOL needRenotifyStartPrm; - uint32_t lastWakeupType; - uint32_t lastDramBackupStatus; - uint32_t lastResetStatus; - char productPrivate[RAM_PRODUCT_PRIVATE_MAX]; - char order_name[SS_SM_ORDER_NAME_MAX]; - BOOL isErrorReset; - char signature_out[4]; -}RAM_SM_INFO_t; - -/** - * \~english System wakeup state type - */ -typedef enum { - RAM_WAKEUP_STATE_DONT_CARE = 0, /* \~english Don't care wakeup state*/ - RAM_WAKEUP_STATE_BACKUP_NG, /* \~english Wakeup state is backup NG*/ - RAM_WAKEUP_STATE_BATTERY_DOWN /* \~english Wakeup state is battery down*/ -}RAM_WAKEUP_STATE; - -/** - * @class RAM_AccessIf - * \~english @brief RAM_AccessIf - * \~english @par Brief Introduction - * Class to provide the function of RAM AccessIf - * - */ -class RAM_AccessIf{ - private: - static void* g_m_plock; - static void* g_m_bakup_map; - static bool g_m_is_first_access; - RAM_SM_INFO_t m_buf; - bool m_dirty; - void initRamBackupEnable(RAM_WAKEUP_STATE wup_state); - void finalRamBackupEnable(void); - - public: -/** - * \ingroup RAM_AccessIf - * \~english @par Summary: - * Obtain the access permission to the system management information. - * \~english @param [in] wup_state - * RAM_WAKEUP_STATE - System maneger wakeup state type - * \~english @par - * RAM_WAKEUP_STATE - * - RAM_WAKEUP_STATE_DONT_CARE Don't care wakeup state\n - * - RAM_WAKEUP_STATE_BACKUP_NG Wakeup state is backup NG\n - * - RAM_WAKEUP_STATE_BATTERY_DOWN Wakeup state is battery down - * \~english @retval None - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - None - * \~english @par Classification: - * Public - * \~english @par Type - * None - * \~english @par Detail: - * Obtain the access permission to the system management information \n - * When the access permission is locked, the API waits for Mutex until the access permission is released. \n - * This API is supposed to be called by SystemManager. - * \~english @see ~RAM_AccessIf, CL_LockMap, CL_LockGet - */ -explicit RAM_AccessIf(RAM_WAKEUP_STATE wup_state = RAM_WAKEUP_STATE_DONT_CARE); - -/** - * \ingroup ~RAM_AccessIf - * \~english @par Summary: - * Release the access permission to the system management information. - * \~english @param None - * \~english @retval None - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - None - * \~english @par Classification: - * Public - * \~english @par Type - * None - * \~english @par Detail: - * Release the access permission to the system management information.\n - * \~english @see RAM_AccessIf, CL_LockRelease - */ - ~RAM_AccessIf(); - -/** - * \ingroup getRamInfo - * \~english @par Summary: - * Read the system management information. - * \~english @param [out] p_boot_info - * RAM_SM_INFO_t * - Destination buffer to read the system management information. - * \~english @par - * RAM_SM_INFO_t Structure body - * \~english @code - * typedef struct { - * char signature_in[4]; - * BOOL isImmediateReset; - * BOOL needRenotifyStartPrm; - * uint32_t lastWakeupType; - * uint32_t lastDramBackupStatus; - * uint32_t lastResetStatus; - * char productPrivate[RAM_PRODUCT_PRIVATE_MAX]; - * char order_name[SS_SM_ORDER_NAME_MAX]; - * BOOL isErrorReset; - * char signature_out[4]; - * }RAM_SM_INFO_t; - * @endcode - * \~english @retval eFrameworkunifiedStatusOK Reading success - * \~english @retval eFrameworkunifiedStatusFail Reading failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If p_boot_info is NULL [eFrameworkunifiedStatusFail] - * - If read data from secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat - * failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Copy the system information stored in the secondary storage area or - * in /nv/BS/ss/rom_access_library/rwdata/ramdata.dat to p_boot_info. \n - * \~english @see setRamInfo - */ - EFrameworkunifiedStatus getRamInfo(RAM_SM_INFO_t* p_boot_info); - -/** - * \ingroup setRamInfo - * \~english @par Summary: - * Write the system management information. - * \~english @param [in] p_boot_info - * RAM_SM_INFO_t * - Original buffer to write the system management information - * \~english @par - * RAM_SM_INFO_t Structure body - * \~english @code - * typedef struct { - * char signature_in[4]; - * BOOL isImmediateReset; - * BOOL needRenotifyStartPrm; - * uint32_t lastWakeupType; - * uint32_t lastDramBackupStatus; - * uint32_t lastResetStatus; - * char productPrivate[RAM_PRODUCT_PRIVATE_MAX]; - * char order_name[SS_SM_ORDER_NAME_MAX]; - * BOOL isErrorReset; - * char signature_out[4]; - * }RAM_SM_INFO_t; - * @endcode - * \~english @retval eFrameworkunifiedStatusOK Write success - * \~english @retval eFrameworkunifiedStatusFail Write failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If p_boot_info is NULL [eFrameworkunifiedStatusFail] - * - If write data to secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat - * failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Write the system manegement information stored in p_boot_info to the - * secondary storage area or /nv/BS/ss/rom_access_library/rwdata/ramdata.dat. \n - * \~english @see getRamInfo - */ - EFrameworkunifiedStatus setRamInfo(RAM_SM_INFO_t* p_boot_info); -}; - -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_RAM_ACCESS_H_ - -/** @}*/ // end of rom_access_library -/** @}*/ // end of system_service -/** @}*/ // end of BaseSystem diff --git a/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h b/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h deleted file mode 100755 index 4ba1a76..0000000 --- a/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h +++ /dev/null @@ -1,1010 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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 ss_sm_rom_access.h - * @brief This file provides API for get rom information from extension memory - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup system_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup rom_access_library - * @ingroup system_service - * @{ - */ - -#ifndef ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_ -#define ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_ - -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_types.h> - -#include "system_service/ss_sm_boot_access.h" - -/** - * \~english boot mode information - */ -typedef enum { - APPLICATION_MODE = 0, - PROGRAMMING_MODE -}EBOOT_MODE; - -/** - * \~english active flash load information - */ -typedef enum { - NEW_FLASHLOADER = 0, - OLD_FLASHLOADER -}EACTIVE_FLASHLOADER; - -/** - * \~english user mode information - */ -typedef enum { - USER_OFF = 0, - USER_ON -}EUSER_MODE; - -/** - * \~english control mode information - */ -typedef enum { - DISABLE_MODE = 0, - ENABLE_MODE -}ECONTROL_MODE; - -/** - * \~english data reset mode information - */ -typedef enum { - DATARESET_NONE = 0, - DATARESET_USER, - DATARESET_FACTORY -}EDATARESET_MODE; - -/** - * \~english last illegal reset mode information - */ -typedef enum { - LAST_ILGRESET_NORMAL = 0, - LAST_ILGRESET_NG -}ELASTILGRESET_MODE; - -/** - * \~english Program update state information - */ -typedef uint32_t EPROGUPDATE_STATE; - -/** - * \~english next wakeup type - */ -typedef enum { - NEXT_WAKEUP_TYPE_NONE = 0, - NEXT_WAKEUP_TYPE_COLD, - NEXT_WAKEUP_TYPE_HOT, -}ENEXT_WAKEUP_TYPE; - -/** - * \~english DRAM backup state - */ -typedef enum { - DRAM_BACKUP_STATE_OK = 0, - DRAM_BACKUP_STATE_NG -}DRAM_BACKUP_STATE; - -/** - * \~english max length of rom product private - */ -#define ROM_PRODUCT_PRIVATE_MAX 128 - -/** - * @class ROM_AccessIf - * \~english @brief ROM_AccessIf - * \~english @par Brief Introduction - * Class to provide the function of ROM AccessIf - * - */ -class ROM_AccessIf { - private: - BOOT_AccessIf* m_pBoot; - static void* g_m_plock; - static void* g_m_bakup_map; - static bool g_m_is_dram_valid; - LBM_NOR_t m_nor; - bool m_norIsDirty; - - EFrameworkunifiedStatus LBA_Read(UI_32 offset, UI_32* buffer, UI_32 word_count); - - EFrameworkunifiedStatus LBA_Write(UI_32 offset, UI_32 value); - - EFrameworkunifiedStatus LBA_Write(UI_32 offset, UI_32* value, UI_32 size); - - EFrameworkunifiedStatus GetDataResetMode_sub(EDATARESET_MODE* p_data_reset_mode); - - public: -/** - * \ingroup ROM_AccessIf - * \~english @par Summary: - * Obtain the access permission to SYS area (secondary storage area). - * \~english @param None - * \~english @retval None - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - None - * \~english @par Classification: - * Public - * \~ english @par Type - * None - * \~english @par Detail: - * Obtain the access permission to SYS area. \n - * When the access permission is locked, the API watis for Mutex until the access permission is released. \n - * This API is assumed to be called by the SystemManager. - * \~english @see ~ROM_AccessIf, CL_LockMap, CL_LockGet - */ - ROM_AccessIf(); - -/** - * \ingroup ~ROM_AccessIf - * \~english @par Summary: - * Release the access permission to SYS area (secondary storage area). - * \~english @param None - * \~english @retval None - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - None - * \~english @par Classification: - * Public - * \~ english @par Type - * None - * \~english @par Detail: - * Release the access permission to SYS area. - * \~english @see ROM_AccessIf, CL_LockRelease - */ - ~ROM_AccessIf(); - -/** - * \ingroup Initialize - * \~english @par Summary: - * Synchronize SYS area (secondary storage area) and the mirror data in DRAM - * \~english @param None - * \~english @retval eFrameworkunifiedStatusOK Synchronization success - * \~english @retval eFrameworkunifiedStatusFail Synchronization failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If system call mmap failed. [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Prepare the access to SYS area. \n - * \~english @see EL_mem_exram_mmap - */ - EFrameworkunifiedStatus Initialize(); - -/** - * \ingroup SetProductPrivate - * \~english @par Summary: - * Write data information depending on the product specification to the secondary storage area. - * \~english @param [in] buf[ROM_PRODUCT_PRIVATE_MAX] - * UI_8[] - Data information depending on the product specification - * \~english @par - * Definition of ROM_PRODUCT_PRIVATE_MAX - * \~english @code - * #define ROM_PRODUCT_PRIVATE_MAX 128 - * @endcode - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Write data information depending on the product specification to the secondary storage area. \n - * \~english @see GetProductPrivate - */ - EFrameworkunifiedStatus SetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]); - -/** - * \ingroup GetProductPrivate - * \~english @par Summary: - * Read the data information depending on the product specification from the secondary storage area. - * \~english @param [out] buf[ROM_PRODUCT_PRIVATE_MAX] - * UI_8[] - Storing destination of data information depending on the product specification - * \~english @par - * Definition of ROM_PRODUCT_PRIVATE_MAX - * \~english @code - * #define ROM_PRODUCT_PRIVATE_MAX 128 - * @endcode - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Read data information depending on the product specification from the secondary storage area. \n - * \~english @see SetProductPrivate - */ - EFrameworkunifiedStatus GetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]); - -/** - * \ingroup SystemInitialize - * \~english @par Summary: - * Initialize the handles used for ROM access. - * \~english @param [in] bkup_state - * \~english @par - * DRAM_BACKUP_STATE - * - DRAM_BACKUP_STATE_OK - * - DRAM_BACKUP_STATE_NG - * \~english @retval eFrameworkunifiedStatusOK Initialize the handles used for ROM access success - * \~english @retval eFrameworkunifiedStatusFail Initialize the handles used for ROM access failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If system call mmap failed. [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Initialize the handles used for ROM access. \n - * \~english @see EL_mem_exram_mmap - */ - EFrameworkunifiedStatus SystemInitialize(DRAM_BACKUP_STATE bkup_state); - -/** - * \ingroup GetBootMode - * \~english @par Summary: - * Get boot mode information. - * \~english @param [out] p_boot_mode - * EBOOT_MODE* - Destination buffer to store information of boot mode. - * \~english @par - * EBOOT_MODE - * - APPLICATION_MODE - * - PROGRAMMING_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get boot mode information from the secondary storage area. \n - * \~english @see SetBootMode - */ - EFrameworkunifiedStatus GetBootMode(EBOOT_MODE* p_boot_mode); - -/** - * \ingroup SetBootMode - * \~english @par Summary: - * Set boot mode information. - * \~english @param [in] boot_mode - * EBOOT_MODE - Boot mode information which write to the secondary storage area. - * \~english @par - * EBOOT_MODE - * - APPLICATION_MODE - * - PROGRAMMING_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set boot mode information to the secondary storage area. \n - * \~english @see GetBootMode - */ - EFrameworkunifiedStatus SetBootMode(EBOOT_MODE boot_mode); - -/** - * \ingroup GetSignature - * \~english @par Summary: - * Get signature information. - * \~english @param [out] p_sig_value - * UI_32 - Destination buffer to store signature information - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write signature information to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get signature information from the secondary storage area. \n - * \~english @see SetSignature - */ - EFrameworkunifiedStatus GetSignature(UI_32* p_sig_value); - -/** - * \ingroup SetSignature - * \~english @par Summary: - * Set signature information. - * \~english @param [in] sig_value - * UI_32 - Signature information which write to the secondary storage area. - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write signature information to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set signature information to the secondary storage area. \n - * \~english @see GetSignature - */ - EFrameworkunifiedStatus SetSignature(UI_32 sig_value); - -/** - * \ingroup SetActiveFlashloader - * \~english @par Summary: - * Set active flash loader information. - * \~english @param [in] active_flash_loader - * EACTIVE_FLASHLOADER - Active flash loader information which write to secondary storage area. - * \~english @par - * EBOOT_MODE - * - APPLICATION_MODE - * - PROGRAMMING_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set active flash loader information to the secondary storage area. \n - * \~english @see GetBootMode - */ - EFrameworkunifiedStatus SetActiveFlashloader(EACTIVE_FLASHLOADER active_flash_loader); - -/** - * \ingroup GetLastUserMode - * \~english @par Summary: - * Get last user mode information. - * \~english @param [out] p_user_mode - * EUSER_MODE* - Destination buffer to store information of user mode. - * \~english @par - * EUSER_MODE - * - USER_ON - * - USER_OFF - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get last user mode information from the secondary storage area. \n - * \~english @see SetLastUserMode - */ - EFrameworkunifiedStatus GetLastUserMode(EUSER_MODE* p_user_mode); - -/** - * \ingroup SetLastUserMode - * \~english @par Summary: - * Set last user mode information. - * \~english @param [in] user_mode - * EUSER_MODE - User mode information which write to the secondary storage area. - * \~english @par - * EUSER_MODE - * - USER_ON - * - USER_OFF - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set last user mode information to the secondary storage area. \n - * \~english @see GetLastUserMode - */ - EFrameworkunifiedStatus SetLastUserMode(EUSER_MODE user_mode); - -/** - * \ingroup GetTransportMode - * \~english @par Summary: - * Get transport mode information. - * \~english @param [out] p_control_mode - * ECONTROL_MODE* - Destination buffer to store information of transport mode. - * \~english @par - * ECONTROL_MODE - * - DISABLE_MODE - * - ENABLE_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get transport mode information from the secondary storage area. \n - * \~english @see SetTransportMode - */ - EFrameworkunifiedStatus GetTransportMode(ECONTROL_MODE* p_control_mode); - -/** - * \ingroup SetTransportMode - * \~english @par Summary: - * Set transport mode information. - * \~english @param [in] control_mode - * ECONTROL_MODE - Transport mode information which write to the secondary storage area. - * \~english @par - * ECONTROL_MODE - * - DISABLE_MODE - * - ENABLE_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set transport mode information to the secondary storage area. \n - * \~english @see GetTransportMode - */ - EFrameworkunifiedStatus SetTransportMode(ECONTROL_MODE control_mode); - -/** - * \ingroup GetProductionMode - * \~english @par Summary: - * Get production mode information. - * \~english @param [out] p_control_mode - * ECONTROL_MODE* - Destination buffer to store information of production mode. - * \~english @par - * ECONTROL_MODE - * - DISABLE_MODE - * - ENABLE_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get production mode information from the secondary storage area. \n - * \~english @see SetProductionMode - */ - EFrameworkunifiedStatus GetProductionMode(ECONTROL_MODE* p_control_mode); - -/** - * \ingroup SetProductionMode - * \~english @par Summary: - * Set transport mode information. - * \~english @param [in] control_mode - * ECONTROL_MODE - Production mode information which write to the secondary storage area. - * \~english @par - * ECONTROL_MODE - * - DISABLE_MODE - * - ENABLE_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set production mode information to the secondary storage area. \n - * \~english @see GetProductionMode - */ - EFrameworkunifiedStatus SetProductionMode(ECONTROL_MODE control_mode); - -/** - * \ingroup GetLimpHomeCutOffReqMode - * \~english @par Summary: - * Get limp home cut off request mode information. - * \~english @param [out] p_control_mode - * ECONTROL_MODE* - Destination buffer to store information of limp home cut off request mode. - * \~english @par - * ECONTROL_MODE - * - DISABLE_MODE - * - ENABLE_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get limp home cut off request mode information from the secondary storage area. \n - * \~english @see SetLimpHomeCutOffReqMode - */ - EFrameworkunifiedStatus GetLimpHomeCutOffReqMode(ECONTROL_MODE* p_control_mode); - -/** - * \ingroup SetLimpHomeCutOffReqMode - * \~english @par Summary: - * Set limp home cut off request mode information. - * \~english @param [in] control_mode - * ECONTROL_MODE - Limp home cut off request mode information which write to the secondary storage area. - * \~english @par - * ECONTROL_MODE - * - DISABLE_MODE - * - ENABLE_MODE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set limp home cut off request mode information to the secondary storage area. \n - * \~english @see GetLimpHomeCutOffReqMode - */ - EFrameworkunifiedStatus SetLimpHomeCutOffReqMode(ECONTROL_MODE control_mode); - -/** - * \ingroup GetDataResetMode - * \~english @par Summary: - * Get reserved data reset mode information. - * \~english @param [out] p_data_reset_mode - * EDATARESET_MODE* - Destination buffer to store information of reserved data reset mode. - * \~english @par - * EDATARESET_MODE - * - DATARESET_NONE - * - DATARESET_USER - * - DATARESET_FACTORY - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get reserved data reset mode information from the secondary storage area. \n - * \~english @see SetDataResetMode - */ - EFrameworkunifiedStatus GetDataResetMode(EDATARESET_MODE* p_data_reset_mode); - -/** - * \ingroup GetDataResetModeFast - * \~english @par Summary: - * Get reserved data reset mode information faster.This api can get correct value before - * calling SetDataResetMode.So it shoud be used only immediately after boot. - * \~english @param [out] p_data_reset_mode - * EDATARESET_MODE* - Destination buffer to store information of reserved data reset mode faster. - * \~english @par - * EDATARESET_MODE - * - DATARESET_NONE - * - DATARESET_USER - * - DATARESET_FACTORY - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * - If system call mmap failed. [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get reserved data reset mode information faster from the secondary storage area.This api can get - * correct value before calling SetDataResetMode.So it shoud be used only immediately after boot. - * \~english @see SetDataResetMode - */ - EFrameworkunifiedStatus GetDataResetModeFast(EDATARESET_MODE* p_data_reset_mode); - -/** - * \ingroup SetDataResetMode - * \~english @par Summary: - * Set reserve data reset mode information. - * \~english @param [in] data_reset_mode - * EDATARESET_MODE - Reserve data reset mode information which write to the secondary storage area. - * \~english @par - * EDATARESET_MODE - * - DATARESET_NONE - * - DATARESET_USER - * - DATARESET_FACTORY - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set reserve data reset mode information to the secondary storage area. \n - * \~english @see GetDataResetMode - */ - EFrameworkunifiedStatus SetDataResetMode(EDATARESET_MODE data_reset_mode); - -/** - * \ingroup GetResetCount - * \~english @par Summary: - * Get reset count information. - * \~english @param [out] p_reset_count - * UI_32* - Destination buffer to store information of reset count. - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get reset count from the secondary storage area. \n - * \~english @see SetResetCount - */ - EFrameworkunifiedStatus GetResetCount(UI_32* p_reset_count); - -/** - * \ingroup SetResetCount - * \~english @par Summary: - * Set reset count information. - * \~english @param [in] reset_count - * UI_32 - Reset count information which write to the secondary storage area. - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set reset count information to the secondary storage area. \n - * \~english @see GetResetCount - */ - EFrameworkunifiedStatus SetResetCount(UI_32 reset_count); - -/** - * \ingroup GetLastIlgReset - * \~english @par Summary: - * Get last illegal reset information. - * \~english @param [out] p_last_ilg_reset - * ELASTILGRESET_MODE* - Destination buffer to store information of last illegal reset. - * \~english @par - * ELASTILGRESET_MODE - * - LAST_ILGRESET_NORMAL - * - LAST_ILGRESET_NG - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get last illegal reset information from the secondary storage area. \n - * \~english @see SetLastIlgReset - */ - EFrameworkunifiedStatus GetLastIlgReset(ELASTILGRESET_MODE* p_last_ilg_reset); - -/** - * \ingroup SetLastIlgReset - * \~english @par Summary: - * Set last illegal reset information. - * \~english @param [in] last_ilg_reset - * ELASTILGRESET_MODE - Last illegal reset information which write to the secondary storage area. - * \~english @par - * ELASTILGRESET_MODE - * - LAST_ILGRESET_NORMAL - * - LAST_ILGRESET_NG - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set last illegal reset information to the secondary storage area. \n - * \~english @see GetLastIlgReset - */ - EFrameworkunifiedStatus SetLastIlgReset(ELASTILGRESET_MODE last_ilg_reset); - -/** - * \ingroup GetProgUpdateState - * \~english @par Summary: - * Get program update status information. - * \~english @param [out] p_prog_update_state - * EPROGUPDATE_STATE* - Destination buffer to store information of program update status. - * \~english @par - * typedef uint32_t EPROGUPDATE_STATE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get program update status information from the secondary storage area. \n - * \~english @see SetProgUpdateState - */ - EFrameworkunifiedStatus GetProgUpdateState(EPROGUPDATE_STATE* p_prog_update_state); - -/** - * \ingroup SetProgUpdateState - * \~english @par Summary: - * Set program update status information. - * \~english @param [in] prog_update_state - * EPROGUPDATE_STATE - Program update status information which write to the secondary storage area. - * \~english @par - * typedef uint32_t EPROGUPDATE_STATE - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If write data to secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Set program update status information to the secondary storage area. \n - * \~english @see GetProgUpdateState - */ - EFrameworkunifiedStatus SetProgUpdateState(EPROGUPDATE_STATE prog_update_state); - -/** - * \ingroup GetErrLogCount - * \~english @par Summary: - * Get error logging count information. - * \~english @param [out] p_err_log_count - * UI_32* - Destination buffer to store information of error logging count. - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get error logging count information from the secondary storage area. \n - * \~english @see SetErrLogCount - */ - EFrameworkunifiedStatus GetErrLogCount(UI_32* p_err_log_count); - -/** - * \ingroup SetErrLogCount - * \~english @par Summary: - * Get error logging count information. - * \~english @param [out] err_log_count - * UI_32* - Destination buffer to store information of error logging count. - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get error logging count information from the secondary storage area. \n - * \~english @see GetErrLogCount - */ - EFrameworkunifiedStatus SetErrLogCount(UI_32 err_log_count); - -/** - * \ingroup GetNextWakeupType - * \~english @par Summary: - * Get next wakeup type information. - * \~english @param [out] p_next_wakeup_type - * ENEXT_WAKEUP_TYPE* - Destination buffer to store information of next wakeup type. - * \~english @par - * ENEXT_WAKEUP_TYPE - * - NEXT_WAKEUP_TYPE_NONE - * - NEXT_WAKEUP_TYPE_COLD - * - NEXT_WAKEUP_TYPE_HOT - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get next wakeup type information from the secondary storage area. \n - * \~english @see SetNextWakeupType - */ - EFrameworkunifiedStatus GetNextWakeupType(ENEXT_WAKEUP_TYPE *p_next_wakeup_type); - -/** - * \ingroup SetNextWakeupType - * \~english @par Summary: - * Get next wakeup type information. - * \~english @param [out] next_wakeup_type - * ENEXT_WAKEUP_TYPE* - Destination buffer to store information of next wakeup type. - * \~english @par - * ENEXT_WAKEUP_TYPE - * - NEXT_WAKEUP_TYPE_NONE - * - NEXT_WAKEUP_TYPE_COLD - * - NEXT_WAKEUP_TYPE_HOT - * \~english @retval eFrameworkunifiedStatusOK Success - * \~english @retval eFrameworkunifiedStatusFail Failed - * \~english @par Precondition: - * - None - * \~english @par Change in the internal status: - * - The change in the internal status does not occur by this API. - * \~english @par Conditions of processing failure - * - If read data from secondary storage area failed [eFrameworkunifiedStatusFail] - * \~english @par Classification: - * Public - * \~ english @par Type - * Sync only(None communication) - * \~english @par Detail: - * Get next wakeup type information from the secondary storage area. \n - * \~english @see GetNextWakeupType - */ - EFrameworkunifiedStatus SetNextWakeupType(ENEXT_WAKEUP_TYPE next_wakeup_type); -}; - -#endif // ROM_ACCESS_LIBRARY_LIBRARY_INCLUDE_SYSTEM_SERVICE_SS_SM_ROM_ACCESS_H_ - -/** @}*/ // end of rom_access_library -/** @}*/ // end of system_service -/** @}*/ // end of BaseSystem diff --git a/systemservice/rom_access_library/library/nor/Makefile b/systemservice/rom_access_library/library/nor/Makefile deleted file mode 100755 index f30c271..0000000 --- a/systemservice/rom_access_library/library/nor/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# @copyright Copyright (c) 2016-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. -# - -######### search paths ############# -VPATH += src -VPATH += ../include/$(COMPONENT_NAME) - -######### installed shared library(*.so) ############# -INST_SHLIBS = libssaccess - -######### headers to be installed(*.h) ############# -INST_HEADERS = nor_backup.h - -######### compiled sources ############# -libssaccess_SRCS = nor_backup.c - -######### add include path ############# -CPPFLAGS += -I../include/ - -######### frameworkunifiedlog options ############# -LDFLAGS += -Wl,--no-undefined -LDFLAGS += -Wl,--no-as-needed - -######### add compile option ############# -LINK_SHLIB_CXX := y -CPPFLAGS += -Werror=implicit-function-declaration -CPPFLAGS += -Werror=format-security -CPPFLAGS += -Wconversion -CPPFLAGS += -Wint-to-pointer-cast -CPPFLAGS += -Wpointer-arith -CPPFLAGS += -Wformat - -include ../../../system_service.mk diff --git a/systemservice/rom_access_library/library/nor/libBlkDev_API.ver b/systemservice/rom_access_library/library/nor/libBlkDev_API.ver deleted file mode 100755 index 5ebddcb..0000000 --- a/systemservice/rom_access_library/library/nor/libBlkDev_API.ver +++ /dev/null @@ -1,30 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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. - */ - -# -# CommonLib version script -# -{ - global: - ### .text section ### - blkDrv_DirectReadData; - blkDrv_DirectWriteData; - blkDrv_GetBlockInfo; - ### .data section ### - local: - *; -}; - diff --git a/systemservice/rom_access_library/library/nor/libssaccess.ver b/systemservice/rom_access_library/library/nor/libssaccess.ver deleted file mode 100755 index c4bd070..0000000 --- a/systemservice/rom_access_library/library/nor/libssaccess.ver +++ /dev/null @@ -1,30 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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. - */ - -# -# CommonLib version script -# -{ - global: - ### .text section ### - mtdn_backup_GetErCnt; - mtdn_backup_Read; - mtdn_backup_Write; - ### .data section ### - local: - *; -}; - diff --git a/systemservice/rom_access_library/library/nor/src/nor_backup.c b/systemservice/rom_access_library/library/nor/src/nor_backup.c deleted file mode 100755 index 8a133b0..0000000 --- a/systemservice/rom_access_library/library/nor/src/nor_backup.c +++ /dev/null @@ -1,807 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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. - */ - -/******************************************************************************* -* $Header:: $ -* $Revision:: $ -*******************************************************************************/ - -/******************************************************************************* -@file mtd_backup.c -@system -@process -@detail - ******************************************************************************/ -#include "system_service/nor_backup.h" -#include <stdio.h> -#include <string.h> -#include <sys/ioctl.h> -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> -#include <pthread.h> -#include <asm/unistd.h> -#include <mtd/mtd-user.h> - -#define BACKUP_RETRY_CNT 3 - -/* Invalid Value */ -#define FLSBACKUP_SEMAPHORE_INVALID (0) - - -#define BACKUP_SECTOR_SIZ 1024 // Secter Size - -#define BACKUP_CHECK_OFFSET 16 -#define BACKUP_CHECK_SIZE 12 -#define BACKUP_CHECK_TEXT "MTD_BACKUPDT" -#define BACKUP_CHECK_DAT1 1 // Lower 8bit -#define BACKUP_CHECK_DAT2 2 // Upper 8bit - -#define NOR_ERRLOG(fmt, args...) \ - fprintf(stderr, "[ERR]%ld/%s/%d/= "fmt"\n", syscall(__NR_gettid), __func__, __LINE__, ##args) - -static pthread_mutex_t g_semid_flash = PTHREAD_MUTEX_INITIALIZER; /* Semaphore ID of dram area access */ -static int g_backup_init = FLSBACKUP_SEMAPHORE_INVALID; - -typedef enum { - RET_WT_CHK_OK = 0, - RET_WT_ERR_OTHER, - RET_WT_DEV_ERR, -} NOR_WRITE_BLK_CHK; - -typedef enum { - RET_RD_CHK_OK = 0, - RET_RD_ERR_OTHER, - RET_RD_DEV_ERR, - RET_RD_ERR_1 = -1, - RET_RD_ERR_2 = -2, - RET_RD_ERR_3 = -3, - RET_RD_ERR_4 = -4, -} NOR_READ_BLK_CHK; - -typedef enum { - RET_CHK_OK = 0, - RET_CHK_TEXT_ERR, - RET_CHK_BCC_ERR, -} NOR_BLK_CHK; - -typedef enum { - NOR_IDLE = 0, // 0:Read-out of block data - NOR_ORG_TEXT, // 1:OrgText Error - NOR_ORG_BCC, // 2:OrgBcc error - NOR_READ_OK, // 3:Normal read-out - NOR_READ_END // 4:end state -} NOR_R_STATE; - -typedef enum { - NOR_IDEL = 0, // 0:IDEL - NOR_READ_ERR, // 1:Read Error - NOR_ORG_READ, // 2:Org Read OK - NOR_BAK_WRT, // 3:Bak Write OK - NOR_BACK_READ, // 4:Bak Read OK - NOR_ORG_WRITE, // 5:Org Write OK - NOR_WRITE_END // 6:end state -} NOR_W_STATE; - -NOR_READ_BLK_CHK MtdnBackupReadSub( - const char * path_name, int i_id, int i_offset, int i_size, - void *p_buff, mtd_info_t * mtd_info, int * get_state); -NOR_WRITE_BLK_CHK MtdnBackupWriteSub( - const char * path_name, int i_id, int i_offset, int i_size, - void *p_buff, mtd_info_t * mtd_info); - -int MtdnBackupWriteBase( - const char * path_name, int i_id, int i_offset, int i_size, - void *p_buff, mtd_info_t * mtd_info); -int MtdnBackupReadBase( - const char * path_name, int i_id, int i_offset, int i_size, - void *p_buff, mtd_info_t * mtd_info); - -int MtdBackupInfo(const char * path_name, mtd_info_t * mtd_info); // INFO Get - -NOR_BLK_CHK MtdBackupCheksumRead(char * p_buff, int erase_size, int * ret_sum); // check SUM -int MtdBackupCheksumWrite(char * p_buff, int erase_size); // check SUM - -/*************************************************************************** -@brief mtdn_backup_Read -@outline Read-out of specified block ID -@type Completion return type -@param[in] const char * path_name : (/dev/mtd Device) -@param[in] int i_id : ID...0~ -@param[in] int i_offset : ( i_offset >= 0) -@param[in] int i_size : ( i_size > 0) -@param[in] void *p_buff : (p_buff != NULL) -@return int -@retval 0 : No error -@retval Except : Error -@usage It is Backup API of data read. -*****************************************************************************/ -int mtdn_backup_Read(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff ) { - int ret_status = RET_DEV_NORMAL; - - if (path_name == NULL) { - NOR_ERRLOG("invalid path:%p", path_name); - return RET_DEV_ERR_PARAM; - } - if (p_buff == NULL) { - NOR_ERRLOG("invalid buf:%p", p_buff); - return RET_DEV_ERR_PARAM; - } - if (i_id < 0) { - NOR_ERRLOG("invalid id:%d", i_id); - return RET_DEV_ERR_PARAM; - } - if ((i_offset < 0) || (i_size <= 0)) { - NOR_ERRLOG("invalid size:%d offset:%d", i_size, i_offset); - return RET_DEV_ERR_PARAM; - } - if (g_backup_init == FLSBACKUP_SEMAPHORE_INVALID) { // LCOV_EXCL_BR_LINE 200: g_backup_init is static variable - pthread_mutex_init(&g_semid_flash, NULL); - g_backup_init = ~FLSBACKUP_SEMAPHORE_INVALID; - } - mtd_info_t mtd_info; - memset(&mtd_info, 0, sizeof(mtd_info_t)); - ret_status = MtdBackupInfo((const char *)path_name, &mtd_info); - if (ret_status == RET_DEV_NORMAL) { - if (mtd_info.type != MTD_NORFLASH) { - NOR_ERRLOG("invalid type:%d", mtd_info.type); - ret_status = RET_DEV_ERR_PARAM; - } else { - if ((i_offset + i_size) > (int)(mtd_info.erasesize - BACKUP_CHECK_OFFSET)) { - NOR_ERRLOG("invalid size:%d offset:%d erasesize:%d", i_size, i_offset, mtd_info.erasesize); - ret_status = RET_DEV_ERR_PARAM; - } - } - if (ret_status == RET_DEV_NORMAL) { - /* Start Semaphore(flash) */ - pthread_mutex_lock(&g_semid_flash); - int get_state; // Read status - ret_status = (int)MtdnBackupReadSub(path_name, i_id, i_offset, i_size, - p_buff, &mtd_info, &get_state); - - /* End Semaphore(flash) */ - pthread_mutex_unlock(&g_semid_flash); - } - } - if (ret_status != RET_DEV_NORMAL) { - NOR_ERRLOG("error return:%d", ret_status); - } - return ret_status; -} - -/*************************************************************************** -@brief mtdn_backup_Write -@outline Writing of specified block ID -@type Completion return type -@param[in] const char * path_name : (/dev/mtd Device) -@param[in] int i_id : ID...0~ -@param[in] int i_offset : ( i_offset >= 0) -@param[in] int i_size : ( i_size > 0) -@param[in] void *p_buff : (p_buff != NULL) -@return int -@retval 0 : No error -@retval Except: Error -@usage It is Backup API of data read. -*****************************************************************************/ -int mtdn_backup_Write(const char * path_name, int i_id, int i_offset, int i_size, void *p_buff) { - int ret_status = RET_DEV_NORMAL; - - if (path_name == NULL) { - NOR_ERRLOG("invalid path:%p", path_name); - return RET_DEV_ERR_PARAM; - } - if (p_buff == NULL) { - NOR_ERRLOG("invalid buf:%p", p_buff); - return RET_DEV_ERR_PARAM; - } - if (i_id < 0) { - NOR_ERRLOG("invalid id:%d", i_id); - return RET_DEV_ERR_PARAM; - } - if ((i_offset < 0) || (i_size <= 0)) { - NOR_ERRLOG("invalid size:%d offset:%d", i_size, i_offset); - return RET_DEV_ERR_PARAM; - } - if (g_backup_init == FLSBACKUP_SEMAPHORE_INVALID) { - pthread_mutex_init(&g_semid_flash, NULL); - g_backup_init = ~FLSBACKUP_SEMAPHORE_INVALID; - } - mtd_info_t mtd_info; - memset(&mtd_info, 0, sizeof(mtd_info_t)); - ret_status = MtdBackupInfo((const char *)path_name, &mtd_info); - if (ret_status == RET_DEV_NORMAL) { - if (mtd_info.type != MTD_NORFLASH) { - NOR_ERRLOG("invalid type:%d", mtd_info.type); - ret_status = RET_DEV_ERR_PARAM; - } else if (mtd_info.erasesize == 0) { - NOR_ERRLOG("invalid erasesize:%d", mtd_info.erasesize); - ret_status = RET_DEV_ERR_PARAM; - } else { - if ((i_offset + i_size) > (int)(mtd_info.erasesize - BACKUP_CHECK_OFFSET)) { - NOR_ERRLOG("invalid size:%d offset:%d erasesize:%d", i_size, i_offset, mtd_info.erasesize); - ret_status = RET_DEV_ERR_PARAM; - } - } - if (ret_status == RET_DEV_NORMAL) { - /* Start Semaphore(flash) */ - pthread_mutex_lock(&g_semid_flash); - ret_status = (int)MtdnBackupWriteSub(path_name, i_id, i_offset, i_size, p_buff, &mtd_info); - - /* End Semaphore(flash) */ - pthread_mutex_unlock(&g_semid_flash); - } - } - if (ret_status != RET_DEV_NORMAL) { - NOR_ERRLOG("error return:%d", ret_status); - } - return ret_status; -} - -/*************************************************************************** -@brief MtdnBackupReadSub -@outline Read-out of specified block ID -@type Completion return type -@param[in] const char * path_name : (/dev/mtd Device) -@param[in] int i_id : ID...0~ -@param[in] int i_offset : ( i_offset >= 0) -@param[in] int i_size : ( i_size > 0) -@param[in] void *p_buff : (p_buff != NULL) -@param[in] mtd_info_t * mtd_info : info -@param[in] int * get_state : 0:Rrg Normal 1:Bak Normal -@return NOR_READ_BLK_CHK -@retval RET_RD_CHK_OK : No error -@retval Except : Error -@usage It is Backup API of data read. -*****************************************************************************/ -NOR_READ_BLK_CHK MtdnBackupReadSub(const char * path_name, int i_id, int i_offset, int i_size, - void *p_buff, mtd_info_t * mtd_info, int * get_state) { - NOR_READ_BLK_CHK ret_status = RET_RD_CHK_OK; - char * lp_buffer; - - if (mtd_info->erasesize != 0) { // LCOV_EXCL_BR_LINE 6: double check - lp_buffer = (char *)malloc(mtd_info->erasesize); - if (lp_buffer == NULL) { - NOR_ERRLOG("malloc:%p", lp_buffer); - ret_status = RET_RD_DEV_ERR; // error - } - } else { - // LCOV_EXCL_START 8: dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - NOR_ERRLOG("invalid erasesize:%d", mtd_info->erasesize); - ret_status = RET_RD_DEV_ERR; // error - // LCOV_EXCL_STOP - } - if (ret_status == RET_RD_CHK_OK) { - memset(lp_buffer, 0x00, mtd_info->erasesize); - NOR_R_STATE cycle_state = NOR_IDLE; - int block_check_mode = 0; - int ret_sum = 0; - while ((cycle_state < NOR_READ_END) - &&(ret_status == RET_RD_CHK_OK)) { - switch (cycle_state) { - case NOR_IDLE: - // Read-out of block data - if (0 != MtdnBackupReadBase((const char *)path_name, i_id, 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info)) { - ret_status = RET_RD_ERR_OTHER; // Other abnormalities - } else { - NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize, (int *)&ret_sum); - if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities - cycle_state = NOR_ORG_TEXT; - } else if (ret == RET_CHK_BCC_ERR) { // (BCC)error - cycle_state = NOR_ORG_BCC; - } else { - block_check_mode = 0; // Org Normal - cycle_state = NOR_READ_OK; - } - } - break; - case NOR_ORG_TEXT: // OrgText Error - // Read-out of block data - if (0 != MtdnBackupReadBase((const char *)path_name, (i_id+1), 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info)) { - // other error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_status = RET_RD_ERR_OTHER; // LCOV_EXCL_LINE 5: c API error case. - } else { - NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize, - (int *)&ret_sum); // check SUM - if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities - ret_status = RET_RD_ERR_1; // Uninitialized. - } else if (ret == RET_CHK_BCC_ERR) { // BCC error - ret_status = RET_RD_ERR_2; // write error - } - block_check_mode = 1; // Bak Normal - cycle_state = NOR_READ_OK; - } - break; - case NOR_ORG_BCC: // OrgBcc error - // Read-out of block data - if (0 != MtdnBackupReadBase((const char *)path_name, (i_id+1), 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info)) { - // other error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_status = RET_RD_ERR_OTHER; // LCOV_EXCL_LINE 5: c API error case. - } else { - NOR_BLK_CHK ret = MtdBackupCheksumRead(lp_buffer, (int)mtd_info->erasesize, - (int *)&ret_sum); // check SUM - if (ret == RET_CHK_TEXT_ERR) { // Text character sequence Abnormalities - ret_status = RET_RD_ERR_3; // write error - } else if (ret == RET_CHK_BCC_ERR) { // BCC error - ret_status = RET_RD_ERR_4; // write error - } - block_check_mode = 1; // Bak Normal - cycle_state = NOR_READ_OK; - } - break; - case NOR_READ_OK: // Normal read-out - // The pickup of the read data - memcpy(p_buff, &lp_buffer[i_offset], (size_t)i_size); - cycle_state = NOR_READ_END; - break; - default: - // LCOV_EXCL_START 8: dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - NOR_ERRLOG("invalid state:%d", cycle_state); - // other error - ret_status = RET_RD_ERR_OTHER; - break; - // LCOV_EXCL_STOP - } - } - *get_state = block_check_mode; // 0:OrgNormal 1:BakNormal - free(lp_buffer); - } - return ret_status; // Normal -} - -static inline NOR_WRITE_BLK_CHK MtdnBackupWriteRetryCount(int *count, NOR_WRITE_BLK_CHK cur_state) { - NOR_WRITE_BLK_CHK ret_state = cur_state; - (*count)++; - if (*count > BACKUP_RETRY_CNT) { - NOR_ERRLOG("retry over!! state:%d count:%d", ret_state, *count); - ret_state = RET_WT_DEV_ERR; - } - return ret_state; -} - -/*************************************************************************** -@brief MtdnBackupWriteSub -@outline Writing of specified block ID -@type Completion return type -@param[in] const char * path_name : (/dev/mtd Device) -@param[in] int i_id : ID...0~ -@param[in] int i_offset : ( i_offset >= 0) -@param[in] int i_size : ( i_size > 0) -@param[in] void *p_buff : (p_buff != NULL) -@param[in] mtd_info_t * mtd_info : info -@return NOR_WRITE_BLK_CHK -@retval RET_WT_CHK_OK : No error -@retval Except : Error -@usage It is Backup API of data read. -*****************************************************************************/ -NOR_WRITE_BLK_CHK MtdnBackupWriteSub(const char * path_name, int i_id, int i_offset, - int i_size, void *p_buff, mtd_info_t * mtd_info) { - NOR_WRITE_BLK_CHK ret_status = RET_WT_CHK_OK; - char* lp_buffer; - - lp_buffer = (char *)malloc(mtd_info->erasesize); - if (lp_buffer == NULL) { - NOR_ERRLOG("malloc:%p", lp_buffer); - ret_status = RET_WT_DEV_ERR; // error - } else { - memset(lp_buffer, 0x00, mtd_info->erasesize); - NOR_W_STATE cycle_state = NOR_IDEL; - int retry_cnt = 0; - int get_state = 0; // Read status - - while ((cycle_state < NOR_WRITE_END) - &&(ret_status == RET_WT_CHK_OK)) { - switch (cycle_state) { - case NOR_IDEL: // IDLE - if (RET_RD_CHK_OK != MtdnBackupReadSub((const char *)path_name, i_id, 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info, &get_state)) { - cycle_state = NOR_READ_ERR; // read error - } else { - // write data set - memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size); - if (get_state == 0) { - cycle_state = NOR_ORG_READ; // Org read Normal - } else { - // Bakread Normal - cycle_state = NOR_BACK_READ; - } - // Embedding of write-in data - memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size); - } - break; - case NOR_READ_ERR: // read error - memset((char *)lp_buffer, 0x00, mtd_info->erasesize); - // Embedding of write-in data - memcpy(&lp_buffer[i_offset], p_buff, (size_t)i_size); - cycle_state = NOR_ORG_READ; // Org read Normal - break; - case NOR_ORG_READ: // Orgread Normal - // LCOV_EXCL_BR_START 6: double check - if (0 != MtdBackupCheksumWrite(lp_buffer, (int)mtd_info->erasesize )) { // check SUM - // LCOV_EXCL_BR_STOP - // error(It does not generate.) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_status = RET_WT_DEV_ERR; // LCOV_EXCL_LINE 8: dead code - } else { - // data write - if (0 == MtdnBackupWriteBase((const char *)path_name, (i_id+1), 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info)) { - cycle_state = NOR_BAK_WRT; // Bakwrite Success - retry_cnt = 0; - } else { - ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status); - } - } - break; - case NOR_BAK_WRT: // BakWriteSuccess - // Data write - // LCOV_EXCL_BR_START 11:unexpected branch - if (0 == MtdnBackupWriteBase((const char *)path_name, i_id, 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info)) { - // LCOV_EXCL_BR_STOP - cycle_state = NOR_WRITE_END; // Normal end - } else { - // LCOV_EXCL_START 5: c API error case. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status); - // LCOV_EXCL_STOP - } - break; - case NOR_BACK_READ: // Bak read normal - // LCOV_EXCL_BR_START 6: double check - if (0 != MtdBackupCheksumWrite(lp_buffer, (int)mtd_info->erasesize )) { // check SUM - // LCOV_EXCL_BR_STOP - // Retry over - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_status = RET_WT_DEV_ERR; // LCOV_EXCL_LINE 8: dead code - } else { - // data write - if (0 == MtdnBackupWriteBase((const char *)path_name, i_id, 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info)) { - // Org write Succses - cycle_state = NOR_ORG_WRITE; - retry_cnt = 0; - } else { - // LCOV_EXCL_START 5: c API error case. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status); - // LCOV_EXCL_STOP - } - } - break; - case NOR_ORG_WRITE: // Org write Succses - // data write - if (0 == MtdnBackupWriteBase((const char *)path_name, (i_id+1), 0, - (int)mtd_info->erasesize, lp_buffer, mtd_info)) { - // Normal end - cycle_state = NOR_WRITE_END; - } else { - // LCOV_EXCL_START 5: c API error case. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ret_status = MtdnBackupWriteRetryCount(&retry_cnt, ret_status); - // LCOV_EXCL_STOP - } - break; - default: - // LCOV_EXCL_START 8: dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - NOR_ERRLOG("invalid state:%d", cycle_state); - // other error - ret_status = RET_WT_ERR_OTHER; - break; - // LCOV_EXCL_STOP - } - } - free(lp_buffer); - } - return ret_status; // Normal -} - -/*************************************************************************** -@brief MtdnBackupReadBase -@outline Read-out of specified block ID -@type Completion return type -@param[in] const char * path_name : (/dev/mtd Device) -@param[in] int i_id : ID...0~ -@param[in] int i_offset : ( i_offset >= 0) -@param[in] int i_size : ( i_size > 0) -@param[in] void *p_buff : (p_buff != NULL) -@param[in] mtd_info_t * mtd_info : -@return int -@retval 0 : No error -@retval Except : Error -@usage It is Backup API of data read. -*****************************************************************************/ -int MtdnBackupReadBase(const char * path_name, int i_id, int i_offset, - int i_size, void *p_buff, mtd_info_t * mtd_info) { - int ret_status = RET_DEV_NORMAL; - - int mtd_fd = open(path_name, O_RDONLY|O_CLOEXEC); - // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed. - if (mtd_fd == -1) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 5:It's impossible to mock open() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - NOR_ERRLOG("open(%s):%s", path_name, strerror(errno)); - ret_status = RET_DEV_ERROR; - // LCOV_EXCL_STOP - } else { - int seek_top = i_id * (int)mtd_info->erasesize + i_offset; - int sector_size = BACKUP_SECTOR_SIZ; - int block_size = (int)mtd_info->erasesize / sector_size; // Division number - int llpi; - int buff_top = 0; - int get_size = i_size; - char * work_buff = (char *)p_buff; - ssize_t read_size; - - // It reads several sector minutes. - for (llpi=0; llpi < block_size; llpi++) { // LCOV_EXCL_BR_LINE 11:unexpected branch - // It moves to a head. - if (-1 == (off_t)lseek(mtd_fd, seek_top, SEEK_SET)) { - NOR_ERRLOG("lseek():%s", strerror(errno)); - ret_status = RET_DEV_ERROR; - break; - } - if (get_size >= sector_size) { // LCOV_EXCL_BR_LINE 6:double check - read_size = read(mtd_fd, &work_buff[buff_top], (size_t)sector_size); - if (read_size < 0) { - NOR_ERRLOG("read():%zd %s", read_size, strerror(errno)); - ret_status = RET_DEV_ERROR; - break; - } - - get_size -= sector_size; - if (get_size <= 0) { - break; - } - } else { - // LCOV_EXCL_START 8: dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - read_size = read(mtd_fd, &work_buff[buff_top], (size_t)get_size); - if (read_size < 0) { - NOR_ERRLOG("read():%zd %s", read_size, strerror(errno)); - ret_status = RET_DEV_ERROR; - break; - } - break; - // LCOV_EXCL_STOP - } - seek_top += (int)read_size; - buff_top += (int)read_size; - } - // LCOV_EXCL_BR_START 5:It's impossible to mock close() function,so this line can not be passed. - if (0 != close(mtd_fd)) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 5:It's impossible to mock close() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - NOR_ERRLOG("close():%s", strerror(errno)); - ret_status = RET_DEV_ERROR; - // LCOV_EXCL_STOP - } - } - return ret_status; -} - -/*************************************************************************** -@brief MtdnBackupWriteBase -@outline Writing of specified block ID -@type Completion return type -@param[in] const char * path_name : (/dev/mtd Device) -@param[in] int i_id : ID...0~ -@param[in] int i_offset : ( i_offset >= 0) -@param[in] int i_size : ( i_size > 0) -@param[in] void *p_buff : (p_buff != NULL) -@param[in] mtd_info_t * mtd_info : -@return int -@retval 0 : No error -@retval Except : Error -@usage It is Backup API of data read. -*****************************************************************************/ -int MtdnBackupWriteBase(const char * path_name, int i_id, int i_offset, - int i_size, void *p_buff, mtd_info_t * mtd_info) { - int ret_status = RET_DEV_NORMAL; - - int mtd_fd = open(path_name, O_RDWR|O_CLOEXEC); - if (mtd_fd == -1) { - NOR_ERRLOG("open(%s):%s", path_name, strerror(errno)); - ret_status = RET_DEV_ERROR; - } else { - erase_info_t s_mtd_erase; - s_mtd_erase.start = (__u32)i_id * mtd_info->erasesize; - s_mtd_erase.length = mtd_info->erasesize; - // erase - if (ioctl(mtd_fd, MEMERASE, &s_mtd_erase) < 0) { - NOR_ERRLOG("ioctl(MEMERASE):%s", strerror(errno)); - ret_status = RET_DEV_ERROR; - } else { - // write - int seek_top = i_id * (int)mtd_info->erasesize + i_offset; - int sector_size = BACKUP_SECTOR_SIZ; // - int block_size = (int)mtd_info->erasesize/sector_size; - int llpi; - int buff_top = 0; - int put_size = i_size; - char * work_buff = (char *)p_buff; - ssize_t write_size; - - for (llpi=0; llpi < block_size; llpi++) { // LCOV_EXCL_BR_LINE 11:unexpected branch - if (-1 == (off_t)lseek(mtd_fd, seek_top, SEEK_SET)) { - NOR_ERRLOG("lseek():%s", strerror(errno)); - ret_status = RET_DEV_ERROR; - break; - } - if (put_size >= sector_size) { // LCOV_EXCL_BR_LINE 6:double check - write_size = write(mtd_fd, &work_buff[buff_top], (size_t)sector_size); - if (write_size < 0) { - NOR_ERRLOG("write():%zd %s", write_size, strerror(errno)); - ret_status = RET_DEV_ERROR; - break; - } - put_size -= sector_size; - if (put_size <= 0) { - break; - } - } else { - // LCOV_EXCL_START 8: dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - write_size = write(mtd_fd, &work_buff[buff_top], (size_t)put_size); - if (write_size < 0) { - NOR_ERRLOG("write():%zd %s", write_size, strerror(errno)); - ret_status = RET_DEV_ERROR; - break; - } - break; - // LCOV_EXCL_STOP - } - seek_top += (int)write_size; - buff_top += (int)write_size; - } - } - // LCOV_EXCL_BR_START 5:It's impossible to mock close() function,so this line can not be passed. - if (0 != close(mtd_fd)) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 5:It's impossible to mock close() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - NOR_ERRLOG("close():%s", strerror(errno)); - ret_status = RET_DEV_ERROR; - // LCOV_EXCL_STOP - } - } - return ret_status; -} - -/*************************************************************************** -int backup_cheksum_read(char * p_buff, int erase_size ,int * ret_sum) - * A text character sequence and a sum value are checked. - IN: char * p_buff ...top address - int erase_size ...erase size - int * ret_sum ...return sum - - OUT: NOR_BLK_CHK RET_CHK_OK:Normal - RET_CHK_TEXT_ERR:test error - RET_CHK_BCC_ERR:sum error Except:other error - Remarks: -*****************************************************************************/ -NOR_BLK_CHK MtdBackupCheksumRead(char * p_buff, int erase_size, int * ret_sum) { - if (erase_size > BACKUP_CHECK_OFFSET) { // LCOV_EXCL_BR_LINE 6: double check - // The check of the compatibility of block data - if (0 != memcmp(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE)) { - char tmp[BACKUP_CHECK_SIZE + 1]; - memcpy(tmp, &p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_SIZE); - tmp[BACKUP_CHECK_SIZE] = '\0'; - NOR_ERRLOG("invalid check_text:%s", tmp); - return RET_CHK_TEXT_ERR; - } - // The check of the compatibility of block data - int llpi; - int get_sum; - int work_sum = 0; - get_sum = ((int)p_buff[(erase_size-BACKUP_CHECK_DAT2)] & 0xff) + - (((int)p_buff[(erase_size-BACKUP_CHECK_DAT1)]) << 8 & 0xff00); - - for (llpi=0; llpi < (erase_size-BACKUP_CHECK_OFFSET); llpi++) { - work_sum += p_buff[llpi]; - } - work_sum = (work_sum & 0xffff); - if (work_sum != get_sum) { - NOR_ERRLOG("invalid checksum: work:%d get:%d", work_sum, get_sum); - return RET_CHK_BCC_ERR; // checksum error - } - if (ret_sum != NULL) { // LCOV_EXCL_BR_LINE 6: double check - *ret_sum = work_sum; // chesum Storing - } - } else { - // LCOV_EXCL_START 8: dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - NOR_ERRLOG("invalid erase_size:%d", erase_size); - // checksum error - return RET_CHK_BCC_ERR; - // LCOV_EXCL_STOP - } - return RET_CHK_OK; -} - -/*************************************************************************** -int backup_cheksum_write(char * p_buff, int erase_size ) - * A text character sequence and a sum value are written in a buffer. - IN: char * p_buff ...top address - int erase_size ...erase size - - OUT: int 0:normal Except:error - Remarks: -*****************************************************************************/ -int MtdBackupCheksumWrite(char * p_buff, int erase_size ) { - int sum_add = 0; - - if (erase_size > BACKUP_CHECK_OFFSET) { // LCOV_EXCL_BR_LINE 11:unexpected branch - int ret_status; - // The check of the compatibility of block data - ret_status = memcmp(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE); - if (ret_status != 0) { - memcpy(&p_buff[(erase_size-BACKUP_CHECK_OFFSET)], BACKUP_CHECK_TEXT, BACKUP_CHECK_SIZE); - } - int llpi; - for (llpi=0; llpi < (erase_size-BACKUP_CHECK_OFFSET); llpi++) { - sum_add += p_buff[llpi]; - } - } - p_buff[(erase_size-BACKUP_CHECK_DAT2)] = (char)(sum_add & 0xff); - p_buff[(erase_size-BACKUP_CHECK_DAT1)] = (char)((sum_add>>8) & 0xff); - return RET_DEV_NORMAL; -} - -/*************************************************************************** -@brief MtdBackupInfo( mtd_info_t * mtd_info) -@outline The information to obtain is obtained. -@type Completion return type -@param[in] mtd_info_t * mtd_info -@return int -@retval 0 : No error -@retval Except : Error -@usage It is Backup API of data read. -*****************************************************************************/ -int MtdBackupInfo(const char * path_name, mtd_info_t * mtd_info) { - int ret_status = RET_DEV_NORMAL; - - int mtd_fd = open(path_name, O_RDONLY|O_CLOEXEC); - if (mtd_fd == -1) { - NOR_ERRLOG("open(%s):%s", path_name, strerror(errno)); - ret_status = RET_DEV_ERROR; - } else { - // device control mtdchar_ioctl of mtdchar.c - if (ioctl(mtd_fd, MEMGETINFO, mtd_info) < 0) { - NOR_ERRLOG("ioctl(MEMGETINFO):%s", strerror(errno)); - ret_status = RET_DEV_ERROR; - } - if (0 != close(mtd_fd)) { - NOR_ERRLOG("close():%s", strerror(errno)); - ret_status = RET_DEV_ERROR; - } - } - return ret_status; -} - -/************************************************************** - End Of Files -**************************************************************/ diff --git a/systemservice/rom_access_library/library/rom/Makefile b/systemservice/rom_access_library/library/rom/Makefile deleted file mode 100755 index 81acd8a..0000000 --- a/systemservice/rom_access_library/library/rom/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# -# @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. -# - -######### search paths ############# -VPATH += src -VPATH += ../include/$(COMPONENT_NAME) - - -######### installed shared library(*.so) ############# -INST_SHLIBS = libSS_RomAccessIf - -######### headers to be installed(*.h) ############# -INST_HEADERS = rom_access_library.h ss_sm_boot_access.h ss_sm_ram_access.h ss_sm_rom_access.h - -######### compiled sources ############# -libSS_RomAccessIf_SRCS += ss_sm_rom_access.cpp ss_sm_boot_access.cpp ss_sm_ram_access.cpp ss_sm_checksum.cpp - -######### add include path ############# -CPPFLAGS += -I./../include - -######### frameworkunifiedlog options ############# -CPPFLAGS += -DLINUX -CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3 -LDFLAGS += -Wl,--no-as-needed -LDFLAGS += -Wl,--no-undefined - -######### add compile option ############# -LDFLAGS += -L./../nor/ -LINK_SHLIB_CXX := y -LDFLAGS += -g -Wl,--gc-sections -shared -CPPFLAGS += -Werror=implicit-function-declaration -CPPFLAGS += -Werror=format-security -CPPFLAGS += -Wconversion -CPPFLAGS += -Wint-to-pointer-cast -CPPFLAGS += -Wpointer-arith -CPPFLAGS += -Wformat - -######### linked library (dynamic) ############# -LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified -LDLIBS += -Wl,-Bdynamic -lcommon -LDLIBS += -Wl,-Bdynamic -lssaccess -LDLIBS += -Wl,-Bdynamic -lextension - -CPPFLAGS_ss_sm_checksum.o += -fno-exceptions -CPPFLAGS_ss_sm_checksum.os += -fno-exceptions -CPPFLAGS_ss_sm_ram_access.o += -fno-exceptions -CPPFLAGS_ss_sm_ram_access.os += -fno-exceptions - -include ../../../system_service.mk diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp deleted file mode 100755 index 44e8a53..0000000 --- a/systemservice/rom_access_library/library/rom/src/ss_sm_boot_access.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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 "system_service/ss_sm_boot_access.h" -#include <stdio.h> -#include <native_service/cl_lock.h> -#include <native_service/cl_lockid.h> -#include "system_service/nor_backup.h" -#include "ss_rom_access_if_romaccesslibrarylog.h" -#include "ss_rom_access_define.h" - -#define BAI_MTD_DEV_RO "/dev/mtd1ro" // NOR device for RO -#define BAI_MTD_DEV_RW "/dev/mtd1" // NOR device for RW - -#define BAI_SERCTOR_OFFSET 0 -#define BAI_DATA_OFFSET 0 - -void* BOOT_AccessIf::g_m_plock = NULL; - -BOOT_AccessIf::BOOT_AccessIf(BAI_OPEN_t type) - : m_type(type) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - if (!(m_type == BAI_OPEN_RO // LCOV_EXCL_BR_LINE 6: double check - || m_type == BAI_OPEN_RW)) { // LCOV_EXCL_BR_LINE 6: double check - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - throw __LINE__; // LCOV_EXCL_LINE 6: double check - } - - if (g_m_plock == NULL) { - g_m_plock = CL_LockMap(LOCK_BOOT_ACCESS_IF); - - if (g_m_plock == MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed - FRAMEWORKUNIFIEDLOG( - ZONE_ERR, __FUNCTION__, - "CL_LockMap Error, please check whether you call CL_LockProcessInit"); - // LCOV_EXCL_BR_STOP - } - } - - if (g_m_plock) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - ROM_ACCESS_ASERT(0 == CL_LockGet(g_m_plock)); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); -} - -BOOT_AccessIf::~BOOT_AccessIf() { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - if (g_m_plock) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock)); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); -} - -EFrameworkunifiedStatus BOOT_AccessIf::getBootInfo(LBM_NOR_t* p_bootInfo) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus eRet = eFrameworkunifiedStatusOK; - try { - int ret; - if (p_bootInfo == NULL) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - throw __LINE__; - } - ret = mtdn_backup_Read((const char *) BAI_MTD_DEV_RO, BAI_SERCTOR_OFFSET, - BAI_DATA_OFFSET, sizeof(LBM_NOR_t), p_bootInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch - - if (ret != 0) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - throw __LINE__; - } - } catch (...) { - eRet = eFrameworkunifiedStatusFail; - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eRet; -} - -EFrameworkunifiedStatus BOOT_AccessIf::setBootInfo(LBM_NOR_t* p_bootInfo) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus eRet = eFrameworkunifiedStatusOK; - try { - int ret; - if (p_bootInfo == NULL) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - throw __LINE__; - } - if (m_type != BAI_OPEN_RW) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - throw __LINE__; - } - ret = mtdn_backup_Write((const char *) BAI_MTD_DEV_RW, BAI_SERCTOR_OFFSET, - BAI_DATA_OFFSET, sizeof(LBM_NOR_t), p_bootInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch - if (ret != 0) { // LCOV_EXCL_BR_LINE 5:c API error case - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ASERT(0); // LCOV_EXCL_LINE 5:c API error case - throw __LINE__; // LCOV_EXCL_LINE 5:c API error case - } - } catch (...) { - eRet = eFrameworkunifiedStatusFail; - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eRet; -} - diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp deleted file mode 100755 index 52cb114..0000000 --- a/systemservice/rom_access_library/library/rom/src/ss_sm_checksum.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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. - */ - -/////////////////////////////////////////////////////////////////////////////// -/// \ingroup tag_SystemManager -/// \brief This file provides for checksum calculation. -/// -/////////////////////////////////////////////////////////////////////////////// -#include "ss_sm_checksum.h" - -CSMChecksum::CSMChecksum() {} -CSMChecksum::~CSMChecksum() {} -UI_32 CSMChecksum::cal_checksum(const void* p_buf, size_t bufSize) { - size_t num; - UI_32 sum = 0; - const UI_32 *p_calcBuf = reinterpret_cast<const UI_32 *>(p_buf); - num = bufSize / sizeof(UI_32); - - for (size_t i = 0; i < num; i++) { - sum += p_calcBuf[i]; - } - return sum; -} - diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp deleted file mode 100755 index b5cf244..0000000 --- a/systemservice/rom_access_library/library/rom/src/ss_sm_ram_access.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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 "system_service/ss_sm_ram_access.h" -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <native_service/cl_lock.h> -#include <native_service/cl_lockid.h> -#include <stub/el_mem.h> -#include "system_service/ss_sm_boot_access.h" -#include "ss_rom_access_if_romaccesslibrarylog.h" -#include "ss_sm_checksum.h" -#include "ss_rom_access_define.h" - - - -#define RAM_PATH "/nv/BS/ss/rom_access_library/rwdata/ramdata.dat" -#define RAM_OLD_PATH RAM_PATH".old" -static const uint8_t kSigNature[] = { 0xDE, 0xAD, 0xBE, 0xEF }; -static const uint8_t kMagic[] = { 0xDE, 0xAD, 0xBE, 0xEF }; - -void* RAM_AccessIf::g_m_plock = NULL; -void* RAM_AccessIf::g_m_bakup_map = MAP_FAILED; -bool RAM_AccessIf::g_m_is_first_access = false; - -typedef struct { - char magic_in[4]; - RAM_SM_INFO_t data0; - uint32_t checksum0; - RAM_SM_INFO_t data1; - uint32_t checksum1; - char magic_out[4]; -} RAM_SM_DRAM_INFO_t; - -void RAM_AccessIf::initRamBackupEnable(RAM_WAKEUP_STATE wupState) { - RAM_SM_DRAM_INFO_t* p_buf; - CSMChecksum l_checksum; - - ROM_ACCESS_STATIC_ASERT(sizeof(RAM_SM_DRAM_INFO_t) <= SS_SYS_AREA_RAM_MAX_SIZE); - // Checking sizes because checksum calculations expect 4 bytes alignments - ROM_ACCESS_STATIC_ASERT((sizeof(RAM_SM_DRAM_INFO_t) % sizeof(UI_32)) == 0); - - if (g_m_bakup_map == MAP_FAILED) { - g_m_bakup_map = EL_mem_exram_mmap( // LCOV_EXCL_BR_LINE 11:unexpected branch - EL_MEM_TYPE_REGION_SYS, - EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_RAM_OFFSET, // LCOV_EXCL_BR_LINE 11:unexpected branch - SS_SYS_AREA_RAM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, - EL_MEM_CACHE_INVALID); - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed - if (g_m_bakup_map == MAP_FAILED) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed - return; // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed - } - } - p_buf = static_cast<RAM_SM_DRAM_INFO_t*>(g_m_bakup_map); - - // LCOV_EXCL_BR_START 6:impossible to confirm because wupState can not be changed - if ((RAM_WAKEUP_STATE_BACKUP_NG == wupState) || - (RAM_WAKEUP_STATE_BATTERY_DOWN == wupState) || - (memcmp(p_buf->magic_out, kMagic, sizeof(kMagic)) != 0) || - (memcmp(p_buf->magic_in, p_buf->magic_out, sizeof(p_buf->magic_in)) != 0)) { - // LCOV_EXCL_BR_STOP - // BACKUP NG - g_m_is_first_access = false; - bzero(p_buf, sizeof(RAM_SM_DRAM_INFO_t)); - } - - if (!g_m_is_first_access) { - // LCOV_EXCL_BR_START 11:unexpected branch - if ((memcmp(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature)) == 0) - && (memcmp(p_buf->data0.signature_out, kSigNature, - sizeof(kSigNature)) == 0) - && (l_checksum.cal_checksum(&(p_buf->data0), sizeof(p_buf->data0)) == p_buf->checksum0)) { - // LCOV_EXCL_BR_STOP - // Use data0 content - memcpy(&(p_buf->data1), &(p_buf->data0), sizeof(p_buf->data1)); - p_buf->checksum1 = p_buf->checksum0; - // LCOV_EXCL_BR_START 11:unexpected branch - } else if ((memcmp(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature)) == 0) - && (memcmp(p_buf->data1.signature_out, kSigNature, - sizeof(kSigNature)) == 0) - && (l_checksum.cal_checksum(&(p_buf->data1), sizeof(p_buf->data1)) == p_buf->checksum1)) { - // LCOV_EXCL_BR_STOP - // Use data1 content - memcpy(&(p_buf->data0), &(p_buf->data1), sizeof(p_buf->data0)); - p_buf->checksum0 = p_buf->checksum1; - } else { - // BACKUP NG or SIGNATURE CHECK or CHECK SUM NG - bzero(p_buf, sizeof(RAM_SM_DRAM_INFO_t)); - memcpy(p_buf->magic_in, kMagic, sizeof(kMagic)); - // data0 - memcpy(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature)); - memcpy(p_buf->data0.signature_out, kSigNature, sizeof(kSigNature)); - p_buf->checksum0 = - l_checksum.cal_checksum(&(p_buf->data0), sizeof(p_buf->data0)); // LCOV_EXCL_BR_LINE 11:unexpected branch - // data1 - memcpy(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature)); - memcpy(p_buf->data1.signature_out, kSigNature, sizeof(kSigNature)); - p_buf->checksum1 = - l_checksum.cal_checksum(&(p_buf->data1), sizeof(p_buf->data1)); // LCOV_EXCL_BR_LINE 11:unexpected branch - memcpy(p_buf->magic_out, kMagic, sizeof(kMagic)); - } - } - memcpy(&m_buf, &(p_buf->data0), sizeof(p_buf->data0)); -} - -void RAM_AccessIf::finalRamBackupEnable(void) { - RAM_SM_DRAM_INFO_t* p_buf; - CSMChecksum l_checksum; - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed - if (g_m_bakup_map == MAP_FAILED) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ASERT(0); // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed - return; // LCOV_EXCL_LINE 6:impossible to confirm because g_m_bakup_map can not be changed - } - - p_buf = static_cast<RAM_SM_DRAM_INFO_t*>(g_m_bakup_map); - - // kSigNature is cleared during writing - bzero(m_buf.signature_in, sizeof(kSigNature)); - - // data0 - memcpy(&(p_buf->data0), &m_buf, sizeof(p_buf->data0)); - memcpy(p_buf->data0.signature_in, kSigNature, sizeof(kSigNature)); - p_buf->checksum0 = l_checksum.cal_checksum(&(p_buf->data0), // LCOV_EXCL_BR_LINE 11:unexpected branch - sizeof(p_buf->data0)); - - // data1 - memcpy(&(p_buf->data1), &m_buf, sizeof(p_buf->data1)); - memcpy(p_buf->data1.signature_in, kSigNature, sizeof(kSigNature)); - p_buf->checksum1 = l_checksum.cal_checksum(&(p_buf->data1), // LCOV_EXCL_BR_LINE 11:unexpected branch - sizeof(p_buf->data1)); - - // Set kSigNature - memcpy(m_buf.signature_in, kSigNature, - sizeof(kSigNature)); -} - -RAM_AccessIf::RAM_AccessIf( - RAM_WAKEUP_STATE wupState /* = RAM_WAKEUP_STATE_DONT_CARE */) - : m_buf(), - m_dirty(false) { - - if (g_m_plock == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - g_m_plock = CL_LockMap(LOCK_RAM_ACCESS_IF); - if (g_m_plock == MAP_FAILED) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed - FRAMEWORKUNIFIEDLOG( - ZONE_ERR, __FUNCTION__, - "CL_LockMap Error, please check whether you call CL_LockProcessInit"); - // LCOV_EXCL_BR_STOP - g_m_plock = NULL; - } - } - if (g_m_plock) { - if (0 != CL_LockGet(g_m_plock)) { - ROM_ACCESS_ASERT(0); - } - } - - if (RAM_WAKEUP_STATE_BATTERY_DOWN == wupState) { // LCOV_EXCL_BR_LINE 13: - // Models without DRAM backups are initialized when +B is down. - // Deletes files because models with DRAM backups are also backwards compatible - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - unlink(RAM_PATH); // LCOV_EXCL_LINE 13: - unlink(RAM_OLD_PATH); // LCOV_EXCL_LINE 13: - } - - initRamBackupEnable(wupState); - g_m_is_first_access = true; -} - -RAM_AccessIf::~RAM_AccessIf() { - if (m_dirty) { - finalRamBackupEnable(); - } - if (g_m_plock) { - ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock)); - } - - return; -} - -EFrameworkunifiedStatus RAM_AccessIf::getRamInfo(RAM_SM_INFO_t* p_bootInfo) { - *p_bootInfo = m_buf; - return eFrameworkunifiedStatusOK; -} - -EFrameworkunifiedStatus RAM_AccessIf::setRamInfo(RAM_SM_INFO_t* p_bootInfo) { - if (0 != memcmp(&m_buf, p_bootInfo, sizeof(m_buf))) { // LCOV_EXCL_BR_LINE 11:unexpected branch - m_buf = *p_bootInfo; - m_dirty = true; - } - - return eFrameworkunifiedStatusOK; -} diff --git a/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp b/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp deleted file mode 100755 index 53589c2..0000000 --- a/systemservice/rom_access_library/library/rom/src/ss_sm_rom_access.cpp +++ /dev/null @@ -1,969 +0,0 @@ -/* - * @copyright Copyright (c) 2016-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. - */ - -/////////////////////////////////////////////////////////////////////////////// -/// \ingroup tag_SS_RomAccess -/// \brief This file supports ROM Access. -/// -/////////////////////////////////////////////////////////////////////////////// -#include "system_service/ss_sm_rom_access.h" -#include <fcntl.h> -#include <stdlib.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_types.h> - -#include <stub/el_mem.h> -#include <native_service/cl_lock.h> -#include <native_service/cl_lockid.h> - -#include "ss_rom_access_if_romaccesslibrarylog.h" -#include "ss_sm_checksum.h" -#include "ss_rom_access_define.h" - -#define ROM_ACCESS_DIR "/nv/BS/ss/rom_access_library/rwdata" -#define ROM_ACCESS_FILE "romdata.dat" -const CHAR kDefaultRomDevice[] = ROM_ACCESS_DIR"/"ROM_ACCESS_FILE; -const CHAR kRecoveryRomDevice[] = ROM_ACCESS_DIR"/"ROM_ACCESS_FILE".old"; -static const uint8_t kMagic[] = { 0xDE, 0xAD, 0xBE, 0xEF }; - -typedef enum { - INDEX_BOOTFLAG = 0, - INDEX_ACTIVE_FLASHLOADER, - INDEX_PARTITIONS_RW_FLAG, - INDEX_LAST_USER_MODE, - INDEX_TRANSPORT_MODE, - INDEX_PRODUCTION_MODE, - INDEX_LIMP_HOME_CUT_OFF_REQUEST, - INDEX_DATARESET_MODE, - INDEX_RESET_COUNT, - INDEX_LAST_ILGRESET, - INDEX_PROGUPDATE_STATE, - INDEX_ERR_LOG_COUNT, - INDEX_NEXT_WAKEUP_TYPE, - INDEX_SIGNATURE = 15, // As far as possible, do not modify this index value!!!!! - INDEX_PROG_STATE = 20, - INDEX_PROG_STATE_END = 63, - INDEX_PRODUCT_PRIVATE, // 64 - INDEX_PRODUCT_PRIVATE_END = (INDEX_PRODUCT_PRIVATE + ROM_PRODUCT_PRIVATE_MAX - - 1), - INDEX_MAX -} eRomIndices; - -void* ROM_AccessIf::g_m_plock = NULL; -void* ROM_AccessIf::g_m_bakup_map = MAP_FAILED; -bool ROM_AccessIf::g_m_is_dram_valid = false; - -typedef struct { - char magic_in[4]; - bool is_dirty; - UI_32 data[INDEX_MAX]; - uint32_t checksum; - char magic_out[4]; -} ROM_SM_DRAM_INFO_t; - -ROM_AccessIf::ROM_AccessIf() - : m_pBoot(NULL), - m_norIsDirty(false) { - bzero(&m_nor, sizeof(m_nor)); - - if (g_m_plock == NULL) { - g_m_plock = CL_LockMap(LOCK_ROM_ACCESS_IF); - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed - if (g_m_plock == MAP_FAILED) { - // LCOV_EXCL_BR_STOP - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed - FRAMEWORKUNIFIEDLOG( - ZONE_ERR, __FUNCTION__, - "CL_LockMap Error, please check whether you call CL_LockProcessInit"); - // LCOV_EXCL_BR_STOP - } - } - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed - if (g_m_plock) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed - if (0 != CL_LockGet(g_m_plock)) { - // LCOV_EXCL_BR_STOP - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because g_m_plock can not be changed - } - } -} - -ROM_AccessIf::~ROM_AccessIf() { - if (m_pBoot) { - if (m_norIsDirty) { - ROM_ACCESS_ASERT(eFrameworkunifiedStatusOK == m_pBoot->setBootInfo(&m_nor)); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - delete m_pBoot; // LCOV_EXCL_BR_LINE 11:unexpected branch - m_pBoot = NULL; - } - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_plock can not be changed - if (g_m_plock) { - ROM_ACCESS_ASERT(0 == CL_LockRelease(g_m_plock)); - } // LCOV_EXCL_BR_STOP -} - -EFrameworkunifiedStatus ROM_AccessIf::LBA_Read(UI_32 offset, UI_32* buffer, - UI_32 word_count) { - ROM_SM_DRAM_INFO_t* p_buf; - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed - if (g_m_bakup_map == MAP_FAILED) { - // LCOV_EXCL_BR_STOP - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " g_m_bakup_map uninitialize"); - return eFrameworkunifiedStatusFail; - } - - p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map); - memcpy(buffer, &p_buf->data[offset], word_count * sizeof(UI_32)); - - return eFrameworkunifiedStatusOK; -} - -EFrameworkunifiedStatus ROM_AccessIf::LBA_Write(UI_32 offset, UI_32 value) { - UI_32 l_value = value; - return LBA_Write(offset, &l_value, sizeof(UI_32)); -} - -EFrameworkunifiedStatus ROM_AccessIf::LBA_Write(UI_32 offset, UI_32* value, UI_32 size) { - EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; - const CHAR *l_file = kDefaultRomDevice; - SI_32 fd = -1; - ROM_SM_DRAM_INFO_t* p_buf; - if (g_m_bakup_map == MAP_FAILED) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " g_m_bakup_map uninitialize"); - return eFrameworkunifiedStatusFail; - } - - p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map); - - if (memcmp(&p_buf->data[offset], value, size) == 0) { - // Not Write when the value does not change - return eFrameworkunifiedStatusOK; - } - - p_buf->is_dirty = true; - memcpy(&p_buf->data[offset], value, size); - - CSMChecksum l_checksum; - p_buf->checksum = l_checksum.cal_checksum(&(p_buf->data), // LCOV_EXCL_BR_LINE 11:unexpected branch - sizeof(p_buf->data)); // LCOV_EXCL_BR_LINE 11:unexpected branch - - if (0 != rename(kDefaultRomDevice, kRecoveryRomDevice)) { - ROM_ACCESS_ERRNO(0); - } else { - int sync_fd; - sync_fd = open(kRecoveryRomDevice, O_RDWR | O_DSYNC | O_CLOEXEC); // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed. - if (sync_fd != -1) { - // LCOV_EXCL_BR_STOP - ROM_ACCESS_ERRNO(0 == fsync(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch - ROM_ACCESS_ERRNO(0 == close(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch - } else { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 5:It's impossible to mock open() function,so this line can not be passed. - } - } - fd = open(l_file, O_CREAT | O_TRUNC | O_RDWR | O_DSYNC | O_CLOEXEC, 00664); // LCOV_EXCL_BR_LINE 11:unexpected branch - if (fd == -1) { - ROM_ACCESS_ERRNO(0); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: open(%s) returned -1", l_file); - eStatus = eFrameworkunifiedStatusFail; - goto ERROR; - } - - /** Write the value of 32-bits at offset location */ - if (sizeof(p_buf->data) != write(fd, p_buf->data, sizeof(p_buf->data))) { // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_START 5:It's impossible to mock write() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ERRNO(0); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: write(%s) returned -1", l_file); - eStatus = eFrameworkunifiedStatusFail; - goto ERROR; - // LCOV_EXCL_STOP - } else { - ROM_ACCESS_ERRNO(0 == close(fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch - fd = -1; - - if (0 != unlink(kRecoveryRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_START 5:It's impossible to mock unlink() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ERRNO(0); - // LCOV_EXCL_STOP - } - - int sync_fd; - sync_fd = open(ROM_ACCESS_DIR, O_RDONLY); // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed. - if (sync_fd != -1) { - // LCOV_EXCL_BR_STOP - ROM_ACCESS_ERRNO(0 == fsync(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch - ROM_ACCESS_ERRNO(0 == close(sync_fd)); // LCOV_EXCL_BR_LINE 11:unexpected branch - } else { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ERRNO(0); // LCOV_EXCL_LINE 5:It's impossible to mock open() function,so this line can not be passed. - } - } - p_buf->is_dirty = false; - ERROR: if (fd != -1) { // LCOV_EXCL_BR_LINE 5:It's impossible to mock open() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - close(fd); // LCOV_EXCL_LINE 5:It's impossible to mock write() function,so this line can not be passed. - } - // @todo memory value is not restored if non-volatile area writing fails after writing to memory - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetDataResetMode_sub(EDATARESET_MODE* pDataResetMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_DATARESET_MODE, - reinterpret_cast<UI_32 *>(pDataResetMode), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -// This function may be called in duplicate, -// so it is necessary to operate normally even if it is called in duplicate. -EFrameworkunifiedStatus ROM_AccessIf::SystemInitialize(DRAM_BACKUP_STATE bkupState) { - EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - - ROM_ACCESS_STATIC_ASERT(sizeof(ROM_SM_DRAM_INFO_t) <= SS_SYS_AREA_ROM_MAX_SIZE); - - // Checksum calculations expect 4-bytes alignments - ROM_ACCESS_STATIC_ASERT((sizeof(ROM_SM_DRAM_INFO_t) % sizeof(UI_32)) == 0); - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed - if (g_m_bakup_map == MAP_FAILED) { - // LCOV_EXCL_BR_STOP - g_m_bakup_map = EL_mem_exram_mmap( - EL_MEM_TYPE_REGION_SYS, - EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_ROM_OFFSET, - SS_SYS_AREA_ROM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, - EL_MEM_CACHE_INVALID); - if (g_m_bakup_map == MAP_FAILED) { - ROM_ACCESS_ERRNO(0); - return eFrameworkunifiedStatusFail; - } - } - - if (bkupState - == DRAM_BACKUP_STATE_NG) { - // BACKUP NG - ROM_SM_DRAM_INFO_t* p_buf; - CSMChecksum l_checksum; - - p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map); - bzero(&(p_buf->magic_in), sizeof(p_buf->magic_in)); - bzero(&(p_buf->magic_out), sizeof(p_buf->magic_out)); - g_m_is_dram_valid = false; - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::Initialize() { - const CHAR *l_file = kDefaultRomDevice; - EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; - CSMChecksum l_checksum; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - if (g_m_bakup_map == MAP_FAILED) { - g_m_bakup_map = EL_mem_exram_mmap( // LCOV_EXCL_BR_LINE 11:unexpected branch - EL_MEM_TYPE_REGION_SYS, - EL_mem_getOffset(EL_MEM_ID_SYS_BOOT) + SS_SYS_AREA_ROM_OFFSET, // LCOV_EXCL_BR_LINE 11:unexpected branch - SS_SYS_AREA_ROM_MAX_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, - EL_MEM_CACHE_INVALID); - // LCOV_EXCL_BR_START 6:impossible to confirm because g_m_bakup_map can not be changed - if (g_m_bakup_map == MAP_FAILED) { - // LCOV_EXCL_BR_STOP - ROM_ACCESS_ERRNO(0); - return eFrameworkunifiedStatusFail; - } - } - if (!g_m_is_dram_valid) { - SI_32 fd = -1; - ROM_SM_DRAM_INFO_t* p_buf; - p_buf = static_cast<ROM_SM_DRAM_INFO_t*>(g_m_bakup_map); - if ((p_buf->is_dirty) - || (memcmp(kMagic, p_buf->magic_in, sizeof(kMagic)) != 0) - || (memcmp(kMagic, p_buf->magic_out, sizeof(kMagic)) != 0) - || ((l_checksum.cal_checksum(&(p_buf->data), sizeof(p_buf->data)) != p_buf->checksum))) { - // Need to synchronize the NVs with the data on the DRAM - struct stat stutInfo; - if (0 != stat(ROM_ACCESS_DIR, &stutInfo)) { // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_BR_START 5:It's impossible to mock stat() function,so this line can not be passed. - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s not found", ROM_ACCESS_DIR); - // LCOV_EXCL_BR_STOP - ROM_ACCESS_ASERT(0 == mkdir(ROM_ACCESS_DIR, 0775)); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - int expectSize = (INT32)(INDEX_MAX * sizeof(UI_32)); - int sigSize = (INT32)((INDEX_SIGNATURE + 1) * sizeof(UI_32)); - - if (access(kRecoveryRomDevice, F_OK) == 0) { // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_BR_START 5:It's impossible to mock access() function,so this line can not be passed. - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s is found", kRecoveryRomDevice); - // LCOV_EXCL_BR_STOP - if (0 != unlink(kDefaultRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_BR_START 5:It's impossible to mock unlink() function,so this line can not be passed. - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error:unlink(%s)", kDefaultRomDevice); - // LCOV_EXCL_BR_STOP - } - if (0 != rename(kRecoveryRomDevice, kDefaultRomDevice)) { // LCOV_EXCL_BR_LINE 11:unexpected branch - ROM_ACCESS_ERRNO(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - } - if (0 == stat(kDefaultRomDevice, &stutInfo) // LCOV_EXCL_BR_LINE 11:unexpected branch - && stutInfo.st_size >= sigSize) { // LCOV_EXCL_BR_LINE 11:unexpected branch - // Use this value if there are more sizes than SIGNITURE - #define ROM_ACCESS_INFO_SIZE (sizeof(ROM_SM_DRAM_INFO_t) - (sizeof(UI_32)*INDEX_MAX)) - #define ROM_ACCESS_MAX_SIZE (INT32)(SS_SYS_AREA_ROM_MAX_SIZE - ROM_ACCESS_INFO_SIZE) - // Maximum size of RAM area - An upper size limit of the management info size - if (stutInfo.st_size > ROM_ACCESS_MAX_SIZE) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - stutInfo.st_size = ROM_ACCESS_MAX_SIZE; - } - fd = open(l_file, // LCOV_EXCL_BR_LINE 11:unexpected branch - O_RDWR | O_DSYNC | O_CLOEXEC); // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed. - if (fd != -1) { - int ret; - if (stutInfo.st_size < expectSize) { - // If the files are large, APPEND them - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "PADDING"); - ret = ftruncate(fd, expectSize); - ROM_ACCESS_ERRNO(ret == 0); - fsync(fd); - } else if (stutInfo.st_size > expectSize) { - // If the files are small, TRANC them - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "CUT"); - ret = ftruncate(fd, expectSize); - ROM_ACCESS_ERRNO(ret == 0); - fsync(fd); - } - } - // LCOV_EXCL_BR_STOP - } else { - // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h" - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s size is not crrect", - kDefaultRomDevice); - // LCOV_EXCL_BR_STOP - fd = open(l_file, O_CREAT | O_TRUNC | O_RDWR | O_DSYNC | O_CLOEXEC, - 00664); // LCOV_EXCL_BR_LINE 11:unexpected branch - // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed. - if (fd != -1) { - UI_32 buf[INDEX_MAX]; - bzero(buf, sizeof(buf)); - ROM_ACCESS_ASERT(sizeof(buf) == write(fd, buf, sizeof(buf))) - fsync(fd); - } - // LCOV_EXCL_BR_STOP - } - // LCOV_EXCL_BR_START 5:It's impossible to mock open() function,so this line can not be passed. - if (fd != -1) { - // LCOV_EXCL_BR_STOP - UI_32 read_buf[INDEX_MAX]; - if (-1 == lseek(fd, 0, SEEK_SET)) { - // LCOV_EXCL_START 5:It's impossible to mock lseek() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ERRNO(0); - // LCOV_EXCL_STOP - } else { - if (-1 == read(fd, read_buf, sizeof(read_buf))) { - // LCOV_EXCL_START 5:It's impossible to mock read() function,so this line can not be passed. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ERRNO(0); - // LCOV_EXCL_STOP - } else { - memcpy(p_buf->magic_in, kMagic, sizeof(kMagic)); - memcpy(&p_buf->data, read_buf, sizeof(p_buf->data)); - p_buf->checksum = l_checksum.cal_checksum(&(p_buf->data), - sizeof(p_buf->data)); - memcpy(p_buf->magic_out, kMagic, sizeof(kMagic)); - p_buf->is_dirty = false; - - // Synchronization of NV data with data on the DRAM completed - g_m_is_dram_valid = true; - } - } - close(fd); - } else { - // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h" - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:open(%s)", l_file); - // LCOV_EXCL_BR_STOP - } - } else { - // No need to synchronize NV data with data on the DRAM - g_m_is_dram_valid = true; - } - } else { - // LCOV_EXCL_BR_START 15:marco defined in "native_service/ns_logger_if.h" - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " alreay initialized"); - // LCOV_EXCL_BR_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetSignature(UI_32* pSigValue) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_SIGNATURE, - reinterpret_cast<UI_32 *>(pSigValue), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetSignature(UI_32 sigValue) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_SIGNATURE, - sigValue))) { - // LCOV_EXCL_BR_STOP - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(0x%X) errored: 0x%X", - sigValue, eStatus); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetBootMode(EBOOT_MODE* pBootMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_BOOTFLAG, - reinterpret_cast<UI_32 *>(pBootMode), 1))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: LBA_Read() errored: 0x%X", eStatus); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetBootMode(EBOOT_MODE bootMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_BOOTFLAG, bootMode))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%d) errored: 0x%X", - bootMode, eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetLastUserMode(EUSER_MODE* pUserMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LAST_USER_MODE, - reinterpret_cast<UI_32 *>(pUserMode), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetLastUserMode(EUSER_MODE userMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_LAST_USER_MODE, userMode))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X", - userMode == USER_OFF ? "USER_OFF" : "USER_ON", eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetTransportMode(ECONTROL_MODE* pControlMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_TRANSPORT_MODE, - reinterpret_cast<UI_32 *>(pControlMode), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetTransportMode(ECONTROL_MODE controlMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_TRANSPORT_MODE, controlMode))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X", - controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE", - eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - - -EFrameworkunifiedStatus ROM_AccessIf::GetProductionMode(ECONTROL_MODE* pControlMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_PRODUCTION_MODE, - reinterpret_cast<UI_32 *>(pControlMode), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetProductionMode(ECONTROL_MODE controlMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_PRODUCTION_MODE, controlMode))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X", - controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE", - eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetLimpHomeCutOffReqMode(ECONTROL_MODE* pControlMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LIMP_HOME_CUT_OFF_REQUEST, - reinterpret_cast<UI_32 *>(pControlMode), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetLimpHomeCutOffReqMode(ECONTROL_MODE controlMode) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_LIMP_HOME_CUT_OFF_REQUEST, controlMode))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write(%s) errored: 0x%X", - controlMode == DISABLE_MODE ? "DISABLE_MODE" : "ENABLE_MODE", - eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetDataResetMode(EDATARESET_MODE* pDataResetMode) { - EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - try { - UI_32 sts; - if (m_pBoot == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because m_pBoot can not be changed - m_pBoot = new BOOT_AccessIf(BAI_OPEN_RW); // LCOV_EXCL_BR_LINE 11:unexpected branch - if (eFrameworkunifiedStatusOK != m_pBoot->getBootInfo(&m_nor)) { // LCOV_EXCL_BR_LINE 11:unexpected branch - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - throw eFrameworkunifiedStatusFail; - } - } - - if ((m_nor.sts1 == m_nor.sts2) || (m_nor.sts1 == m_nor.sts3)) { - sts = m_nor.sts1; - } else if (m_nor.sts2 == m_nor.sts3) { - sts = m_nor.sts2; - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - } else { - sts = SYSUP_CND_NORMAL; - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - - if (sts == SYSUP_CND_FACTRESET) { - *pDataResetMode = DATARESET_FACTORY; - } else { - eStatus = GetDataResetMode_sub(pDataResetMode); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - } catch (const EFrameworkunifiedStatus& e) { - eStatus = e; - } catch (...) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - eStatus = eFrameworkunifiedStatusFail; - } // LCOV_EXCL_STOP - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetDataResetModeFast(EDATARESET_MODE* pDataResetMode) { - EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; - void* p_map = MAP_FAILED; - size_t mapSize = 0; - try { - LBM_RAM_t* p_lbm = NULL; - mapSize = SS_SYS_AREA_BOOT_MAX_SIZE; - - if (EL_mem_getLength(EL_MEM_ID_SYS_BOOT) < SS_SYS_AREA_BOOT_MAX_SIZE) { // LCOV_EXCL_BR_LINE 11:unexpected branch - mapSize = EL_mem_getLength(EL_MEM_ID_SYS_BOOT); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - // LCOV_EXCL_BR_START 11:unexpected branch - p_map = reinterpret_cast<LBM_RAM_t*>(EL_mem_exram_mmap(EL_MEM_TYPE_REGION_SYS, - EL_mem_getOffset(EL_MEM_ID_SYS_BOOT), - mapSize, PROT_READ | PROT_WRITE, - MAP_SHARED, EL_MEM_CACHE_INVALID)); - // LCOV_EXCL_BR_STOP - if (p_map == MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed - ROM_ACCESS_ERRNO(0); // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed - throw eFrameworkunifiedStatusFail; - } - p_lbm = static_cast<LBM_RAM_t*>(p_map); - if (p_lbm->sts == SYSUP_CND_FACTRESET) { - *pDataResetMode = DATARESET_FACTORY; - } else { - eStatus = GetDataResetMode_sub(pDataResetMode); // LCOV_EXCL_BR_LINE 11:unexpected branch - } - } catch (const EFrameworkunifiedStatus& e) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - eStatus = e; - } catch (...) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ASERT(0); - eStatus = eFrameworkunifiedStatusFail; - } // LCOV_EXCL_STOP - - if (p_map != MAP_FAILED) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because p_map can not be changed - ROM_ACCESS_ERRNO(0 == EL_mem_exram_munmap(p_map, // LCOV_EXCL_BR_LINE 11:unexpected branch - mapSize)); - } - return eStatus; // LCOV_EXCL_BR_LINE 11:unexpected branch -} - -EFrameworkunifiedStatus ROM_AccessIf::SetDataResetMode(EDATARESET_MODE dataResetMode) { - EFrameworkunifiedStatus eStatus; - EDATARESET_MODE l_mode = dataResetMode; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - try { - if (m_pBoot == NULL) { // LCOV_EXCL_BR_LINE 6:impossible to confirm because m_pBoot can not be changed - // LCOV_EXCL_BR_START 11:unexpected branch - m_pBoot = new BOOT_AccessIf(BAI_OPEN_RW); - // LCOV_EXCL_BR_STOP - if (eFrameworkunifiedStatusOK != m_pBoot->getBootInfo(&m_nor)) { // LCOV_EXCL_BR_LINE 11:unexpected branch - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - throw eFrameworkunifiedStatusFail; - } - } - m_norIsDirty = true; - if (dataResetMode == DATARESET_FACTORY) { - m_nor.sts1 = m_nor.sts2 = m_nor.sts3 = SYSUP_CND_FACTRESET; - l_mode = DATARESET_NONE; - } else { - m_nor.sts1 = m_nor.sts2 = m_nor.sts3 = SYSUP_CND_NORMAL; - } - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Write(INDEX_DATARESET_MODE, l_mode))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", - eStatus); - // LCOV_EXCL_STOP - } - } catch (const EFrameworkunifiedStatus& e) { - ROM_ACCESS_ASERT(0); // LCOV_EXCL_BR_LINE 11:unexpected branch - eStatus = e; - } catch (...) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - ROM_ACCESS_ASERT(0); - eStatus = eFrameworkunifiedStatusFail; - } // LCOV_EXCL_STOP - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetResetCount(UI_32* pResetCount) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_RESET_COUNT, reinterpret_cast<UI_32 *>(pResetCount), - 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} -EFrameworkunifiedStatus ROM_AccessIf::SetResetCount(UI_32 resetCount) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - if (eFrameworkunifiedStatusOK != (eStatus = // LCOV_EXCL_BR_LINE 11:unexpected branch - LBA_Write(INDEX_RESET_COUNT, resetCount))) { // LCOV_EXCL_BR_LINE 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch - eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} -EFrameworkunifiedStatus ROM_AccessIf::GetLastIlgReset(ELASTILGRESET_MODE* pLastIlgReset) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_LAST_ILGRESET, - reinterpret_cast<UI_32 *>(pLastIlgReset), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetLastIlgReset(ELASTILGRESET_MODE lastIlgReset) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_LAST_ILGRESET, lastIlgReset))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch - eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetProgUpdateState( - EPROGUPDATE_STATE* pProgUpdateState) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_PROGUPDATE_STATE, - reinterpret_cast<UI_32 *>(pProgUpdateState), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetProgUpdateState(EPROGUPDATE_STATE progUpdateState) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_PROGUPDATE_STATE, progUpdateState))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch - eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetErrLogCount(UI_32* pErrLogCount) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_ERR_LOG_COUNT, - reinterpret_cast<UI_32 *>(pErrLogCount), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetErrLogCount(UI_32 errLogCount) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - if (eFrameworkunifiedStatusOK != (eStatus = // LCOV_EXCL_BR_LINE 11:unexpected branch - LBA_Write(INDEX_ERR_LOG_COUNT, errLogCount))) { // LCOV_EXCL_BR_LINE 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", // LCOV_EXCL_LINE 11:unexpected branch - eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetNextWakeupType(ENEXT_WAKEUP_TYPE *pNextWakeupType) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK != (eStatus = LBA_Read((UI_32) INDEX_NEXT_WAKEUP_TYPE, - reinterpret_cast<UI_32 *>(pNextWakeupType), 1))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Read() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetNextWakeupType(ENEXT_WAKEUP_TYPE nextWakeupType) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_NEXT_WAKEUP_TYPE, nextWakeupType))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_LINE 11:unexpected branch - " Error: LBA_Write() errored: 0x%X", eStatus); // LCOV_EXCL_LINE 11:unexpected branch - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetActiveFlashloader( - EACTIVE_FLASHLOADER activeFlashloader) { - EFrameworkunifiedStatus eStatus; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_ACTIVE_FLASHLOADER, activeFlashloader))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG( - ZONE_ERR, - __FUNCTION__, - " Error: LBA_Write(%s) errored: 0x%X", - activeFlashloader == NEW_FLASHLOADER ? - "NEW_FLASHLOADER" : "OLD_FLASHLOADER", - eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::SetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]) { - EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Write(INDEX_PRODUCT_PRIVATE, reinterpret_cast<UI_32*>(buf), - ROM_PRODUCT_PRIVATE_MAX / sizeof(UI_32)))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Write() errored: 0x%X", - eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return eStatus; -} - -EFrameworkunifiedStatus ROM_AccessIf::GetProductPrivate(UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]) { - EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK; - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - - // LCOV_EXCL_BR_START 11:unexpected branch - if (eFrameworkunifiedStatusOK - != (eStatus = LBA_Read(INDEX_PRODUCT_PRIVATE, reinterpret_cast<UI_32 *>(buf), - ROM_PRODUCT_PRIVATE_MAX / sizeof(UI_32)))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 11:unexpected branch - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: LBA_Read() errored: 0x%X", eStatus); - // LCOV_EXCL_STOP - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - - return eStatus; -} |