Veethree D7 SDK
Loading...
Searching...
No Matches
io_rpmsg_protocol.h
Go to the documentation of this file.
1
5#ifndef IO_RPMSG_PROTOCOL_H
6#define IO_RPMSG_PROTOCOL_H
7
8#include <cstdint>
9#include <string>
10#include <variant>
11
12#ifdef __cplusplus
13// C++ specific code
14namespace vsdk::io::rpmsg {
15#endif
16
20//NOLINTBEGIN(performance-enum-size, *member-init*)
21enum class field_type : uint8_t {
22 int8 = 1,
23 uint8 = 2,
24 int16 = 3,
25 uint16 = 4,
26 int32 = 5,
27 uint32 = 6,
28 float_type = 7,
29 int64 = 8,
30 uint64 = 9,
31};
32
36#ifdef __cplusplus
37// C++ version of the field structure
38struct field {
39 field_type type;
40 std::string name;
41 std::variant<int8_t,
42 uint8_t,
43 int16_t,
44 uint16_t,
45 int32_t,
46 uint32_t,
47 int64_t,
48 uint64_t,
49 float>
50 value;
51};
52#else
53// C version of the field structure
54struct field {
56 char name[64];
57 union {
58 int8_t int8_val;
59 uint8_t uint8_val;
60 int16_t int16_val;
61 uint16_t uint16_val;
62 int32_t int32_val;
63 uint32_t uint32_val;
64 float float_val;
65 int64_t int64_val;
66 uint64_t uint64_val;
67 } value;
68};
69#endif
70
71//NOLINTBEGIN(modernize-use-using)
75typedef enum {
76 pwm_in_config = 0,
77 pwm_in_get = 1,
78 pwm_in_start = 2,
79 pwm_in_stop = 3,
80 max = 20,
81 // Add more commands as needed, Max is defined as 20 in the vt_rpmsg_io driver
83
87typedef enum {
88 none = 0,
89 success = 1,
90 invalid_command = 2,
91 invalid_parameter = 3,
92 // Add more result codes as needed
94//NOLINTEND(modernize-use-using)
99 uint8_t type;
100 uint8_t length;
101};
102//NOLINTEND(performance-enum-size, *member-init*)
103} // namespace vsdk::io::rpmsg
104
105#endif // IO_RPMSG_PROTOCOL_H
command_type
Command types for RPMsg communication.
Definition io_rpmsg_protocol.h:75
status_code
Result codes returned from M4.
Definition io_rpmsg_protocol.h:87
field_type
Field types for RPMsg communication.
Definition io_rpmsg_protocol.h:21
Structure representing a field in a message.
Definition io_rpmsg_protocol.h:54
char name[64]
The name of the field.
Definition io_rpmsg_protocol.h:56
field_type type
The type of the field.
Definition io_rpmsg_protocol.h:55
Common header for all RPMsg messages.
Definition io_rpmsg_protocol.h:98
uint8_t length
Length of the payload in bytes.
Definition io_rpmsg_protocol.h:100
uint8_t type
Command type.
Definition io_rpmsg_protocol.h:99