-
Notifications
You must be signed in to change notification settings - Fork 3
/
diag_structs.h
143 lines (120 loc) · 3.6 KB
/
diag_structs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef __DIAG_STRUCTS_H__
#define __DIAG_STRUCTS_H__
uint16_t get_arfcn_from_arfcn_and_band(uint16_t val)
{
//uint16_t arfcn:12;
//uint16_t band:4;
uint16_t val_a = val >> 8;
uint16_t val_b = val & 0xff;
val = val_a + (val_b << 8);
//bottom 12 (yup!!)
return val & 0x0fff;
}
uint8_t get_band_from_arfcn_and_band(uint16_t val)
{
//uint16_t arfcn:12;
//uint16_t band:4;
uint16_t val_a = val >> 8;
uint16_t val_b = val & 0xff;
val = val_a + (val_b << 8);
//top 4(yup!)
return val >> 12;
}
/*********************************************************/
struct burst_metrics {
uint32_t frame_number;
uint16_t arfcn_and_band;
uint32_t rssi;
int16_t rx_power;
int16_t dc_offset___i_channel;
int16_t dc_offset___q_channel;
int16_t frequency_offset_estimate;
uint16_t timing_offset_estimate;
uint16_t snr_estimate;
uint8_t gain_state;
} __attribute__((packed));
//cmd: 0x506C
struct gsm_l1_burst_metrics {
uint8_t channel;
struct burst_metrics metrics[4];
} __attribute__((packed));
/*********************************************************/
struct bsic {
uint8_t bcc : 3; // NOTE: sub-byte
uint8_t ncc : 3; // NOTE: sub-byte
uint8_t Pad: 2;
} __attribute__((packed));
struct surrounding_cell {
uint16_t bcch_arfcn_and_band;
int16_t rx_power;
uint8_t bsic_known;
struct bsic bsic_this;
uint32_t frame_number_offset;
uint16_t time_offset;
} __attribute__((packed));
//cmd: 0x5071
struct gsm_l1_surround_cell_ba_list {
uint8_t cell_count;
struct surrounding_cell surr_cells[0];
} __attribute__((packed));
/*********************************************************/
//cmd: 0x5076
struct gsm_l1_txlev_timing_advance {
uint16_t arfcn_and_band;
uint8_t tx_power_level;
uint8_t timing_advance;
} __attribute__((packed));
/*********************************************************/
struct cell {
uint16_t arfcn_and_band;
int16_t rx_power;
} __attribute__((packed));
//cmd: 0x507B
struct gsm_l1_neighbor_cell_auxiliary_measurments {
uint8_t cell_count;
struct cell cells[0];
} __attribute__((packed));
/*********************************************************/
struct monitor_record {
uint32_t frame_number;
uint16_t arfcn_and_band;
int16_t rx_power;
uint32_t rssi;
uint8_t gain_state;
} __attribute__((packed));
//cmd: 0x5082
struct gsm_monitor_bursts_v2 {
uint32_t number_of_records;
struct monitor_record records[0];
} __attribute__((packed));
/*********************************************************/
struct neighbor {
uint16_t neighbor_cell_bcch_arfcn_and_band;
uint16_t neighbor_cell_pbcch_arfcn_and_band;
uint8_t hierarchy_cell_structure_priority;
uint8_t neighbor_cell_rx_level_average;
uint32_t neighbor_cell___computed_c1_value;
uint32_t neighbor_cell___computed_c2_value;
uint32_t neighbor_cell___computed_c31_value;
uint32_t neighbor_cell___computed_c32_value;
uint8_t neighbor_five_second_timer;
uint8_t neighbor_cell_reselection;
uint8_t serving_ra;
} __attribute__((packed));
//0x51FC
struct gprs_grr_cell_reselection_measurements {
uint16_t serving_bcch_arfcn_and_band;
uint16_t serving_pbcch_arfcn_and_band;
uint8_t serving_priority_class;
uint8_t serving_rx_level_average;
uint32_t serving_cell___computed_c1_value;
uint32_t serving_cell___computed_c2_value;
uint32_t serving_cell___computed_c31_value;
uint32_t serving_cell___computed_c32_value;
uint8_t serving_five_second_timer;
uint8_t serving_cell_reselection;
uint8_t serving_cell_recent_reselection;
uint8_t neighboring_6_strongest_cells_count;
struct neighbor neigbors[6];
} __attribute__((packed));
#endif //__DIAG_STRUCTS_H__