diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-06-27 11:25:35 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-06-27 11:25:35 +0200 |
commit | c6b4c87e5d57b91b29894835e7ac8e42f6e67f32 (patch) | |
tree | 2dfca5a61c881e88e6f29d03c29bb26e1c643332 /src/common/sysinfo.c | |
parent | 8e47fb89bfd0e2b54b714393ac2a80ca76df56a9 (diff) |
re-work original osmo-bts with support for sysmocom femtobts
This code re-works osmo-bts to add support for the upcoming sysmocom BTS.
It also tries to add some level of abstraction between the generic
part of a BTS (A-bis, RSL, OML, data structures, paging scheduling,
BCCH/AGCH scheduling, etc.) and the actual hardware-specific bits.
The hardware-specific bits are currently only implemented for the sysmocom
femtobts, but should be (re-)added for osmocom-bb, as well as a virtual
BTS for simulation purpose later.
The sysmocom bts specific parts require hardware-specific header files
which are (at least currently) not publicly distributed.
Diffstat (limited to 'src/common/sysinfo.c')
-rw-r--r-- | src/common/sysinfo.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c new file mode 100644 index 00000000..90141d5b --- /dev/null +++ b/src/common/sysinfo.c @@ -0,0 +1,66 @@ +/* (C) 2011 by Harald Welte <laforge@gnumonks.org> + * + * 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 <stdint.h> + +#include <osmocom/gsm/gsm_utils.h> +#include <osmocom/gsm/sysinfo.h> + +#include <osmo-bts/gsm_data.h> + +uint8_t *bts_sysinfo_get(struct gsm_bts *bts, struct gsm_time *g_time) +{ + /* Apply the rules from 05.02 6.3.1.3 Mapping of BCCH Data */ + switch (g_time->tc) { + case 0: + return GSM_BTS_SI(bts, SYSINFO_TYPE_1); + case 1: + return GSM_BTS_SI(bts, SYSINFO_TYPE_2); + case 2: + return GSM_BTS_SI(bts, SYSINFO_TYPE_3); + case 3: + return GSM_BTS_SI(bts, SYSINFO_TYPE_4); + case 4: + /* 2ter, 2quater, 9, 13 */ + break; + case 5: + /* 2ter, 2quater */ + break; + case 6: + return GSM_BTS_SI(bts, SYSINFO_TYPE_3); + case 7: + return GSM_BTS_SI(bts, SYSINFO_TYPE_4); + } + + return NULL; +} + +uint8_t *lchan_sacch_get(struct gsm_lchan *lchan, struct gsm_time *g_time) +{ + uint32_t tmp; + + for (tmp = lchan->si.last + 1; tmp != lchan->si.last; tmp = (tmp + 1) % 32) { + if (lchan->si.valid & (1 << tmp)) { + lchan->si.last = tmp; + printf("returning SACCH SI type %u\n", tmp); + return lchan->si.buf[tmp]; + } + } + return NULL; +} |