libosmogsm 1.9.0.196-9975
Osmocom GSM library
gsm48_arfcn_range_encode.c File Reference

Functions

static int greatest_power_of_2_lesser_or_equal_to (int index)
 
static int mod (int data, int range)
 
int osmo_gsm48_range_enc_find_index (enum osmo_gsm48_range range, const int *freqs, const int size)
 Determine at which index to split the ARFCNs to create an equally size partition for the given range. More...
 
static int _range_enc_arfcns (enum osmo_gsm48_range range, const int *arfcns, int size, int *out, const int index)
 
int osmo_gsm48_range_enc_arfcns (enum osmo_gsm48_range range, const int *arfcns, int size, int *out, const int index)
 Range encode the ARFCN list. More...
 
int osmo_gsm48_range_enc_determine_range (const int *arfcns, const int size, int *f0)
 This implements the range determination as described in GSM 04.08 J4. More...
 
static void write_orig_arfcn (uint8_t *chan_list, int f0)
 
static void write_all_wn (uint8_t *chan_list, int bit_offs, int *w, int w_size, int w1_len)
 
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_included, int *w)
 
int osmo_gsm48_range_enc_filter_arfcns (int *arfcns, const int size, const int f0, int *f0_included)
 

Function Documentation

◆ _range_enc_arfcns()

static int _range_enc_arfcns ( enum osmo_gsm48_range  range,
const int *  arfcns,
int  size,
int *  out,
const int  index 
)
static

◆ greatest_power_of_2_lesser_or_equal_to()

static int greatest_power_of_2_lesser_or_equal_to ( int  index)
inlinestatic

Referenced by _range_enc_arfcns().

◆ mod()

static int mod ( int  data,
int  range 
)
inlinestatic

◆ osmo_gsm48_range_enc_1024()

int osmo_gsm48_range_enc_1024 ( uint8_t *  chan_list,
int  f0,
int  f0_included,
int *  w 
)

References write_all_wn().

Referenced by range_encode().

◆ osmo_gsm48_range_enc_128()

int osmo_gsm48_range_enc_128 ( uint8_t *  chan_list,
int  f0,
int *  w 
)

References write_all_wn(), and write_orig_arfcn().

Referenced by range_encode().

◆ osmo_gsm48_range_enc_256()

int osmo_gsm48_range_enc_256 ( uint8_t *  chan_list,
int  f0,
int *  w 
)

References write_all_wn(), and write_orig_arfcn().

Referenced by range_encode().

◆ osmo_gsm48_range_enc_512()

int osmo_gsm48_range_enc_512 ( uint8_t *  chan_list,
int  f0,
int *  w 
)

References write_all_wn(), and write_orig_arfcn().

Referenced by range_encode().

◆ osmo_gsm48_range_enc_arfcns()

int osmo_gsm48_range_enc_arfcns ( enum osmo_gsm48_range  range,
const int *  arfcns,
int  size,
int *  out,
const int  index 
)

Range encode the ARFCN list.

Parameters
rangeThe range to use.
arfcnsThe list of ARFCNs
sizeThe size of the list of ARFCNs
outPlace to store the W(i) output.

References _range_enc_arfcns().

Referenced by _range_enc_arfcns(), and range_encode().

◆ osmo_gsm48_range_enc_determine_range()

int osmo_gsm48_range_enc_determine_range ( const int *  arfcns,
const int  size,
int *  f0 
)

This implements the range determination as described in GSM 04.08 J4.

The result will be a base frequency f0 and the range to use. Note that for range 1024 encoding f0 always refers to ARFCN 0 even if it is not an element of the arfcns list.

Parameters
[in]arfcnsThe input frequencies, they must be sorted, lowest number first
[in]sizeThe length of the array
[out]f0The selected F0 base frequency. It might not be inside the list

References OSMO_GSM48_ARFCN_RANGE_1024, OSMO_GSM48_ARFCN_RANGE_128, OSMO_GSM48_ARFCN_RANGE_256, OSMO_GSM48_ARFCN_RANGE_512, and OSMO_GSM48_ARFCN_RANGE_INVALID.

◆ osmo_gsm48_range_enc_filter_arfcns()

int osmo_gsm48_range_enc_filter_arfcns ( int *  arfcns,
const int  size,
const int  f0,
int *  f0_included 
)

References mod().

Referenced by range_encode().

◆ osmo_gsm48_range_enc_find_index()

int osmo_gsm48_range_enc_find_index ( enum osmo_gsm48_range  range,
const int *  freqs,
const int  size 
)

Determine at which index to split the ARFCNs to create an equally size partition for the given range.

Return -1 if no such partition exists.

References mod(), and n.

Referenced by _range_enc_arfcns().

◆ write_all_wn()

static void write_all_wn ( uint8_t *  chan_list,
int  bit_offs,
int *  w,
int  w_size,
int  w1_len 
)
static

◆ write_orig_arfcn()

static void write_orig_arfcn ( uint8_t *  chan_list,
int  f0 
)
static