Harald Welte | 1389e86 | 2017-06-18 18:16:02 +0300 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <stdint.h> |
| 3 | #include <osmocom/core/bits.h> |
| 4 | |
| 5 | /*! \brief definition of a PRBS sequence */ |
| 6 | struct 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 */ |
| 13 | struct osmo_prbs_state { |
| 14 | const struct osmo_prbs *prbs; |
| 15 | uint64_t state; |
| 16 | }; |
| 17 | |
| 18 | extern const struct osmo_prbs osmo_prbs7; |
| 19 | extern const struct osmo_prbs osmo_prbs9; |
| 20 | extern const struct osmo_prbs osmo_prbs11; |
| 21 | extern const struct osmo_prbs osmo_prbs15; |
| 22 | |
| 23 | void osmo_prbs_state_init(struct osmo_prbs_state *st, const struct osmo_prbs *prbs); |
| 24 | ubit_t osmo_prbs_get_ubit(struct osmo_prbs_state *state); |
| 25 | int osmo_prbs_get_ubits(ubit_t *out, unsigned int out_len, struct osmo_prbs_state *state); |