aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/support.c
blob: e271b95766976407342f1b4cbc8d4bc7628e948e (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
/* (C) 2011 by Andreas Eversberg <jolly@eversberg.eu>
 *
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation; either version 3 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 Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <sys/types.h>
#include <string.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
//#include <osmocom/bb/common/osmocom_data.h>
#include <osmo-bts/support.h>

struct bts_support bts_support;

void bts_support_init(void)
{
	struct bts_support *sup = &bts_support;
	int i;

	memset(sup, 0, sizeof(*sup));

	/* crypto supprot */
	sup->a5_1 = 0;
	sup->a5_2 = 0;
	sup->a5_3 = 0;
	sup->a5_4 = 0;
	sup->a5_5 = 0;
	sup->a5_6 = 0;
	sup->a5_7 = 0;
	/* set supported frequencies */
	for(i = 1; i <= 124; i++) // P-GSM
		sup->freq_map[i >> 3] |= (1 << (i & 7));
	for(i = 512; i <= 885; i++) // DCS
		sup->freq_map[i >> 3] |= (1 << (i & 7));
	for(i = 975; i <= 1023; i++) // E-GSM extension
		sup->freq_map[i >> 3] |= (1 << (i & 7));
	sup->freq_map[0] |= 1; // channel 0
	for(i = 955; i <= 974; i++) // R-GSM extension
		sup->freq_map[i >> 3] |= (1 << (i & 7));
	/* channel combinations */
	sup->chan_comb[NM_CHANC_mainBCCH] = 1;
	sup->chan_comb[NM_CHANC_BCCHComb] = 1;
	sup->chan_comb[NM_CHANC_SDCCH] = 1;
	sup->chan_comb[NM_CHANC_TCHFull] = 1;
	sup->chan_comb[NM_CHANC_TCHHalf] = 1;
	/* codec */
	sup->full_v1 = 1;
	sup->full_v2 = 1;
	sup->full_v3 = 1;
	sup->half_v1 = 1;
	sup->half_v3 = 1;
}

char *bts_support_comb_name(uint8_t chan_comb)
{
	if (chan_comb == NM_CHANC_mainBCCH)
		return("BCCH");
	if (chan_comb == NM_CHANC_BCCHComb)
		return("BCCH+SDCCH/4");
	if (chan_comb == NM_CHANC_SDCCH)
		return("SDCCH/8");
	if (chan_comb == NM_CHANC_TCHFull)
		return("TCH/F");
	if (chan_comb == NM_CHANC_TCHHalf)
		return("TCH/H");
	return "Unknown";
}