blob: 21601cea73bbc7237207e02cb860d34d185b42db [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
Harald Weltebd448582016-12-23 23:41:14 +01006struct msgb;
7
Harald Welte272b4ae2016-12-23 23:28:28 +01008/* From Qualcomm Linux kernel diagchar.h */
9#define DIAG_MAX_REQ_SIZE (16 * 1024)
10#define DIAG_MAX_HDLC_BUF_SIZE ((DIAG_MAX_REQ_SIZE * 2) + 3)
11#define HDLC_FOOTER_LEN 3
12
13
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010014/*
15 * 79 00 03 00 06 00 9C 76 B6 07 00 00 D4 00 00 00 y......v¶...Ô...
16 * 02 00 00 00 39 00 00 00 63 F9 FF FF 00 00 00 00 ....9...cùÿÿ....
17 * 41 43 51 20 53 74 61 72 74 65 64 2C 20 41 52 46 ACQ.Started,.ARF
18 * 43 4E 3D 25 64 2C 20 52 78 50 57 52 78 31 36 3D CN=%d,.RxPWRx16=
19 * 25 64 00 6C 31 5F 61 63 71 2E 63 00 %d.l1_acq.c.
20 */
21
22struct ext_log_msg {
Harald Weltecd877f12016-12-23 20:04:27 +010023 /* msg_hdr_type equivalent */
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010024 uint8_t type;
Harald Weltecd877f12016-12-23 20:04:27 +010025 uint8_t ts_type; /* timestamp tyoe */
26 uint8_t num_args; /* number of arguments */
27 uint8_t drop_cnt; /* dropped messages */
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010028 uint64_t timestamp; /* More 32 bit but dm-commands.h */
Harald Weltecd877f12016-12-23 20:04:27 +010029
30 /* msg_desc_type */
31 uint16_t line_nr;
32 uint16_t subsys_id;
33 uint32_t subsys_mask;
34
35 int32_t params[0]; /* three params */
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010036} __attribute__((packed));
37
Harald Weltef5d6fee2016-01-13 22:29:10 +010038
39/* message header */
40struct diag_msg_hdr {
41 uint8_t cmd_code;
42 uint8_t timestamp_type;
43 uint8_t num_args;
44 uint8_t drop_count;
45 uint64_t ts;
46} __attribute__((packed));
47
48/* message descriptor */
49struct diag_msg_desc {
50 uint16_t line;
51 uint16_t subsys_id;
52 uint16_t subsys_mask;
53} __attribute__((packed));
54
55/* message header for DIAG_EXT_MSG_F */
56struct diag_msg_ext {
57 struct diag_msg_hdr hdr;
58 struct diag_msg_desc desc;
59 uint32_t args[0]; /* see hdr.num_args */
60 /* followed by null-terminated strings */
61} __attribute__((packed));
62
63
64/* message header for DIAG_LOG_F */
65struct diag_log_hdr {
66 uint8_t cmd_code;
67 uint8_t more;
68 uint16_t len;
69 uint8_t data[0];
70} __attribute__((packed));
71
72struct log_hdr {
73 uint16_t len;
74 uint16_t code;
75 uint64_t ts;
76 uint8_t data[0];
77} __attribute__((packed));
78
79
80/* extended DIAG packet, */
81struct diagpkt_subsys_hdr {
82 uint8_t command; /* DIAG_SUBSYS_CMD_F */
83 uint8_t subsys_id;
84 uint8_t subsys_cmd_code;
85} __attribute__((packed));
86
87int diag_push_subsys_hdr(struct msgb *msg, uint8_t subsys, uint8_t code);
88
Holger Hans Peter Freythera7d50bf2013-12-23 14:26:36 +010089#endif