blob: aaca17d93fc2620364c03f452505edab0ee00978 [file] [log] [blame]
Harald Welte1389e862017-06-18 18:16:02 +03001#pragma once
2#include <stdint.h>
3#include <osmocom/core/bits.h>
4
5/*! \brief definition of a PRBS sequence */
6struct osmo_prbs {
7 const char *name; /*!< human-readable name */
8 unsigned int len; /*!< length in bits */
9 uint64_t coeff; /*!< coefficients */
10};
11
12/*! \brief state of a given PRBS sequence generator */
13struct osmo_prbs_state {
14 const struct osmo_prbs *prbs;
15 uint64_t state;
16};
17
18extern const struct osmo_prbs osmo_prbs7;
19extern const struct osmo_prbs osmo_prbs9;
20extern const struct osmo_prbs osmo_prbs11;
21extern const struct osmo_prbs osmo_prbs15;
22
23void osmo_prbs_state_init(struct osmo_prbs_state *st, const struct osmo_prbs *prbs);
24ubit_t osmo_prbs_get_ubit(struct osmo_prbs_state *state);
25int osmo_prbs_get_ubits(ubit_t *out, unsigned int out_len, struct osmo_prbs_state *state);