From 11c7193ad8ceb4f3898799dc44b700b8b93a59b8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 24 May 2011 17:15:12 +0200 Subject: Import abis_nm_{chcomb4pchan,pchan4chcomb}() from openbsc --- src/gsm/abis_nm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/gsm') diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 109c3bba..a82194fd 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -21,9 +21,12 @@ */ #include +#include + #include #include #include +#include #include #include @@ -394,3 +397,32 @@ void abis_nm_debugp_foh(int ss, struct abis_om_fom_hdr *foh) 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; +} -- cgit v1.2.3