common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / update_hal / include / update_hal.h
1 /*
2  * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \brief    This file provides support for Software Download.
19 ///
20 ///////////////////////////////////////////////////////////////////////////////
21
22 /**
23  * @file update_hal.h
24  */
25
26 /** @addtogroup update_service
27  *  @{
28  */
29 /** @addtogroup update_hal
30  *  @ingroup update_service
31  *  @{
32  */
33
34 #ifndef INCLUDE_UPDATE_HAL_H_
35 #define INCLUDE_UPDATE_HAL_H_
36 #include <stdint.h>
37
38 /* status of VUP_COMPLETE */
39 #define VUP_SUCCESS       0        //!< \~english Success
40 #define VUP_FAIL          1        //!< \~english Failed
41
42 /* Inter process command codes */
43
44 /**
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.
50 */
51 #define VUP_REQ_VUPSTART     205
52
53 /**
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.
59 */
60 #define VUP_REQ_DIFFVUPSTART 209
61
62 /**
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.
68 */
69 #define VUP_REQ_COPY         216
70
71 /**
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.
77 */
78 #define VUP_REQ_CANCEL       207
79
80 /**
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.
86 */
87 #define VUP_RES_CANCEL       208
88
89 /**
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.
95 */
96 #define VUP_PROGRESS         203
97
98 /**
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.
104 */
105 #define VUP_COMPLETE         204
106
107 #define UPDATE_START_TYPE_UPDATE       1    //!< \~english  Type of Update
108 #define UPDATE_START_TYPE_VERIFY       2    //!< \~english  Type of Verification
109
110 /* Data format of request to updater to exec update(UpdateService -> updater) */
111 // Formate is:
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
118
119 /**
120 * \~english Structure for starts update external update
121 */
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*/
135 } UpdateDataInfo;
136
137 /**
138 * \~english List of structure for starts update external update
139 */
140 typedef struct _UpdateDataInfos {
141   UI_32 units;                              /*!< \~english Num of Data Info*/
142   UpdateDataInfo info[VUP_MAX_KWI_DETAIL];  /*!< \~english Data Infos*/
143 } UpdateDataInfos;
144
145 /**
146 * \~english Structure for notify update complete
147 */
148 typedef union _ResUpdCompletion {
149   // for Normal/SYS Updater
150   struct {
151     UI_32 type;                       /*!< \~english type*/
152     UI_32 status;                     /*!< \~english result*/
153   } inner;
154   // for Outer Updater
155   struct {
156     UI_32 status;                     /*!< \~english result*/
157     UI_32 need_reboot;                /*!< \~english Whether it is necessary to reboot system.*/
158   } outer;
159 } ResUpdCompletion;
160
161
162 /** @}*/  // end of update_hal
163 /** @}*/  // end of update_service
164
165 #endif  // INCLUDE_UPDATE_HAL_H_