/** * * \section COPYRIGHT * * Copyright 2013-2015 The srsLTE Developers. See the * COPYRIGHT file at the top-level directory of this distribution. * * \section LICENSE * * This file is part of the srsLTE library. * * srsLTE 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. * * srsLTE 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. * * A copy of the GNU Affero General Public License can be found in * the LICENSE file in the top-level directory of this distribution * and at http://www.gnu.org/licenses/. * */ #include #include #include #include #include #include #include #include #include "srslte/srslte.h" int nof_e_bits = -1; int rv_idx = -1; int cb_idx = -1; uint8_t systematic[6148], parity[2*6148]; uint8_t systematic_bytes[6148/8+1], parity_bytes[2*6148/8+1]; #define BUFFSZ 6176*3 uint8_t bits[3*6144+12]; uint8_t buff_b[BUFFSZ]; float buff_f[BUFFSZ]; float bits_f[3*6144+12]; float bits2_f[3*6144+12]; void usage(char *prog) { printf("Usage: %s -c cb_idx -e nof_e_bits [-i rv_idx]\n", prog); } void parse_args(int argc, char **argv) { int opt; while ((opt = getopt(argc, argv, "cei")) != -1) { switch (opt) { case 'c': cb_idx = atoi(argv[optind]); break; case 'e': nof_e_bits = atoi(argv[optind]); break; case 'i': rv_idx = atoi(argv[optind]); break; default: usage(argv[0]); exit(-1); } } if (nof_e_bits == -1) { usage(argv[0]); exit(-1); } } int main(int argc, char **argv) { int i; uint8_t *rm_bits, *rm_bits2, *rm_bits2_bytes; float *rm_bits_f; parse_args(argc, argv); srslte_rm_turbo_gentables(); rm_bits_f = malloc(sizeof(float) * nof_e_bits); if (!rm_bits_f) { perror("malloc"); exit(-1); } rm_bits = malloc(sizeof(uint8_t) * nof_e_bits); if (!rm_bits) { perror("malloc"); exit(-1); } rm_bits2 = malloc(sizeof(uint8_t) * nof_e_bits); if (!rm_bits2) { perror("malloc"); exit(-1); } rm_bits2_bytes = malloc(sizeof(uint8_t) * nof_e_bits/8 + 1); if (!rm_bits2_bytes) { perror("malloc"); exit(-1); } uint32_t st=0, end=188; if (cb_idx != -1) { st=cb_idx; end=cb_idx+1; } uint32_t rv_st=0, rv_end=4; if (rv_idx != -1) { rv_st=rv_idx; rv_end=rv_idx+1; } for (cb_idx=st;cb_idx 0) { srslte_rm_turbo_tx(buff_b, BUFFSZ, bits, long_cb_enc, rm_bits, nof_e_bits, rv_idx); } for (int i=0;i 0) { bzero(rm_bits2_bytes, nof_e_bits/8); srslte_rm_turbo_tx_lut(buff_b, systematic_bytes, parity_bytes, rm_bits2_bytes, cb_idx, nof_e_bits, 0, rv_idx); } srslte_bit_unpack_vector(rm_bits2_bytes, rm_bits2, nof_e_bits); for (int i=0;i