コード例 #1
0
ファイル: pbch.c プロジェクト: immortaltw/libLTE
int pbch_cp(cf_t *input, cf_t *output, int nof_prb, lte_cp_t cp, int cell_id,
    bool put) {
  int i;
  cf_t *ptr;
  assert(cell_id >= 0);
  if (put) {
    ptr = input;
    output += nof_prb * RE_X_RB / 2 - 36;
  } else {
    ptr = output;
    input += nof_prb * RE_X_RB / 2 - 36;
  }

  /* symbol 0 & 1 */
  for (i = 0; i < 2; i++) {
    prb_cp_ref(&input, &output, cell_id % 3, 4, 6, put);
  }
  /* symbols 2 & 3 */
  if (CP_ISNORM(cp)) {
    for (i = 0; i < 2; i++) {
      prb_cp(&input, &output, 6);
    }
  } else {
    prb_cp(&input, &output, 6);
    prb_cp_ref(&input, &output, cell_id % 3, 4, 6, put);
  }
  if (put) {
    return input - ptr;
  } else {
    return output - ptr;
  }
}
コード例 #2
0
ファイル: pmch.c プロジェクト: mdasari823/srsLTE
int srslte_pmch_cp(srslte_pmch_t *q, cf_t *input, cf_t *output, uint32_t lstart_grant, bool put)
{
  uint32_t s, n, l, lp, lstart, lend, nof_refs;
  cf_t *in_ptr = input, *out_ptr = output;
  uint32_t offset = 0;

  #ifdef DEBUG_IDX
  indices_ptr = 0;
  if (put) {
    offset_original = output;
  } else {
    offset_original = input;
  }
  #endif
  nof_refs = 6;
  for (s = 0; s < 2; s++) {
    for (l = 0; l < SRSLTE_CP_EXT_NSYMB; l++) {
      for (n = 0; n < q->cell.nof_prb; n++) {
        // If this PRB is assigned
        if (true) {
          if (s == 0) {
            lstart = lstart_grant;
          } else {
            lstart = 0;
          }
          lend = SRSLTE_CP_EXT_NSYMB;
          lp = l + s * SRSLTE_CP_EXT_NSYMB;
          if (put) {
            out_ptr = &output[(lp * q->cell.nof_prb + n) * SRSLTE_NRE];
          } else {
            in_ptr = &input[(lp * q->cell.nof_prb + n) * SRSLTE_NRE];
          }
          // This is a symbol in a normal PRB with or without references
          if (l >= lstart && l < lend) {
            if (SRSLTE_SYMBOL_HAS_REF_MBSFN(l,s)) {
              if (l == 0 && s == 1) {
                offset = 1;
              } else {
                offset = 0;
              }
              prb_cp_ref(&in_ptr, &out_ptr, offset, nof_refs, nof_refs, put);
            } else {
              prb_cp(&in_ptr, &out_ptr, 1);
            }
          }
        }
      }
    }
  }

  int r;
  if (put) {
    r = abs((int) (input - in_ptr));
  } else {
    r = abs((int) (output - out_ptr));
  }

  return r;
}
コード例 #3
0
ファイル: pbch.c プロジェクト: SPLURGE831/libLTE
int pbch_cp(cf_t *input, cf_t *output, lte_cell_t cell, bool put) {
  int i;
  cf_t *ptr;

  if (put) {
    ptr = input;
    output += cell.nof_prb * RE_X_RB / 2 - 36;
  } else {
    ptr = output;
    input += cell.nof_prb * RE_X_RB / 2 - 36;
  }
  
  /* symbol 0 & 1 */
  for (i = 0; i < 2; i++) {
    prb_cp_ref(&input, &output, cell.id % 3, 4, 4*6, put);
    if (put) {
      output += cell.nof_prb * RE_X_RB - 2*36;
    } else {
      input += cell.nof_prb * RE_X_RB - 2*36;
    }
  }
  /* symbols 2 & 3 */
  if (CP_ISNORM(cell.cp)) {
    for (i = 0; i < 2; i++) {
      prb_cp(&input, &output, 6);
      if (put) {
        output += cell.nof_prb * RE_X_RB - 2*36;
      } else {
        input += cell.nof_prb * RE_X_RB - 2*36;
      }
    }
  } else {
    prb_cp(&input, &output, 6);
    if (put) {
      output += cell.nof_prb * RE_X_RB - 2*36;
    } else {
      input += cell.nof_prb * RE_X_RB - 2*36;
    }
    prb_cp_ref(&input, &output, cell.id % 3, 4, 4*6, put);
  }
  if (put) {
    return input - ptr;
  } else {
    return output - ptr;
  }
}
コード例 #4
0
ファイル: prb.c プロジェクト: SPLURGE831/libLTE
void prb_get_ref_(cf_t **input, cf_t **output, int offset, int nof_refs,
    int nof_intervals) {
  prb_cp_ref(input, output, offset, nof_refs, nof_intervals, true);
}
コード例 #5
0
ファイル: prb.c プロジェクト: immortaltw/libLTE
void prb_put_ref_(cf_t **input, cf_t **output, int offset, int nof_refs,
    int nof_prb) {
  prb_cp_ref(input, output, offset, nof_refs, nof_prb, false);
}
コード例 #6
0
ファイル: pdsch.c プロジェクト: sdnnfv/srsLTE
int srslte_pdsch_cp(srslte_pdsch_t *q, cf_t *input, cf_t *output, srslte_ra_dl_grant_t *grant, uint32_t lstart_grant, uint32_t nsubframe, bool put)
{
    uint32_t s, n, l, lp, lstart, lend, nof_refs;
    bool is_pbch, is_sss;
    cf_t *in_ptr = input, *out_ptr = output;
    uint32_t offset = 0;

#ifdef DEBUG_IDX
    indices_ptr = 0;
    if (put) {
        offset_original = output;
    } else {
        offset_original = input;
    }
#endif

    if (q->cell.nof_ports == 1) {
        nof_refs = 2;
    } else {
        nof_refs = 4;
    }

    for (s = 0; s < 2; s++) {
        for (l = 0; l < SRSLTE_CP_NSYMB(q->cell.cp); l++) {
            for (n = 0; n < q->cell.nof_prb; n++) {

                // If this PRB is assigned
                if (grant->prb_idx[s][n]) {
                    if (s == 0) {
                        lstart = lstart_grant;
                    } else {
                        lstart = 0;
                    }
                    lend = SRSLTE_CP_NSYMB(q->cell.cp);
                    is_pbch = is_sss = false;

                    // Skip PSS/SSS signals
                    if (s == 0 && (nsubframe == 0 || nsubframe == 5)) {
                        if (n >= q->cell.nof_prb / 2 - 3
                                && n < q->cell.nof_prb / 2 + 3 + (q->cell.nof_prb%2)) {
                            lend = SRSLTE_CP_NSYMB(q->cell.cp) - 2;
                            is_sss = true;
                        }
                    }
                    // Skip PBCH
                    if (s == 1 && nsubframe == 0) {
                        if (n >= q->cell.nof_prb / 2 - 3
                                && n < q->cell.nof_prb / 2 + 3 + (q->cell.nof_prb%2)) {
                            lstart = 4;
                            is_pbch = true;
                        }
                    }
                    lp = l + s * SRSLTE_CP_NSYMB(q->cell.cp);
                    if (put) {
                        out_ptr = &output[(lp * q->cell.nof_prb + n)
                                          * SRSLTE_NRE];
                    } else {
                        in_ptr = &input[(lp * q->cell.nof_prb + n)
                                        * SRSLTE_NRE];
                    }
                    // This is a symbol in a normal PRB with or without references
                    if (l >= lstart && l < lend) {
                        if (SRSLTE_SYMBOL_HAS_REF(l, q->cell.cp, q->cell.nof_ports)) {
                            if (nof_refs == 2) {
                                if (l == 0) {
                                    offset = q->cell.id % 6;
                                } else {
                                    offset = (q->cell.id + 3) % 6;
                                }
                            } else {
                                offset = q->cell.id % 3;
                            }
                            prb_cp_ref(&in_ptr, &out_ptr, offset, nof_refs, nof_refs, put);
                        } else {
                            prb_cp(&in_ptr, &out_ptr, 1);
                        }
                    }
                    // This is a symbol in a PRB with PBCH or Synch signals (SS).
                    // If the number or total PRB is odd, half of the the PBCH or SS will fall into the symbol
                    if ((q->cell.nof_prb % 2) && ((is_pbch && l < lstart) || (is_sss && l >= lend))) {
                        if (n == q->cell.nof_prb / 2 - 3) {
                            if (SRSLTE_SYMBOL_HAS_REF(l, q->cell.cp, q->cell.nof_ports)) {
                                prb_cp_ref(&in_ptr, &out_ptr, offset, nof_refs, nof_refs/2, put);
                            } else {
                                prb_cp_half(&in_ptr, &out_ptr, 1);
                            }
                        } else if (n == q->cell.nof_prb / 2 + 3) {
                            if (put) {
                                out_ptr += 6;
                            } else {
                                in_ptr += 6;
                            }
                            if (SRSLTE_SYMBOL_HAS_REF(l, q->cell.cp, q->cell.nof_ports)) {
                                prb_cp_ref(&in_ptr, &out_ptr, offset, nof_refs, nof_refs/2, put);
                            } else {
                                prb_cp_half(&in_ptr, &out_ptr, 1);
                            }
                        }
                    }
                }
            }
        }
    }

    int r;
    if (put) {
        r = abs((int) (input - in_ptr));
    } else {
        r = abs((int) (output - out_ptr));
    }

    return r;
}