aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2015-04-04 13:53:45 +0200
committerSylvain Munaut <tnt@246tNt.com>2015-04-04 13:54:30 +0200
commitab449343f9fe62ddc5de16bb535987308c26a916 (patch)
tree3580321b59c046913b4d9315b93e614e6a757ead
parenta23f3d3243cb99d94a3a61a8c01eb06179c2a557 (diff)
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 <tnt@246tNt.com>
-rw-r--r--src/Makefile.am7
-rw-r--r--src/gmr1_rach_gen.c65
2 files changed, 71 insertions, 1 deletions
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 <tnt@246tNt.com>
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <osmocom/core/bits.h>
+#include <osmocom/core/utils.h>
+
+#include <osmocom/dsp/cxvec.h>
+
+#include <osmocom/gmr1/l1/rach.h>
+#include <osmocom/gmr1/sdr/defs.h>
+#include <osmocom/gmr1/sdr/pi4cxpsk.h>
+#include <osmocom/gmr1/sdr/nb.h>
+
+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;
+}