From ab449343f9fe62ddc5de16bb535987308c26a916 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Sat, 4 Apr 2015 13:53:45 +0200 Subject: misc: Add an utility to modulate a RACH burst The output is only 1sps and needs to be filtered by an RRC filter (0.35) before transmission. Signed-off-by: Sylvain Munaut --- src/Makefile.am | 7 +++++- src/gmr1_rach_gen.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/gmr1_rach_gen.c diff --git a/src/Makefile.am b/src/Makefile.am index a89e065..08f14ff 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,13 +3,18 @@ SUBDIRS = codec l1 sdr AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir) AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMODSP_CFLAGS) -bin_PROGRAMS = gmr1_rx gmr1_gen_mat gmr1_ambe_decode +bin_PROGRAMS = gmr1_rx gmr1_rach_gen gmr1_gen_mat gmr1_ambe_decode gmr1_rx_SOURCES = gmr1_rx.c gsmtap.c gmr1_rx_LDADD = $(top_builddir)/src/l1/libgmr1-l1.a \ $(top_builddir)/src/sdr/libgmr1-sdr.a \ $(LIBOSMOCORE_LIBS) $(LIBOSMODSP_LIBS) $(FFTW3F_LIBS) +gmr1_rach_gen_SOURCES = gmr1_rach_gen.c +gmr1_rach_gen_LDADD = $(top_builddir)/src/l1/libgmr1-l1.a \ + $(top_builddir)/src/sdr/libgmr1-sdr.a \ + $(LIBOSMOCORE_LIBS) $(LIBOSMODSP_LIBS) $(FFTW3F_LIBS) + gmr1_gen_mat_SOURCES = gmr1_gen_mat.c gmr1_gen_mat_LDADD = $(top_builddir)/src/l1/libgmr1-l1.a \ $(LIBOSMOCORE_LIBS) diff --git a/src/gmr1_rach_gen.c b/src/gmr1_rach_gen.c new file mode 100644 index 0000000..de4cf12 --- /dev/null +++ b/src/gmr1_rach_gen.c @@ -0,0 +1,65 @@ +/* GMR-1 RACH generation utility */ + +/* (C) 2015 by Sylvain Munaut + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + const char *filename; + uint8_t sb_mask, rach[18]; + ubit_t ebits[494]; + struct osmo_cxvec *burst; + int rv; + + /* Check and parse args */ + if (argc != 4) { + fprintf(stderr, "Usage: %s out.cfile sb_mask payload\n", argv[0]); + return -1; + } + + filename = argv[1]; + sb_mask = strtoul(argv[2], NULL, 0); + + rv = osmo_hexparse(argv[3], rach, 18); + if (rv != 18) { + fprintf(stderr, "Invalid payload string\n"); + return -1; + } + + /* Alloc, encode, modulate, save, release */ + burst = osmo_cxvec_alloc(gmr1_rach_burst.len); + gmr1_rach_encode(ebits, rach, sb_mask); + gmr1_pi4cxpsk_mod(&gmr1_rach_burst, ebits, 0, burst); + osmo_cxvec_dbg_dump(burst, filename); + osmo_cxvec_free(burst); + + /* Done */ + return 0; +} -- cgit v1.2.3