Exemple #1
0
int main(int argc, char **argv) {
  ra_pdsch_t ra_dl;
  int i;
  int frame_cnt;
  int ret;
  dci_location_t locations[MAX_CANDIDATES];
  uint32_t nof_locations;
  dci_msg_t dci_msg; 

  if (argc < 3) {
    usage(argv[0]);
    exit(-1);
  }

  parse_args(argc,argv);

  if (base_init()) {
    fprintf(stderr, "Error initializing memory\n");
    exit(-1);
  }

  ret = -1;
  frame_cnt = 0;
  do {
    filesource_read(&fsrc, input_buffer, flen);

    INFO("Reading %d samples sub-frame %d\n", flen, frame_cnt);

    lte_fft_run_sf(&fft, input_buffer, fft_buffer);

    /* Get channel estimates for each port */
    chest_dl_estimate(&chest, fft_buffer, ce, frame_cnt %10);
    
    uint16_t crc_rem = 0;
    if (pdcch_extract_llr(&pdcch, fft_buffer, 
                          ce, chest_dl_get_noise_estimate(&chest), 
                          frame_cnt %10, cfi)) {
      fprintf(stderr, "Error extracting LLRs\n");
      return -1;
    }
    if (rnti == SIRNTI) {
      INFO("Initializing common search space for SI-RNTI\n",0);
      nof_locations = pdcch_common_locations(&pdcch, locations, MAX_CANDIDATES, cfi);
    } else {
      INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti);
      nof_locations = pdcch_ue_locations(&pdcch, locations, MAX_CANDIDATES, frame_cnt %10, cfi, rnti); 
    }

    for (i=0;i<nof_locations && crc_rem != rnti;i++) {
      if (pdcch_decode_msg(&pdcch, &dci_msg, &locations[i], dci_format, &crc_rem)) {
        fprintf(stderr, "Error decoding DCI msg\n");
        return -1;
      }
    }
    
    if (crc_rem == rnti) {
      dci_msg_type_t type;
      if (dci_msg_get_type(&dci_msg, &type, cell.nof_prb, rnti, 1234)) {
        fprintf(stderr, "Can't get DCI message type\n");
        exit(-1);
      }
      printf("MSG %d: ",i);
      dci_msg_type_fprint(stdout, type);
      switch(type.type) {
      case PDSCH_SCHED:
        bzero(&ra_dl, sizeof(ra_pdsch_t));
        if (dci_msg_unpack_pdsch(&dci_msg, &ra_dl, cell.nof_prb, rnti != SIRNTI)) {
          fprintf(stderr, "Can't unpack PDSCH message\n");
        } else {
          ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb);
          if (ra_dl.alloc_type == alloc_type2 && ra_dl.type2_alloc.mode == t2_loc
              && ra_dl.type2_alloc.riv == 11 && ra_dl.rv_idx == 0
              && ra_dl.harq_process == 0 && ra_dl.mcs_idx == 2) {
            printf("This is the file signal.1.92M.amar.dat\n");
            ret = 0;
          }
        }
        break;
      default:
        fprintf(stderr, "Unsupported message type\n");
        break;
      }

    }

    frame_cnt++;
  } while (frame_cnt <= max_frames);

  base_free();
  exit(ret);
}
Exemple #2
0
int main(int argc, char **argv) {
    dci_msg_t msg;
    ra_pdsch_t ra_dl;
    int len, rlen;
    int nof_prb;
    int nwords;
    int i;
    char *y;

    if (argc < 3) {
        usage(argv[0]);
        exit(-1);
    }

    nof_prb = atoi(argv[1]);
    len = atoi(argv[2]);

    nwords = (len - 1) / 32 + 1;

    if (argc < 3 + nwords) {
        usage(argv[0]);
        exit(-1);
    }

    y = msg.data;
    rlen = 0;
    unsigned int x;
    for (i = 0; i < nwords; i++) {
        x = strtoul(argv[i + 3], NULL, 16);
        if (len - rlen < 32) {
            bit_pack(x, &y, len - rlen);
        } else {
            bit_pack(x, &y, 32);
        }

    }

    printf("DCI message len %d:\n", len);
    for (i = 0; i < len; i++) {
        printf("%d, ", msg.data[i]);
    }
    printf("\n");

    dci_msg_type_t dci_type;
    msg.nof_bits = len;
    if (dci_msg_get_type(&msg, &dci_type, nof_prb, SIRNTI, 1234)) {
        fprintf(stderr, "Can't obtain DCI message type\n");
        exit(-1);
    }
    printf("\n");
    printf("Message type:");
    dci_msg_type_fprint(stdout, dci_type);
    switch (dci_type.type) {
    case PDSCH_SCHED:
        bzero(&ra_dl, sizeof(ra_pdsch_t));
        dci_msg_unpack_pdsch(&msg, &ra_dl, nof_prb, false);
        ra_pdsch_fprint(stdout, &ra_dl, nof_prb);
        break;
    default:
        printf("Error expected PDSCH\n");
        exit(-1);
    }
    printf("\n");
}