/** * * \section COPYRIGHT * * Copyright 2013-2014 The libLTE Developers. See the * COPYRIGHT file at the top-level directory of this distribution. * * \section LICENSE * * This file is part of the libLTE library. * * libLTE is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * libLTE 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 Lesser General Public License for more details. * * A copy of the GNU Lesser 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 "lte.h" int cell_id = 1; int nof_prb = 6; int nof_ports = 1; int cfi = 1; void usage(char *prog) { printf("Usage: %s [cpv]\n", prog); printf("\t-c cell id [Default %d]\n", cell_id); printf("\t-f cfi [Default %d]\n", cfi); printf("\t-p nof_ports [Default %d]\n", nof_ports); printf("\t-n nof_prb [Default %d]\n", nof_prb); printf("\t-v [set verbose to debug, default none]\n"); } void parse_args(int argc, char **argv) { int opt; while ((opt = getopt(argc, argv, "cpnfv")) != -1) { switch(opt) { case 'p': nof_ports = atoi(argv[optind]); break; case 'f': cfi = atoi(argv[optind]); break; case 'n': nof_prb = atoi(argv[optind]); break; case 'c': cell_id = atoi(argv[optind]); break; case 'v': verbose++; break; default: usage(argv[0]); exit(-1); } } } int test_dci_payload_size() { int i, j; int x[4]; const dci_format_t formats[4] = {Format0, Format1, Format1A, Format1C}; const int prb[6]={6, 15, 25, 50, 75, 100}; const int dci_sz[6][5] = { {21, 19, 21, 8}, {22, 23, 22, 10}, {25, 27, 25, 12}, {27, 31, 27, 13}, {27, 33, 27, 14}, {28, 39, 28, 15} }; printf("Testing DCI payload sizes...\n"); printf(" PRB\t0\t1\t1A\t1C\n"); for (i=0;i<6;i++) { int n=prb[i]; for (j=0;j<4;j++) { x[j] = dci_format_sizeof(formats[j], n); if (x[j] != dci_sz[i][j]) { fprintf(stderr, "Invalid DCI payload size for %s\n", dci_format_string(formats[j])); return -1; } } printf(" %2d:\t%2d\t%2d\t%2d\t%2d\n",n,x[0],x[1],x[2],x[3]); } printf("Ok\n"); return 0; } int main(int argc, char **argv) { pdcch_t pdcch; dci_t dci_tx, dci_rx; ra_pdsch_t ra_dl; regs_t regs; int i, j; cf_t *ce[MAX_PORTS_CTRL]; int nof_re; cf_t *slot1_symbols[MAX_PORTS_CTRL]; int nof_dcis; int ret = -1; parse_args(argc,argv); nof_re = CPNORM_NSYMB * nof_prb * RE_X_RB; if (test_dci_payload_size()) { exit(-1); } /* init memory */ for (i=0;i