5 #include "sw/device/lib/base/status.h"
7 #include "sw/device/lib/testing/json/command.h"
8 #include "sw/device/lib/testing/json/mem.h"
9 #include "sw/device/lib/testing/json/provisioning_data.h"
10 #include "sw/device/lib/testing/spi_device_testutils.h"
11 #include "sw/device/lib/testing/test_framework/check.h"
13 #include "sw/device/lib/testing/test_framework/ujson_ottf.h"
14 #include "sw/device/lib/testing/test_framework/ujson_ottf_commands.h"
15 #include "sw/device/lib/ujson/ujson.h"
27 OTTF_DEFINE_TEST_CONFIG(.console.type = kOttfConsoleSpiDevice,
29 .console.test_may_clobber =
false, );
31 volatile uint8_t kTestBytes[256];
32 volatile uint32_t kTestWord;
33 volatile uint32_t kEndTest;
34 static perso_blob_t perso_blob_to_host;
35 static perso_blob_t perso_blob_from_host;
39 test_command_t command;
40 TRY(UJSON_WITH_CRC(ujson_deserialize_test_command_t, uj, &command));
42 if (status_err(
status) == kUnimplemented) {
44 }
else if (status_err(
status) != kOk) {
52 LOG_INFO(
"SYNC: Sending perso blob");
53 TRY(RESP_OK(ujson_serialize_perso_blob_t, uj, &perso_blob_to_host));
54 memset(&perso_blob_from_host, 0xa5,
sizeof(perso_blob_from_host));
55 LOG_INFO(
"SYNC: Waiting for perso blob");
56 TRY(ujson_deserialize_perso_blob_t(uj, &perso_blob_from_host));
57 CHECK_ARRAYS_EQ((uint8_t *)&perso_blob_to_host,
58 (uint8_t *)&perso_blob_from_host,
59 sizeof(perso_blob_from_host));
65 kTestWord = 0xface1234u;
66 for (
size_t i = 0; i < 256; ++i) {
67 kTestBytes[i] = (uint8_t)i;
69 ujson_t uj = ujson_ottf_console();
75 return status_ok(result);