summaryrefslogtreecommitdiffstats
path: root/include/l1a_l23_interface.h
blob: 03f80a534987f83ab6ae58d3cc37d5864332d16a (plain)
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
/* Messages to be sent between the different layers */

/* (C) 2010 by Harald Welte <laforge@gnumonks.org>
 * (C) 2010 by Holger Hans Peter Freyther
 *
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef l1a_l23_interface_h
#define l1a_l23_interface_h

#define L1CTL_NEW_CCCH_REQ	1
#define L1CTL_NEW_CCCH_RESP	2
#define L1CTL_DATA_IND		3
#define L1CTL_RACH_REQ		4
#define L1CTL_DM_EST_REQ	5
#define L1CTL_DATA_REQ		7
#define L1CTL_RESET		8
#define L1CTL_PM_REQ		9	/* power measurement */

/*
 * NOTE: struct size. We do add manual padding out of the believe
 * that it will avoid some unaligned access.
 */

struct l1ctl_hdr {
	uint8_t msg_type;
	uint8_t padding;
	uint8_t data[0];
} __attribute__((packed));

/*
 * downlink info ... down from the BTS..
 */
struct l1ctl_info_dl {
	/* GSM 08.58 channel number (9.3.1) */
	uint8_t chan_nr;
	/* GSM 08.58 link identifier (9.3.2) */
	uint8_t link_id;

	uint32_t frame_nr;

	/* the ARFCN and the band. FIXME: what about MAIO? */
	uint16_t band_arfcn;

	uint8_t rx_level;	/* 0 .. 63 in typical GSM notation (dBm+110) */
	uint8_t snr;		/* Signal/Noise Ration (dB) */
	uint8_t payload[0];
} __attribute__((packed));

/* new CCCH was found. This is following the header */
struct l1ctl_sync_new_ccch_resp {
	uint8_t bsic;
	uint8_t padding[3];
} __attribute__((packed));

/* data on the CCCH was found. This is following the header */
struct l1ctl_data_ind {
	uint8_t data[23];
} __attribute__((packed));

/*
 * uplink info
 */
struct l1ctl_info_ul {
	/* GSM 08.58 channel number (9.3.1) */
	uint8_t chan_nr;
	/* GSM 08.58 link identifier (9.3.2) */
	uint8_t link_id;

	uint8_t tx_power;
	uint8_t padding2;

	uint8_t payload[0];
} __attribute__((packed));

/*
 * msg for SYNC_NEW_CCCH_REQ
 * the l1_info_ul header is in front
 */
struct l1ctl_sync_new_ccch_req {
	uint16_t band_arfcn;
} __attribute__((packed));


/* the l1_info_ul header is in front */
struct l1ctl_rach_req {
	uint8_t ra;
	uint8_t padding[3];
} __attribute__((packed));

struct l1ctl_dm_est_req {
	uint16_t band_arfcn;
	union {
		struct {
			uint8_t maio_high:4,
				 h:1,
				 tsc:3;
			uint8_t hsn:6,
				 maio_low:2;
		} h1;
		struct {
			uint8_t arfcn_high:2,
				 spare:2,
				 h:1,
				 tsc:3;
			uint8_t arfcn_low;
		} h0;
	};
} __attribute__((packed));

struct l1ctl_pm_req {
	uint8_t type;
	uint8_t padding2;

	union {
		struct {
			uint16_t band_arfcn_from;
			uint16_t band_arfcn_to;
		} range;
	};
} __attribute__((packed));

#endif