blob: ac9a8b90042a73d6842c7640a631db8c9ba2c397 [file] [log] [blame]
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +01001#ifndef protocol_h
2#define protocol_h
3
4#include <stdint.h>
5
6/*
7 * 79 00 03 00 06 00 9C 76 B6 07 00 00 D4 00 00 00 y......v¶...Ô...
8 * 02 00 00 00 39 00 00 00 63 F9 FF FF 00 00 00 00 ....9...cùÿÿ....
9 * 41 43 51 20 53 74 61 72 74 65 64 2C 20 41 52 46 ACQ.Started,.ARF
10 * 43 4E 3D 25 64 2C 20 52 78 50 57 52 78 31 36 3D CN=%d,.RxPWRx16=
11 * 25 64 00 6C 31 5F 61 63 71 2E 63 00 %d.l1_acq.c.
12 */
13
14struct ext_log_msg {
Harald Weltecd877f12016-12-23 20:04:27 +010015 /* msg_hdr_type equivalent */
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010016 uint8_t type;
Harald Weltecd877f12016-12-23 20:04:27 +010017 uint8_t ts_type; /* timestamp tyoe */
18 uint8_t num_args; /* number of arguments */
19 uint8_t drop_cnt; /* dropped messages */
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010020 uint64_t timestamp; /* More 32 bit but dm-commands.h */
Harald Weltecd877f12016-12-23 20:04:27 +010021
22 /* msg_desc_type */
23 uint16_t line_nr;
24 uint16_t subsys_id;
25 uint32_t subsys_mask;
26
27 int32_t params[0]; /* three params */
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010028} __attribute__((packed));
29
Harald Weltef5d6fee2016-01-13 22:29:10 +010030
31/* message header */
32struct diag_msg_hdr {
33 uint8_t cmd_code;
34 uint8_t timestamp_type;
35 uint8_t num_args;
36 uint8_t drop_count;
37 uint64_t ts;
38} __attribute__((packed));
39
40/* message descriptor */
41struct diag_msg_desc {
42 uint16_t line;
43 uint16_t subsys_id;
44 uint16_t subsys_mask;
45} __attribute__((packed));
46
47/* message header for DIAG_EXT_MSG_F */
48struct diag_msg_ext {
49 struct diag_msg_hdr hdr;
50 struct diag_msg_desc desc;
51 uint32_t args[0]; /* see hdr.num_args */
52 /* followed by null-terminated strings */
53} __attribute__((packed));
54
55
56/* message header for DIAG_LOG_F */
57struct diag_log_hdr {
58 uint8_t cmd_code;
59 uint8_t more;
60 uint16_t len;
61 uint8_t data[0];
62} __attribute__((packed));
63
64struct log_hdr {
65 uint16_t len;
66 uint16_t code;
67 uint64_t ts;
68 uint8_t data[0];
69} __attribute__((packed));
70
71
72/* extended DIAG packet, */
73struct diagpkt_subsys_hdr {
74 uint8_t command; /* DIAG_SUBSYS_CMD_F */
75 uint8_t subsys_id;
76 uint8_t subsys_cmd_code;
77} __attribute__((packed));
78
79int diag_push_subsys_hdr(struct msgb *msg, uint8_t subsys, uint8_t code);
80
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010081#endif