State before directory reorganization

master
ismagom 10 years ago
parent e7cc7b330e
commit c57d8969be

@ -49,7 +49,7 @@ bool radio_uhd::init(char *args)
bool radio_uhd::rx_at(void* buffer, uint32_t nof_samples, srslte_timestamp_t rx_time)
{
fprintf(stderr, "Not implemented\n");
fprintf(stderr, "UHD Receive at time not implemented\n");
return false;
}

@ -43,7 +43,7 @@
#include "srslte/config.h"
#define SRSLTE_AGC_DEFAULT_TARGET 1.0
#define SRSLTE_AGC_DEFAULT_TARGET 0.7
#define SRSLTE_AGC_DEFAULT_BW (5e-2)
typedef enum SRSLTE_API {

@ -44,7 +44,9 @@
#include "srslte/common/phy_common.h"
#include "srslte/phch/ra.h"
#define DCI_MAX_BITS 57
#define SRSLTE_DCI_MAX_BITS 57
#define SRSLTE_RAR_GRANT_LEN 20
typedef enum {
SRSLTE_DCI_FORMAT0,
@ -77,13 +79,16 @@ typedef struct SRSLTE_API {
} srslte_dci_location_t;
typedef struct SRSLTE_API {
uint8_t data[DCI_MAX_BITS];
uint8_t data[SRSLTE_DCI_MAX_BITS];
uint32_t nof_bits;
} srslte_dci_msg_t;
typedef struct SRSLTE_API {
uint32_t rba;
uint32_t trunc_mcs;
uint32_t tpc_pusch;
bool ul_delay;
bool cqi_request;
bool hopping_flag;
} srslte_dci_rar_grant_t;
@ -112,6 +117,9 @@ SRSLTE_API int srslte_dci_rar_to_ul_grant(srslte_dci_rar_grant_t *rar,
srslte_ra_ul_dci_t *ul_dci,
srslte_ra_ul_grant_t *grant);
SRSLTE_API void srslte_dci_rar_grant_unpack(srslte_dci_rar_grant_t *rar,
uint8_t grant[SRSLTE_RAR_GRANT_LEN]);
SRSLTE_API srslte_dci_format_t srslte_dci_format_from_string(char *str);
SRSLTE_API char* srslte_dci_format_string(srslte_dci_format_t format);

@ -73,7 +73,7 @@ typedef struct SRSLTE_API {
cf_t *x[SRSLTE_MAX_PORTS];
cf_t *d;
uint8_t *e;
float rm_f[3 * (DCI_MAX_BITS + 16)];
float rm_f[3 * (SRSLTE_DCI_MAX_BITS + 16)];
float *llr;
/* tx & rx objects */

@ -42,33 +42,20 @@ namespace ue {
*/
class SRSLTE_API dl_buffer : public queue::element {
public:
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;
int buffer_id;
bool init_cell(srslte_cell_t cell, phy_params *params_db);
void free_cell();
bool recv_ue_sync(srslte_ue_sync_t *ue_sync, srslte_timestamp_t *rx_time);
bool get_ul_grant(pdcch_ul_search_t mode, ul_sched_grant *grant);
bool get_dl_grant(pdcch_dl_search_t mode, dl_sched_grant *grant);
bool get_ul_grant(ul_sched_grant *grant);
bool get_dl_grant(dl_sched_grant *grant);
void discard_pending_rar_grant();
void set_rar_grant(srslte_dci_rar_grant_t *rar_grant);
void set_rar_grant(uint8_t grant[SRSLTE_RAR_GRANT_LEN]);
bool decode_ack(ul_sched_grant *pusch_grant);
bool decode_data(dl_sched_grant *pdsch_grant, uint8_t *payload); // returns true or false for CRC OK/NOK
bool decode_data(dl_sched_grant *grant, srslte_softbuffer_rx_t *softbuffer, uint8_t *payload);
private:
phy_params *params_db;
@ -79,6 +66,8 @@ namespace ue {
uint32_t cfi;
bool sf_symbols_and_ce_done;
bool pdcch_llr_extracted;
bool pending_rar_grant;
srslte_dci_rar_grant_t rar_grant;
};
}
}

@ -39,6 +39,7 @@ namespace ue {
class SRSLTE_API dl_sched_grant : public sched_grant {
public:
dl_sched_grant(rnti_type_t type, uint16_t rnti) : sched_grant(type, rnti) {}
dl_sched_grant(uint16_t rnti) : sched_grant(rnti) {}
uint32_t get_rv() {

@ -39,6 +39,11 @@
#ifndef LOG_H
#define LOG_H
#define Error(fmt, ...) log_h->error(tti, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define Warning(fmt, ...) log_h->warning(tti, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define Info(fmt, ...) log_h->info(tti, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define Debug(fmt, ...) log_h->debug(tti, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
using namespace std;
namespace srslte {

@ -24,6 +24,7 @@
* and at http://www.gnu.org/licenses/.
*
*/
#include <stdlib.h>
#include "srslte/srslte.h"
@ -37,10 +38,12 @@ namespace ue {
public:
params_db(uint32_t nof_params_) {
nof_params = nof_params_;
db = new int64_t[nof_params_];
db = (int64_t*) calloc(sizeof(int64_t), nof_params);
}
~params_db() {
delete db;
if (db) {
free(db);
}
}
void set_param(uint32_t param_idx, int64_t value) {
if (param_idx < nof_params) {

@ -63,6 +63,7 @@ public:
started = false;
is_sfn_synched = false;
cell_is_set = false;
phy_state = IDLE;
}
bool init(radio *radio_handler, tti_sync *ttisync);
void stop();
@ -78,7 +79,10 @@ public:
bool stop_rxtx();
// Indicate the PHY to send PRACH as soon as possible
bool init_prach();
bool send_prach(uint32_t preamble_idx);
bool send_prach(uint32_t preamble_idx, int allowed_subframe);
bool send_prach(uint32_t preamble_idx, int allowed_subframe, int target_power_dbm);
// Returns TTI when PRACH was transmitted. -1 if not yet transmitted
int get_prach_transmitted_tti();
@ -90,7 +94,7 @@ public:
void set_timeadv_rar(uint32_t ta_cmd);
void set_timeadv(uint32_t ta_cmd);
// Generate Msg3 UL grant from RAR
// Convert Msg3 UL grant to ul_sched_grant
void rar_ul_grant(srslte_dci_rar_grant_t *rar, ul_sched_grant *grant);
// Get status

@ -53,6 +53,7 @@ namespace ue {
CELLSEARCH_TIMEOUT_PSS_CORRELATION_THRESHOLD, // integer that will be divided by 10
PUSCH_BETA,
PUSCH_EN_64QAM,
PUSCH_RS_GROUP_HOPPING_EN,
PUSCH_RS_SEQUENCE_HOPPING_EN,
PUSCH_RS_CYCLIC_SHIFT,
@ -61,7 +62,7 @@ namespace ue {
PUSCH_HOPPING_N_SB,
PUSCH_HOPPING_INTRA_SF,
PUSCH_HOPPING_OFFSET,
PUCCH_BETA,
PUCCH_DELTA_SHIFT,
PUCCH_CYCLIC_SHIFT,

@ -46,6 +46,8 @@ namespace ue {
bool init_cell(srslte_cell_t cell, phy_params *params_db);
void free_cell();
bool prepare_to_send(uint32_t preamble_idx);
bool prepare_to_send(uint32_t preamble_idx, int allowed_subframe);
bool prepare_to_send(uint32_t preamble_idx, int allowed_subframe, int target_power_dbm);
bool is_ready_to_send(uint32_t current_tti);
int get_transmitted_tti();
bool send(srslte::radio* radio_handler, float cfo, srslte_timestamp_t rx_time);
@ -53,6 +55,7 @@ namespace ue {
static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission
phy_params *params_db = NULL;
int preamble_idx;
int allowed_subframe;
bool initiated = false;
uint32_t len;
cf_t *buffer[64];

@ -37,12 +37,47 @@ namespace ue {
/* Uplink/Downlink scheduling grant generated by a successfully decoded PDCCH */
class SRSLTE_API sched_grant {
public:
sched_grant(uint16_t rnti_) {
rnti = rnti_;
}
uint16_t get_rnti() {
return rnti;
}
typedef enum {
RNTI_TYPE_NOTDEFINED = 0,
RNTI_TYPE_CRNTI,
RNTI_TYPE_RA,
RNTI_TYPE_SPS,
RNTI_TYPE_TEMP,
RNTI_TYPE_SIRNTI,
RNTI_TYPE_PRNTI,
RNTI_TYPE_TPC_PUSCH,
RNTI_TYPE_TPC_PUCCH
} rnti_type_t;
sched_grant(uint16_t rnti_) {
rnti = rnti_;
rnti_type = RNTI_TYPE_NOTDEFINED;
}
sched_grant(rnti_type_t rnti_type_, uint16_t rnti_) {
rnti = rnti_;
rnti_type = rnti_type_;
}
uint16_t get_rnti() {
return rnti;
}
bool is_temp_rnti() {
return rnti_type == RNTI_TYPE_TEMP;
}
bool is_crnti() {
return rnti_type == RNTI_TYPE_CRNTI;
}
bool is_ra_rnti() {
return rnti_type == RNTI_TYPE_RA;
}
bool is_SPS_rnti() {
return rnti_type == RNTI_TYPE_SPS;
}
bool is_sys_rnti() {
return (rnti_type == RNTI_TYPE_SIRNTI || rnti_type == RNTI_TYPE_PRNTI);
}
bool is_tpc_rnti() {
return (rnti_type == RNTI_TYPE_TPC_PUSCH || rnti_type == RNTI_TYPE_TPC_PUCCH);
}
virtual uint32_t get_rv() = 0;
virtual void set_rv(uint32_t rv) = 0;
virtual bool get_ndi() = 0;
@ -51,6 +86,7 @@ namespace ue {
virtual uint32_t get_tbs() = 0;
protected:
uint16_t rnti;
rnti_type_t rnti_type;
};
}

@ -47,7 +47,6 @@ namespace ue {
public:
bool init_cell(srslte_cell_t cell, phy_params *params_db);
void free_cell();
void set_tti(uint32_t tti);
void set_current_tx_nb(uint32_t current_tx_nb);
bool generate_ack(bool ack, dl_sched_grant *last_dl_grant);
bool generate_ack(bool ack[2]);
@ -56,6 +55,7 @@ namespace ue {
bool uci_ready();
bool generate_data();
bool generate_data(ul_sched_grant *pusch_grant, uint8_t *payload);
bool generate_data(ul_sched_grant *pusch_grant, srslte_softbuffer_tx_t *softbuffer, uint8_t *payload);
bool send(radio* radio_handler, float time_adv_sec, float cfo, srslte_timestamp_t rx_time);
static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission

@ -39,6 +39,7 @@ namespace ue {
class SRSLTE_API ul_sched_grant : public sched_grant {
public:
ul_sched_grant(rnti_type_t type, uint16_t rnti) : sched_grant(type, rnti) {}
ul_sched_grant(uint16_t rnti) : sched_grant(rnti) {}
uint32_t get_rv() {
@ -77,7 +78,11 @@ namespace ue {
uint32_t get_n_dmrs() {
return ul_dci.n_dmrs;
}
bool is_from_rar() {
return grant_is_from_rar;
}
bool create_from_dci(srslte_dci_msg_t *msg, srslte_cell_t cell, uint32_t N_srs, uint32_t n_rb_ho) {
grant_is_from_rar = false;
if (srslte_dci_msg_to_ul_grant(msg, cell, N_srs, n_rb_ho, &ul_dci, &grant)) {
return false;
} else {
@ -88,6 +93,7 @@ namespace ue {
}
}
bool create_from_rar(srslte_dci_rar_grant_t *rar, srslte_cell_t cell, uint32_t N_srs, uint32_t n_rb_ho) {
grant_is_from_rar = true;
if (srslte_dci_rar_to_ul_grant(rar, cell, N_srs, n_rb_ho, &ul_dci, &grant)) {
return false;
} else {
@ -109,6 +115,7 @@ namespace ue {
srslte_ra_ul_dci_t ul_dci;
uint32_t current_tx_nb;
uint16_t rnti;
bool grant_is_from_rar;
};
}

@ -74,7 +74,7 @@ int srslte_chest_dl_init(srslte_chest_dl_t *q, srslte_cell_t cell)
perror("malloc");
goto clean_exit;
}
q->tmp_noise = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_MAX_NUM_SF(cell.nof_prb));
q->tmp_noise = srslte_vec_malloc(sizeof(cf_t) * 2 * SRSLTE_REFSIGNAL_MAX_NUM_SF(cell.nof_prb));
if (!q->tmp_noise) {
perror("malloc");
goto clean_exit;
@ -99,7 +99,8 @@ int srslte_chest_dl_init(srslte_chest_dl_t *q, srslte_cell_t cell)
perror("malloc");
goto clean_exit;
}
q->pilot_estimates_average[i] = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(cell.nof_prb, i));
// FIXME: There's an invalid read during rsrp estimation for this buffer
q->pilot_estimates_average[i] = srslte_vec_malloc(2 * sizeof(cf_t) * SRSLTE_REFSIGNAL_NUM_SF(cell.nof_prb, i));
if (!q->pilot_estimates_average[i]) {
perror("malloc");
goto clean_exit;

@ -78,7 +78,7 @@ int srslte_dci_msg_to_dl_grant(srslte_dci_msg_t *msg, uint16_t msg_rnti,
crc_is_crnti = true;
}
if (srslte_dci_msg_unpack_pdsch(msg, dl_dci, cell.nof_prb, crc_is_crnti)) {
fprintf(stderr, "Can't unpack PDSCH message\n");
fprintf(stderr, "Can't unpack DCI message\n");
return ret;
}
@ -140,6 +140,18 @@ int srslte_dci_rar_to_ul_grant(srslte_dci_rar_grant_t *rar, srslte_cell_t cell,
return SRSLTE_SUCCESS;
}
/* Unpack RAR UL grant as defined in Section 6.2 of 36.213 */
void srslte_dci_rar_grant_unpack(srslte_dci_rar_grant_t *rar, uint8_t grant[SRSLTE_RAR_GRANT_LEN])
{
uint8_t *grant_ptr = grant;
rar->hopping_flag = srslte_bit_unpack(&grant_ptr, 1)?true:false;
rar->rba = srslte_bit_unpack(&grant_ptr, 10);
rar->trunc_mcs = srslte_bit_unpack(&grant_ptr, 4);
rar->tpc_pusch = srslte_bit_unpack(&grant_ptr, 3);
rar->ul_delay = srslte_bit_unpack(&grant_ptr, 1)?true:false;
rar->cqi_request = srslte_bit_unpack(&grant_ptr, 1)?true:false;
}
/* Creates the UL PUSCH resource allocation grant from a DCI format 0 message
*/
int srslte_dci_msg_to_ul_grant(srslte_dci_msg_t *msg, srslte_cell_t cell,

@ -98,7 +98,7 @@ int srslte_pdcch_init(srslte_pdcch_t *q, srslte_regs_t *regs, srslte_cell_t cell
}
uint32_t poly[3] = { 0x6D, 0x4F, 0x57 };
if (srslte_viterbi_init(&q->decoder, SRSLTE_VITERBI_37, poly, DCI_MAX_BITS + 16, true)) {
if (srslte_viterbi_init(&q->decoder, SRSLTE_VITERBI_37, poly, SRSLTE_DCI_MAX_BITS + 16, true)) {
goto clean;
}
@ -281,7 +281,7 @@ static int dci_decode(srslte_pdcch_t *q, float *e, uint8_t *data, uint32_t E, ui
if (q != NULL &&
data != NULL &&
E <= q->max_bits &&
nof_bits <= DCI_MAX_BITS)
nof_bits <= SRSLTE_DCI_MAX_BITS)
{
/* unrate matching */
@ -441,12 +441,12 @@ static void crc_set_mask_rnti(uint8_t *crc, uint16_t rnti) {
static int dci_encode(srslte_pdcch_t *q, uint8_t *data, uint8_t *e, uint32_t nof_bits, uint32_t E,
uint16_t rnti) {
srslte_convcoder_t encoder;
uint8_t tmp[3 * (DCI_MAX_BITS + 16)];
uint8_t tmp[3 * (SRSLTE_DCI_MAX_BITS + 16)];
if (q != NULL &&
data != NULL &&
e != NULL &&
nof_bits < DCI_MAX_BITS &&
nof_bits < SRSLTE_DCI_MAX_BITS &&
E < q->max_bits)
{
@ -506,7 +506,7 @@ int srslte_pdcch_encode(srslte_pdcch_t *q, srslte_dci_msg_t *msg, srslte_dci_loc
ret = SRSLTE_ERROR;
if (location.ncce + PDCCH_FORMAT_NOF_CCE(location.L) <= q->nof_cce &&
msg->nof_bits < DCI_MAX_BITS)
msg->nof_bits < SRSLTE_DCI_MAX_BITS)
{
INFO("Encoding DCI: Nbits: %d, E: %d, nCCE: %d, L: %d, RNTI: 0x%x\n",
msg->nof_bits, e_bits, location.ncce, location.L, rnti);

@ -266,7 +266,7 @@ int main(int argc, char **argv) {
case SRSLTE_DCI_MSG_TYPE_PDSCH_SCHED:
bzero(&ra_dl, sizeof(srslte_ra_dl_dci_t));
if (srslte_dci_msg_unpack_pdsch(&dci_msg, &ra_dl, cell.nof_prb, rnti != SRSLTE_SIRNTI)) {
fprintf(stderr, "Can't unpack PDSCH message\n");
fprintf(stderr, "Can't unpack DCI message\n");
} else {
srslte_ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb);
if (ra_dl.alloc_type == SRSLTE_RA_ALLOC_TYPE2 && ra_dl.type2_alloc.mode == SRSLTE_RA_TYPE2_LOC

@ -45,6 +45,7 @@ bool dl_buffer::init_cell(srslte_cell_t cell_, phy_params *params_db_)
cell = cell_;
sf_symbols_and_ce_done = false;
pdcch_llr_extracted = false;
pending_rar_grant = 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));
@ -81,33 +82,55 @@ bool dl_buffer::recv_ue_sync(srslte_ue_sync_t *ue_sync, srslte_timestamp_t *rx_t
return ret;
}
bool dl_buffer::get_ul_grant(pdcch_ul_search_t mode, ul_sched_grant *grant)
void dl_buffer::discard_pending_rar_grant() {
pending_rar_grant = false;
}
bool dl_buffer::get_ul_grant(ul_sched_grant *grant)
{
if (signal_buffer) {
if (!sf_symbols_and_ce_done) {
if (srslte_ue_dl_decode_fft_estimate(&ue_dl, signal_buffer, tti%10, &cfi) < 0) {
return false;
printf("get_ul_grant tti=%d, is_temp_rnti=%d\n", tti, grant->is_temp_rnti());
if (pending_rar_grant && grant->is_temp_rnti()) {
printf("Get pending RAR grant tti=%d\n", tti);
return grant->create_from_rar(&rar_grant, cell, 0, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
} else {
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;
}
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)) {
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, grant->get_rnti()) != 1) {
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, grant->get_rnti())) {
return false;
}
return grant->create_from_dci(&dci_msg, cell, 0, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
return grant->create_from_dci(&dci_msg, cell, 0, params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET));
}
}
}
void dl_buffer::set_rar_grant(uint8_t grant[SRSLTE_RAR_GRANT_LEN])
{
srslte_dci_rar_grant_t rar_grant;
}
bool dl_buffer::get_dl_grant(pdcch_dl_search_t mode, dl_sched_grant *grant)
void dl_buffer::set_rar_grant(srslte_dci_rar_grant_t* rar_grant_)
{
printf("Set pending RAR grant tti=%d\n", tti);
pending_rar_grant = true;
memcpy(&rar_grant, rar_grant_, sizeof(srslte_dci_rar_grant_t));
}
bool dl_buffer::get_dl_grant(dl_sched_grant *grant)
{
if (signal_buffer && is_ready()) {
INFO("DL Buffer TTI %d: Getting DL grant\n", tti);
@ -157,6 +180,11 @@ bool dl_buffer::decode_ack(ul_sched_grant *grant)
}
bool dl_buffer::decode_data(dl_sched_grant *grant, uint8_t *payload)
{
return decode_data(grant, &ue_dl.softbuffer, payload);
}
bool dl_buffer::decode_data(dl_sched_grant *grant, srslte_softbuffer_rx_t *softbuffer, uint8_t *payload)
{
if (signal_buffer && is_ready()) {
INFO("DL Buffer TTI %d: Decoding PDSCH\n", tti);
@ -170,7 +198,7 @@ bool dl_buffer::decode_data(dl_sched_grant *grant, uint8_t *payload)
grant->get_pdsch_cfg(tti%10, &ue_dl.pdsch_cfg);
if (ue_dl.pdsch_cfg.grant.mcs.mod > 0 && ue_dl.pdsch_cfg.grant.mcs.tbs >= 0) {
int ret = srslte_pdsch_decode_rnti(&ue_dl.pdsch, &ue_dl.pdsch_cfg, &ue_dl.softbuffer, ue_dl.sf_symbols,
int ret = srslte_pdsch_decode_rnti(&ue_dl.pdsch, &ue_dl.pdsch_cfg, softbuffer, ue_dl.sf_symbols,
ue_dl.ce, 0, grant->get_rnti(), payload);
if (SRSLTE_VERBOSE_ISINFO()) {

@ -114,10 +114,16 @@ void phy::set_param(phy_params::phy_param_t param, int64_t value) {
// FIXME: Add PRACH power control
bool phy::send_prach(uint32_t preamble_idx)
bool phy::send_prach(uint32_t preamble_idx) {
send_prach(preamble_idx, -1, 0);
}
bool phy::send_prach(uint32_t preamble_idx, int allowed_subframe) {
send_prach(preamble_idx, allowed_subframe, 0);
}
bool phy::send_prach(uint32_t preamble_idx, int allowed_subframe, int target_power_dbm)
{
if (phy_state == RXTX) {
return prach_buffer.prepare_to_send(preamble_idx);
return prach_buffer.prepare_to_send(preamble_idx, allowed_subframe, target_power_dbm);
}
return false;
}
@ -209,16 +215,14 @@ bool phy::set_cell(srslte_cell_t cell_) {
{
srslte_ue_sync_set_cfo(&ue_sync, cellsearch_cfo);
if (prach_buffer.init_cell(cell, &params_db)) {
for(uint32_t i=0;i<6;i++) {
((ul_buffer*) ul_buffer_queue->get(i))->init_cell(cell, &params_db);
((dl_buffer*) dl_buffer_queue->get(i))->init_cell(cell, &params_db);
((dl_buffer*) dl_buffer_queue->get(i))->buffer_id = i;
((ul_buffer*) ul_buffer_queue->get(i))->ready();
((dl_buffer*) dl_buffer_queue->get(i))->release();
}
cell_is_set = true;
}
for(uint32_t i=0;i<6;i++) {
((ul_buffer*) ul_buffer_queue->get(i))->init_cell(cell, &params_db);
((dl_buffer*) dl_buffer_queue->get(i))->init_cell(cell, &params_db);
((dl_buffer*) dl_buffer_queue->get(i))->buffer_id = i;
((ul_buffer*) ul_buffer_queue->get(i))->ready();
((dl_buffer*) dl_buffer_queue->get(i))->release();
}
cell_is_set = true;
} else {
fprintf(stderr, "Error setting cell: initiating ue_sync");
}
@ -231,6 +235,10 @@ bool phy::set_cell(srslte_cell_t cell_) {
return cell_is_set;
}
bool phy::init_prach() {
return prach_buffer.init_cell(cell, &params_db);
}
ul_buffer* phy::get_ul_buffer(uint32_t tti)
{
return (ul_buffer*) ul_buffer_queue->get(tti);

@ -85,10 +85,17 @@ bool prach::init_cell(srslte_cell_t cell_, phy_params *params_db_)
return initiated;
}
bool prach::prepare_to_send(uint32_t preamble_idx_)
bool prach::prepare_to_send(uint32_t preamble_idx_) {
prepare_to_send(preamble_idx_, -1, 0);
}
bool prach::prepare_to_send(uint32_t preamble_idx_, int allowed_subframe_) {
prepare_to_send(preamble_idx_, allowed_subframe_, 0);
}
bool prach::prepare_to_send(uint32_t preamble_idx_, int allowed_subframe_, int target_power_dbm)
{
if (initiated && preamble_idx_ < 64) {
preamble_idx = preamble_idx_;
allowed_subframe = allowed_subframe_;
transmitted_tti = -1;
INFO("PRACH Buffer: Prepare to send preamble %d\n", preamble_idx);
return true;
@ -112,7 +119,9 @@ bool prach::is_ready_to_send(uint32_t current_tti_) {
srslte_prach_sf_config_t sf_config;
srslte_prach_sf_config(config_idx, &sf_config);
for (int i=0;i<sf_config.nof_sf;i++) {
if ((current_tti%10) == sf_config.sf[i]) {
if ((current_tti%10) == sf_config.sf[i] && allowed_subframe == -1 ||
((current_tti%10) == sf_config.sf[i] && (current_tti%10) == allowed_subframe))
{
INFO("PRACH Buffer: Ready to send at tti: %d (now is %d)\n", current_tti, current_tti_);
transmitted_tti = current_tti;
return true;

@ -79,6 +79,16 @@ bool ul_buffer::generate_ack(bool ack[2])
uci_pending = true;
}
void ul_buffer::set_current_tx_nb(uint32_t current_tx_nb_)
{
current_tx_nb = current_tx_nb_;
}
bool ul_buffer::generate_cqi_report()
{
return false;
}
bool ul_buffer::generate_sr() {
uci_data.scheduling_request = true;
uci_pending = true;
@ -95,6 +105,11 @@ bool ul_buffer::generate_data() {
bool ul_buffer::generate_data(ul_sched_grant *grant,
uint8_t *payload)
{
generate_data(grant, &ue_ul.softbuffer, payload);
}
bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *softbuffer, uint8_t *payload)
{
if (is_ready()) {

@ -263,7 +263,7 @@ void run_tti(uint32_t tti) {
INFO("Interval=%u\n", interval_ra);
if (interval_ra >= 3 && interval_ra <= 13) {
// Get DL grant for RA-RNTI=2
if (dl_buffer->get_dl_grant(srslte::ue::dl_buffer::PDCCH_DL_SEARCH_RARNTI, &rar_grant))
if (dl_buffer->get_dl_grant(&rar_grant))
{
// Decode packet
if (dl_buffer->decode_data(&rar_grant, payload)) {
@ -366,7 +366,7 @@ void run_tti(uint32_t tti) {
srslte::ue::dl_sched_grant conn_setup_grant(rar_msg.temp_c_rnti);
bool connsetup_recv = false;
// Get DL grant for tmp_rnti
if (dl_buffer->get_dl_grant(srslte::ue::dl_buffer::PDCCH_DL_SEARCH_TEMPORAL, &conn_setup_grant))
if (dl_buffer->get_dl_grant(&conn_setup_grant))
{
// Decode packet
if (dl_buffer->decode_data(&conn_setup_grant, payload)) {

@ -101,7 +101,7 @@ void run_tti(uint32_t tti) {
srslte::ue::dl_buffer *buffer = phy.get_dl_buffer(tti);
// Get DL grant
if (buffer->get_dl_grant(srslte::ue::dl_buffer::PDCCH_DL_SEARCH_SIRNTI, &grant))
if (buffer->get_dl_grant(&grant))
{
total_dci++;
// MAC sets RV

Loading…
Cancel
Save