common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning_base_library / library / src / _pbDram.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      : _pbDram.cpp
20  System name    : 05 Integration Platform
21  Subsystem name : System common functions
22  Title          : System API
23 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
24 */
25
26 #include <vehicle_service/positioning_base_library.h>
27 #include "WPF_STD_private.h"
28
29 /*
30  Constants and structure definitions
31 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
32 #define END                 0xFFFFFFFF              /* DRAM R/W check address table end flag */
33 /* Definitions for CRC calculations */
34 #define DIV_BYTE_DATA       0x000000FF
35 #define CRC_INIT            0x00000000
36 #define DATA_L_SHIFTNUM     8
37 #define DATA_R_SHIFTNUM     24
38
39 /*
40  Global Variable Definitions
41 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
42 extern int      g_n_api_set_id;                        /* ID variable for PSL registration */
43
44 /*
45 External function prototype declaration
46 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50     BOOL            VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect);
51 #ifdef __cplusplus
52 };
53 #endif
54
55 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
56  * MODULE    : DramWt
57  * ABSTRACT  : DRAM self-refresh area write process
58  * NOTE      : Write the content of the buffer to the offset-position of the area of the specified DRAM ID.
59  *             Perform CRC calculation and add it to the end of the area
60  * ARGUMENT  : u_int8   id      DRAM Area IDs
61  *             void     *pbuf   Source buffer pointer
62  *             u_int32  off     Destination DRAM offsets(bytes)
63  *             u_int16  size    Transfer data size(bytes)
64  * RETURN    : RET_API defineed
65 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
66 RET_API
67 DramWt(u_int8 id, void *pbuf, u_int32 off, u_int16 size) {  // LCOV_EXCL_START 8:dead code
68     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
69     RET_API ret = PbDramWt32(id, pbuf, off, (u_int32)size);
70     return(ret);
71 }
72 // LCOV_EXCL_STOP
73
74 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
75  * MODULE    : PbDramWt32
76  * ABSTRACT  : DRAM self-refresh area write process
77  * NOTE      : Write the content of the buffer to the offset-position of the area of the specified DRAM ID.
78  *             Perform CRC calculation and add it to the end of the area
79  * ARGUMENT  : u_int8   id      DRAM Area IDs
80  *             void     *pbuf   Source buffer pointer
81  *             u_int32  off     Destination DRAM offsets(bytes)
82  *             u_int32  size    Transfer data size(bytes)
83  * RETURN    : RET_API defined
84  * RETURN    : RET_API defined
85  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
86 RET_API
87 PbDramWt32(u_int8 id, void *pbuf, u_int32 off, u_int32 size) {  // LCOV_EXCL_START 8:dead code
88     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
89     return(RET_NORMAL);
90 }
91 // LCOV_EXCL_STOP
92
93 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
94  * MODULE    : DramRd
95  * ABSTRACT  : DRAM self-refresh area read process
96  * NOTE      : Write the offsets of the area of the specified DRAM ID to buffer.
97  * ARGUMENT  : u_int8   id      DRAM Area IDs
98  *             u_int32  off     Source DRAM Offsets(bytes)
99  *             void     *pbuf   Destination buffer pointer
100  *             u_int16  size    Transfer data size(bytes)
101  * RETURN    : RET_API definef
102  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
103 RET_API
104 DramRd(u_int8 id, u_int32 off, void *pbuf, u_int16 size) {  // LCOV_EXCL_START 8:dead code
105     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
106     return(RET_NORMAL);
107 }
108 // LCOV_EXCL_STOP
109
110 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
111  * MODULE    : DramRd32
112  * ABSTRACT  : DRAM self-refresh area read process
113  * NOTE      : Write the offsets of the area of the specified DRAM ID to buffer.
114  * ARGUMENT  : u_int8   id      DRAM Area IDs
115  *             u_int32  off     Source DRAM Offset(bytes)
116  *             void     *pbuf   Destination buffer pointer
117  *             u_int32  size    Transfer data size(bytes)
118  * RETURN    : RET_API defined
119  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
120 RET_API
121 DramRd32(u_int8 id, u_int32 off, void *pbuf, u_int32 size) {  // LCOV_EXCL_START 8:dead code
122     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
123     return(RET_NORMAL);
124 }
125 // LCOV_EXCL_STOP
126
127 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
128  * MODULE    : DramSz
129  * ABSTRACT  : DRAM ID size acquisition processing
130  * NOTE      : Get the effective area size of the specified DRAM ID.
131  * ARGUMENT  : u_int8   id      DRAM Area IDs
132  *             u_int16  *psize  Size(bytes)
133  * RETURN    : RET_API defined
134  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
135 RET_API
136 DramSz(u_int8 id, u_int16 *psize) {  // LCOV_EXCL_START 8:dead code
137     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
138     return(RET_NORMAL);
139 }
140 // LCOV_EXCL_STOP
141
142 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
143  * MODULE    : DramSz32
144  * ABSTRACT  : DRAM ID size acquisition processing
145  * NOTE      : Get the effective area size of the specified DRAM ID.
146  * ARGUMENT  : u_int8   id      DRAM Area IDs
147  *             u_int32  *psize  Size(bytes)
148  * RETURN    : RET_API defined
149  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
150 RET_API
151 DramSz32(u_int8 id, u_int32 *psize) {  // LCOV_EXCL_START 8:dead code
152     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
153     return(RET_NORMAL);
154 }
155 // LCOV_EXCL_STOP
156
157 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
158  * MODULE    : DramFilCrc
159  * ABSTRACT  : DRAM memory-fill process (add CRC-value)
160  * NOTE      : Fill with the specified patterns from the offset position of the area of the specified DRAM ID.
161  *             After filling, add result of the CRC calculation to the end of the region.
162  * ARGUMENT  : u_int8   id      DRAM Area IDs
163  *             u_int32  off     Fill destination DRAM offset(bytes)
164  *             u_int8   pat     Fill pattern
165  *             u_int16  size    Fill size(bytes)
166  * RETURN    : RET_API defined
167  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
168 RET_API
169 DramFilCrc(u_int8 id, u_int32 off, u_int8 pat, u_int16 size) {  // LCOV_EXCL_START 8:dead code
170     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
171     return(RET_NORMAL);
172 }
173 // LCOV_EXCL_STOP
174
175 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
176  * MODULE    : DramFil32Crc
177  * ABSTRACT  : DRAM memory-fill process (CRC-value addition)
178  * NOTE      : Fill with the specified patterns from the offset position of the area of the specified DRAM ID.
179  *             After filling, perform CRC calculation and add it to the end of the region
180  * ARGUMENT  : u_int8   id      DRAM Area IDs
181  *             u_int32  off     Fill destination DRAM offset(bytes)
182  *             u_int8   pat     Fill pattern
183  *             u_int32  size    Fill size(bytes)
184  * RETURN    : RET_API defined
185  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
186 RET_API
187 DramFil32Crc(u_int8 id, u_int32 off, u_int8 pat, u_int32 size) {  // LCOV_EXCL_START 8:dead code
188     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
189     return(RET_NORMAL);
190 }
191 // LCOV_EXCL_STOP
192
193 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
194  * MODULE    : DramCrcChk
195  * ABSTRACT  : DRAM self-refresh area CRC-check
196  * NOTE      : Perform CRC calculation for the specified area and check whether the CRC value is normal.
197  * ARGUMENT  : u_int8   id      DRAM Area IDs
198  * RETURN    : RET_API defined
199  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
200 RET_API
201 DramCrcChk(u_int8 id) {  // LCOV_EXCL_START 8:dead code
202     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
203     return(RET_NORMAL);
204 }
205 // LCOV_EXCL_STOP
206
207 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
208  * MODULE    : DramRWChk
209  * ABSTRACT  : DRAM read/write checking
210  * NOTE      : Check whether DRAM can be read/written correctly
211  * ARGUMENT  : None
212  * RETURN    : RET_API define RET_NORMAL      : Normal status
213  *                          RET_ERROR       : In case of read/write error
214  *                          RET_OSERRER     : Virtual area mapping error
215  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
216 RET_API
217 DramRWChk(void) {  // LCOV_EXCL_START 8:dead code
218     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
219     return(RET_NORMAL);
220 }
221 // LCOV_EXCL_STOP
222
223 /*******************************************************************************
224  * MODULE   : Crc
225  * ABSTRACT : Calculate sum of a given range
226  * FUNCTION : RET_API Crc(u_int32 start_addr,u_int32 size, u_int32 *sum);
227  * ARGUMENT : u_int32 start_addr Top address
228  *            u_int32 size       Size
229  *            u_int32* sum       Sum value storage
230  * NOTE     : Calculate the 4 bytes sum of the size portion from start_addr and stores the result in sum.
231  *            If start_addr and size are not 4-bytes boundaries, errors are returned.
232  *            On error, -1 is stored in sum and returned.
233  * RETURN   : RET_NORMAL Sum value calculation success
234  *            RET_ERROR Sum value calculation failed
235  ******************************************************************************/
236 RET_API
237 Crc(u_int32 start_addr, u_int32 size, u_int32 *sum) {  // LCOV_EXCL_START 8:dead code
238     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
239     return(RET_NORMAL);
240 }
241 // LCOV_EXCL_STOP
242
243 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
244  * MODULE    : DramDestroy
245  * ABSTRACT  : SRAM alternative DRAM self-refresh area destruction process
246  * NOTE      : The SRAM replacement DRAM self-refresh area is destroyed by adding 1
247  *             to the CRC value held by the area ID and destroying the CRC value.
248  * ARGUMENT  : u_int8   id      DRAM Area IDs
249  * RETURN    : RET_API defined
250  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
251 RET_API
252 DramDestroy(u_int8 id) {  // LCOV_EXCL_START 8:dead code
253     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
254     return(RET_NORMAL);
255 }
256 // LCOV_EXCL_STOP
257
258 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
259  * MODULE   : CrcEx
260  * ABSTRACT : Calculate the sum of the CRC values in the given range and the CRC values passed in the arguments
261  * FUNCTION : RET_API CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc);
262  * ARGUMENT : u_int32 start_addr Top address
263  *            u_int32 size       Size
264  *            u_int32* sum       CRC value storage
265  *            u_int32 addcrc     CRC value to add
266  * NOTE     : When the 4-bytes-CRC value for the size is calculated from start_addr,
267  *            Add the CRC value passed in the fourth argument to sum, and store it in sum.
268  *                        Note:Because the address align is undefined, 1-byte calculation shall be performed.
269  * RETURN   : RET_NORMAL Sum value calculation success
270  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
271 RET_API
272 CrcEx(u_int32 start_addr, u_int32 size, u_int32 *sum, u_int32 addcrc) {  // LCOV_EXCL_START 8:dead code
273     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
274     return(RET_NORMAL);
275 }
276 // LCOV_EXCL_STOP
277
278
279
280 /*
281 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
282  End of File : _pbDram.cpp
283 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
284 */