pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/34168 ) Change subject: rlcmac: Move FN related helper functions to private header inside libosmo-gprs ...................................................................... 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 --- M include/osmocom/gprs/rlcmac/sched.h M tests/rlcmac/rlcmac_prim_test.c 2 files changed, 25 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/68/34168/1 diff --git a/include/osmocom/gprs/rlcmac/sched.h b/include/osmocom/gprs/rlcmac/sched.h index 18fbe7d..a90cbc1 100644 --- a/include/osmocom/gprs/rlcmac/sched.h +++ b/include/osmocom/gprs/rlcmac/sched.h @@ -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 @@ /* 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; +} diff --git a/tests/rlcmac/rlcmac_prim_test.c b/tests/rlcmac/rlcmac_prim_test.c index 410b266..6e317b1 100644 --- a/tests/rlcmac/rlcmac_prim_test.c +++ b/tests/rlcmac/rlcmac_prim_test.c @@ -262,20 +262,6 @@ } #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; -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/34168 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I87393239b05a1c11498323139866aec9f6550f3b Gerrit-Change-Number: 34168 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-MessageType: newchange