1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef TEST_COMMANDS_H
7 #include <stdint.h>
8 
9 /**
10  * @brief Test commands executable by remote
11  */
12 enum ipc_test_commands {
13 	IPC_TEST_CMD_NONE,     /**< Command to be ingored */
14 	IPC_TEST_CMD_PING,     /**< Respond with the @ref IPC_TEST_CMD_PONG message */
15 	IPC_TEST_CMD_PONG,     /**< Expected response to IPC_TEST_CMD_PING */
16 	IPC_TEST_CMD_ECHO,     /**< Respond with the same data */
17 	IPC_TEST_CMD_ECHO_RSP, /**< Echo respond */
18 	IPC_TEST_CMD_REBOND,   /**< Unbond and rebond back whole interface */
19 	IPC_TEST_CMD_REBOOT,   /**< Restart remote CPU after a given delay */
20 	/* Commands used for data transfer test */
21 	IPC_TEST_CMD_RXSTART,  /**< Start receiving data */
22 	IPC_TEST_CMD_TXSTART,  /**< Start sending data */
23 	IPC_TEST_CMD_RXGET,    /**< Get rx status */
24 	IPC_TEST_CMD_TXGET,    /**< Get tx status */
25 	IPC_TEST_CMD_XSTAT,    /**< rx/tx status response */
26 	IPC_TEST_CMD_XDATA,    /**< Transfer data block */
27 	/* End of commands used for data transfer test */
28 };
29 
30 /**
31  * @brief Base command structure
32  */
33 struct ipc_test_cmd {
34 	uint32_t cmd;   /**< The command of @ref ipc_test_command type */
35 	uint8_t data[]; /**< Command data depending on the command itself */
36 };
37 
38 /**
39  * @brief Rebond command structure
40  */
41 struct ipc_test_cmd_rebond {
42 	struct ipc_test_cmd base;
43 	uint32_t timeout_ms;
44 };
45 
46 /**
47  * @brief Reboot command structure
48  */
49 struct ipc_test_cmd_reboot {
50 	struct ipc_test_cmd base;
51 	uint32_t timeout_ms;
52 };
53 
54 /**
55  * @brief Start the rx or tx transfer
56  */
57 struct ipc_test_cmd_xstart {
58 	struct ipc_test_cmd base;
59 	uint32_t blk_size;
60 	uint32_t blk_cnt;
61 	uint32_t seed;
62 };
63 
64 /**
65  * @brief Get the status of rx or tx transfer
66  */
67 struct ipc_test_cmd_xstat {
68 	struct ipc_test_cmd base;
69 	uint32_t blk_cnt; /**< Transfers left */
70 	int32_t  result;  /**< Current result */
71 };
72 
73 /**
74  * @brief The result of rx or tx transfer
75  */
76 struct ipc_test_cmd_xrsp {
77 	struct ipc_test_cmd base;
78 	int32_t result;
79 };
80 
81 #endif /* TEST_COMMANDS_H */
82