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 : _pbDram.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"
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
40 Global Variable Definitions
41 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
42 extern int g_n_api_set_id; /* ID variable for PSL registration */
45 External function prototype declaration
46 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
50 BOOL VirtualCopy(LPVOID lpv_dest, LPVOID lpv_src, DWORD cb_size, DWORD fdw_protect);
55 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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);
74 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
93 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
110 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
127 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
142 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
201 DramCrcChk(u_int8 id) { // LCOV_EXCL_START 8:dead code
202 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
207 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
209 * ABSTRACT : DRAM read/write checking
210 * NOTE : Check whether DRAM can be read/written correctly
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
217 DramRWChk(void) { // LCOV_EXCL_START 8:dead code
218 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
223 /*******************************************************************************
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
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 ******************************************************************************/
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
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
252 DramDestroy(u_int8 id) { // LCOV_EXCL_START 8:dead code
253 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
258 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
281 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
282 End of File : _pbDram.cpp
283 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *