blob: f478635b0bbec3a461c23e08cdfdc16b95074eb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <osmocom/core/prbs.h>
static void dump_bits(const ubit_t *bits, unsigned int num_bits)
{
unsigned int i;
for (i = 0; i < num_bits; i++) {
if (bits[i])
fputc('1', stdout);
else
fputc('0', stdout);
}
fputc('\n',stdout);
}
static void test_prbs(const struct osmo_prbs *prbs)
{
struct osmo_prbs_state st;
unsigned int i;
printf("Testing PRBS sequence generation '%s'\n", prbs->name);
osmo_prbs_state_init(&st, prbs);
/* 2 lines */
for (i = 0; i < 2; i++) {
unsigned int seq_len = (1 << prbs->len)-1;
ubit_t bits[seq_len];
memset(bits, 0, sizeof(bits));
osmo_prbs_get_ubits(bits, sizeof(bits), &st);
dump_bits(bits, sizeof(bits));
}
printf("\n");
}
int main(int argc, char **argv)
{
test_prbs(&osmo_prbs7);
test_prbs(&osmo_prbs9);
test_prbs(&osmo_prbs11);
test_prbs(&osmo_prbs15);
exit(0);
}
|