- Fixes on MM, RR, cell selection, plmn search processes.
[osmocom-bb.git] / src / host / layer23 / src / support.c
1 /*
2  * (C) 2010 by Andreas Eversberg <jolly@eversberg.eu>
3  *
4  * All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  */
21
22 #include <stdio.h>
23 #include <stdint.h>
24 #include <string.h>
25
26 #include <osmocom/osmocom_data.h>
27
28 void gsm_support_init(struct osmocom_ms *ms)
29 {
30         struct gsm_support *sup = &ms->support;
31         int i;
32
33         memset(sup, 0, sizeof(*sup));
34
35         /* rf power capability */
36         sup->pwr_lev_900 = 3; /* CLASS 4: Handheld 2W */
37         sup->pwr_lev_1800 = 0; /* CLASS 1: Handheld 1W */
38         /* controlled early classmark sending */
39         sup->es_ind = 0; /* no */
40         /* revision level */
41         sup->rev_lev = 1; /* phase 2 mobile station */
42         /* support of VGCS */
43         sup->vgcs = 0; /* no */
44         /* support of VBS */
45         sup->vbs = 0; /* no */
46         /* support of SMS */
47         sup->sms_ptp = 1; /* yes */
48         /* screening indicator */
49         sup->ss_ind = 1; /* phase 2 error handling */
50         /* pseudo synchronised capability */
51         sup->ps_cap = 0; /* no */
52         /* CM service prompt */
53         sup->cmsp = 0; /* no */
54         /* solsa support */
55         sup->solsa = 0; /* no */
56         /* location service support */
57         sup->lcsva = 0; /* no */
58         sup->loc_serv = 0; /* no */
59         /* codec supprot */
60         sup->a5_1 = 0; /* currently not */
61         sup->a5_2 = 0;
62         sup->a5_3 = 0;
63         sup->a5_4 = 0;
64         sup->a5_5 = 0;
65         sup->a5_6 = 0;
66         sup->a5_7 = 0;
67         /* radio support */
68         sup->p_gsm = 1; /* P-GSM only */
69         sup->e_gsm = 0; /* E-GSM */
70         sup->r_gsm = 0; /* R-GSM */
71         sup->r_capa = 0;
72         sup->low_capa = 4; /* p,e,r power class */
73         sup->dcs_1800 = 0;
74         /* set supported frequencies */
75         if (sup->e_gsm || sup->r_gsm)
76                 sup->freq_map[0] |= 1;
77         if (sup->p_gsm || sup->e_gsm || sup->r_gsm)
78                 for(i = 1; i <= 124; i++)
79                         sup->freq_map[i >> 3] |= (1 << (i & 7));
80         if (sup->dcs_1800)
81                 for(i = 512; i <= 885; i++)
82                         sup->freq_map[i >> 3] |= (1 << (i & 7));
83         if (sup->e_gsm)
84                 for(i = 975; i <= 1023; i++)
85                         sup->freq_map[i >> 3] |= (1 << (i & 7));
86 //              for(i = 978; i <= 978; i++)
87 //                      sup->freq_map[i >> 3] |= (1 << (i & 7));
88         if (sup->r_gsm)
89                 for(i = 955; i <= 1023; i++)
90                         sup->freq_map[i >> 3] |= (1 << (i & 7));
91         sup->dcs_capa = 1; /* dcs power class */
92         /* multi slot support */
93         sup->ms_sup = 0; /* no */
94         /* ucs2 treatment */
95         sup->ucs2_treat = 0; /* default */
96         /* support extended measurements */
97         sup->ext_meas = 0; /* no */
98         /* support switched measurement capability */
99         sup->meas_cap = 0; /* no */
100         //sup->sms_val = ;
101         //sup->sm_val = ;
102
103         /* IMEI */
104         sprintf(sup->imei, "000000000000000");
105         sprintf(sup->imeisv, "0000000000000000");
106
107         /* radio */
108         sup->min_rxlev_db = -60; // TODO
109         sup->sync_to = 6; /* how long to wait sync (0.9 s) */
110         sup->scan_to = 4; /* how long to wait for all sysinfos (>=4 s) */
111 }
112
113 /* (3.2.1) maximum channels to scan within each band */
114 struct gsm_support_scan_max gsm_sup_smax[] = {
115 #if 0
116         { 259, 293, 15, 0 },
117         { 360, 340, 15, 0 },
118         { 438, 511, 25, 0 },
119         { 128, 251, 30, 0 },
120         { 955, 124, 30, 0 },
121         { 512, 885, 40, 0 },
122 #else
123 //      { 955, 125, 1, 0 }, /* we support only one ARFCN */
124 #endif
125         { 0, 0, 0, 0 }
126 };
127
128