aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm/gsm48_arfcn_range_encode.h
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-07-27 12:19:15 +0200
committerHarald Welte <laforge@gnumonks.org>2019-01-12 09:51:05 +0000
commitfdf8b7b1beeb0cda262c5fb060a933aa7edb5e9a (patch)
treea98bfbe04e8b63607482a897a92f0a2663f24023 /include/osmocom/gsm/gsm48_arfcn_range_encode.h
parente118ed22e39730552c6d9cd923c920f03029abec (diff)
port arfcn range encode support from osmo-bsc
As part of fixing issue OS#3075, we want to migrate support for encoding system information from osmo-bsc to libosmocore. This change ports one of the prerequisites for doing so: osmo-bsc code for range-encoding ARFCNs, including tests. An osmo_gsm48_ prefix has been prepended to public symbols in order to avoid clashes with existing symbols in osmo-bsc code. Change-Id: Ia220764fba451be5e975ae7c5eefb1a25ac2bf2c Related: OS#3075
Diffstat (limited to 'include/osmocom/gsm/gsm48_arfcn_range_encode.h')
-rw-r--r--include/osmocom/gsm/gsm48_arfcn_range_encode.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm48_arfcn_range_encode.h b/include/osmocom/gsm/gsm48_arfcn_range_encode.h
new file mode 100644
index 00000000..146c8534
--- /dev/null
+++ b/include/osmocom/gsm/gsm48_arfcn_range_encode.h
@@ -0,0 +1,25 @@
+/*! \file gsm48_arfcn_range_encode.h */
+
+#pragma once
+
+#include <stdint.h>
+
+enum osmo_gsm48_range {
+ OSMO_GSM48_ARFCN_RANGE_INVALID = -1,
+ OSMO_GSM48_ARFCN_RANGE_128 = 127,
+ OSMO_GSM48_ARFCN_RANGE_256 = 255,
+ OSMO_GSM48_ARFCN_RANGE_512 = 511,
+ OSMO_GSM48_ARFCN_RANGE_1024 = 1023,
+};
+
+#define OSMO_GSM48_RANGE_ENC_MAX_ARFCNS 29
+
+int osmo_gsm48_range_enc_determine_range(const int *arfcns, int size, int *f0_out);
+int osmo_gsm48_range_enc_arfcns(enum osmo_gsm48_range rng, const int *arfcns, int sze, int *out, int idx);
+int osmo_gsm48_range_enc_find_index(enum osmo_gsm48_range rng, const int *arfcns, int size);
+int osmo_gsm48_range_enc_filter_arfcns(int *arfcns, const int sze, const int f0, int *f0_included);
+
+int osmo_gsm48_range_enc_128(uint8_t *chan_list, int f0, int *w);
+int osmo_gsm48_range_enc_256(uint8_t *chan_list, int f0, int *w);
+int osmo_gsm48_range_enc_512(uint8_t *chan_list, int f0, int *w);
+int osmo_gsm48_range_enc_1024(uint8_t *chan_list, int f0, int f0_incl, int *w);