Beispiel #1
0
int main(int argc, char **argv) {
  srslte_dci_msg_t msg;
  srslte_ra_dl_dci_t ra_dl;
  int len, rlen;
  int nof_prb;
  int nwords;
  int i;
  uint8_t *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;
  uint32_t x;
  for (i = 0; i < nwords; i++) {
    x = strtoul(argv[i + 3], NULL, 16);
    if (len - rlen < 32) {
      srslte_bit_unpack(x, &y, len - rlen);
    } else {
      srslte_bit_unpack(x, &y, 32);
    }

  }

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

  srslte_dci_msg_type_t dci_type;
  msg.nof_bits = len;
  if (srslte_dci_msg_get_type(&msg, &dci_type, nof_prb, SRSLTE_SIRNTI)) {
    fprintf(stderr, "Can't obtain DCI message type\n");
    exit(-1);
  }
  printf("\n");
  printf("Message type:");
  srslte_dci_msg_type_fprint(stdout, dci_type);
  switch (dci_type.type) {
  case SRSLTE_DCI_MSG_TYPE_PDSCH_SCHED:
    bzero(&ra_dl, sizeof(srslte_ra_dl_dci_t));
    srslte_dci_msg_unpack_pdsch(&msg, &ra_dl, nof_prb, false);
    srslte_ra_pdsch_fprint(stdout, &ra_dl, nof_prb);
    break;
  default:
    printf("Error expected PDSCH\n");
    exit(-1);
  }
  printf("\n");
}
Beispiel #2
0
int main(int argc, char **argv) {
  srslte_ra_dl_dci_t ra_dl;
  int i;
  int frame_cnt;
  int ret;
  srslte_dci_location_t locations[MAX_CANDIDATES];
  uint32_t nof_locations;
  srslte_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 {
    srslte_filesource_read(&fsrc, input_buffer, flen);

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

    srslte_ofdm_rx_sf(&fft, input_buffer, fft_buffer);

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

    for (i=0;i<nof_locations && crc_rem != rnti;i++) {
      if (srslte_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) {
      srslte_dci_msg_type_t type;
      if (srslte_dci_msg_get_type(&dci_msg, &type, cell.nof_prb, rnti)) {
        fprintf(stderr, "Can't get DCI message type\n");
        exit(-1);
      }
      printf("MSG %d: ",i);
      srslte_dci_msg_type_fprint(stdout, type);
      switch(type.type) {
      case SRSLTE_DCI_MSG_TYPE_PDSCH_SCHED:
        bzero(&ra_dl, sizeof(srslte_ra_dl_dci_t));
        if (srslte_dci_msg_unpack_pdsch(&dci_msg, &ra_dl, cell.nof_prb, rnti != SRSLTE_SIRNTI)) {
          fprintf(stderr, "Can't unpack DCI message\n");
        } else {
          srslte_ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb);
          if (ra_dl.alloc_type == SRSLTE_RA_ALLOC_TYPE2 && ra_dl.type2_alloc.mode == SRSLTE_RA_TYPE2_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);
}