Init basesystem source codes.
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning_base_library / library / src / _pbSram.cpp
1 /*
2  * @copyright Copyright (c) 2016-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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
19  File name      : _pbSram.cpp
20  System name    : 05 Integration Platform
21  Subsystem name : System common functions
22  Title          : System APIs
23 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
24 */
25
26 #include <vehicle_service/positioning_base_library.h>
27 #include "WPF_STD_private.h"
28
29
30 #ifdef    __cplusplus
31 extern "C" {
32 #endif
33     /*
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);
39
40 #ifdef    __cplusplus
41 }
42 #endif
43
44 /*
45  External function prototype declarations
46 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
47 extern RET_API    CreateAsyncWtThread(void);
48
49 /*
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 */
54
55 #ifdef CEPC_EM    /* Physical area (pseudo area) setting for CEPC and EM  */
56
57 /* Allocation size of temporary work for diagnosis memory */
58 #define SIZE_DIAGMEM_WRK        0x00001000
59
60 #endif
61
62 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
63  * MODULE    : SramSetup
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  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
75 RET_API
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;
79     return(ret_sts);
80 }
81 // LCOV_EXCL_STOP
82
83 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
84  * MODULE    : SramWt
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)
93  * RETURN    : RET_API
94  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
95 RET_API
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;
99     return(ret_sts);
100 }
101 // LCOV_EXCL_STOP
102
103 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
104  * MODULE    : SramFil
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)
114  *
115  * RETURN    : RET_API defined
116  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
117 RET_API
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;
121
122     ret_sts = PbSramFil32(id, off, pat, (u_int32)size);
123
124     return(ret_sts);
125 }
126 // LCOV_EXCL_STOP
127
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  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
141 RET_API
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;
145     return(ret_sts);
146 }
147 // LCOV_EXCL_STOP
148
149 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
150  * MODULE    : SramRd
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)
157  * RETURN    : RET_API
158  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
159 RET_API
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;
163
164     ret_sts = PbSramRd32(id, off, pbuf, (u_int32)size);
165
166     return(ret_sts);
167 }
168 // LCOV_EXCL_STOP
169
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)
178  * RETURN    : RET_API
179  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
180 RET_API
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;
184     return(ret_sts);
185 }
186 // LCOV_EXCL_STOP
187
188 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
189  * MODULE    : SramSz
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)
194  * RETURN    : RET_API
195  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
196 RET_API
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;
200     u_int32        size32 = 0;
201
202     ret_sts = PbSramSz32(id, &size32);
203     if (ret_sts == RET_NORMAL) {
204         if (size32 <= 0x0000FFFF) {
205             *psize = (u_int16)size32;
206         } else {
207             /* When the size of the specified ID is u_int16 or greater */
208             ret_sts = RET_ERRPARAM;
209         }
210     }
211
212     return(ret_sts);
213 }
214 // LCOV_EXCL_STOP
215
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)
222  * RETURN    : RET_API
223  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
224 RET_API
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;
228     return(ret_sts);
229 }
230 // LCOV_EXCL_STOP
231
232 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
233  * MODULE    : SramRWChk
234  * ABSTRACT  : SRAM read/write check processing
235  * NOTE      : Checking whether SRAM can be read/written correctly
236  * ARGUMENT  : None
237  * RETURN    : RET_API
238  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
239 RET_API
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    */
243     return ret_sts;
244 }
245 // LCOV_EXCL_STOP
246
247 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
248  * MODULE    : AsyncFWt
249  * ABSTRACT  : Asynchronous Data HDD Backup Processing
250  * NOTE      :
251  * ARGUMENT  : void
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(); */
258     return(ret_sts);
259 }
260 // LCOV_EXCL_STOP
261
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
266  * ARGUMENT  : void
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(); */
273     return(ret_sts);
274 }
275 // LCOV_EXCL_STOP
276
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  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
284 RET_API
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    */
288     return ret_sts;
289 }
290 // LCOV_EXCL_STOP
291
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  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
303 RET_API
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;
307     return(ret_sts);
308 }
309 // LCOV_EXCL_STOP
310
311 /*
312 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
313  End of File : _pbSram.cpp
314 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
315 */
316