File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,25 @@ int main() {
20
20
// Row to write raw data
21
21
uint16_t raw_row = 0x410 ;
22
22
23
+ // Check rows are empty - else the rest of the tests won't behave as expected
24
+ unsigned char initial_data [32 ] = {0 };
25
+ cmd .flags = ecc_row ;
26
+ ret = rom_func_otp_access (initial_data , sizeof (initial_data )/2 , cmd );
27
+ if (ret ) {
28
+ printf ("ERROR: Initial ECC Row Read failed with error %d\n" , ret );
29
+ }
30
+ cmd .flags = raw_row ;
31
+ ret = rom_func_otp_access (initial_data + (sizeof (initial_data )/2 ), sizeof (initial_data )/2 , cmd );
32
+ if (ret ) {
33
+ printf ("ERROR: Initial Raw Row Read failed with error %d\n" , ret );
34
+ }
35
+ for (int i = 0 ; i < sizeof (initial_data ); i ++ ) {
36
+ if (initial_data [i ] != 0 ) {
37
+ printf ("ERROR: This example requires empty OTP rows to run - change the ecc_row and raw_row variables to an empty row and recompile\n" );
38
+ return 0 ;
39
+ }
40
+ }
41
+
23
42
if (ecc_row ) {
24
43
// Write an ECC value to OTP - the buffer must have a multiple of 2 length for ECC data
25
44
unsigned char ecc_write_data [16 ] = "Hello from OTP" ;
You can’t perform that action at this time.
0 commit comments