2 * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \brief This file provides support for Software Download.
20 ///////////////////////////////////////////////////////////////////////////////
26 /** @addtogroup update_service
29 /** @addtogroup update_hal
30 * @ingroup update_service
34 #ifndef INCLUDE_UPDATE_HAL_H_
35 #define INCLUDE_UPDATE_HAL_H_
38 /* status of VUP_COMPLETE */
39 #define VUP_SUCCESS 0 //!< \~english Success
40 #define VUP_FAIL 1 //!< \~english Failed
42 /* Inter process command codes */
45 * \~english Start all updates\n
46 * Command ID that the user specifies when requesting update_hal to start all updates \n
47 * This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
48 * In this case, specify updater as the destination and UpdateDataInfo as the datatype.
49 * \~english @attention Do not send this command from multiple processes or threads at the same time.
51 #define VUP_REQ_VUPSTART 205
54 * \~english Start differential update\n
55 * Command ID that the user specifies when requesting incremental update start from update_hal \n
56 * This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
57 * In this case, specify updater as the destination and UpdateDataInfo as the datatype.
58 * \~english @attention Do not send this command from multiple processes or threads at the same time.
60 #define VUP_REQ_DIFFVUPSTART 209
63 * \~english Copy of the updated side\n
64 * Command ID that the user specifies when requesting update_hal to copy the update plane \n
65 * This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
66 * In this case, specify updater as the destination and UpdateDataInfo as the datatype.
67 * \~english @attention Do not send this command from multiple processes or threads at the same time.
69 #define VUP_REQ_COPY 216
72 * \~english Cancel update\n
73 * Command ID that the user specifies when requesting update_hal to cancel the update \n
74 * This command should be sent using the interface_unified FrameworkunifiedSendMsg. \n
75 * At this time, specify updater as the destination.
76 * \~english @attention Do not send this command from multiple processes or threads at the same time.
78 #define VUP_REQ_CANCEL 207
81 * \~english Update cancellation completion notice\n
82 * Command ID that notifies the user that update cancellation processing has been completed from update_hal \n
83 * When receiving the event of this command,
84 * Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
85 * \~english @attention Do not send this command from multiple processes or threads at the same time.
87 #define VUP_RES_CANCEL 208
90 * \~english Progress status notification\n
91 * Command ID that notifies the update progress status from update_hal to the user \n
92 * When receiving the event of this command,
93 * Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
94 * \~english @attention Do not send this command from multiple processes or threads at the same time.
96 #define VUP_PROGRESS 203
99 * \~english Update completion notice\n
100 * Command ID that notifies the end of update from update_hal to the user \n
101 * When receiving the event of this command,
102 * Use of interfaces provided by interface_unified (such as FrameworkunifiedAttachCallbackToDispatcher)
103 * \~english @attention Do not send this command from multiple processes or threads at the same time.
105 #define VUP_COMPLETE 204
107 #define UPDATE_START_TYPE_UPDATE 1 //!< \~english Type of Update
108 #define UPDATE_START_TYPE_VERIFY 2 //!< \~english Type of Verification
110 /* Data format of request to updater to exec update(UpdateService -> updater) */
112 // num_of_fileset x 1 : UI_32
113 // fileset x N : UpdateDataInfo(struct) x N
114 #define KWI_MAX_MOD_FPATH 128 //!< \~english Max file path of module in Detailed info
115 #define VUP_MAX_KWI_FNAME (KWI_MAX_MOD_FPATH+1) //!< \~english 129 Max size of the string which to save the file path
116 #define KWI_SIZE_HASH 32 //!< \~english HashSize length
117 #define VUP_MAX_KWI_DETAIL 15 //!< \~english Max file path of Data infos
120 * \~english Structure for starts update external update
122 typedef struct _UpdateDataInfo {
123 UI_32 ID; /*!< \~english ID originated by 0(ROOTFS:0, BOOT:1)*/
124 char filename[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name(fullpath)*/
125 char srcname[VUP_MAX_KWI_FNAME]; /*!< \~english source file(device) name in diff update(fullpath)*/
126 char destname[VUP_MAX_KWI_FNAME]; /*!< \~english destinamtion file(device) name(fullpath)*/
127 UI_64 offset; /*!< \~english offset of source file*/
128 UI_64 seek; /*!< \~english seek of destination file*/
129 UI_32 size; /*!< \~english size of data*/
130 char src_hash[KWI_SIZE_HASH]; /*!< \~english Original Data Hash(for diff update only)*/
131 char dst_hash[KWI_SIZE_HASH]; /*!< \~english Restored Data Hash*/
132 UI_32 num_of_div; /*!< \~english Num of Detail files*/
133 UI_64 mod_offset; /*!< \~english offset of module in KWI file*/
134 UI_64 div_offset; /*!< \~english offset of divide header in KWI file*/
138 * \~english List of structure for starts update external update
140 typedef struct _UpdateDataInfos {
141 UI_32 units; /*!< \~english Num of Data Info*/
142 UpdateDataInfo info[VUP_MAX_KWI_DETAIL]; /*!< \~english Data Infos*/
146 * \~english Structure for notify update complete
148 typedef union _ResUpdCompletion {
149 // for Normal/SYS Updater
151 UI_32 type; /*!< \~english type*/
152 UI_32 status; /*!< \~english result*/
156 UI_32 status; /*!< \~english result*/
157 UI_32 need_reboot; /*!< \~english Whether it is necessary to reboot system.*/
162 /** @}*/ // end of update_hal
163 /** @}*/ // end of update_service
165 #endif // INCLUDE_UPDATE_HAL_H_