summaryrefslogtreecommitdiffstats
path: root/src/gsm/abis_nm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsm/abis_nm.c')
-rw-r--r--src/gsm/abis_nm.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index acea4ed5..a82194fd 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -21,9 +21,12 @@
*/
#include <stdint.h>
+#include <errno.h>
+
#include <osmocom/core/utils.h>
#include <osmocom/core/logging.h>
#include <osmocom/gsm/tlv.h>
+#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
#include <osmocom/gsm/abis_nm.h>
@@ -308,7 +311,7 @@ const struct tlv_definition abis_nm_att_tlvdef = {
},
};
-static const struct value_string abis_nm_obj_class_names[] = {
+const struct value_string abis_nm_obj_class_names[] = {
{ NM_OC_SITE_MANAGER, "SITE-MANAGER" },
{ NM_OC_BTS, "BTS" },
{ NM_OC_RADIO_CARRIER, "RADIO-CARRIER" },
@@ -329,11 +332,6 @@ static const struct value_string abis_nm_obj_class_names[] = {
{ 0, NULL }
};
-const char *abis_nm_obj_class_name(uint8_t oc)
-{
- return get_value_string(abis_nm_obj_class_names, oc);
-}
-
const char *abis_nm_opstate_name(uint8_t os)
{
switch (os) {
@@ -384,7 +382,7 @@ const char *abis_nm_test_name(uint8_t test)
return get_value_string(test_names, test);
}
-static const struct value_string abis_nm_adm_state_names[] = {
+const struct value_string abis_nm_adm_state_names[] = {
{ NM_STATE_LOCKED, "Locked" },
{ NM_STATE_UNLOCKED, "Unlocked" },
{ NM_STATE_SHUTDOWN, "Shutdown" },
@@ -392,15 +390,39 @@ static const struct value_string abis_nm_adm_state_names[] = {
{ 0, NULL }
};
-const char *abis_nm_adm_name(uint8_t adm)
-{
- return get_value_string(abis_nm_adm_state_names, adm);
-}
-
void abis_nm_debugp_foh(int ss, struct abis_om_fom_hdr *foh)
{
DEBUGP(ss, "OC=%s(%02x) INST=(%02x,%02x,%02x) ",
- abis_nm_obj_class_name(foh->obj_class), foh->obj_class,
- foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
+ get_value_string(abis_nm_obj_class_names, foh->obj_class),
+ foh->obj_class, foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
foh->obj_inst.ts_nr);
}
+
+static const enum abis_nm_chan_comb chcomb4pchan[] = {
+ [GSM_PCHAN_CCCH] = NM_CHANC_mainBCCH,
+ [GSM_PCHAN_CCCH_SDCCH4] = NM_CHANC_BCCHComb,
+ [GSM_PCHAN_TCH_F] = NM_CHANC_TCHFull,
+ [GSM_PCHAN_TCH_H] = NM_CHANC_TCHHalf,
+ [GSM_PCHAN_SDCCH8_SACCH8C] = NM_CHANC_SDCCH,
+ [GSM_PCHAN_PDCH] = NM_CHANC_IPAC_PDCH,
+ [GSM_PCHAN_TCH_F_PDCH] = NM_CHANC_IPAC_TCHFull_PDCH,
+ /* FIXME: bounds check */
+};
+
+int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan)
+{
+ if (pchan < ARRAY_SIZE(chcomb4pchan))
+ return chcomb4pchan[pchan];
+
+ return -EINVAL;
+}
+
+enum abis_nm_chan_comb abis_nm_pchan4chcomb(uint8_t chcomb)
+{
+ int i;
+ for (i = 0; i < ARRAY_SIZE(chcomb4pchan); i++) {
+ if (chcomb4pchan[i] == chcomb)
+ return i;
+ }
+ return GSM_PCHAN_NONE;
+}