diff options
Diffstat (limited to 'systemservice/rom_access_library/library/include')
10 files changed, 2115 insertions, 0 deletions
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 new file mode 100644 index 00000000..417b78f7 --- /dev/null +++ b/systemservice/rom_access_library/library/include/rom_access_library_nor.h @@ -0,0 +1,43 @@ +// +// @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 new file mode 100644 index 00000000..1e02e6e2 --- /dev/null +++ b/systemservice/rom_access_library/library/include/rom_access_library_rom.h @@ -0,0 +1,45 @@ +// +// @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 new file mode 100644 index 00000000..689fea20 --- /dev/null +++ b/systemservice/rom_access_library/library/include/ss_rom_access_define.h @@ -0,0 +1,38 @@ +/* + * @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 new file mode 100644 index 00000000..e62b5af3 --- /dev/null +++ b/systemservice/rom_access_library/library/include/ss_rom_access_if_romaccesslibrarylog.h @@ -0,0 +1,89 @@ +/* + * @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 new file mode 100644 index 00000000..271964c6 --- /dev/null +++ b/systemservice/rom_access_library/library/include/ss_sm_checksum.h @@ -0,0 +1,34 @@ +/* + * @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 new file mode 100644 index 00000000..8c95a10c --- /dev/null +++ b/systemservice/rom_access_library/library/include/system_service/nor_backup.h @@ -0,0 +1,212 @@ +/* + * @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 new file mode 100644 index 00000000..50e44b11 --- /dev/null +++ b/systemservice/rom_access_library/library/include/system_service/rom_access_library.h @@ -0,0 +1,47 @@ +// +// @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 new file mode 100644 index 00000000..bac051cd --- /dev/null +++ b/systemservice/rom_access_library/library/include/system_service/ss_sm_boot_access.h @@ -0,0 +1,362 @@ +/* + * @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 new file mode 100644 index 00000000..f96966ba --- /dev/null +++ b/systemservice/rom_access_library/library/include/system_service/ss_sm_ram_access.h @@ -0,0 +1,235 @@ +/* + * @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 new file mode 100644 index 00000000..4ba1a76a --- /dev/null +++ b/systemservice/rom_access_library/library/include/system_service/ss_sm_rom_access.h @@ -0,0 +1,1010 @@ +/* + * @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 |