mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.2 KiB
C
81 lines
2.2 KiB
C
11 years ago
|
/**
|
||
11 years ago
|
*
|
||
11 years ago
|
* \section COPYRIGHT
|
||
11 years ago
|
*
|
||
11 years ago
|
* 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,
|
||
11 years ago
|
* 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.
|
||
|
*
|
||
11 years ago
|
* 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/.
|
||
|
*
|
||
11 years ago
|
*/
|
||
|
|
||
11 years ago
|
|
||
11 years ago
|
#include <stdbool.h>
|
||
|
#include <string.h>
|
||
|
|
||
11 years ago
|
#include "prb.h"
|
||
11 years ago
|
#include "lte/common/base.h"
|
||
11 years ago
|
|
||
11 years ago
|
void prb_cp_ref(cf_t **input, cf_t **output, int offset, int nof_refs,
|
||
11 years ago
|
int nof_prb, bool advance_output) {
|
||
|
int i;
|
||
|
|
||
|
int ref_interval = ((RE_X_RB / nof_refs) - 1);
|
||
|
memcpy(*output, *input, offset * sizeof(cf_t));
|
||
|
*input += offset;
|
||
|
*output += offset;
|
||
|
for (i = 0; i < nof_refs * nof_prb - 1; i++) {
|
||
|
if (advance_output) {
|
||
|
(*output)++;
|
||
|
} else {
|
||
|
(*input)++;
|
||
|
}
|
||
|
memcpy(*output, *input, ref_interval * sizeof(cf_t));
|
||
|
*output += ref_interval;
|
||
|
*input += ref_interval;
|
||
|
}
|
||
|
if (ref_interval - offset > 0) {
|
||
|
if (advance_output) {
|
||
|
(*output)++;
|
||
|
} else {
|
||
|
(*input)++;
|
||
|
}
|
||
|
memcpy(*output, *input, (ref_interval - offset) * sizeof(cf_t));
|
||
|
*output += (ref_interval - offset);
|
||
|
*input += (ref_interval - offset);
|
||
|
}
|
||
|
}
|
||
|
|
||
11 years ago
|
void prb_cp(cf_t **input, cf_t **output, int nof_prb) {
|
||
11 years ago
|
memcpy(*output, *input, sizeof(cf_t) * RE_X_RB * nof_prb);
|
||
|
*input += nof_prb * RE_X_RB;
|
||
|
*output += nof_prb * RE_X_RB;
|
||
|
}
|
||
|
|
||
11 years ago
|
void prb_put_ref_(cf_t **input, cf_t **output, int offset, int nof_refs,
|
||
11 years ago
|
int nof_prb) {
|
||
11 years ago
|
prb_cp_ref(input, output, offset, nof_refs, nof_prb, false);
|
||
11 years ago
|
}
|
||
|
|
||
11 years ago
|
void prb_get_ref_(cf_t **input, cf_t **output, int offset, int nof_refs,
|
||
11 years ago
|
int nof_prb) {
|
||
11 years ago
|
prb_cp_ref(input, output, offset, nof_refs, nof_prb, true);
|
||
11 years ago
|
}
|
||
|
|