rlcmac: Move FN related helper functions to private header inside libosmo-gprs
These may be handy in other tests or inside the library. Change-Id: I87393239b05a1c11498323139866aec9f6550f3b
This commit is contained in:
parent
ffb7833ce7
commit
1e2779652b
|
@ -2,6 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <osmocom/gsm/gsm_utils.h>
|
||||
|
||||
struct gprs_rlcmac_rts_block_ind {
|
||||
uint8_t ts;
|
||||
|
@ -32,3 +33,16 @@ static inline int fn_cmp(uint32_t fn1, uint32_t fn2)
|
|||
/* FN1 goes after FN2: */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline uint32_t fn2bn(uint32_t fn)
|
||||
{
|
||||
return (fn % 52) / 4;
|
||||
}
|
||||
|
||||
static inline uint32_t fn_next_block(uint32_t fn)
|
||||
{
|
||||
uint32_t bn = fn2bn(fn) + 1;
|
||||
fn = fn - (fn % 52);
|
||||
fn += bn * 4 + bn / 3;
|
||||
return fn % GSM_MAX_FN;
|
||||
}
|
||||
|
|
|
@ -262,20 +262,6 @@ static void clock_override_add_debug(long sec, long usec, bool dbg)
|
|||
}
|
||||
#define clock_override_add(sec, usec) clock_override_add_debug(sec, usec, true)
|
||||
|
||||
|
||||
static inline unsigned fn2bn(unsigned fn)
|
||||
{
|
||||
return (fn % 52) / 4;
|
||||
}
|
||||
|
||||
static inline unsigned fn_next_block(unsigned fn)
|
||||
{
|
||||
unsigned bn = fn2bn(fn) + 1;
|
||||
fn = fn - (fn % 52);
|
||||
fn += bn * 4 + bn / 3;
|
||||
return fn % GSM_MAX_FN;
|
||||
}
|
||||
|
||||
static struct osmo_gprs_rlcmac_prim *create_dl_ctrl_block_buf(uint8_t *buf, int num_bytes, uint8_t tn, uint32_t fn)
|
||||
{
|
||||
struct osmo_gprs_rlcmac_prim *rlcmac_prim;
|
||||
|
|
Loading…
Reference in New Issue