2 * @copyright Copyright (c) 2016-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.
18 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
19 File name : _pbSram.cpp
20 System name : 05 Integration Platform
21 Subsystem name : System common functions
23 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
26 #include <vehicle_service/positioning_base_library.h>
27 #include "WPF_STD_private.h"
34 Function prototype declarations
35 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
36 RET_API SramDMWt(u_int32 mode);
37 RET_API SramDMWrkWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size);
38 RET_API SramDMWrkRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size);
45 External function prototype declarations
46 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
47 extern RET_API CreateAsyncWtThread(void);
50 Global Variable Definitions
51 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
52 extern int g_n_api_set_id; /* ID variable for PSL registration */
53 extern void *g_adr_diagmem_wrktop; /* Diag memory temporary work area top address */
55 #ifdef CEPC_EM /* Physical area (pseudo area) setting for CEPC and EM */
57 /* Allocation size of temporary work for diagnosis memory */
58 #define SIZE_DIAGMEM_WRK 0x00001000
62 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
64 * ABSTRACT : SRAM Access-Initialization Process
65 * NOTE : When called by _sys_SramInit when _CWORD64_api.dll is attached, the SRAM physical area
66 * is mapped to the shared area so that the SRAM physical area can be accessed.
67 * The first call after system startup checks the result of the previous SRAM write processing.
68 * If the power is off during system startup, the system performs continuous write processing.
69 * (Before the _CWORD100_ modularization of SRAM access functions,
70 * they were used to open ports, but now they do not need to be opened.)
71 * ARGUMENT : u_int32 mount_flg HDD mount status flag
72 * u_int32 *mount_sts HDD mount status return pointer
73 * RETURN : RET_API defined
74 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
76 SramSetup(u_int32 mount_flg, u_int32 *mount_sts) { // LCOV_EXCL_START 8:dead code
77 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
78 RET_API ret_sts = RET_OSERROR;
83 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
85 * ABSTRACT : SRAM write process
86 * NOTE : Write the content of the buffer to the offset-position of the area of the specified SRAM ID.
87 * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
88 * Therefore, the transfer data size must be less than or equal to the temporary buffer size.
89 * ARGUMENT : u_int8 id SRAM area id
90 * void *pbuf Source buffer pointer
91 * u_int32 off Destination SRAM offsets (bytes)
92 * u_int16 size Transfer data size (bytes)
94 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
96 SramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) { // LCOV_EXCL_START 8:dead code
97 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
98 RET_API ret_sts = RET_OSERROR;
103 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
105 * ABSTRACT : SRAM memory-fill process
106 * NOTE : Fill with the specified patterns from the offset position of
107 * the area of the specified SRAM ID.
108 * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
109 * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size.
110 * ARGUMENT : u_int8 id SRAM area id
111 * u_int32 off Fill destination SRAM offset (bytes)
112 * u_int8 pat Fill pattern
113 * u_int16 size Fill size (bytes)
115 * RETURN : RET_API defined
116 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
118 SramFil(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) { // LCOV_EXCL_START 8:dead code
119 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
120 RET_API ret_sts = RET_OSERROR;
122 ret_sts = PbSramFil32(id, off, pat, (u_int32)size);
128 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
129 * MODULE : PbSramFil32
130 * ABSTRACT : SRAM memory-fill process
131 * NOTE : Fill with the specified patterns from the offset position of
132 * the area of the specified SRAM ID.
133 * Temporary buffer is used for SRAM writing, and recovery from writing is considered.
134 * Therefore, it is effective that the fill size is less than or equal to the temporary buffer size.
135 * ARGUMENT : u_int8 id SRAM area id
136 * u_int32 off Fill destination SRAM offset (bytes)
137 * u_int8 pat Fill pattern
138 * u_int32 size Fill size (bytes)
139 * RETURN : RET_API defined
140 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
142 PbSramFil32(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) { // LCOV_EXCL_START 8:dead code
143 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
144 RET_API ret_sts = RET_OSERROR;
149 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
151 * ABSTRACT : SRAM read process
152 * NOTE : Write content in the area specified SRAM ID and offset position to buffer.
153 * ARGUMENT : u_int8 id SRAM area ID
154 * u_int32 off Source SRAM Offset (bytes)
155 * void *pbuf Destination buffer pointer
156 * u_int16 size Transfer data size (bytes)
158 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
160 SramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) { // LCOV_EXCL_START 8:dead code
161 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
162 RET_API ret_sts = RET_OSERROR;
164 ret_sts = PbSramRd32(id, off, pbuf, (u_int32)size);
170 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
171 * MODULE : PbSramRd32
172 * ABSTRACT : SRAM read process
173 * NOTE : Write content in the area specified SRAM ID and offset position to buffer.
174 * ARGUMENT : u_int8 id SRAM area ID
175 * u_int32 off Source SRAM Offset (bytes)
176 * void *pbuf Destination buffer pointer
177 * u_int32 size Transfer data size(bytes)
179 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
181 PbSramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) { // LCOV_EXCL_START 8:dead code
182 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
183 RET_API ret_sts = RET_OSERROR;
188 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
190 * ABSTRACT : Acquisition of SRAM ID size
191 * NOTE : Get the effective area size of the specified SRAM ID.
192 * ARGUMENT : u_int8 id SRAM area ID
193 * u_int16 *psize Size (bytes)
195 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
197 SramSz(u_int8 id, u_int16 *psize) { // LCOV_EXCL_START 8:dead code
198 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
199 RET_API ret_sts = RET_OSERROR;
202 ret_sts = PbSramSz32(id, &size32);
203 if (ret_sts == RET_NORMAL) {
204 if (size32 <= 0x0000FFFF) {
205 *psize = (u_int16)size32;
207 /* When the size of the specified ID is u_int16 or greater */
208 ret_sts = RET_ERRPARAM;
216 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
217 * MODULE : PbSramSz32
218 * ABSTRACT : Acquisition of SRAM ID size
219 * NOTE : Get the effective area size of the specified SRAM ID.
220 * ARGUMENT : u_int8 id SRAM area ID
221 * u_int32 *psize Size (bytes)
223 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
225 PbSramSz32(u_int8 id, u_int32 *psize) { // LCOV_EXCL_START 8:dead code
226 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
227 RET_API ret_sts = RET_OSERROR;
232 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
234 * ABSTRACT : SRAM read/write check processing
235 * NOTE : Checking whether SRAM can be read/written correctly
238 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
240 SramRWChk(void) { // LCOV_EXCL_START 8:dead code
241 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
242 RET_API ret_sts = RET_NORMAL; /* Result */
247 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
249 * ABSTRACT : Asynchronous Data HDD Backup Processing
252 * RETURN : RET_API defined
253 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
254 RET_API AsyncFWt(void) { // LCOV_EXCL_START 8:dead code
255 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
256 RET_API ret_sts = RET_OSERROR;
257 /* _CWORD121_ compliant ret_sts = Backup_AsyncForcibleWrite(); */
262 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
263 * MODULE : SramWtAccOff
264 * ABSTRACT : Asynchronous Data HDD Backup Process at ACC-OFF
265 * NOTE : Saving Asynchronous Data to Hard Drives at ACC-OFF
267 * RETURN : RET_API defined
268 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
269 RET_API SramWtAccOff(void) { // LCOV_EXCL_START 8:dead code
270 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
271 RET_API ret_sts = RET_OSERROR;
272 /* _CWORD121_ compliant ret_sts = Backup_AccOffNotify(); */
277 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
278 * MODULE : DataWtWaitHDDSpinup
279 * ABSTRACT : HDD spin-up completion wait data save processing
280 * NOTE : Save to the HDD
281 * ARGUMENT : u_int16 para Startup Identification Value
282 * RETURN : RET_API defined
283 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
285 DataWtWaitHDDSpinup(u_int16 para) { // LCOV_EXCL_START 8:dead code
286 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
287 RET_API ret_sts = RET_NORMAL; /* Result */
292 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
293 * MODULE : SramLoadFromExtDev
294 * ABSTRACT : SRAM recovery processing
295 * NOTE : Restore Static data stored as a file on an externally attached device
296 * and the registry data to the HDD.
297 * ARGUMENT : u_int32 device Device where the file to be restored resides
298 * SD card:EXTDEV_STRAGECARD
299 * PC card:EXTDEV_PCCARD
300 * RET_API *err Error code
301 * RETURN : Return only RET_ERROR (Just perform reset without returning of this function when normal end)
302 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
304 SramLoadFromExtDev(ANA_RET_API *err) { // LCOV_EXCL_START 8:dead code
305 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
306 RET_API ret_sts = RET_OSERROR;
312 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
313 End of File : _pbSram.cpp
314 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *