Add function for appending range1024 to bitvec

Add convenience function to append range1024 encoded data (see 3GPP TS
44.018 Annex J) to a given bitvec.
This commit is contained in:
Max 2016-04-22 19:28:09 +02:00 committed by Holger Hans Peter Freyther
parent 1f9d8183be
commit 8a5346ba2f
4 changed files with 51 additions and 1 deletions

View File

@ -57,6 +57,7 @@ nobase_include_HEADERS = \
osmocom/gsm/apn.h \
osmocom/gsm/comp128.h \
osmocom/gsm/comp128v23.h \
osmocom/gsm/bitvec_gsm.h \
osmocom/gsm/gan.h \
osmocom/gsm/gsm0341.h \
osmocom/gsm/gsm0411_smc.h \

View File

@ -0,0 +1,13 @@
#pragma once
#include <osmocom/core/bitvec.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
/*! \defgroup bitvec helpers for GSM
* @{
*/
/*! \file bitvec_gsm.h */
void bitvec_add_range1024(struct bitvec *bv, const struct gsm48_range_1024 *r);
/*! @} */

View File

@ -64,7 +64,9 @@
//#include <openbsc/gsm_data.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <stdlib.h>
#include <stdint.h>
@ -655,6 +657,40 @@ uint32_t gsm_gsmtime2fn(struct gsm_time *time)
return (51 * ((time->t3 - time->t2 + 26) % 26) + time->t3 + (26 * 51 * time->t1));
}
/*! \brief append range1024 encoded data to bit vector */
void bitvec_add_range1024(struct bitvec *bv, const struct gsm48_range_1024 *r)
{
bitvec_set_uint(bv, r->w1_hi, 2);
bitvec_set_uint(bv, r->w1_lo, 8);
bitvec_set_uint(bv, r->w2_hi, 8);
bitvec_set_uint(bv, r->w2_lo, 1);
bitvec_set_uint(bv, r->w3_hi, 7);
bitvec_set_uint(bv, r->w3_lo, 2);
bitvec_set_uint(bv, r->w4_hi, 6);
bitvec_set_uint(bv, r->w4_lo, 2);
bitvec_set_uint(bv, r->w5_hi, 6);
bitvec_set_uint(bv, r->w5_lo, 2);
bitvec_set_uint(bv, r->w6_hi, 6);
bitvec_set_uint(bv, r->w6_lo, 2);
bitvec_set_uint(bv, r->w7_hi, 6);
bitvec_set_uint(bv, r->w7_lo, 2);
bitvec_set_uint(bv, r->w8_hi, 6);
bitvec_set_uint(bv, r->w8_lo, 1);
bitvec_set_uint(bv, r->w9, 7);
bitvec_set_uint(bv, r->w10, 7);
bitvec_set_uint(bv, r->w11_hi, 1);
bitvec_set_uint(bv, r->w11_lo, 6);
bitvec_set_uint(bv, r->w12_hi, 2);
bitvec_set_uint(bv, r->w12_lo, 5);
bitvec_set_uint(bv, r->w13_hi, 3);
bitvec_set_uint(bv, r->w13_lo, 4);
bitvec_set_uint(bv, r->w14_hi, 4);
bitvec_set_uint(bv, r->w14_lo, 3);
bitvec_set_uint(bv, r->w15_hi, 5);
bitvec_set_uint(bv, r->w15_lo, 2);
bitvec_set_uint(bv, r->w16, 6);
}
/* TS 23.003 Chapter 2.6 */
int gprs_tlli_type(uint32_t tlli)
{

View File

@ -25,7 +25,7 @@ abis_nm_osmo_magic;
abis_nm_ipa_magic;
osmo_sitype_strs;
bitvec_add_range1024;
comp128;
dbm2rxlev;