Working on UE c++ itf
This commit is contained in:
parent
a9d5e72ac5
commit
5588791695
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
@ -48,4 +48,5 @@ ADD_SUBDIRECTORY(lib)
|
|||
ADD_SUBDIRECTORY(examples)
|
||||
|
||||
|
||||
add_subdirectory(tutorial_examples)
|
||||
add_subdirectory(tutorial_examples)
|
||||
add_subdirectory(itf)
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -145,7 +145,7 @@ int main(int argc, char **argv) {
|
|||
uint32_t nof_trials = 0;
|
||||
uint32_t sfn = 0; // system frame number
|
||||
int n;
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
uint32_t sfn_offset;
|
||||
float rssi_utra=0,rssi=0, rsrp=0, rsrq=0, snr=0;
|
||||
cf_t *ce[SRSLTE_MAX_PORTS];
|
||||
|
|
|
@ -53,7 +53,7 @@ int cuhd_recv_wrapper_cs(void *h, void *data, uint32_t nsamples, srslte_timestam
|
|||
int cuhd_mib_decoder(void *uhd, uint32_t max_nof_frames, srslte_cell_t *cell) {
|
||||
int ret = SRSLTE_ERROR;
|
||||
srslte_ue_mib_sync_t ue_mib;
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
|
||||
if (srslte_ue_mib_sync_init(&ue_mib, cell->id, cell->cp, cuhd_recv_wrapper_cs, uhd)) {
|
||||
fprintf(stderr, "Error initiating srslte_ue_mib_sync\n");
|
||||
|
|
|
@ -441,7 +441,7 @@ int main(int argc, char **argv) {
|
|||
cf_t pss_signal[SRSLTE_PSS_LEN];
|
||||
float sss_signal0[SRSLTE_SSS_LEN]; // for subframe 0
|
||||
float sss_signal5[SRSLTE_SSS_LEN]; // for subframe 5
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
int i;
|
||||
cf_t *sf_symbols[SRSLTE_MAX_PORTS];
|
||||
cf_t *slot1_symbols[SRSLTE_MAX_PORTS];
|
||||
|
|
|
@ -235,7 +235,7 @@ int main(int argc, char **argv) {
|
|||
#endif
|
||||
uint32_t nof_trials = 0;
|
||||
int n;
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
uint32_t sfn_offset;
|
||||
|
||||
parse_args(&prog_args, argc, argv);
|
||||
|
|
|
@ -295,7 +295,7 @@ int main(int argc, char **argv) {
|
|||
srslte_ue_mib_t ue_mib;
|
||||
void *uhd;
|
||||
int n;
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
uint32_t sfn_offset;
|
||||
rar_msg_t rar_msg;
|
||||
srslte_ra_pusch_t ra_pusch;
|
||||
|
@ -382,7 +382,7 @@ int main(int argc, char **argv) {
|
|||
perror("maloc");
|
||||
exit(-1);
|
||||
}
|
||||
if(srslte_prach_gen(&prach, prog_args.preamble_idx, 0, prog_args.beta_prach, prach_buffer)){
|
||||
if(srslte_prach_gen(&prach, prog_args.preamble_idx, 0, prach_buffer)){
|
||||
fprintf(stderr, "Error generating prach sequence\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ int main(int argc, char **argv) {
|
|||
bzero(&drms_cfg, sizeof(srslte_refsignal_drms_pusch_cfg_t));
|
||||
drms_cfg.beta_pusch = 1.0;
|
||||
drms_cfg.group_hopping_en = false;
|
||||
drms_cfg.srslte_sequence_hopping_en = false;
|
||||
drms_cfg.sequence_hopping_en = false;
|
||||
drms_cfg.delta_ss = 0;
|
||||
drms_cfg.cyclic_shift = 0;
|
||||
drms_cfg.cyclic_shift_for_drms = 0;
|
||||
|
@ -555,7 +555,7 @@ int main(int argc, char **argv) {
|
|||
ra_pusch.rv_idx = rv[i];
|
||||
ul_sf_idx = (srslte_ue_sync_get_sfidx(&ue_sync)+6+i*8)%10;
|
||||
|
||||
n = srslte_ue_ul_srslte_pusch_encode_rnti(&ue_ul, &ra_pusch, data, ul_sf_idx, rar_msg.temp_c_rnti, ul_signal);
|
||||
n = srslte_ue_ul_pusch_encode_rnti(&ue_ul, &ra_pusch, data, ul_sf_idx, rar_msg.temp_c_rnti, ul_signal);
|
||||
if (n < 0) {
|
||||
fprintf(stderr, "Error encoding PUSCH\n");
|
||||
exit(-1);
|
||||
|
@ -604,7 +604,7 @@ int main(int argc, char **argv) {
|
|||
printf("L: %d\n", ra_pusch.prb_alloc.L_prb);
|
||||
// srslte_ue_ul_set_cfo(&ue_ul, srslte_sync_get_cfo(&ue_sync.strack));
|
||||
srslte_bit_pack_vector((uint8_t*) conn_request_msg, data, ra_pusch.mcs.tbs);
|
||||
n = srslte_ue_ul_srslte_pusch_encode_rnti(&ue_ul, &ra_pusch, data, ul_sf_idx, 111, ul_signal);
|
||||
n = srslte_ue_ul_pusch_encode_rnti(&ue_ul, &ra_pusch, data, ul_sf_idx, 111, ul_signal);
|
||||
if (n < 0) {
|
||||
fprintf(stderr, "Error encoding PUSCH\n");
|
||||
exit(-1);
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef struct SRSLTE_API {
|
|||
bool en_drms_2;
|
||||
float beta_pusch;
|
||||
bool group_hopping_en;
|
||||
bool srslte_sequence_hopping_en;
|
||||
bool sequence_hopping_en;
|
||||
}srslte_refsignal_drms_pusch_cfg_t;
|
||||
|
||||
typedef struct SRSLTE_API {
|
||||
|
|
|
@ -41,12 +41,9 @@
|
|||
#include "srslte/fec/viterbi.h"
|
||||
#include "srslte/fec/crc.h"
|
||||
|
||||
#define BCH_PAYLOAD_LEN 24
|
||||
#define BCH_PAYLOADCRC_LEN (BCH_PAYLOAD_LEN+16)
|
||||
#define BCH_ENCODED_LEN 3*(BCH_PAYLOADCRC_LEN)
|
||||
|
||||
#define PBCH_RE_SRSLTE_SRSLTE_CP_NORM 240
|
||||
#define PBCH_RE_SRSLTE_SRSLTE_CP_EXT 216
|
||||
#define SRSLTE_BCH_PAYLOAD_LEN 24
|
||||
#define SRSLTE_BCH_PAYLOADCRC_LEN (SRSLTE_BCH_PAYLOAD_LEN+16)
|
||||
#define SRSLTE_BCH_ENCODED_LEN 3*(SRSLTE_BCH_PAYLOADCRC_LEN)
|
||||
|
||||
/* PBCH object */
|
||||
typedef struct SRSLTE_API {
|
||||
|
@ -61,10 +58,10 @@ typedef struct SRSLTE_API {
|
|||
cf_t *d;
|
||||
float *llr;
|
||||
float *temp;
|
||||
float rm_f[BCH_ENCODED_LEN];
|
||||
float rm_f[SRSLTE_BCH_ENCODED_LEN];
|
||||
uint8_t *rm_b;
|
||||
uint8_t data[BCH_PAYLOADCRC_LEN];
|
||||
uint8_t data_enc[BCH_ENCODED_LEN];
|
||||
uint8_t data[SRSLTE_BCH_PAYLOADCRC_LEN];
|
||||
uint8_t data_enc[SRSLTE_BCH_ENCODED_LEN];
|
||||
|
||||
uint32_t frame_idx;
|
||||
|
||||
|
@ -87,12 +84,12 @@ SRSLTE_API int srslte_pbch_decode(srslte_pbch_t *q,
|
|||
cf_t *slot1_symbols,
|
||||
cf_t *ce_slot1[SRSLTE_MAX_PORTS],
|
||||
float noise_estimate,
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN],
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
||||
uint32_t *nof_tx_ports,
|
||||
uint32_t *sfn_offset);
|
||||
|
||||
SRSLTE_API int srslte_pbch_encode(srslte_pbch_t *q,
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN],
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
||||
cf_t *slot1_symbols[SRSLTE_MAX_PORTS]);
|
||||
|
||||
SRSLTE_API void srslte_pbch_decode_reset(srslte_pbch_t *q);
|
||||
|
|
|
@ -79,9 +79,25 @@ typedef struct SRSLTE_API {
|
|||
srslte_dft_plan_t *zc_fft;
|
||||
srslte_dft_plan_t *zc_ifft;
|
||||
|
||||
|
||||
} srslte_prach_t;
|
||||
|
||||
typedef struct SRSLTE_API {
|
||||
int nof_sf;
|
||||
uint32_t sf[5];
|
||||
} srslte_prach_sf_config_t;
|
||||
|
||||
typedef enum SRSLTE_API {
|
||||
SRSLTE_PRACH_SFN_EVEN = 0,
|
||||
SRSLTE_PRACH_SFN_ANY,
|
||||
} srslte_prach_sfn_t;
|
||||
|
||||
SRSLTE_API uint32_t srslte_prach_get_preamble_format(uint32_t config_idx);
|
||||
|
||||
SRSLTE_API srslte_prach_sfn_t srslte_prach_get_sfn(uint32_t config_idx);
|
||||
|
||||
SRSLTE_API void srslte_prach_sf_config(uint32_t config_idx,
|
||||
srslte_prach_sf_config_t *sf_config);
|
||||
|
||||
SRSLTE_API int srslte_prach_init(srslte_prach_t *p,
|
||||
uint32_t N_ifft_ul,
|
||||
uint32_t preamble_format,
|
||||
|
@ -92,7 +108,6 @@ SRSLTE_API int srslte_prach_init(srslte_prach_t *p,
|
|||
SRSLTE_API int srslte_prach_gen(srslte_prach_t *p,
|
||||
uint32_t seq_index,
|
||||
uint32_t freq_offset,
|
||||
float beta_prach,
|
||||
cf_t *signal);
|
||||
|
||||
SRSLTE_API int srslte_prach_detect(srslte_prach_t *p,
|
||||
|
|
|
@ -93,7 +93,6 @@ typedef struct SRSLTE_API {
|
|||
} srslte_ra_ul_alloc_t;
|
||||
|
||||
typedef struct SRSLTE_API {
|
||||
uint16_t rnti;
|
||||
srslte_ra_type_t alloc_type;
|
||||
union {
|
||||
srslte_ra_type0_t type0_alloc;
|
||||
|
|
|
@ -48,13 +48,13 @@ typedef struct SRSLTE_API {
|
|||
typedef struct SRSLTE_API {
|
||||
uint8_t *uci_cqi;
|
||||
uint32_t uci_cqi_len;
|
||||
float beta_cqi;
|
||||
uint8_t uci_ri; // Only 1-bit supported for RI
|
||||
uint32_t I_offset_cqi;
|
||||
uint8_t uci_ri; // Only 1-bit supported for RI
|
||||
uint32_t uci_ri_len;
|
||||
float beta_ri;
|
||||
uint8_t uci_ack; // Only 1-bit supported for HARQ
|
||||
uint32_t I_offset_ri;
|
||||
uint8_t uci_ack; // Only 1-bit supported for HARQ
|
||||
uint32_t uci_ack_len;
|
||||
float beta_ack;
|
||||
uint32_t I_offset_ack;
|
||||
} srslte_uci_data_t;
|
||||
|
||||
SRSLTE_API int srslte_uci_cqi_init(srslte_uci_cqi_pusch_t *q);
|
||||
|
|
|
@ -105,6 +105,12 @@ SRSLTE_API int srslte_ue_dl_find_ul_dci(srslte_ue_dl_t *q,
|
|||
uint32_t sf_idx,
|
||||
uint16_t rnti);
|
||||
|
||||
SRSLTE_API int srslte_ue_dl_find_dl_dci(srslte_ue_dl_t *q,
|
||||
srslte_dci_msg_t *dci_msg,
|
||||
uint32_t cfi,
|
||||
uint32_t sf_idx,
|
||||
uint16_t rnti);
|
||||
|
||||
SRSLTE_API int srslte_ue_dl_decode(srslte_ue_dl_t * q,
|
||||
cf_t *input,
|
||||
uint8_t *data,
|
||||
|
|
|
@ -72,7 +72,7 @@ typedef struct SRSLTE_API {
|
|||
srslte_chest_dl_t chest;
|
||||
srslte_pbch_t pbch;
|
||||
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
uint32_t nof_tx_ports;
|
||||
uint32_t sfn_offset;
|
||||
|
||||
|
@ -88,7 +88,7 @@ SRSLTE_API void srslte_ue_mib_reset(srslte_ue_mib_t * q);
|
|||
|
||||
SRSLTE_API int srslte_ue_mib_decode(srslte_ue_mib_t * q,
|
||||
cf_t *input,
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN],
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
||||
uint32_t *nof_tx_ports,
|
||||
uint32_t *sfn_offset);
|
||||
|
||||
|
@ -113,7 +113,7 @@ SRSLTE_API void srslte_ue_mib_sync_reset(srslte_ue_mib_sync_t * q);
|
|||
|
||||
SRSLTE_API int srslte_ue_mib_sync_decode(srslte_ue_mib_sync_t * q,
|
||||
uint32_t max_frames_timeout,
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN],
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
||||
uint32_t *nof_tx_ports,
|
||||
uint32_t *sfn_offset);
|
||||
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2014 The srsLTE Developers. See the
|
||||
* COPYRIGHT file at the top-level directory of this distribution.
|
||||
*
|
||||
* \section LICENSE
|
||||
*
|
||||
* This file is part of the srsLTE library.
|
||||
*
|
||||
* srsLTE 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.
|
||||
*
|
||||
* srsLTE 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 "srslte/srslte.h"
|
||||
#include "srslte/utils/queue.h"
|
||||
|
||||
#ifndef UEPHY_H
|
||||
#define UEPHY_H
|
||||
|
||||
#define SYNC_MODE_CV 0
|
||||
#define SYNC_MODE_CALLBACK 1
|
||||
#define SYNC_MODE SYNC_MODE_CV
|
||||
|
||||
namespace srslte {
|
||||
|
||||
typedef _Complex float cf_t;
|
||||
|
||||
class ue_phy
|
||||
{
|
||||
public:
|
||||
|
||||
typedef enum {DOWNLINK, UPLINK} direction_t;
|
||||
|
||||
typedef enum {
|
||||
PDCCH_UL_SEARCH_CRNTI = 0,
|
||||
PDCCH_UL_SEARCH_RA_PROC,
|
||||
PDCCH_UL_SEARCH_SPS,
|
||||
PDCCH_UL_SEARCH_TEMPORAL,
|
||||
PDCCH_UL_SEARCH_TPC_PUSCH,
|
||||
PDCCH_UL_SEARCH_TPC_PUCCH
|
||||
} pdcch_ul_search_t;
|
||||
|
||||
typedef enum {
|
||||
PDCCH_DL_SEARCH_CRNTI = 0,
|
||||
PDCCH_DL_SEARCH_SIRNTI,
|
||||
PDCCH_DL_SEARCH_PRNTI,
|
||||
PDCCH_DL_SEARCH_RARNTI,
|
||||
PDCCH_DL_SEARCH_TEMPORAL,
|
||||
PDCCH_DL_SEARCH_SPS
|
||||
} pdcch_dl_search_t;
|
||||
|
||||
/* Uplink/Downlink scheduling grant generated by a successfully decoded PDCCH */
|
||||
class sched_grant {
|
||||
public:
|
||||
uint16_t get_rnti();
|
||||
uint32_t get_rv();
|
||||
void set_rv(uint32_t rv);
|
||||
bool get_ndi();
|
||||
bool get_cqi_request();
|
||||
uint32_t get_harq_process();
|
||||
private:
|
||||
union {
|
||||
srslte_ra_pusch_t ul_grant;
|
||||
srslte_ra_pdsch_t dl_grant;
|
||||
};
|
||||
direction_t dir;
|
||||
};
|
||||
|
||||
|
||||
/* Uplink scheduling assignment. The MAC instructs the PHY to prepare an UL packet (PUSCH or PUCCH)
|
||||
* for transmission. The MAC must call generate_pusch() to set the packet ready for transmission
|
||||
*/
|
||||
class ul_buffer : public queue::element {
|
||||
public:
|
||||
ul_buffer(srslte_cell_t cell);
|
||||
void generate_pusch(sched_grant pusch_grant, uint8_t *payload, srslte_uci_data_t uci_data);
|
||||
void generate_pucch(srslte_uci_data_t uci_data);
|
||||
private:
|
||||
srslte_ue_ul_t ue_ul;
|
||||
bool signal_generated = false;
|
||||
cf_t* signal_buffer = NULL;
|
||||
uint32_t tti = 0;
|
||||
};
|
||||
|
||||
/* Class for the processing of Downlink buffers. The MAC obtains a buffer for a given TTI and then
|
||||
* gets ul/dl scheduling grants and/or processes phich/pdsch channels
|
||||
*/
|
||||
class dl_buffer : public queue::element {
|
||||
public:
|
||||
dl_buffer(srslte_cell_t cell);
|
||||
sched_grant get_ul_grant(pdcch_ul_search_t mode, uint32_t rnti);
|
||||
sched_grant get_dl_grant(pdcch_dl_search_t mode, uint32_t rnti);
|
||||
bool decode_phich(srslte_phich_alloc_t assignment);
|
||||
bool decode_pdsch(sched_grant pdsch_grant, uint8_t *payload); // returns true or false for CRC OK/KO
|
||||
private:
|
||||
srslte_ue_dl_t ue_dl;
|
||||
srslte_phich_t phich;
|
||||
cf_t *signal_buffer = NULL;
|
||||
bool sf_symbols_and_ce_done = false;
|
||||
bool pdcch_llr_extracted = false;
|
||||
uint32_t tti = 0;
|
||||
};
|
||||
|
||||
|
||||
#if SYNC_MODE==SYNC_MODE_CALLBACK
|
||||
typedef (*ue_phy_tti_clock_fcn_t) (void);
|
||||
ue_phy(ue_phy_tti_clock_fcn_t tti_clock_callback);
|
||||
#else
|
||||
ue_phy();
|
||||
#endif
|
||||
~ue_phy();
|
||||
|
||||
void measure(); // TBD
|
||||
void dl_bch();
|
||||
void start_rxtx();
|
||||
void stop_rxtx();
|
||||
void init_prach();
|
||||
void send_prach(/* prach_cfg_t in prach.h with power, seq idx, etc */);
|
||||
void set_param();
|
||||
|
||||
uint32_t get_tti();
|
||||
#if SYNC_MODE==SYNC_MODE_CV
|
||||
std::condition_variable tti_cv;
|
||||
std::mutex tti_mutex;
|
||||
#endif
|
||||
|
||||
ul_buffer get_ul_buffer(uint32_t tti);
|
||||
dl_buffer get_dl_buffer(uint32_t tti);
|
||||
|
||||
private:
|
||||
enum {
|
||||
IDLE, MEASURE, RX_BCH, RXTX
|
||||
} phy_state;
|
||||
|
||||
bool prach_initiated = false;
|
||||
bool prach_ready_to_send = false;
|
||||
srslte_prach_t prach;
|
||||
|
||||
queue ul_buffer_queue;
|
||||
queue dl_buffer_queue;
|
||||
|
||||
pthread_t radio_thread;
|
||||
void *radio_handler;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
|
@ -86,33 +86,33 @@ SRSLTE_API void srslte_ue_ul_set_pusch_cfg(srslte_ue_ul_t *q,
|
|||
srslte_refsignal_drms_pusch_cfg_t *drms_cfg,
|
||||
srslte_pusch_hopping_cfg_t *pusch_hopping_cfg);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_srslte_pusch_encode(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
uint32_t sf_idx,
|
||||
cf_t *output_signal);
|
||||
SRSLTE_API int srslte_ue_ul_pusch_encode(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
uint32_t sf_idx,
|
||||
cf_t *output_signal);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_srslte_pusch_encode_rnti(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
uint32_t sf_idx,
|
||||
uint16_t rnti,
|
||||
cf_t *output_signal);
|
||||
SRSLTE_API int srslte_ue_ul_pusch_encode_rnti(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
uint32_t sf_idx,
|
||||
uint16_t rnti,
|
||||
cf_t *output_signal);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_srslte_pusch_uci_encode(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
srslte_uci_data_t uci_data,
|
||||
uint32_t sf_idx,
|
||||
cf_t *output_signal);
|
||||
SRSLTE_API int srslte_ue_ul_pusch_uci_encode(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
srslte_uci_data_t uci_data,
|
||||
uint32_t sf_idx,
|
||||
cf_t *output_signal);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_srslte_pusch_uci_encode_rnti(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
srslte_uci_data_t uci_data,
|
||||
uint32_t sf_idx,
|
||||
uint16_t rnti,
|
||||
cf_t *output_signal);
|
||||
SRSLTE_API int srslte_ue_ul_pusch_uci_encode_rnti(srslte_ue_ul_t *q,
|
||||
srslte_ra_pusch_t *ra_ul,
|
||||
uint8_t *data,
|
||||
srslte_uci_data_t uci_data,
|
||||
uint32_t sf_idx,
|
||||
uint16_t rnti,
|
||||
cf_t *output_signal);
|
||||
|
||||
SRSLTE_API void srslte_ue_ul_reset(srslte_ue_ul_t *q);
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# srsLTE 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.
|
||||
#
|
||||
# srsLTE 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/.
|
||||
#
|
||||
|
||||
|
||||
ADD_LIBRARY(srslte++ SHARED ue_phy.cc)
|
||||
TARGET_LINK_LIBRARIES(srslte++ srslte m ${FFTW3F_LIBRARIES})
|
||||
INSTALL(TARGETS srslte++ DESTINATION ${LIBRARY_DIR})
|
||||
LIBLTE_SET_PIC(srslte++)
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2014 The srsLTE Developers. See the
|
||||
* COPYRIGHT file at the top-level directory of this distribution.
|
||||
*
|
||||
* \section LICENSE
|
||||
*
|
||||
* This file is part of the srsLTE library.
|
||||
*
|
||||
* srsLTE 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.
|
||||
*
|
||||
* srsLTE 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 <stdlib.h>
|
||||
#include "queue.h"
|
||||
|
||||
srslte::queue::queue(uint32_t nof_elements, uint32_t element_size)
|
||||
{
|
||||
buffer_of_elements = (queue::element**) malloc(sizeof(queue::element*) * nof_elements);
|
||||
for (int i=0;i<nof_elements;i++) {
|
||||
buffer_of_elements[i] = (queue::element*) malloc(element_size);
|
||||
}
|
||||
}
|
||||
|
||||
srslte::queue::~queue()
|
||||
{
|
||||
for (int i=0;i<nof_elements;i++) {
|
||||
free(buffer_of_elements[i]);
|
||||
}
|
||||
free(buffer_of_elements);
|
||||
}
|
||||
|
||||
srslte::queue::element* srslte::queue::get(uint32_t idx)
|
||||
{
|
||||
return (queue::element*) buffer_of_elements[idx%nof_elements];
|
||||
}
|
|
@ -67,17 +67,17 @@ public:
|
|||
enum {
|
||||
RELEASED, READY
|
||||
} state;
|
||||
}
|
||||
};
|
||||
|
||||
queue(uint32_t nof_elements, uint32_t element_size);
|
||||
~queue();
|
||||
|
||||
element* get(uint32_t idx);
|
||||
|
||||
|
||||
private:
|
||||
uint32_t nof_elements;
|
||||
uint32_t element_size;
|
||||
void **buffer_of_elements;
|
||||
element* *buffer_of_elements;
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,577 @@
|
|||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2014 The srsLTE Developers. See the
|
||||
* COPYRIGHT file at the top-level directory of this distribution.
|
||||
*
|
||||
* \section LICENSE
|
||||
*
|
||||
* This file is part of the srsLTE library.
|
||||
*
|
||||
* srsLTE 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.
|
||||
*
|
||||
* srsLTE 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 <string.h>
|
||||
#include <strings.h>
|
||||
#include <pthread.h>
|
||||
#include "srslte/srslte.h"
|
||||
#include "ue_phy.h"
|
||||
|
||||
|
||||
/*
|
||||
* CLASS SCHED_GRANT
|
||||
*
|
||||
*/
|
||||
|
||||
/* Returns the RNTI associated with the UL/DL scheduling grant */
|
||||
uint16_t srslte::ue_phy::sched_grant::get_rnti() {
|
||||
return rnti;
|
||||
}
|
||||
|
||||
uint32_t srslte::ue_phy::sched_grant::get_rv() {
|
||||
if (dir == UPLINK) {
|
||||
return ul_grant.rv_idx;
|
||||
} else {
|
||||
return dl_grant.rv_idx;
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::sched_grant::set_rv(uint32_t rv) {
|
||||
if (dir == UPLINK) {
|
||||
ul_grant.rv_idx = rv;
|
||||
} else {
|
||||
dl_grant.rv_idx = rv;
|
||||
}
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::sched_grant::get_ndi() {
|
||||
if (dir == UPLINK) {
|
||||
return ul_grant.ndi;
|
||||
} else {
|
||||
return dl_grant.ndi;
|
||||
}
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::sched_grant::get_cqi_request() {
|
||||
if (dir == UPLINK) {
|
||||
return ul_grant.ndi;
|
||||
} else {
|
||||
return dl_grant.ndi;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t srslte::ue_phy::sched_grant::get_current_tti() {
|
||||
return current_tti;
|
||||
}
|
||||
|
||||
int srslte::ue_phy::sched_grant::get_harq_process() {
|
||||
if (dir == UPLINK) {
|
||||
return -1;
|
||||
} else {
|
||||
return dl_grant.harq_process;
|
||||
}
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::sched_grant::is_uplink() {
|
||||
return dir == UPLINK;
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::sched_grant::is_downlink() {
|
||||
return dir == DOWNLINK;
|
||||
}
|
||||
void* srslte::ue_phy::sched_grant::get_grant_ptr() {
|
||||
if (is_uplink()) {
|
||||
return (void*) &ul_grant;
|
||||
} else {
|
||||
return (void*) &dl_grant;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CLASS UL_BUFFER
|
||||
*
|
||||
*/
|
||||
bool srslte::ue_phy::ul_buffer::init_cell(srslte_cell_t cell_, int64_t *params_db_) {
|
||||
cell = cell_;
|
||||
params_db = params_db_;
|
||||
signal_generated = false;
|
||||
current_tx_nb = 0;
|
||||
if (!srslte_ue_ul_init(&ue_ul, cell)) {
|
||||
signal_buffer = (cf_t*) srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
||||
return signal_buffer?true:false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::ul_buffer::free_cell() {
|
||||
if (signal_buffer) {
|
||||
free(signal_buffer);
|
||||
}
|
||||
srslte_ue_ul_free(&ue_ul);
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::ul_buffer::generate_pusch(sched_grant pusch_grant,
|
||||
uint8_t *payload,
|
||||
srslte_uci_data_t uci_data)
|
||||
{
|
||||
if (pusch_grant.is_uplink()) {
|
||||
fprintf(stderr, "Invalid scheduling grant. Grant is for Downlink\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
srslte_refsignal_drms_pusch_cfg_t drms_cfg;
|
||||
bzero(&drms_cfg, sizeof(srslte_refsignal_drms_pusch_cfg_t));
|
||||
|
||||
drms_cfg.beta_pusch = params_db[PARAM_PUSCH_BETA];
|
||||
drms_cfg.group_hopping_en = params_db[PARAM_PUSCH_RS_GROUP_HOPPING_EN];
|
||||
drms_cfg.sequence_hopping_en = params_db[PARAM_PUSCH_RS_SEQUENCE_HOPPING_EN];
|
||||
drms_cfg.cyclic_shift = params_db[PARAM_PUSCH_RS_CYCLIC_SHIFT];
|
||||
drms_cfg.delta_ss = params_db[PARAM_PUSCH_RS_GROUP_ASSIGNMENT];
|
||||
|
||||
srslte_pusch_hopping_cfg_t pusch_hopping;
|
||||
pusch_hopping.n_sb = params_db[PARAM_PUSCH_HOPPING_N_SB];
|
||||
pusch_hopping.hop_mode = params_db[PARAM_PUSCH_HOPPING_INTRA_SF] ?
|
||||
pusch_hopping.SRSLTE_PUSCH_HOP_MODE_INTRA_SF :
|
||||
pusch_hopping.SRSLTE_PUSCH_HOP_MODE_INTER_SF;
|
||||
pusch_hopping.hopping_offset = params_db[PARAM_PUSCH_HOPPING_OFFSET];
|
||||
pusch_hopping.current_tx_nb = current_tx_nb;
|
||||
|
||||
srslte_ue_ul_set_pusch_cfg(&ue_ul, &drms_cfg, &pusch_hopping);
|
||||
|
||||
int n = srslte_ue_ul_pusch_uci_encode_rnti(&ue_ul, (srslte_ra_pusch_t*) pusch_grant.get_grant_ptr(),
|
||||
payload, uci_data,
|
||||
tti%10, pusch_grant.get_rnti(),
|
||||
signal_buffer);
|
||||
if (n < 0) {
|
||||
fprintf(stderr, "Error encoding PUSCH\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
signal_generated = true;
|
||||
|
||||
/* This is done by the transmission thread
|
||||
srslte_vec_sc_prod_cfc(signal_buffer, beta_pusch, signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
||||
float time_adv_sec = TA_OFFSET + ((float) n_ta)*LTE_TS;
|
||||
srslte_timestamp_t next_tx_time;
|
||||
srslte_timestamp_copy(&next_tx_time, &last_rx_time);
|
||||
srslte_timestamp_add(&next_tx_time, 0, 0.003 - time_adv_sec);
|
||||
*/
|
||||
// Send through radio
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::ul_buffer::generate_pucch(srslte_uci_data_t uci_data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* CLASS DL_BUFFER
|
||||
*
|
||||
*/
|
||||
bool srslte::ue_phy::dl_buffer::init_cell(srslte_cell_t cell_, int64_t *params_db_)
|
||||
{
|
||||
params_db = params_db_;
|
||||
cell = cell_;
|
||||
sf_symbols_and_ce_done = false;
|
||||
pdcch_llr_extracted = false;
|
||||
tti = 0;
|
||||
if (srslte_ue_dl_init(&ue_dl, cell)) {
|
||||
signal_buffer = (cf_t*) srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
||||
return signal_buffer?true:false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::dl_buffer::free_cell()
|
||||
{
|
||||
if (signal_buffer) {
|
||||
free(signal_buffer);
|
||||
}
|
||||
srslte_ue_dl_free(&ue_dl);
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::dl_buffer::get_ul_grant(pdcch_ul_search_t mode, uint32_t rnti, ue_phy::sched_grant *grant)
|
||||
{
|
||||
if (!sf_symbols_and_ce_done) {
|
||||
if (srslte_ue_dl_decode_fft_estimate(&ue_dl, signal_buffer, tti%10, &cfi) < 0) {
|
||||
return false;
|
||||
}
|
||||
sf_symbols_and_ce_done = true;
|
||||
}
|
||||
if (!pdcch_llr_extracted) {
|
||||
if (srslte_pdcch_extract_llr(&ue_dl.pdcch, ue_dl.sf_symbols, ue_dl.ce, 0, tti%10, cfi)) {
|
||||
return false;
|
||||
}
|
||||
pdcch_llr_extracted = true;
|
||||
}
|
||||
|
||||
srslte_dci_msg_t dci_msg;
|
||||
if (srslte_ue_dl_find_ul_dci(&ue_dl, &dci_msg, cfi, tti%10, rnti)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (srslte_dci_msg_to_ra_ul(&dci_msg, cell.nof_prb,
|
||||
params_db[PARAM_PUSCH_HOPPING_OFFSET],
|
||||
(srslte_ra_pusch_t*) grant->get_grant_ptr()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::dl_buffer::get_dl_grant(pdcch_dl_search_t mode, uint32_t rnti, ue_phy::sched_grant *grant)
|
||||
{
|
||||
if (!sf_symbols_and_ce_done) {
|
||||
if (srslte_ue_dl_decode_fft_estimate(&ue_dl, signal_buffer, tti%10, &cfi) < 0) {
|
||||
return false;
|
||||
}
|
||||
sf_symbols_and_ce_done = true;
|
||||
}
|
||||
if (!pdcch_llr_extracted) {
|
||||
if (srslte_pdcch_extract_llr(&ue_dl.pdcch, ue_dl.sf_symbols, ue_dl.ce, 0, tti%10, cfi)) {
|
||||
return false;
|
||||
}
|
||||
pdcch_llr_extracted = true;
|
||||
}
|
||||
|
||||
srslte_dci_msg_t dci_msg;
|
||||
if (srslte_ue_dl_find_dl_dci(&ue_dl, &dci_msg, cfi, tti%10, rnti)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (srslte_dci_msg_to_ra_dl(&dci_msg, rnti, cell, cfi,
|
||||
(srslte_ra_pdsch_t*) grant->get_grant_ptr()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::dl_buffer::decode_phich(srslte_phich_alloc_t assignment)
|
||||
{
|
||||
if (!sf_symbols_and_ce_done) {
|
||||
if (srslte_ue_dl_decode_fft_estimate(&ue_dl, signal_buffer, tti%10, &cfi) < 0) {
|
||||
return false;
|
||||
}
|
||||
sf_symbols_and_ce_done = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::dl_buffer::decode_pdsch(sched_grant pdsch_grant, uint8_t *payload)
|
||||
{
|
||||
if (!sf_symbols_and_ce_done) {
|
||||
if (srslte_ue_dl_decode_fft_estimate(&ue_dl, signal_buffer, tti%10, &cfi) < 0) {
|
||||
return false;
|
||||
}
|
||||
sf_symbols_and_ce_done = true;
|
||||
}
|
||||
srslte_ra_pdsch_t *ra_dl = (srslte_ra_pdsch_t*) pdsch_grant.get_grant_ptr();
|
||||
if (srslte_harq_setup_dl(&ue_dl.harq_process[0], ra_dl->mcs,
|
||||
pdsch_grant.get_rv(), tti%10, &ra_dl->prb_alloc)) {
|
||||
fprintf(stderr, "Error configuring HARQ process\n");
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
if (ue_dl.harq_process[0].mcs.mod > 0 && ue_dl.harq_process[0].mcs.tbs >= 0) {
|
||||
int ret = srslte_pdsch_decode_rnti(&ue_dl.pdsch, &ue_dl.harq_process[0], ue_dl.sf_symbols,
|
||||
ue_dl.ce, 0, pdsch_grant.get_rnti(), payload);
|
||||
if (ret == SRSLTE_SUCCESS) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CLASS UE_PHY
|
||||
*
|
||||
*/
|
||||
#if SYNC_MODE==SYNC_MODE_CALLBACK
|
||||
srslte::ue_phy::ue_phy(ue_phy_callback_t tti_clock_callback_, ue_phy_callback_t status_change_)
|
||||
{
|
||||
tti_clock_callback = tti_clock_callback_;
|
||||
status_change = status_change_;
|
||||
ul_buffer_queue = new queue(6, sizeof(ul_buffer));
|
||||
dl_buffer_queue = new queue(6, sizeof(dl_buffer));
|
||||
|
||||
started = true;
|
||||
|
||||
pthread_create(&radio_thread, NULL, radio_thread_fnc, this);
|
||||
}
|
||||
|
||||
#else
|
||||
srslte::ue_phy::ue_phy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
srslte::ue_phy::~ue_phy()
|
||||
{
|
||||
started = false;
|
||||
|
||||
pthread_join(radio_thread, NULL);
|
||||
|
||||
delete ul_buffer_queue;
|
||||
delete dl_buffer_queue;
|
||||
|
||||
if (prach_initiated) {
|
||||
for (uint32_t i=0;i<64;i++) {
|
||||
if (prach_buffer[i]) {
|
||||
free(prach_buffer[i]);
|
||||
}
|
||||
}
|
||||
srslte_prach_free(&prach);
|
||||
}
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::init_prach()
|
||||
{
|
||||
|
||||
if (srslte_prach_init(&prach, srslte_symbol_sz(cell.nof_prb),
|
||||
srslte_prach_get_preamble_format(params_db[PARAMS_PRACH_CONFIG_INDEX]),
|
||||
params_db[PARAMS_PRACH_ROOT_SEQ_IDX],
|
||||
params_db[PARAMS_PRACH_HIGH_SPEED_FLAG]?true:false,
|
||||
params_db[PARAMS_PRACH_ZC_CONFIG])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
prach_len = prach.N_seq + prach.N_cp;
|
||||
for (uint32_t i=0;i<64;i++) {
|
||||
prach_buffer[i] = (cf_t*) srslte_vec_malloc(prach_len*sizeof(cf_t));
|
||||
if(!prach_buffer[i]) {
|
||||
return false;
|
||||
}
|
||||
if(srslte_prach_gen(&prach, i, params_db[PARAMS_PRACH_FREQ_OFFSET], prach_buffer[i])){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
prach_initiated = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME: Add PRACH power control
|
||||
void srslte::ue_phy::send_prach(uint32_t preamble_idx)
|
||||
{
|
||||
if (prach_initiated && phy_state == RXTX) {
|
||||
prach_ready_to_send = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Do fast measurement on RSSI and/or PSS autocorrelation energy or PSR
|
||||
void srslte::ue_phy::measure()
|
||||
{
|
||||
if (phy_state == IDLE) {
|
||||
// capture and do measurement
|
||||
status_change();
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::dl_bch()
|
||||
{
|
||||
if (phy_state == IDLE) {
|
||||
phy_state = RX_BCH;
|
||||
status_change();
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::start_rxtx()
|
||||
{
|
||||
if (phy_state == MIB_DECODED) {
|
||||
// Set sampling freq to MIB PRB
|
||||
// start radio streaming
|
||||
phy_state = RXTX;
|
||||
status_change();
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::stop_rxtx()
|
||||
{
|
||||
// stop radio
|
||||
phy_state = IDLE;
|
||||
status_change();
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::status_is_idle() {
|
||||
return phy_state == IDLE;
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::status_is_rxtx() {
|
||||
return phy_state == RXTX;
|
||||
}
|
||||
|
||||
bool srslte::ue_phy::status_bch_decoded(uint8_t payload[SRSLTE_BCH_PAYLOAD_LEN])
|
||||
{
|
||||
if (phy_state == MIB_DECODED) {
|
||||
memcpy(payload, bch_payload, SRSLTE_BCH_PAYLOAD_LEN*sizeof(uint8_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void* radio_thread_fnc(void *arg) {
|
||||
srslte::ue_phy* ue_phy = (srslte::ue_phy*) arg;
|
||||
ue_phy->main_radio_loop();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int radio_recv_wrapper_cs(void*,void*,uint32_t,srslte_timestamp_t*);
|
||||
|
||||
bool srslte::ue_phy::rx_bch()
|
||||
{
|
||||
srslte_ue_cellsearch_result_t found_cells[3];
|
||||
srslte_ue_cellsearch_t cs;
|
||||
|
||||
bzero(found_cells, 3*sizeof(srslte_ue_cellsearch_result_t));
|
||||
|
||||
if (srslte_ue_cellsearch_init(&cs, radio_recv_wrapper_cs, radio_handler)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
srslte_ue_cellsearch_set_nof_frames_to_scan(&cs, params_db[PARAM_CELLSEARCH_TIMEOUT_PSS_NFRAMES]);
|
||||
srslte_ue_cellsearch_set_threshold(&cs, (float) params_db[PARAM_CELLSEARCH_CORRELATION_THRESHOLD]/10);
|
||||
|
||||
// set sampling freq 1.92 MHz
|
||||
// set frequency, gain etc
|
||||
// start radio streaming
|
||||
|
||||
/* Find a cell in the given N_id_2 or go through the 3 of them to find the strongest */
|
||||
uint32_t max_peak_cell = 0;
|
||||
int ret = SRSLTE_ERROR;
|
||||
uint32_t force_N_id_2 = params_db[PARAM_CELLSEARCH_FORCE_N_ID_2];
|
||||
if (force_N_id_2 >= 0 && force_N_id_2 < 3) {
|
||||
ret = srslte_ue_cellsearch_scan_N_id_2(&cs, force_N_id_2, &found_cells[force_N_id_2]);
|
||||
max_peak_cell = force_N_id_2;
|
||||
} else {
|
||||
ret = srslte_ue_cellsearch_scan(&cs, found_cells, &max_peak_cell);
|
||||
}
|
||||
// Stop radio
|
||||
|
||||
srslte_ue_cellsearch_free(&cs);
|
||||
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error searching cell");
|
||||
return false;
|
||||
} else if (ret == 0) {
|
||||
fprintf(stderr, "Could not find any cell in this frequency");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save result
|
||||
cell.id = found_cells[max_peak_cell].cell_id;
|
||||
cell.cp = found_cells[max_peak_cell].cp;
|
||||
|
||||
printf("Found CELL PHY_ID: %d, CP: %s PSR: %.1f AbsPower: %.1f dBm",
|
||||
cell.id, srslte_cp_string(cell.cp),
|
||||
found_cells[max_peak_cell].psr, 30+10*log10(found_cells[max_peak_cell].peak));
|
||||
|
||||
srslte_ue_mib_sync_t ue_mib;
|
||||
|
||||
if (srslte_ue_mib_sync_init(&ue_mib, cell.id, cell.cp, radio_recv_wrapper_cs, radio_handler)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t sfn, sfn_offset;
|
||||
|
||||
/* Find and decode MIB */
|
||||
|
||||
// Start RX stream again
|
||||
|
||||
ret = srslte_ue_mib_sync_decode(&ue_mib, params_db[PARAM_CELLSEARCH_TIMEOUT_MIB_NFRAMES],
|
||||
bch_payload, &cell.nof_ports, &sfn_offset);
|
||||
// Stop RX stream again
|
||||
srslte_ue_mib_sync_free(&ue_mib);
|
||||
|
||||
if (ret == 1) {
|
||||
srslte_pbch_mib_unpack(bch_payload, &cell, &sfn);
|
||||
sfn = (sfn + sfn_offset)%1024;
|
||||
current_tti = sfn*10+1;
|
||||
printf("MIB decoded: %d ports, SFN: %d, TTI: %d", cell.nof_ports, sfn, current_tti);
|
||||
return true;
|
||||
} else {
|
||||
printf("Error decoding MIB");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::run_rx_bch_state() {
|
||||
if (rx_bch()) {
|
||||
for(uint32_t i=0;i<6;i++) {
|
||||
get_ul_buffer(i)->init_cell(cell, params_db);
|
||||
get_dl_buffer(i)->init_cell(cell, params_db);
|
||||
}
|
||||
// init also ue_mib for sfn synch
|
||||
phy_state = MIB_DECODED;
|
||||
status_change();
|
||||
} else {
|
||||
phy_state = IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::run_rx_tx_state()
|
||||
{
|
||||
// if not synched -> go through mib
|
||||
// else receive sync frame on dl_frame
|
||||
// if have to send prach, send it
|
||||
// if ul ready to send send
|
||||
}
|
||||
|
||||
void srslte::ue_phy::main_radio_loop() {
|
||||
while(started) {
|
||||
switch(phy_state) {
|
||||
case IDLE:
|
||||
case MIB_DECODED:
|
||||
break;
|
||||
case RX_BCH:
|
||||
run_rx_bch_state();
|
||||
break;
|
||||
case RXTX:
|
||||
run_rx_tx_state();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void srslte::ue_phy::set_param(param_t param, int64_t value)
|
||||
{
|
||||
params_db[param] = value;
|
||||
}
|
||||
|
||||
srslte::ue_phy::ul_buffer* srslte::ue_phy::get_ul_buffer(uint32_t tti)
|
||||
{
|
||||
return (srslte::ue_phy::ul_buffer*) ul_buffer_queue->get(tti);
|
||||
}
|
||||
|
||||
srslte::ue_phy::dl_buffer* srslte::ue_phy::get_dl_buffer(uint32_t tti)
|
||||
{
|
||||
return (srslte::ue_phy::dl_buffer*) dl_buffer_queue->get(tti);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,233 @@
|
|||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2014 The srsLTE Developers. See the
|
||||
* COPYRIGHT file at the top-level directory of this distribution.
|
||||
*
|
||||
* \section LICENSE
|
||||
*
|
||||
* This file is part of the srsLTE library.
|
||||
*
|
||||
* srsLTE 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.
|
||||
*
|
||||
* srsLTE 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 "srslte/srslte.h"
|
||||
#include "queue.h"
|
||||
|
||||
#ifndef UEPHY_H
|
||||
#define UEPHY_H
|
||||
|
||||
#define SYNC_MODE_CV 0
|
||||
#define SYNC_MODE_CALLBACK 1
|
||||
#define SYNC_MODE SYNC_MODE_CALLBACK
|
||||
|
||||
namespace srslte {
|
||||
|
||||
typedef _Complex float cf_t;
|
||||
|
||||
class ue_phy
|
||||
{
|
||||
public:
|
||||
|
||||
typedef enum {DOWNLINK=0, UPLINK=1} direction_t;
|
||||
|
||||
typedef enum {
|
||||
PDCCH_UL_SEARCH_CRNTI = 0,
|
||||
PDCCH_UL_SEARCH_RA_PROC,
|
||||
PDCCH_UL_SEARCH_SPS,
|
||||
PDCCH_UL_SEARCH_TEMPORAL,
|
||||
PDCCH_UL_SEARCH_TPC_PUSCH,
|
||||
PDCCH_UL_SEARCH_TPC_PUCCH
|
||||
} pdcch_ul_search_t;
|
||||
|
||||
typedef enum {
|
||||
PDCCH_DL_SEARCH_CRNTI = 0,
|
||||
PDCCH_DL_SEARCH_SIRNTI,
|
||||
PDCCH_DL_SEARCH_PRNTI,
|
||||
PDCCH_DL_SEARCH_RARNTI,
|
||||
PDCCH_DL_SEARCH_TEMPORAL,
|
||||
PDCCH_DL_SEARCH_SPS
|
||||
} pdcch_dl_search_t;
|
||||
|
||||
/* Uplink/Downlink scheduling grant generated by a successfully decoded PDCCH */
|
||||
class sched_grant {
|
||||
public:
|
||||
uint16_t get_rnti();
|
||||
uint32_t get_rv();
|
||||
void set_rv(uint32_t rv);
|
||||
bool get_ndi();
|
||||
uint32_t get_current_tti();
|
||||
bool get_cqi_request();
|
||||
int get_harq_process();
|
||||
bool is_uplink();
|
||||
bool is_downlink();
|
||||
void* get_grant_ptr();
|
||||
protected:
|
||||
union {
|
||||
srslte_ra_pusch_t ul_grant;
|
||||
srslte_ra_pdsch_t dl_grant;
|
||||
};
|
||||
direction_t dir;
|
||||
uint16_t rnti;
|
||||
uint32_t current_tti;
|
||||
};
|
||||
|
||||
/* Uplink scheduling assignment. The MAC instructs the PHY to prepare an UL packet (PUSCH or PUCCH)
|
||||
* for transmission. The MAC must call generate_pusch() to set the packet ready for transmission
|
||||
*/
|
||||
class ul_buffer : public queue::element {
|
||||
public:
|
||||
bool init_cell(srslte_cell_t cell, int64_t *params_db);
|
||||
void free_cell();
|
||||
void set_tti(uint32_t tti);
|
||||
void set_current_tx_nb(uint32_t current_tx_nb);
|
||||
bool generate_pusch(sched_grant pusch_grant, uint8_t *payload, srslte_uci_data_t uci_data);
|
||||
bool generate_pucch(srslte_uci_data_t uci_data);
|
||||
private:
|
||||
int64_t *params_db;
|
||||
srslte_cell_t cell;
|
||||
srslte_ue_ul_t ue_ul;
|
||||
bool signal_generated;
|
||||
cf_t* signal_buffer;
|
||||
uint32_t tti;
|
||||
uint32_t current_tx_nb;
|
||||
};
|
||||
|
||||
/* Class for the processing of Downlink buffers. The MAC obtains a buffer for a given TTI and then
|
||||
* gets ul/dl scheduling grants and/or processes phich/pdsch channels
|
||||
*/
|
||||
class dl_buffer : public queue::element {
|
||||
public:
|
||||
bool init_cell(srslte_cell_t cell, int64_t *params_db);
|
||||
void free_cell();
|
||||
bool get_ul_grant(pdcch_ul_search_t mode, uint32_t rnti, ue_phy::sched_grant *grant);
|
||||
bool get_dl_grant(pdcch_dl_search_t mode, uint32_t rnti, ue_phy::sched_grant *grant);
|
||||
bool decode_phich(srslte_phich_alloc_t assignment);
|
||||
bool decode_pdsch(sched_grant pdsch_grant, uint8_t *payload); // returns true or false for CRC OK/KO
|
||||
private:
|
||||
int64_t *params_db;
|
||||
srslte_cell_t cell;
|
||||
srslte_ue_dl_t ue_dl;
|
||||
srslte_phich_t phich;
|
||||
cf_t *signal_buffer;
|
||||
uint32_t cfi;
|
||||
bool sf_symbols_and_ce_done;
|
||||
bool pdcch_llr_extracted;
|
||||
uint32_t tti;
|
||||
};
|
||||
|
||||
#if SYNC_MODE==SYNC_MODE_CALLBACK
|
||||
typedef void (*ue_phy_callback_t) (void);
|
||||
ue_phy_callback_t tti_clock_callback;
|
||||
ue_phy_callback_t status_change;
|
||||
ue_phy(ue_phy_callback_t tti_clock_callback, ue_phy_callback_t status_change);
|
||||
#else
|
||||
ue_phy();
|
||||
#endif
|
||||
~ue_phy();
|
||||
|
||||
void measure(); // TBD
|
||||
void dl_bch();
|
||||
void start_rxtx();
|
||||
void stop_rxtx();
|
||||
bool init_prach();
|
||||
void send_prach(uint32_t preamble_idx);
|
||||
|
||||
bool status_is_idle();
|
||||
bool status_is_rxtx();
|
||||
bool status_bch_decoded(uint8_t payload[SRSLTE_BCH_PAYLOAD_LEN]);
|
||||
|
||||
typedef enum {
|
||||
|
||||
PARAM_DL_FREQ = 0,
|
||||
PARAM_UL_FREQ,
|
||||
|
||||
PARAM_CELLSEARCH_TIMEOUT_PSS_NFRAMES,
|
||||
PARAM_CELLSEARCH_TIMEOUT_MIB_NFRAMES,
|
||||
PARAM_CELLSEARCH_FORCE_N_ID_2,
|
||||
PARAM_CELLSEARCH_CORRELATION_THRESHOLD, // integer that will be divided by 10
|
||||
|
||||
PARAM_PUSCH_BETA,
|
||||
|
||||
PARAM_PUSCH_RS_GROUP_HOPPING_EN,
|
||||
PARAM_PUSCH_RS_SEQUENCE_HOPPING_EN,
|
||||
PARAM_PUSCH_RS_CYCLIC_SHIFT,
|
||||
PARAM_PUSCH_RS_GROUP_ASSIGNMENT,
|
||||
|
||||
PARAM_PUSCH_HOPPING_N_SB,
|
||||
PARAM_PUSCH_HOPPING_INTRA_SF,
|
||||
PARAM_PUSCH_HOPPING_OFFSET,
|
||||
|
||||
PARAMS_UCI_I_OFFSET_ACK,
|
||||
PARAMS_UCI_I_OFFSET_RI,
|
||||
PARAMS_UCI_I_OFFSET_CQI,
|
||||
|
||||
PARAMS_PRACH_CONFIG_INDEX,
|
||||
PARAMS_PRACH_ROOT_SEQ_IDX,
|
||||
PARAMS_PRACH_HIGH_SPEED_FLAG,
|
||||
PARAMS_PRACH_ZC_CONFIG,
|
||||
PARAMS_PRACH_FREQ_OFFSET,
|
||||
|
||||
PARAM_NOF_PARAMS,
|
||||
} param_t;
|
||||
|
||||
|
||||
void set_param(param_t param, int64_t value);
|
||||
|
||||
uint32_t get_tti();
|
||||
#if SYNC_MODE==SYNC_MODE_CV
|
||||
std::condition_variable tti_cv;
|
||||
std::mutex tti_mutex;
|
||||
#endif
|
||||
|
||||
ul_buffer* get_ul_buffer(uint32_t tti);
|
||||
dl_buffer* get_dl_buffer(uint32_t tti);
|
||||
|
||||
void main_radio_loop();
|
||||
|
||||
private:
|
||||
enum {
|
||||
IDLE, MEASURE, RX_BCH, MIB_DECODED, RXTX
|
||||
} phy_state;
|
||||
|
||||
int64_t *params_db;
|
||||
|
||||
srslte_cell_t cell;
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
bool is_sfn_synched = false;
|
||||
bool started = false;
|
||||
uint32_t current_tti;
|
||||
|
||||
bool prach_initiated = false;
|
||||
bool prach_ready_to_send = false;
|
||||
uint32_t prach_len;
|
||||
cf_t *prach_buffer[64];
|
||||
srslte_prach_t prach;
|
||||
|
||||
queue *ul_buffer_queue;
|
||||
queue *dl_buffer_queue;
|
||||
|
||||
pthread_t radio_thread;
|
||||
void *radio_handler;
|
||||
static void* radio_thread_fnc(void *arg);
|
||||
void run_rx_bch_state();
|
||||
bool rx_bch();
|
||||
void run_rx_tx_state();
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -297,7 +297,7 @@ int srslte_refsignal_dmrs_gen(srslte_refsignal_ul_t *q, srslte_refsignal_drms_pu
|
|||
|
||||
// Get sequence hopping number v
|
||||
uint32_t v = 0;
|
||||
if (nof_prb >= 6 && cfg->srslte_sequence_hopping_en) {
|
||||
if (nof_prb >= 6 && cfg->sequence_hopping_en) {
|
||||
v = q->v_pusch[ns][cfg->delta_ss];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -77,13 +77,13 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
|
||||
|
||||
pusch_cfg.group_hopping_en = false;
|
||||
pusch_cfg.srslte_sequence_hopping_en = false;
|
||||
pusch_cfg.sequence_hopping_en = false;
|
||||
char *tmp = mexutils_get_char_struct(UECFG, "Hopping");
|
||||
if (tmp) {
|
||||
if (!strcmp(tmp, "Group")) {
|
||||
pusch_cfg.group_hopping_en = true;
|
||||
} else if (!strcmp(tmp, "Sequence")) {
|
||||
pusch_cfg.srslte_sequence_hopping_en = true;
|
||||
pusch_cfg.sequence_hopping_en = true;
|
||||
}
|
||||
mxFree(tmp);
|
||||
}
|
||||
|
|
|
@ -108,13 +108,13 @@ int main(int argc, char **argv) {
|
|||
pusch_cfg.delta_ss = delta_ss;
|
||||
if (!h) {
|
||||
pusch_cfg.group_hopping_en = false;
|
||||
pusch_cfg.srslte_sequence_hopping_en = false;
|
||||
pusch_cfg.sequence_hopping_en = false;
|
||||
} else if (h == 1) {
|
||||
pusch_cfg.group_hopping_en = false;
|
||||
pusch_cfg.srslte_sequence_hopping_en = true;
|
||||
pusch_cfg.sequence_hopping_en = true;
|
||||
} else if (h == 2) {
|
||||
pusch_cfg.group_hopping_en = true;
|
||||
pusch_cfg.srslte_sequence_hopping_en = false;
|
||||
pusch_cfg.sequence_hopping_en = false;
|
||||
}
|
||||
pusch_cfg.en_drms_2 = true;
|
||||
printf("Beta: %f, ",pusch_cfg.beta_pusch);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#include "srslte/utils/vector.h"
|
||||
#include "srslte/utils/debug.h"
|
||||
|
||||
#define PBCH_RE_SRSLTE_SRSLTE_CP_NORM 240
|
||||
#define PBCH_RE_SRSLTE_SRSLTE_CP_EXT 216
|
||||
|
||||
const uint8_t srslte_crc_mask[4][16] = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
||||
|
@ -359,7 +362,7 @@ void srslte_pbch_decode_reset(srslte_pbch_t *q) {
|
|||
void srslte_crc_set_mask(uint8_t *data, int nof_ports) {
|
||||
int i;
|
||||
for (i = 0; i < 16; i++) {
|
||||
data[BCH_PAYLOAD_LEN + i] = (data[BCH_PAYLOAD_LEN + i] + srslte_crc_mask[nof_ports - 1][i]) % 2;
|
||||
data[SRSLTE_BCH_PAYLOAD_LEN + i] = (data[SRSLTE_BCH_PAYLOAD_LEN + i] + srslte_crc_mask[nof_ports - 1][i]) % 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -371,13 +374,13 @@ void srslte_crc_set_mask(uint8_t *data, int nof_ports) {
|
|||
* Returns 0 if the data is correct, -1 otherwise
|
||||
*/
|
||||
uint32_t srslte_pbch_crc_check(srslte_pbch_t *q, uint8_t *bits, uint32_t nof_ports) {
|
||||
uint8_t data[BCH_PAYLOADCRC_LEN];
|
||||
memcpy(data, bits, BCH_PAYLOADCRC_LEN * sizeof(uint8_t));
|
||||
uint8_t data[SRSLTE_BCH_PAYLOADCRC_LEN];
|
||||
memcpy(data, bits, SRSLTE_BCH_PAYLOADCRC_LEN * sizeof(uint8_t));
|
||||
srslte_crc_set_mask(data, nof_ports);
|
||||
int ret = srslte_crc_checksum(&q->crc, data, BCH_PAYLOADCRC_LEN);
|
||||
int ret = srslte_crc_checksum(&q->crc, data, SRSLTE_BCH_PAYLOADCRC_LEN);
|
||||
if (ret == 0) {
|
||||
uint32_t chkzeros=0;
|
||||
for (int i=0;i<BCH_PAYLOAD_LEN;i++) {
|
||||
for (int i=0;i<SRSLTE_BCH_PAYLOAD_LEN;i++) {
|
||||
chkzeros += data[i];
|
||||
}
|
||||
if (chkzeros) {
|
||||
|
@ -411,10 +414,10 @@ int decode_frame(srslte_pbch_t *q, uint32_t src, uint32_t dst, uint32_t n,
|
|||
}
|
||||
|
||||
/* unrate matching */
|
||||
srslte_rm_conv_rx(q->temp, 4 * nof_bits, q->rm_f, BCH_ENCODED_LEN);
|
||||
srslte_rm_conv_rx(q->temp, 4 * nof_bits, q->rm_f, SRSLTE_BCH_ENCODED_LEN);
|
||||
|
||||
/* decode */
|
||||
srslte_viterbi_decode_f(&q->decoder, q->rm_f, q->data, BCH_PAYLOADCRC_LEN);
|
||||
srslte_viterbi_decode_f(&q->decoder, q->rm_f, q->data, SRSLTE_BCH_PAYLOADCRC_LEN);
|
||||
|
||||
if (!srslte_pbch_crc_check(q, q->data, nof_ports)) {
|
||||
return 1;
|
||||
|
@ -432,7 +435,7 @@ int decode_frame(srslte_pbch_t *q, uint32_t src, uint32_t dst, uint32_t n,
|
|||
* Returns 1 if successfully decoded MIB, 0 if not and -1 on error
|
||||
*/
|
||||
int srslte_pbch_decode(srslte_pbch_t *q, cf_t *slot1_symbols, cf_t *ce_slot1[SRSLTE_MAX_PORTS], float noise_estimate,
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset)
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset)
|
||||
{
|
||||
uint32_t src, dst, nb;
|
||||
uint32_t nant;
|
||||
|
@ -517,7 +520,7 @@ int srslte_pbch_decode(srslte_pbch_t *q, cf_t *slot1_symbols, cf_t *ce_slot1[SRS
|
|||
*nof_tx_ports = nant;
|
||||
}
|
||||
if (bch_payload) {
|
||||
memcpy(bch_payload, q->data, sizeof(uint8_t) * BCH_PAYLOAD_LEN);
|
||||
memcpy(bch_payload, q->data, sizeof(uint8_t) * SRSLTE_BCH_PAYLOAD_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +540,7 @@ int srslte_pbch_decode(srslte_pbch_t *q, cf_t *slot1_symbols, cf_t *ce_slot1[SRS
|
|||
|
||||
/** Converts the MIB message to symbols mapped to SLOT #1 ready for transmission
|
||||
*/
|
||||
int srslte_pbch_encode(srslte_pbch_t *q, uint8_t bch_payload[BCH_PAYLOAD_LEN], cf_t *slot1_symbols[SRSLTE_MAX_PORTS]) {
|
||||
int srslte_pbch_encode(srslte_pbch_t *q, uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN], cf_t *slot1_symbols[SRSLTE_MAX_PORTS]) {
|
||||
int i;
|
||||
int nof_bits;
|
||||
cf_t *x[SRSLTE_MAX_LAYERS];
|
||||
|
@ -560,15 +563,15 @@ int srslte_pbch_encode(srslte_pbch_t *q, uint8_t bch_payload[BCH_PAYLOAD_LEN], c
|
|||
memset(&x[q->cell.nof_ports], 0, sizeof(cf_t*) * (SRSLTE_MAX_LAYERS - q->cell.nof_ports));
|
||||
|
||||
if (q->frame_idx == 0) {
|
||||
memcpy(q->data, bch_payload, sizeof(uint8_t) * BCH_PAYLOAD_LEN);
|
||||
memcpy(q->data, bch_payload, sizeof(uint8_t) * SRSLTE_BCH_PAYLOAD_LEN);
|
||||
|
||||
/* encode & modulate */
|
||||
srslte_crc_attach(&q->crc, q->data, BCH_PAYLOAD_LEN);
|
||||
srslte_crc_attach(&q->crc, q->data, SRSLTE_BCH_PAYLOAD_LEN);
|
||||
srslte_crc_set_mask(q->data, q->cell.nof_ports);
|
||||
|
||||
srslte_convcoder_encode(&q->encoder, q->data, q->data_enc, BCH_PAYLOADCRC_LEN);
|
||||
srslte_convcoder_encode(&q->encoder, q->data, q->data_enc, SRSLTE_BCH_PAYLOADCRC_LEN);
|
||||
|
||||
srslte_rm_conv_tx(q->data_enc, BCH_ENCODED_LEN, q->rm_b, 4 * nof_bits);
|
||||
srslte_rm_conv_tx(q->data_enc, SRSLTE_BCH_ENCODED_LEN, q->rm_b, 4 * nof_bits);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,42 @@ uint32_t prach_zc_roots_format4[138] = {
|
|||
61, 78, 62, 77, 63, 76, 64, 75, 65, 74, 66, 73,
|
||||
67, 72, 68, 71, 69, 70};
|
||||
|
||||
|
||||
srslte_prach_sf_config_t prach_sf_config[16] = {
|
||||
{1, {1, 0, 0, 0, 0}},
|
||||
{1, {4, 0, 0, 0, 0}},
|
||||
{1, {7, 0, 0, 0, 0}},
|
||||
{1, {1, 0, 0, 0, 0}},
|
||||
{1, {4, 0, 0, 0, 0}},
|
||||
{1, {7, 0, 0, 0, 0}},
|
||||
{2, {1, 6, 0, 0, 0}},
|
||||
{2, {2, 7, 0, 0, 0}},
|
||||
{2, {3, 8, 0, 0, 0}},
|
||||
{3, {1, 4, 7, 0, 0}},
|
||||
{3, {2, 5, 8, 0, 0}},
|
||||
{3, {3, 6, 9, 0, 0}},
|
||||
{5, {0, 2, 4, 6, 8}},
|
||||
{5, {1, 3, 5, 7, 9}},
|
||||
{-1, {0, 0, 0, 0, 0}}, // this means all subframes
|
||||
{1, {9, 0, 0, 0, 0}}};
|
||||
|
||||
uint32_t srslte_prach_get_preamble_format(uint32_t config_idx) {
|
||||
return config_idx/16;
|
||||
}
|
||||
|
||||
srslte_prach_sfn_t srslte_prach_get_sfn(uint32_t config_idx) {
|
||||
if ((config_idx%16)<3 || (config_idx%16)==15) {
|
||||
return SRSLTE_PRACH_SFN_EVEN;
|
||||
} else {
|
||||
return SRSLTE_PRACH_SFN_ANY;
|
||||
}
|
||||
}
|
||||
|
||||
void srslte_prach_sf_config(uint32_t config_idx, srslte_prach_sf_config_t *sf_config) {
|
||||
memcpy(sf_config, &prach_sf_config[config_idx%16], sizeof(srslte_prach_sf_config_t));
|
||||
}
|
||||
|
||||
|
||||
// For debug use only
|
||||
void print(void *d, uint32_t size, uint32_t len, char* file_str)
|
||||
{
|
||||
|
@ -375,7 +411,6 @@ int srslte_prach_init(srslte_prach_t *p,
|
|||
int srslte_prach_gen(srslte_prach_t *p,
|
||||
uint32_t seq_index,
|
||||
uint32_t freq_offset,
|
||||
float beta_prach,
|
||||
cf_t *signal)
|
||||
{
|
||||
int ret = SRSLTE_ERROR;
|
||||
|
@ -405,9 +440,6 @@ int srslte_prach_gen(srslte_prach_t *p,
|
|||
signal[p->N_cp+i] = p->ifft_out[i%p->N_ifft_prach];
|
||||
}
|
||||
|
||||
// Normalize
|
||||
srslte_vec_sc_prod_cfc(signal, beta_prach, signal, (p->N_cp + p->N_seq));
|
||||
|
||||
ret = SRSLTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,18 @@
|
|||
#include "srslte/utils/debug.h"
|
||||
#include "srslte/utils/vector.h"
|
||||
|
||||
/* 36.213 Table 8.6.3-1: Mapping of HARQ-ACK offset values and the index signalled by higher layers */
|
||||
float beta_harq_offset[16] = {2.0, 2.5, 3.125, 4.0, 5.0, 6.250, 8.0, 10.0,
|
||||
12.625, 15.875, 20.0, 31.0, 50.0, 80.0, 126.0, -1.0};
|
||||
|
||||
/* 36.213 Table 8.6.3-2: Mapping of RI offset values and the index signalled by higher layers */
|
||||
float beta_ri_offset[16] = {1.25, 1.625, 2.0, 2.5, 3.125, 4.0, 5.0, 6.25, 8.0, 10.0,
|
||||
12.625, 15.875, 20.0, -1.0, -1.0, -1.0};
|
||||
|
||||
/* 36.213 Table 8.6.3-3: Mapping of CQI offset values and the index signalled by higher layers */
|
||||
float beta_cqi_offset[16] = {-1.0, -1.0, 1.125, 1.25, 1.375, 1.625, 1.750, 2.0, 2.25, 2.5, 2.875,
|
||||
3.125, 3.5, 4.0, 5.0, 6.25};
|
||||
|
||||
|
||||
int srslte_sch_init(srslte_sch_t *q) {
|
||||
int ret = SRSLTE_ERROR_INVALID_INPUTS;
|
||||
|
@ -459,9 +471,9 @@ int srslte_ulsch_uci_encode(srslte_sch_t *q, srslte_harq_t *harq, uint8_t *data,
|
|||
|
||||
// Encode RI
|
||||
if (uci_data.uci_ri_len > 0) {
|
||||
float beta = uci_data.beta_ri;
|
||||
float beta = beta_ri_offset[uci_data.I_offset_ri];
|
||||
if (harq->mcs.tbs == 0) {
|
||||
beta /= uci_data.beta_cqi;
|
||||
beta /= beta_cqi_offset[uci_data.I_offset_cqi];
|
||||
}
|
||||
ret = srslte_uci_encode_ri(uci_data.uci_ri, uci_data.uci_cqi_len, beta, harq, nb_q/Q_m, q_bits);
|
||||
if (ret < 0) {
|
||||
|
@ -473,8 +485,9 @@ int srslte_ulsch_uci_encode(srslte_sch_t *q, srslte_harq_t *harq, uint8_t *data,
|
|||
// Encode CQI
|
||||
if (uci_data.uci_cqi_len > 0) {
|
||||
|
||||
ret = srslte_uci_encode_cqi_pusch(&q->uci_cqi, uci_data.uci_cqi, uci_data.uci_cqi_len, uci_data.beta_cqi,
|
||||
Q_prime_ri, harq, g_bits);
|
||||
ret = srslte_uci_encode_cqi_pusch(&q->uci_cqi, uci_data.uci_cqi, uci_data.uci_cqi_len,
|
||||
beta_cqi_offset[uci_data.I_offset_cqi],
|
||||
Q_prime_ri, harq, g_bits);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -497,9 +510,9 @@ int srslte_ulsch_uci_encode(srslte_sch_t *q, srslte_harq_t *harq, uint8_t *data,
|
|||
|
||||
// Encode (and interleave) ACK
|
||||
if (uci_data.uci_ack_len > 0) {
|
||||
float beta = uci_data.beta_ack;
|
||||
float beta = beta_harq_offset[uci_data.I_offset_ack];
|
||||
if (harq->mcs.tbs == 0) {
|
||||
beta /= uci_data.beta_cqi;
|
||||
beta /= beta_cqi_offset[uci_data.I_offset_cqi];
|
||||
}
|
||||
ret = srslte_uci_encode_ack(uci_data.uci_ack, uci_data.uci_cqi_len, beta, harq, nb_q/Q_m, q_bits);
|
||||
if (ret < 0) {
|
||||
|
|
|
@ -102,7 +102,7 @@ static uint8_t M_basis_seq_pucch[20][13]={
|
|||
{1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
|
||||
{1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
|
||||
int srslte_uci_cqi_init(srslte_uci_cqi_pusch_t *q) {
|
||||
if (srslte_crc_init(&q->crc, SRSLTE_LTE_CRC8, 8)) {
|
||||
return SRSLTE_ERROR;
|
||||
|
@ -220,7 +220,10 @@ int srslte_uci_encode_cqi_pucch(uint8_t *cqi_data, uint32_t cqi_len, uint8_t b_b
|
|||
int srslte_uci_encode_cqi_pusch(srslte_uci_cqi_pusch_t *q, uint8_t *cqi_data, uint32_t cqi_len, float beta, uint32_t Q_prime_ri,
|
||||
srslte_harq_t *harq, uint8_t *q_bits)
|
||||
{
|
||||
|
||||
if (beta < 0) {
|
||||
fprintf(stderr, "Error beta is reserved\n");
|
||||
return -1;
|
||||
}
|
||||
uint32_t Q_prime = Q_prime_cqi(cqi_len, beta, Q_prime_ri, harq);
|
||||
uint32_t Q_m = srslte_mod_bits_x_symbol(harq->mcs.mod);
|
||||
|
||||
|
@ -244,6 +247,7 @@ static int uci_ulsch_interleave_ack(uint8_t ack_coded_bits[6], uint32_t ack_q_bi
|
|||
|
||||
const uint32_t ack_column_set_norm[4] = {2, 3, 8, 9};
|
||||
const uint32_t ack_column_set_ext[4] = {1, 2, 6, 7};
|
||||
|
||||
|
||||
if (H_prime_total/N_pusch_symbs >= 1+ack_q_bit_idx/4) {
|
||||
uint32_t row = H_prime_total/N_pusch_symbs-1-ack_q_bit_idx/4;
|
||||
|
@ -287,6 +291,12 @@ static int uci_ulsch_interleave_ri(uint8_t ri_coded_bits[6], uint32_t ri_q_bit_i
|
|||
}
|
||||
|
||||
static uint32_t Q_prime_ri_ack(uint32_t O, uint32_t O_cqi, float beta, srslte_harq_t *harq) {
|
||||
|
||||
if (beta < 0) {
|
||||
fprintf(stderr, "Error beta is reserved\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t M_sc = harq->ul_alloc.L_prb * SRSLTE_NRE;
|
||||
|
||||
uint32_t K = harq->cb_segm.C1*harq->cb_segm.K1 +
|
||||
|
@ -321,8 +331,15 @@ static void encode_ri_ack(uint8_t data, uint8_t q_encoded_bits[6], uint8_t Q_m)
|
|||
/* Encode UCI HARQ/ACK bits as described in 5.2.2.6 of 36.212
|
||||
* Currently only supporting 1-bit HARQ
|
||||
*/
|
||||
int srslte_uci_encode_ack(uint8_t data, uint32_t O_cqi, float beta, srslte_harq_t *harq, uint32_t H_prime_total, uint8_t *q_bits)
|
||||
int srslte_uci_encode_ack(uint8_t data, uint32_t O_cqi,
|
||||
float beta, srslte_harq_t *harq,
|
||||
uint32_t H_prime_total, uint8_t *q_bits)
|
||||
{
|
||||
if (beta < 0) {
|
||||
fprintf(stderr, "Error beta is reserved\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t Q_m = srslte_mod_bits_x_symbol(harq->mcs.mod);
|
||||
uint32_t Qprime = Q_prime_ri_ack(1, O_cqi, beta, harq);
|
||||
uint8_t q_encoded_bits[6];
|
||||
|
@ -340,8 +357,15 @@ int srslte_uci_encode_ack(uint8_t data, uint32_t O_cqi, float beta, srslte_harq_
|
|||
/* Encode UCI RI bits as described in 5.2.2.6 of 36.212
|
||||
* Currently only supporting 1-bit RI
|
||||
*/
|
||||
int srslte_uci_encode_ri(uint8_t data, uint32_t O_cqi, float beta, srslte_harq_t *harq, uint32_t H_prime_total, uint8_t *q_bits)
|
||||
int srslte_uci_encode_ri(uint8_t data, uint32_t O_cqi, float beta,
|
||||
srslte_harq_t *harq, uint32_t H_prime_total,
|
||||
uint8_t *q_bits)
|
||||
{
|
||||
if (beta < 0) {
|
||||
fprintf(stderr, "Error beta is reserved\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t Q_m = srslte_mod_bits_x_symbol(harq->mcs.mod);
|
||||
uint32_t Qprime = Q_prime_ri_ack(1, O_cqi, beta, harq);
|
||||
uint8_t q_encoded_bits[6];
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -47,7 +47,7 @@ srslte_cell_t cell = {
|
|||
|
||||
int nof_frames = 1;
|
||||
|
||||
uint8_t bch_payload_file[BCH_PAYLOAD_LEN] = {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t bch_payload_file[SRSLTE_BCH_PAYLOAD_LEN] = {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
#define FLEN (10*SRSLTE_SF_LEN(srslte_symbol_sz(cell.nof_prb)))
|
||||
|
||||
|
@ -171,7 +171,7 @@ void base_free() {
|
|||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
int n;
|
||||
uint32_t nof_tx_ports, sfn_offset;
|
||||
cf_t *ce_slot1[SRSLTE_MAX_PORTS];
|
||||
|
@ -231,8 +231,8 @@ int main(int argc, char **argv) {
|
|||
exit(-1);
|
||||
} else {
|
||||
printf("MIB decoded OK. Nof ports: %d. SFN offset: %d Payload: ", nof_tx_ports, sfn_offset);
|
||||
srslte_vec_fprint_hex(stdout, bch_payload, BCH_PAYLOAD_LEN);
|
||||
if (nof_tx_ports == 2 && sfn_offset == 0 && !memcmp(bch_payload, bch_payload_file, BCH_PAYLOAD_LEN)) {
|
||||
srslte_vec_fprint_hex(stdout, bch_payload, SRSLTE_BCH_PAYLOAD_LEN);
|
||||
if (nof_tx_ports == 2 && sfn_offset == 0 && !memcmp(bch_payload, bch_payload_file, SRSLTE_BCH_PAYLOAD_LEN)) {
|
||||
printf("This is the signal.1.92M.dat file\n");
|
||||
exit(0);
|
||||
} else {
|
||||
|
|
|
@ -77,7 +77,7 @@ void parse_args(int argc, char **argv) {
|
|||
|
||||
int main(int argc, char **argv) {
|
||||
srslte_pbch_t pbch;
|
||||
uint8_t bch_payload_tx[BCH_PAYLOAD_LEN], bch_payload_rx[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload_tx[SRSLTE_BCH_PAYLOAD_LEN], bch_payload_rx[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
int i, j;
|
||||
cf_t *ce[SRSLTE_MAX_PORTS];
|
||||
int nof_re;
|
||||
|
@ -111,7 +111,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
srand(time(NULL));
|
||||
for (i=0;i<BCH_PAYLOAD_LEN;i++) {
|
||||
for (i=0;i<SRSLTE_BCH_PAYLOAD_LEN;i++) {
|
||||
bch_payload_tx[i] = rand()%2;
|
||||
}
|
||||
|
||||
|
@ -138,11 +138,11 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
printf("Tx ports: %d - Rx ports: %d\n", cell.nof_ports, nof_rx_ports);
|
||||
printf("Tx payload: ");
|
||||
srslte_vec_fprint_hex(stdout, bch_payload_tx, BCH_PAYLOAD_LEN);
|
||||
srslte_vec_fprint_hex(stdout, bch_payload_tx, SRSLTE_BCH_PAYLOAD_LEN);
|
||||
printf("Rx payload: ");
|
||||
srslte_vec_fprint_hex(stdout, bch_payload_rx, BCH_PAYLOAD_LEN);
|
||||
srslte_vec_fprint_hex(stdout, bch_payload_rx, SRSLTE_BCH_PAYLOAD_LEN);
|
||||
|
||||
if (nof_rx_ports == cell.nof_ports && !memcmp(bch_payload_rx, bch_payload_tx, sizeof(uint8_t) * BCH_PAYLOAD_LEN)) {
|
||||
if (nof_rx_ports == cell.nof_ports && !memcmp(bch_payload_rx, bch_payload_tx, sizeof(uint8_t) * SRSLTE_BCH_PAYLOAD_LEN)) {
|
||||
printf("OK\n");
|
||||
exit(0);
|
||||
} else {
|
||||
|
|
|
@ -77,7 +77,6 @@ int main(int argc, char **argv) {
|
|||
srslte_prach_gen(p,
|
||||
seq_index,
|
||||
frequency_offset,
|
||||
0.2,
|
||||
preamble);
|
||||
|
||||
uint32_t prach_len = p->N_seq;
|
||||
|
|
|
@ -97,7 +97,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
return;
|
||||
}
|
||||
bzero(signal, sizeof(cf_t) * nof_samples);
|
||||
if (srslte_prach_gen(&prach, seq_idx, frequency_offset, 0.2, signal)) {
|
||||
if (srslte_prach_gen(&prach, seq_idx, frequency_offset, signal)) {
|
||||
mexErrMsgTxt("Error generating PRACH\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ int main(int argc, char **argv) {
|
|||
srslte_prach_gen(p,
|
||||
seq_index,
|
||||
frequency_offset,
|
||||
0.2,
|
||||
preamble);
|
||||
|
||||
for(int i=0;i<p->N_cp+p->N_seq;i++)
|
||||
|
|
|
@ -156,17 +156,15 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
free(tmp);
|
||||
|
||||
|
||||
if (mexutils_read_float_struct(PUSCHCFG, "BetaCQI", &uci_data.beta_cqi)) {
|
||||
uci_data.beta_cqi = 2.0;
|
||||
if (mexutils_read_uint32_struct(PUSCHCFG, "OffsetCQI", &uci_data.I_offset_cqi)) {
|
||||
uci_data.I_offset_cqi = 7;
|
||||
}
|
||||
if (mexutils_read_float_struct(PUSCHCFG, "BetaRI", &uci_data.beta_ri)) {
|
||||
uci_data.beta_ri = 2.0;
|
||||
if (mexutils_read_uint32_struct(PUSCHCFG, "OffsetRI", &uci_data.I_offset_ri)) {
|
||||
uci_data.I_offset_ri = 2;
|
||||
}
|
||||
if (mexutils_read_float_struct(PUSCHCFG, "BetaACK", &uci_data.beta_ack)) {
|
||||
uci_data.beta_ack = 2.0;
|
||||
if (mexutils_read_uint32_struct(PUSCHCFG, "OffsetACK", &uci_data.I_offset_ack)) {
|
||||
uci_data.I_offset_ack = 0;
|
||||
}
|
||||
mexPrintf("Beta_CQI: %.1f, Beta_ACK: %.1f, Beta_RI: %.1f\n",
|
||||
uci_data.beta_cqi, uci_data.beta_ack, uci_data.beta_ri);
|
||||
mexPrintf("TRBL_len: %d, CQI_len: %d, ACK_len: %d (%d), RI_len: %d (%d)\n", mcs.tbs,
|
||||
uci_data.uci_cqi_len, uci_data.uci_ack_len, uci_data.uci_ack, uci_data.uci_ri_len, uci_data.uci_ri);
|
||||
|
||||
|
|
|
@ -165,9 +165,9 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
srslte_uci_data_t uci_data;
|
||||
bzero(&uci_data, sizeof(srslte_uci_data_t));
|
||||
uci_data.beta_cqi = 2.0;
|
||||
uci_data.beta_ri = 2.0;
|
||||
uci_data.beta_ack = 2.0;
|
||||
uci_data.I_offset_cqi = 7;
|
||||
uci_data.I_offset_ri = 2;
|
||||
uci_data.I_offset_ack = 0;
|
||||
|
||||
uci_data.uci_cqi_len = 0;
|
||||
uci_data.uci_ri_len = 0;
|
||||
|
|
|
@ -95,17 +95,15 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
return;
|
||||
}
|
||||
|
||||
if (mexutils_read_float_struct(PUSCHCFG, "BetaCQI", &uci_data.beta_cqi)) {
|
||||
uci_data.beta_cqi = 2.0;
|
||||
if (mexutils_read_uint32_struct(PUSCHCFG, "OffsetCQI", &uci_data.I_offset_cqi)) {
|
||||
uci_data.I_offset_cqi = 7;
|
||||
}
|
||||
if (mexutils_read_float_struct(PUSCHCFG, "BetaRI", &uci_data.beta_ri)) {
|
||||
uci_data.beta_ri = 2.0;
|
||||
if (mexutils_read_uint32_struct(PUSCHCFG, "OffsetRI", &uci_data.I_offset_ri)) {
|
||||
uci_data.I_offset_ri = 2;
|
||||
}
|
||||
if (mexutils_read_float_struct(PUSCHCFG, "BetaACK", &uci_data.beta_ack)) {
|
||||
uci_data.beta_ack = 2.0;
|
||||
if (mexutils_read_uint32_struct(PUSCHCFG, "OffsetACK", &uci_data.I_offset_ack)) {
|
||||
uci_data.I_offset_ack = 0;
|
||||
}
|
||||
mexPrintf("Beta_CQI: %.1f, Beta_ACK: %.1f, Beta_RI: %.1f\n",
|
||||
uci_data.beta_cqi, uci_data.beta_ack, uci_data.beta_ri);
|
||||
|
||||
char *mod_str = mexutils_get_char_struct(PUSCHCFG, "Modulation");
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -194,13 +194,6 @@ int srslte_ue_dl_decode_fft_estimate(srslte_ue_dl_t *q, cf_t *input, uint32_t sf
|
|||
fprintf(stderr, "Error setting CFI\n");
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
|
||||
/* Extract all PDCCH symbols and get LLRs */
|
||||
if (srslte_pdcch_extract_llr(&q->pdcch, q->sf_symbols, q->ce, 0, sf_idx, *cfi)) {
|
||||
fprintf(stderr, "Error extracting LLRs\n");
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
} else {
|
||||
|
@ -249,32 +242,24 @@ int srslte_ue_dl_find_ul_dci(srslte_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint3
|
|||
{
|
||||
srslte_dci_location_t locations[MAX_CANDIDATES];
|
||||
uint32_t nof_locations = srslte_pdcch_ue_locations(&q->pdcch, locations, MAX_CANDIDATES, sf_idx, cfi, rnti);
|
||||
uint16_t srslte_crc_rem = 0;
|
||||
for (uint32_t i=0;i<nof_locations && srslte_crc_rem != rnti;i++) {
|
||||
if (srslte_pdcch_decode_msg(&q->pdcch, dci_msg, &locations[i], SRSLTE_DCI_FORMAT0, &srslte_crc_rem)) {
|
||||
uint16_t crc_rem = 0;
|
||||
for (uint32_t i=0;i<nof_locations && crc_rem != rnti;i++) {
|
||||
if (srslte_pdcch_decode_msg(&q->pdcch, dci_msg, &locations[i], SRSLTE_DCI_FORMAT0, &crc_rem)) {
|
||||
fprintf(stderr, "Error decoding DCI msg\n");
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
INFO("Decoded DCI message RNTI: 0x%x\n", srslte_crc_rem);
|
||||
INFO("Decoded DCI message RNTI: 0x%x\n", crc_rem);
|
||||
}
|
||||
return srslte_crc_rem == rnti;
|
||||
return crc_rem == rnti;
|
||||
}
|
||||
|
||||
int srslte_ue_dl_decode_rnti_rv(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx, uint16_t rnti, uint32_t rvidx)
|
||||
int srslte_ue_dl_find_dl_dci(srslte_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint32_t cfi, uint32_t sf_idx, uint16_t rnti)
|
||||
{
|
||||
uint32_t i;
|
||||
srslte_dci_msg_t dci_msg;
|
||||
srslte_dci_location_t locations[MAX_CANDIDATES];
|
||||
uint32_t nof_locations;
|
||||
uint16_t srslte_crc_rem;
|
||||
int ret = SRSLTE_ERROR;
|
||||
uint32_t nof_formats;
|
||||
srslte_dci_format_t *formats = NULL;
|
||||
|
||||
if ((ret = srslte_ue_dl_decode_fft_estimate(q, input, sf_idx, &q->cfi)) < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Generate PDCCH candidates */
|
||||
if (rnti == SRSLTE_SIRNTI) {
|
||||
nof_locations = srslte_pdcch_common_locations(&q->pdcch, locations, MAX_CANDIDATES, q->cfi);
|
||||
|
@ -285,28 +270,42 @@ int srslte_ue_dl_decode_rnti_rv(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, u
|
|||
formats = ue_formats;
|
||||
nof_formats = nof_ue_formats;
|
||||
}
|
||||
|
||||
/* For all possible locations, try to decode a DCI message */
|
||||
srslte_crc_rem = 0;
|
||||
uint32_t found_dci = 0;
|
||||
for (int f=0;f<nof_formats && !found_dci;f++) {
|
||||
|
||||
uint16_t crc_rem = 0;
|
||||
for (int f=0;f<nof_formats && crc_rem != rnti;f++) {
|
||||
INFO("Trying format %s\n", srslte_dci_format_string(formats[f]));
|
||||
for (i=0;i<nof_locations && !found_dci;i++) {
|
||||
if (srslte_pdcch_decode_msg(&q->pdcch, &dci_msg, &locations[i], formats[f], &srslte_crc_rem)) {
|
||||
for (int i=0;i<nof_locations && crc_rem != rnti;i++) {
|
||||
if (srslte_pdcch_decode_msg(&q->pdcch, dci_msg, &locations[i], formats[f], &crc_rem)) {
|
||||
fprintf(stderr, "Error decoding DCI msg\n");
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
INFO("Decoded DCI message RNTI: 0x%x\n", srslte_crc_rem);
|
||||
|
||||
if (srslte_crc_rem == rnti) {
|
||||
q->dci_format = formats[f];
|
||||
found_dci++;
|
||||
ret = srslte_ue_dl_decode_rnti_rv_packet(q, &dci_msg, data, q->cfi, sf_idx, rnti, rvidx);
|
||||
}
|
||||
INFO("Decoded DCI message RNTI: 0x%x\n", crc_rem);
|
||||
}
|
||||
}
|
||||
return crc_rem == rnti;
|
||||
}
|
||||
|
||||
|
||||
int srslte_ue_dl_decode_rnti_rv(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx, uint16_t rnti, uint32_t rvidx)
|
||||
{
|
||||
srslte_dci_msg_t dci_msg;
|
||||
int ret = SRSLTE_ERROR;
|
||||
|
||||
if ((ret = srslte_ue_dl_decode_fft_estimate(q, input, sf_idx, &q->cfi)) < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (srslte_pdcch_extract_llr(&q->pdcch, q->sf_symbols, q->ce, 0, sf_idx, q->cfi)) {
|
||||
fprintf(stderr, "Error extracting LLRs\n");
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
|
||||
int found_dci = srslte_ue_dl_find_dl_dci(q, &dci_msg, q->cfi, sf_idx, rnti);
|
||||
if (found_dci == 1) {
|
||||
ret = srslte_ue_dl_decode_rnti_rv_packet(q, &dci_msg, data, q->cfi, sf_idx, rnti, rvidx);
|
||||
}
|
||||
|
||||
if (found_dci > 0 && ret == SRSLTE_SUCCESS) {
|
||||
if (found_dci == 1 && ret == SRSLTE_SUCCESS) {
|
||||
return q->ra_dl.mcs.tbs;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
@ -113,7 +113,7 @@ void srslte_ue_mib_reset(srslte_ue_mib_t * q)
|
|||
}
|
||||
|
||||
int srslte_ue_mib_decode(srslte_ue_mib_t * q, cf_t *input,
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset)
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset)
|
||||
{
|
||||
int ret = SRSLTE_SUCCESS;
|
||||
cf_t *ce_slot1[SRSLTE_MAX_PORTS];
|
||||
|
@ -193,7 +193,7 @@ void srslte_ue_mib_sync_reset(srslte_ue_mib_sync_t * q) {
|
|||
|
||||
int srslte_ue_mib_sync_decode(srslte_ue_mib_sync_t * q,
|
||||
uint32_t max_frames_timeout,
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN],
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
||||
uint32_t *nof_tx_ports,
|
||||
uint32_t *sfn_offset)
|
||||
{
|
||||
|
|
|
@ -152,26 +152,26 @@ void srslte_ue_ul_set_pusch_cfg(srslte_ue_ul_t *q, srslte_refsignal_drms_pusch_c
|
|||
srslte_pusch_set_hopping_cfg(&q->pusch, pusch_hopping_cfg);
|
||||
}
|
||||
|
||||
int srslte_ue_ul_srslte_pusch_encode(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, uint32_t sf_idx, cf_t *output_signal)
|
||||
int srslte_ue_ul_pusch_encode(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, uint32_t sf_idx, cf_t *output_signal)
|
||||
{
|
||||
srslte_uci_data_t uci_data;
|
||||
bzero(&uci_data, sizeof(srslte_uci_data_t));
|
||||
return srslte_ue_ul_srslte_pusch_uci_encode_rnti(q, ra_ul, data, uci_data, sf_idx, q->current_rnti, output_signal);
|
||||
return srslte_ue_ul_pusch_uci_encode_rnti(q, ra_ul, data, uci_data, sf_idx, q->current_rnti, output_signal);
|
||||
}
|
||||
|
||||
int srslte_ue_ul_srslte_pusch_encode_rnti(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, uint32_t sf_idx, uint16_t rnti, cf_t *output_signal)
|
||||
int srslte_ue_ul_pusch_encode_rnti(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, uint32_t sf_idx, uint16_t rnti, cf_t *output_signal)
|
||||
{
|
||||
srslte_uci_data_t uci_data;
|
||||
bzero(&uci_data, sizeof(srslte_uci_data_t));
|
||||
return srslte_ue_ul_srslte_pusch_uci_encode_rnti(q, ra_ul, data, uci_data, sf_idx, rnti, output_signal);
|
||||
return srslte_ue_ul_pusch_uci_encode_rnti(q, ra_ul, data, uci_data, sf_idx, rnti, output_signal);
|
||||
}
|
||||
|
||||
int srslte_ue_ul_srslte_pusch_uci_encode(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, srslte_uci_data_t uci_data, uint32_t sf_idx, cf_t *output_signal)
|
||||
int srslte_ue_ul_pusch_uci_encode(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, srslte_uci_data_t uci_data, uint32_t sf_idx, cf_t *output_signal)
|
||||
{
|
||||
return srslte_ue_ul_srslte_pusch_uci_encode_rnti(q, ra_ul, data, uci_data, sf_idx, q->current_rnti, output_signal);
|
||||
return srslte_ue_ul_pusch_uci_encode_rnti(q, ra_ul, data, uci_data, sf_idx, q->current_rnti, output_signal);
|
||||
}
|
||||
|
||||
int srslte_ue_ul_srslte_pusch_uci_encode_rnti(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, srslte_uci_data_t uci_data,
|
||||
int srslte_ue_ul_pusch_uci_encode_rnti(srslte_ue_ul_t *q, srslte_ra_pusch_t *ra_ul, uint8_t *data, srslte_uci_data_t uci_data,
|
||||
uint32_t sf_idx, uint16_t rnti,
|
||||
cf_t *output_signal)
|
||||
{
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#
|
||||
# Copyright 2012-2013 The libLTE Developers. See the
|
||||
# Copyright 2012-2013 The srsLTE Developers. See the
|
||||
# COPYRIGHT file at the top-level directory of this distribution.
|
||||
#
|
||||
# This file is part of the libLTE library.
|
||||
# This file is part of the srsLTE library.
|
||||
#
|
||||
# libLTE is free software: you can redistribute it and/or modify
|
||||
# srsLTE 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,
|
||||
# srsLTE 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.
|
||||
|
|
|
@ -247,7 +247,7 @@ int main(int argc, char **argv) {
|
|||
#endif
|
||||
uint32_t nof_trials = 0;
|
||||
int n;
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
uint32_t sfn_offset;
|
||||
|
||||
parse_args(&prog_args, argc, argv);
|
||||
|
|
Loading…
Reference in New Issue