Software APIs
ujson_ottf_commands.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_UJSON_OTTF_COMMANDS_H_
6 #define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_UJSON_OTTF_COMMANDS_H_
7 
8 #include "sw/device/lib/base/status.h"
9 #include "sw/device/lib/testing/json/command.h"
10 #include "sw/device/lib/ujson/ujson.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /**
17  * Handles basic memory commands known to the OTTF ujson framework.
18  *
19  * For unrecognized command codes, no response is sent back to the requester.
20  * This function returns a status with code `kUnimplemented`, and the caller
21  * chooses whether to send an error response or to forward the command code to
22  * some other handling routine.
23  *
24  * @param uj A ujson IO context.
25  * @param command The identifier for the command that was received.
26  * @return The status result of the operation, where kOk means the command's
27  * operation completed, kUnimplemented means the command ID is unknown
28  * to the function and may belong to a different space, and any other
29  * status represents an error.
30  */
31 status_t ujson_ottf_dispatch(ujson_t *uj, test_command_t command);
32 
33 #ifdef __cplusplus
34 }
35 #endif
36 #endif // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_UJSON_OTTF_COMMANDS_H_