Holger Hans Peter Freyther | a7d50bf | 2013-12-23 14:26:36 +0100 | [diff] [blame] | 1 | #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 | |
| 14 | struct ext_log_msg { |
Harald Welte | cd877f1 | 2016-12-23 20:04:27 +0100 | [diff] [blame^] | 15 | /* msg_hdr_type equivalent */ |
Holger Hans Peter Freyther | a7d50bf | 2013-12-23 14:26:36 +0100 | [diff] [blame] | 16 | uint8_t type; |
Harald Welte | cd877f1 | 2016-12-23 20:04:27 +0100 | [diff] [blame^] | 17 | uint8_t ts_type; /* timestamp tyoe */ |
| 18 | uint8_t num_args; /* number of arguments */ |
| 19 | uint8_t drop_cnt; /* dropped messages */ |
Holger Hans Peter Freyther | a7d50bf | 2013-12-23 14:26:36 +0100 | [diff] [blame] | 20 | uint64_t timestamp; /* More 32 bit but dm-commands.h */ |
Harald Welte | cd877f1 | 2016-12-23 20:04:27 +0100 | [diff] [blame^] | 21 | |
| 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 Freyther | a7d50bf | 2013-12-23 14:26:36 +0100 | [diff] [blame] | 28 | } __attribute__((packed)); |
| 29 | |
Harald Welte | f5d6fee | 2016-01-13 22:29:10 +0100 | [diff] [blame] | 30 | |
| 31 | /* message header */ |
| 32 | struct 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 */ |
| 41 | struct 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 */ |
| 48 | struct 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 */ |
| 57 | struct 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 | |
| 64 | struct 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, */ |
| 73 | struct 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 | |
| 79 | int diag_push_subsys_hdr(struct msgb *msg, uint8_t subsys, uint8_t code); |
| 80 | |
Holger Hans Peter Freyther | a7d50bf | 2013-12-23 14:26:36 +0100 | [diff] [blame] | 81 | #endif |