Changed a few names. Initial UE PHY itf draft

master
ismagom 10 years ago
parent 6d51de5ed6
commit 7b8a00ce9b

@ -139,7 +139,7 @@ int main(int argc, char **argv) {
srslte_ue_sync_t ue_sync;
srslte_ue_mib_t ue_mib;
void *uhd;
srs_ue_dl_t ue_dl;
srslte_ue_dl_t ue_dl;
srslte_ofdm_t fft;
srslte_chest_dl_t chest;
uint32_t nframes=0;
@ -194,7 +194,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error initiating ue_sync\n");
return -1;
}
if (srs_ue_dl_init(&ue_dl, cell)) {
if (srslte_ue_dl_init(&ue_dl, cell)) {
fprintf(stderr, "Error initiating UE downlink processing module\n");
return -1;
}
@ -204,7 +204,7 @@ int main(int argc, char **argv) {
}
/* Configure downlink receiver for the SI-RNTI since will be the only one we'll use */
srs_ue_dl_set_rnti(&ue_dl, SRSLTE_SIRNTI);
srslte_ue_dl_set_rnti(&ue_dl, SRSLTE_SIRNTI);
/* Initialize subframe counter */
sf_cnt = 0;
@ -259,7 +259,7 @@ int main(int argc, char **argv) {
case DECODE_SIB:
/* We are looking for SI Blocks, search only in appropiate places */
if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {
n = srs_ue_dl_decode_rnti_rv(&ue_dl, sf_buffer, data, srslte_ue_sync_get_sfidx(&ue_sync), SRSLTE_SIRNTI,
n = srslte_ue_dl_decode_rnti_rv(&ue_dl, sf_buffer, data, srslte_ue_sync_get_sfidx(&ue_sync), SRSLTE_SIRNTI,
((int) ceilf((float)3*(((sfn)/2)%4)/2))%4);
if (n < 0) {
fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);

@ -314,7 +314,7 @@ uint32_t prbset_to_bitmask() {
}
int update_radl(uint32_t sf_idx) {
srslte_srslte_ra_dl_alloc_t prb_alloc;
srslte_ra_dl_alloc_t prb_alloc;
bzero(&ra_dl, sizeof(srslte_ra_pdsch_t));
ra_dl.harq_process = 0;

@ -218,7 +218,7 @@ extern float mean_exec_time;
enum receiver_state { DECODE_MIB, DECODE_PDSCH} state;
srs_ue_dl_t ue_dl;
srslte_ue_dl_t ue_dl;
srslte_ue_sync_t ue_sync;
prog_args_t prog_args;
@ -326,13 +326,13 @@ int main(int argc, char **argv) {
#endif
}
if (srs_ue_dl_init(&ue_dl, cell)) { // This is the User RNTI
if (srslte_ue_dl_init(&ue_dl, cell)) { // This is the User RNTI
fprintf(stderr, "Error initiating UE downlink processing module\n");
exit(-1);
}
/* Configure downlink receiver for the SI-RNTI since will be the only one we'll use */
srs_ue_dl_set_rnti(&ue_dl, prog_args.rnti);
srslte_ue_dl_set_rnti(&ue_dl, prog_args.rnti);
/* Initialize subframe counter */
sf_cnt = 0;
@ -398,9 +398,9 @@ int main(int argc, char **argv) {
}
if (decode_pdsch) {
if (prog_args.rnti != SRSLTE_SIRNTI) {
n = srs_ue_dl_decode(&ue_dl, sf_buffer, data_packed, srslte_ue_sync_get_sfidx(&ue_sync));
n = srslte_ue_dl_decode(&ue_dl, sf_buffer, data_packed, srslte_ue_sync_get_sfidx(&ue_sync));
} else {
n = srs_ue_dl_decode_rnti_rv(&ue_dl, sf_buffer, data_packed, srslte_ue_sync_get_sfidx(&ue_sync), SRSLTE_SIRNTI,
n = srslte_ue_dl_decode_rnti_rv(&ue_dl, sf_buffer, data_packed, srslte_ue_sync_get_sfidx(&ue_sync), SRSLTE_SIRNTI,
((int) ceilf((float)3*(((sfn)/2)%4)/2))%4);
}
if (n < 0) {
@ -490,7 +490,7 @@ int main(int argc, char **argv) {
sf_cnt++;
} // Main loop
srs_ue_dl_free(&ue_dl);
srslte_ue_dl_free(&ue_dl);
srslte_ue_sync_free(&ue_sync);
#ifndef DISABLE_UHD

@ -184,7 +184,7 @@ enum receiver_state { DECODE_MIB, SEND_PRACH, RECV_RAR, RECV_CONNSETUP} state;
#define NOF_PRACH_SEQUENCES 52
srs_ue_dl_t ue_dl;
srslte_ue_dl_t ue_dl;
srslte_ue_ul_t ue_ul;
srslte_ue_sync_t ue_sync;
srslte_prach_t prach;
@ -413,7 +413,7 @@ int main(int argc, char **argv) {
}
bzero(ul_signal, sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
if (srs_ue_dl_init(&ue_dl, cell)) {
if (srslte_ue_dl_init(&ue_dl, cell)) {
fprintf(stderr, "Error initiating UE downlink processing module\n");
exit(-1);
}
@ -522,7 +522,7 @@ int main(int argc, char **argv) {
if ((sfn == rar_window_start && srslte_ue_sync_get_sfidx(&ue_sync) > 3) || sfn > rar_window_start) {
printf("Looking for RAR in sfn: %d sf_idx: %d\n", sfn, srslte_ue_sync_get_sfidx(&ue_sync));
n = srs_ue_dl_decode_rnti(&ue_dl, sf_buffer, data_rx, srslte_ue_sync_get_sfidx(&ue_sync), ra_rnti);
n = srslte_ue_dl_decode_rnti(&ue_dl, sf_buffer, data_rx, srslte_ue_sync_get_sfidx(&ue_sync), ra_rnti);
if (n < 0) {
fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
} else if (n > 0) {
@ -636,7 +636,7 @@ int main(int argc, char **argv) {
//srslte_verbose=SRSLTE_VERBOSE_NONE;
}
printf("Looking for ConnectionSetup in sfn: %d sf_idx: %d, RNTI: %d\n", sfn, srslte_ue_sync_get_sfidx(&ue_sync),rar_msg.temp_c_rnti);
n = srs_ue_dl_decode_rnti(&ue_dl, sf_buffer, data_rx, srslte_ue_sync_get_sfidx(&ue_sync), rar_msg.temp_c_rnti);
n = srslte_ue_dl_decode_rnti(&ue_dl, sf_buffer, data_rx, srslte_ue_sync_get_sfidx(&ue_sync), rar_msg.temp_c_rnti);
if (n < 0) {
fprintf(stderr, "Error decoding UE DL\n");fflush(stdout);
} else if (n > 0) {
@ -669,7 +669,7 @@ int main(int argc, char **argv) {
sf_cnt++;
} // Main loop
srs_ue_dl_free(&ue_dl);
srslte_ue_dl_free(&ue_dl);
srslte_ue_sync_free(&ue_sync);
srslte_ue_mib_free(&ue_mib);

@ -47,8 +47,8 @@ typedef struct SRSLTE_API {
srslte_ra_mcs_t mcs;
uint32_t rv;
uint32_t sf_idx;
srslte_srslte_ra_dl_alloc_t dl_alloc;
srslte_srslte_ra_ul_alloc_t ul_alloc;
srslte_ra_dl_alloc_t dl_alloc;
srslte_ra_ul_alloc_t ul_alloc;
srslte_cell_t cell;
uint32_t nof_re; // Number of RE per subframe
@ -72,13 +72,13 @@ SRSLTE_API int srslte_harq_setup_dl(srslte_harq_t *p,
srslte_ra_mcs_t mcs,
uint32_t rv,
uint32_t sf_idx,
srslte_srslte_ra_dl_alloc_t *prb_alloc);
srslte_ra_dl_alloc_t *prb_alloc);
SRSLTE_API int srslte_harq_setup_ul(srslte_harq_t *p,
srslte_ra_mcs_t mcs,
uint32_t rv,
uint32_t sf_idx,
srslte_srslte_ra_ul_alloc_t *prb_alloc);
srslte_ra_ul_alloc_t *prb_alloc);
SRSLTE_API void srslte_harq_reset(srslte_harq_t *p);

@ -52,6 +52,11 @@ typedef _Complex float cf_t;
#define SRSLTE_PHICH_NORM_NSF 4
#define SRSLTE_PHICH_EXT_NSF 2
typedef struct SRSLTE_API {
uint32_t ngroup;
uint32_t nseq;
}srslte_phich_alloc_t;
/* phich object */
typedef struct SRSLTE_API {
srslte_cell_t cell;

@ -83,14 +83,14 @@ typedef struct SRSLTE_API {
srslte_ra_prb_slot_t slot[2];
uint32_t lstart;
uint32_t re_sf[SRSLTE_NSUBFRAMES_X_FRAME];
} srslte_srslte_ra_dl_alloc_t;
} srslte_ra_dl_alloc_t;
typedef struct SRSLTE_API {
uint32_t n_prb[2];
uint32_t n_prb_tilde[2];
uint32_t L_prb;
uint32_t freq_hopping;
} srslte_srslte_ra_ul_alloc_t;
} srslte_ra_ul_alloc_t;
typedef struct SRSLTE_API {
uint16_t rnti;
@ -100,7 +100,7 @@ typedef struct SRSLTE_API {
srslte_ra_type1_t type1_alloc;
srslte_ra_type2_t type2_alloc;
};
srslte_srslte_ra_dl_alloc_t prb_alloc;
srslte_ra_dl_alloc_t prb_alloc;
uint32_t mcs_idx;
srslte_ra_mcs_t mcs;
uint32_t harq_process;
@ -120,13 +120,13 @@ typedef struct SRSLTE_API {
SRSLTE_RA_PUSCH_HOP_TYPE2 = 3
} freq_hop_fl;
srslte_srslte_ra_ul_alloc_t prb_alloc;
srslte_ra_ul_alloc_t prb_alloc;
srslte_ra_type2_t type2_alloc;
uint32_t mcs_idx;
srslte_ra_mcs_t mcs;
uint32_t rv_idx; // If set to non-zero, a retransmission is requested with the same modulation
// than before (SRSLTE_DCI_FORMAT0 message, see also 8.6.1 in 36.2313).
// than before (SRSLTE_DCI_FORMAT0 message, see also 8.6.1 in 36.2313).
bool ndi;
bool cqi_request;
@ -136,16 +136,16 @@ SRSLTE_API void srslte_ra_prb_fprint(FILE *f,
srslte_ra_prb_slot_t *prb,
uint32_t nof_prb);
SRSLTE_API int srslte_ra_dl_alloc(srslte_srslte_ra_dl_alloc_t *prb,
SRSLTE_API int srslte_ra_dl_alloc(srslte_ra_dl_alloc_t *prb,
srslte_ra_pdsch_t *ra,
uint32_t nof_prb);
SRSLTE_API int srslte_ra_ul_alloc(srslte_srslte_ra_ul_alloc_t *prb,
SRSLTE_API int srslte_ra_ul_alloc(srslte_ra_ul_alloc_t *prb,
srslte_ra_pusch_t *ra,
uint32_t n_rb_ho,
uint32_t nof_prb);
SRSLTE_API void srslte_ra_dl_alloc_re(srslte_srslte_ra_dl_alloc_t *prb_dist,
SRSLTE_API void srslte_ra_dl_alloc_re(srslte_ra_dl_alloc_t *prb_dist,
uint32_t nof_prb,
uint32_t nof_ports,
uint32_t nof_ctrl_symbols,
@ -165,7 +165,7 @@ SRSLTE_API int srslte_ra_mcs_from_idx_ul(uint32_t mcs_idx,
uint32_t nof_prb,
srslte_ra_mcs_t *mcs);
SRSLTE_API int srslte_srslte_ra_tbs_from_idx_format1c(uint32_t tbs_idx);
SRSLTE_API int srslte_ra_tbs_from_idx_format1c(uint32_t tbs_idx);
SRSLTE_API int srslte_ra_tbs_from_idx(uint32_t tbs_idx,
uint32_t n_prb);

@ -76,54 +76,54 @@ typedef struct SRSLTE_API {
uint64_t nof_detected;
uint16_t current_rnti;
}srs_ue_dl_t;
}srslte_ue_dl_t;
/* This function shall be called just after the initial synchronization */
SRSLTE_API int srs_ue_dl_init(srs_ue_dl_t *q,
srslte_cell_t cell);
SRSLTE_API void srs_ue_dl_free(srs_ue_dl_t *q);
SRSLTE_API int srs_ue_dl_decode_fft_estimate(srs_ue_dl_t *q,
cf_t *input,
uint32_t sf_idx,
uint32_t *cfi);
SRSLTE_API int srs_ue_dl_decode_rnti_rv_packet(srs_ue_dl_t *q,
srslte_dci_msg_t *dci_msg,
uint8_t *data,
uint32_t cfi,
uint32_t sf_idx,
uint16_t rnti,
uint32_t rvidx);
SRSLTE_API int srs_ue_dl_find_ul_dci(srs_ue_dl_t *q,
srslte_dci_msg_t *dci_msg,
uint32_t cfi,
uint32_t sf_idx,
uint16_t rnti);
SRSLTE_API int srs_ue_dl_decode(srs_ue_dl_t * q,
cf_t *input,
uint8_t *data,
uint32_t sf_idx);
SRSLTE_API int srs_ue_dl_decode_rnti(srs_ue_dl_t * q,
cf_t *input,
uint8_t *data,
uint32_t sf_idx,
uint16_t rnti);
SRSLTE_API int srs_ue_dl_decode_rnti_rv(srs_ue_dl_t * q,
cf_t *input,
uint8_t * data,
SRSLTE_API int srslte_ue_dl_init(srslte_ue_dl_t *q,
srslte_cell_t cell);
SRSLTE_API void srslte_ue_dl_free(srslte_ue_dl_t *q);
SRSLTE_API int srslte_ue_dl_decode_fft_estimate(srslte_ue_dl_t *q,
cf_t *input,
uint32_t sf_idx,
uint32_t *cfi);
SRSLTE_API int srslte_ue_dl_decode_rnti_rv_packet(srslte_ue_dl_t *q,
srslte_dci_msg_t *dci_msg,
uint8_t *data,
uint32_t cfi,
uint32_t sf_idx,
uint16_t rnti,
uint32_t rvidx);
SRSLTE_API int srslte_ue_dl_find_ul_dci(srslte_ue_dl_t *q,
srslte_dci_msg_t *dci_msg,
uint32_t cfi,
uint32_t sf_idx,
uint16_t rnti,
uint32_t rvidx);
uint16_t rnti);
SRSLTE_API int srslte_ue_dl_decode(srslte_ue_dl_t * q,
cf_t *input,
uint8_t *data,
uint32_t sf_idx);
SRSLTE_API int srslte_ue_dl_decode_rnti(srslte_ue_dl_t * q,
cf_t *input,
uint8_t *data,
uint32_t sf_idx,
uint16_t rnti);
SRSLTE_API 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_API void srs_ue_dl_reset(srs_ue_dl_t *q);
SRSLTE_API void srslte_ue_dl_reset(srslte_ue_dl_t *q);
SRSLTE_API void srs_ue_dl_set_rnti(srs_ue_dl_t *q,
uint16_t rnti);
SRSLTE_API void srslte_ue_dl_set_rnti(srslte_ue_dl_t *q,
uint16_t rnti);
#endif

@ -1,6 +0,0 @@
class srslte_ue_mac_itf
{
public:
virtual void ready_to_send() = 0;
};

@ -25,139 +25,103 @@
*
*/
#include "ue_mac_itf.h"
#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 srslte_ue_phy
class ue_phy
{
public:
class pdcch_ul_search : public queue::element {
public:
set_crnti(uint16_t rnti);
set_crnti_ra_procedure(uint16_t rnti);
set_sps_crnti(uint16_t rnti);
set_temporal_crnti(uint16_t rnti);
set_tpc_pusch(uint16_t rnti);
set_tpc_pucch(uint16_t rnti);
private:
uint16_t rnti;
bool is_crnti = false;
bool is_crnti_ra_procedure = false;
bool is_sps_crnti = false;
bool is_t_crnti = false;
bool is_tpc_pusch = false;
bool is_tpc_pucch = false;
};
class dl_search : public queue::element {
public:
set_crnti(uint16_t rnti);
set_crnti_ra_procedure(uint16_t rnti);
set_sps_crnti(uint16_t rnti);
set_temporal_crnti(uint16_t rnti);
set_tpc_pusch(uint16_t rnti);
set_tpc_pucch(uint16_t rnti);
private:
uint16_t rnti;
bool is_crnti = false;
bool is_crnti_ra_procedure = false;
bool is_sps_crnti = false;
bool is_t_crnti = false;
bool is_tpc_pusch = false;
bool is_tpc_pucch = false;
};
class ul_allocation {
};
class ul_assignment : public queue::element {
public:
ul_assignment(uint32_t nof_prb, uint32_t max_ulsch_bits);
void set_allocation(ul_allocation allocation);
uint8_t* get_ulsch_buffer();
cf_t* get_signal_buffer();
void set_uci_data();
void generate_signal();
private:
cf_t* signal_buffer = NULL;
uint8_t* ulsch_buffer;
ul_allocation allocation;
};
class dl_allocation {
};
typedef enum {DOWNLINK, UPLINK} direction_t;
class dl_assignment : public queue::element {
public:
void set_allocation(dl_allocation allocation);
private:
dl_allocation allocation;
};
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;
class phich_assignment {
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;
};
class phich_assignment : public queue::element {
/* Uplink/Downlink scheduling grant generated by a successfully decoded PDCCH */
class sched_grant {
public:
phich_assignment();
void set_allocation(phich_assignment assignment);
private:
phich_assignment assignment;
};
class dl_tb : public queue::element {
public:
dl_tb(uint32_t max_dlsch_bits);
uint16_t get_rnti();
bool is_srslte_crc_valid();
uint8_t* get_dlsch_payload();
private:
uint8_t* dlsch_buffer;
uint16_t rnti;
bool srslte_crc_result;
};
class dl_grant : public queue::element {
public:
dl_allocation get_allocation();
private:
dl_allocation allocation;
};
class ul_grant : public queue::element {
public:
ul_allocation get_allocation();
uint32_t get_rv();
void set_rv(uint32_t rv);
bool get_ndi();
bool get_cqi_request();
uint32_t get_harq_process();
private:
ul_allocation allocation;
union {
srslte_ra_pusch_t ul_grant;
srslte_ra_pdsch_t dl_grant;
};
direction_t dir;
};
class ul_ack : public queue::element {
/* 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 get_ack();
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:
bool ack;
srslte_ue_ul_t ue_ul;
bool signal_generated = false;
cf_t* signal_buffer = NULL;
uint32_t tti = 0;
};
class rx_buffer : public queue::element {
/* 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:
rx_buffer(uint32_t nof_prb);
cf_t* get_signal_buffer();
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:
uint32_t nof_prb;
cf_t* signal_buffer;
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;
};
ue_phy(ue_mac_itf *mac);
#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
@ -167,36 +131,31 @@ public:
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);
pdcch_ul_search* get_pdcch_ul_search(uint32_t tti);
dl_search* get_dl_search(uint32_t tti);
ul_assignment* get_ul_assignment(uint32_t tti);
dl_assignment* get_dl_assignment(uint32_t tti);
phich_assignment* get_phich_assignment(uint32_t tti);
dl_tb* get_dl_tb(uint32_t tti);
dl_grant* get_dl_grant(uint32_t tti);
ul_grant* get_ul_grant(uint32_t tti);
ul_ack* get_ul_ack(uint32_t tti);
private:
enum {
IDLE, MEASURE, RX_BCH, RXTX
} phy_state;
bool srslte_prach_initiated = false;
bool prach_initiated = false;
bool prach_ready_to_send = false;
srslte_prach_t prach;
queue pdcch_ul_search;
queue dl_search;
queue ul_assignment;
queue dl_assignment;
queue phich_assignment;
queue dl_tb;
queue dl_grant;
queue ul_grant;
queue ul_grant;
queue rx_buffer;
queue ul_buffer_queue;
queue dl_buffer_queue;
pthread_t radio_thread;
void *radio_handler;
};
}
#endif

@ -123,7 +123,7 @@ SRSLTE_API int srslte_ue_sync_get_buffer(srslte_ue_sync_t *q,
SRSLTE_API void srslte_ue_sync_reset(srslte_ue_sync_t *q);
SRSLTE_API void ue_srslte_sync_set_N_id_2(srslte_ue_sync_t *q,
SRSLTE_API void srslte_ue_sync_set_N_id_2(srslte_ue_sync_t *q,
uint32_t N_id_2);
SRSLTE_API void srslte_ue_sync_decode_sss_on_track(srslte_ue_sync_t *q,

@ -25,12 +25,12 @@
*
*/
#include "ue_mac_itf.h"
#ifndef QUEUE_H
#define QUEUE_H
class srslte_queue
namespace srslte {
class queue
{
public:
@ -80,5 +80,7 @@ private:
void **buffer_of_elements;
};
}
#endif

@ -756,7 +756,7 @@ int dci_format1Cs_unpack(srslte_dci_msg_t *msg, srslte_ra_pdsch_t *data, uint32_
data->type2_alloc.riv = riv;
data->mcs_idx = srslte_bit_unpack(&y, 5);
data->mcs.tbs = srslte_srslte_ra_tbs_from_idx_format1c(data->mcs_idx);
data->mcs.tbs = srslte_ra_tbs_from_idx_format1c(data->mcs_idx);
data->mcs.mod = SRSLTE_MOD_QPSK;
msg->nof_bits = (y - msg->data);

@ -180,7 +180,7 @@ void srslte_harq_reset(srslte_harq_t *q) {
}
bzero(&q->mcs, sizeof(srslte_ra_mcs_t));
bzero(&q->cb_segm, sizeof(srslte_harq_cbsegm_t));
bzero(&q->dl_alloc, sizeof(srslte_srslte_ra_dl_alloc_t));
bzero(&q->dl_alloc, sizeof(srslte_ra_dl_alloc_t));
}
static int harq_setup_common(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uint32_t sf_idx) {
@ -199,7 +199,7 @@ static int harq_setup_common(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv,
return SRSLTE_SUCCESS;
}
int srslte_harq_setup_dl(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uint32_t sf_idx, srslte_srslte_ra_dl_alloc_t *dl_alloc) {
int srslte_harq_setup_dl(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uint32_t sf_idx, srslte_ra_dl_alloc_t *dl_alloc) {
int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL &&
@ -210,7 +210,7 @@ int srslte_harq_setup_dl(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uin
if (ret) {
return ret;
}
memcpy(&q->dl_alloc, dl_alloc, sizeof(srslte_srslte_ra_dl_alloc_t));
memcpy(&q->dl_alloc, dl_alloc, sizeof(srslte_ra_dl_alloc_t));
// Number of symbols, RE and bits per subframe for DL
q->nof_re = q->dl_alloc.re_sf[q->sf_idx];
@ -223,7 +223,7 @@ int srslte_harq_setup_dl(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uin
return ret;
}
int srslte_harq_setup_ul(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uint32_t sf_idx, srslte_srslte_ra_ul_alloc_t *ul_alloc) {
int srslte_harq_setup_ul(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uint32_t sf_idx, srslte_ra_ul_alloc_t *ul_alloc) {
int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL &&
@ -234,7 +234,7 @@ int srslte_harq_setup_ul(srslte_harq_t *q, srslte_ra_mcs_t mcs, uint32_t rv, uin
if (ret) {
return ret;
}
memcpy(&q->ul_alloc, ul_alloc, sizeof(srslte_srslte_ra_ul_alloc_t));
memcpy(&q->ul_alloc, ul_alloc, sizeof(srslte_ra_ul_alloc_t));
// Number of symbols, RE and bits per subframe for UL
q->nof_symb = 2*(SRSLTE_CP_NSYMB(q->cell.cp)-1);

@ -58,7 +58,7 @@ extern int indices_ptr;
#endif
int srslte_pdsch_cp(srslte_pdsch_t *q, cf_t *input, cf_t *output, srslte_srslte_ra_dl_alloc_t *prb_alloc,
int srslte_pdsch_cp(srslte_pdsch_t *q, cf_t *input, cf_t *output, srslte_ra_dl_alloc_t *prb_alloc,
uint32_t nsubframe, bool put) {
uint32_t s, n, l, lp, lstart, lend, nof_refs;
bool is_pbch, is_sss;
@ -179,7 +179,7 @@ int srslte_pdsch_cp(srslte_pdsch_t *q, cf_t *input, cf_t *output, srslte_srslte_
* 36.211 10.3 section 6.3.5
*/
int srslte_pdsch_put(srslte_pdsch_t *q, cf_t *symbols, cf_t *sf_symbols,
srslte_srslte_ra_dl_alloc_t *prb_alloc, uint32_t subframe) {
srslte_ra_dl_alloc_t *prb_alloc, uint32_t subframe) {
return srslte_pdsch_cp(q, symbols, sf_symbols, prb_alloc, subframe, true);
}
@ -191,7 +191,7 @@ int srslte_pdsch_put(srslte_pdsch_t *q, cf_t *symbols, cf_t *sf_symbols,
* 36.211 10.3 section 6.3.5
*/
int srslte_pdsch_get(srslte_pdsch_t *q, cf_t *sf_symbols, cf_t *symbols,
srslte_srslte_ra_dl_alloc_t *prb_alloc, uint32_t subframe) {
srslte_ra_dl_alloc_t *prb_alloc, uint32_t subframe) {
return srslte_pdsch_cp(q, sf_symbols, symbols, prb_alloc, subframe, false);
}

@ -122,9 +122,9 @@ void srslte_ra_prb_fprint(FILE *f, srslte_ra_prb_slot_t *prb, uint32_t nof_prb)
}
/** Compute PRB allocation for Uplink as defined in 8.1 and 8.4 of 36.213 */
int srslte_ra_ul_alloc(srslte_srslte_ra_ul_alloc_t *prb_dist, srslte_ra_pusch_t *ra, uint32_t n_rb_ho, uint32_t nof_prb) {
int srslte_ra_ul_alloc(srslte_ra_ul_alloc_t *prb_dist, srslte_ra_pusch_t *ra, uint32_t n_rb_ho, uint32_t nof_prb) {
bzero(prb_dist, sizeof(srslte_srslte_ra_ul_alloc_t));
bzero(prb_dist, sizeof(srslte_ra_ul_alloc_t));
prb_dist->L_prb = ra->type2_alloc.L_crb;
uint32_t n_prb_1 = ra->type2_alloc.RB_start;
uint32_t n_rb_pusch = 0;
@ -184,7 +184,7 @@ int srslte_ra_ul_alloc(srslte_srslte_ra_ul_alloc_t *prb_dist, srslte_ra_pusch_t
}
/* Computes the number of RE for each PRB in the prb_dist structure */
void srslte_ra_dl_alloc_re(srslte_srslte_ra_dl_alloc_t *prb_dist, uint32_t nof_prb, uint32_t nof_ports,
void srslte_ra_dl_alloc_re(srslte_ra_dl_alloc_t *prb_dist, uint32_t nof_prb, uint32_t nof_ports,
uint32_t nof_ctrl_symbols, srslte_cp_t cp) {
uint32_t i, j, s;
@ -205,13 +205,13 @@ void srslte_ra_dl_alloc_re(srslte_srslte_ra_dl_alloc_t *prb_dist, uint32_t nof_p
}
/** Compute PRB allocation for Downlink as defined in 7.1.6 of 36.213 */
int srslte_ra_dl_alloc(srslte_srslte_ra_dl_alloc_t *prb_dist, srslte_ra_pdsch_t *ra, uint32_t nof_prb) {
int srslte_ra_dl_alloc(srslte_ra_dl_alloc_t *prb_dist, srslte_ra_pdsch_t *ra, uint32_t nof_prb) {
int i, j;
uint32_t bitmask;
uint32_t P = srslte_ra_type0_P(nof_prb);
uint32_t n_rb_rbg_subset, n_rb_type1;
bzero(prb_dist, sizeof(srslte_srslte_ra_dl_alloc_t));
bzero(prb_dist, sizeof(srslte_ra_dl_alloc_t));
switch (ra->alloc_type) {
case SRSLTE_RA_ALLOC_TYPE0:
bitmask = ra->type0_alloc.rbg_bitmask;
@ -487,7 +487,7 @@ int srslte_ra_mcs_from_idx_ul(uint32_t mcs_idx, uint32_t nof_prb, srslte_ra_mcs_
}
/* Downlink Transport Block size for Format 1C as defined in 7.1.7.2.2-1 on 36.213 */
int srslte_srslte_ra_tbs_from_idx_format1c(uint32_t tbs_idx) {
int srslte_ra_tbs_from_idx_format1c(uint32_t tbs_idx) {
if (tbs_idx < 32) {
return tbs_format1c_table[tbs_idx];
} else {
@ -603,7 +603,7 @@ void srslte_ra_pdsch_fprint(FILE *f, srslte_ra_pdsch_t *ra, uint32_t nof_prb) {
break;
}
srslte_srslte_ra_dl_alloc_t alloc;
srslte_ra_dl_alloc_t alloc;
srslte_ra_dl_alloc(&alloc, ra, nof_prb);
for (int s = 0; s < 2; s++) {
fprintf(f, " - PRB Bitmap Assignment %dst slot:\n", s);

@ -47,7 +47,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
srslte_sch_t dlsch;
uint8_t *trblkin;
srslte_ra_mcs_t mcs;
srslte_srslte_ra_dl_alloc_t prb_alloc;
srslte_ra_dl_alloc_t prb_alloc;
srslte_harq_t harq_process;
uint32_t rv;

@ -132,7 +132,7 @@ int main(int argc, char **argv) {
int ret = -1;
struct timeval t[3];
srslte_ra_mcs_t mcs;
srslte_srslte_ra_dl_alloc_t prb_alloc;
srslte_ra_dl_alloc_t prb_alloc;
srslte_harq_t harq_process;
uint32_t rv;

@ -58,7 +58,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
cf_t *input_fft, *input_signal;
int nof_re;
srslte_ra_mcs_t mcs;
srslte_srslte_ra_dl_alloc_t dl_alloc;
srslte_ra_dl_alloc_t dl_alloc;
srslte_harq_t harq_process;
uint32_t rv;
uint32_t rnti32;

@ -109,8 +109,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return;
}
srslte_srslte_ra_ul_alloc_t prb_alloc;
bzero(&prb_alloc, sizeof(srslte_srslte_ra_ul_alloc_t));
srslte_ra_ul_alloc_t prb_alloc;
bzero(&prb_alloc, sizeof(srslte_ra_ul_alloc_t));
prb_alloc.L_prb = mexutils_read_f(p, &prbset);
prb_alloc.n_prb[0] = prbset[0];
prb_alloc.n_prb[1] = prbset[0];

@ -136,7 +136,7 @@ int main(int argc, char **argv) {
int ret = -1;
struct timeval t[3];
srslte_ra_mcs_t mcs;
srslte_srslte_ra_ul_alloc_t prb_alloc;
srslte_ra_ul_alloc_t prb_alloc;
srslte_harq_t harq_process;
parse_args(argc,argv);
@ -144,7 +144,7 @@ int main(int argc, char **argv) {
mcs.tbs = tbs;
mcs.mod = modulation;
bzero(&prb_alloc, sizeof(srslte_srslte_ra_ul_alloc_t));
bzero(&prb_alloc, sizeof(srslte_ra_ul_alloc_t));
if (srslte_pusch_init(&pusch, cell)) {
fprintf(stderr, "Error creating PDSCH object\n");

@ -49,7 +49,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
srslte_sch_t ulsch;
uint8_t *trblkin;
srslte_ra_mcs_t mcs;
srslte_srslte_ra_ul_alloc_t prb_alloc;
srslte_ra_ul_alloc_t prb_alloc;
srslte_harq_t harq_process;
uint32_t rv;
srslte_uci_data_t uci_data;

@ -218,7 +218,7 @@ int srslte_ue_cellsearch_scan_N_id_2(srslte_ue_cellsearch_t * q, uint32_t N_id_2
{
ret = SRSLTE_SUCCESS;
ue_srslte_sync_set_N_id_2(&q->ue_sync, N_id_2);
srslte_ue_sync_set_N_id_2(&q->ue_sync, N_id_2);
srslte_ue_sync_reset(&q->ue_sync);
do {

@ -38,7 +38,7 @@
#define MAX_CANDIDATES 64
int srs_ue_dl_init(srs_ue_dl_t *q,
int srslte_ue_dl_init(srslte_ue_dl_t *q,
srslte_cell_t cell)
{
int ret = SRSLTE_ERROR_INVALID_INPUTS;
@ -48,7 +48,7 @@ int srs_ue_dl_init(srs_ue_dl_t *q,
{
ret = SRSLTE_ERROR;
bzero(q, sizeof(srs_ue_dl_t));
bzero(q, sizeof(srslte_ue_dl_t));
q->cell = cell;
q->pkt_errors = 0;
@ -107,12 +107,12 @@ int srs_ue_dl_init(srs_ue_dl_t *q,
clean_exit:
if (ret == SRSLTE_ERROR) {
srs_ue_dl_free(q);
srslte_ue_dl_free(q);
}
return ret;
}
void srs_ue_dl_free(srs_ue_dl_t *q) {
void srslte_ue_dl_free(srslte_ue_dl_t *q) {
if (q) {
srslte_ofdm_tx_free(&q->fft);
srslte_chest_dl_free(&q->chest);
@ -132,7 +132,7 @@ void srs_ue_dl_free(srs_ue_dl_t *q) {
}
}
bzero(q, sizeof(srs_ue_dl_t));
bzero(q, sizeof(srslte_ue_dl_t));
}
}
@ -141,12 +141,12 @@ void srs_ue_dl_free(srs_ue_dl_t *q) {
* to execute, so shall be called once the final C-RNTI has been allocated for the session.
* For the connection procedure, use srslte_pusch_encode_rnti() or srslte_pusch_decode_rnti() functions
*/
void srs_ue_dl_set_rnti(srs_ue_dl_t *q, uint16_t rnti) {
void srslte_ue_dl_set_rnti(srslte_ue_dl_t *q, uint16_t rnti) {
q->current_rnti = rnti;
srslte_pdsch_set_rnti(&q->pdsch, rnti);
}
void srs_ue_dl_reset(srs_ue_dl_t *q) {
void srslte_ue_dl_reset(srslte_ue_dl_t *q) {
srslte_harq_reset(&q->harq_process[0]);
}
@ -160,18 +160,18 @@ const uint32_t nof_common_formats = 2;
* - OFDM demodulation
* - Channel estimation
* - PCFICH decoding
* - PDCCH decoding: Find DCI for RNTI given by previous call to srs_ue_dl_set_rnti()
* - PDSCH decoding: Decode TB scrambling with RNTI given by srs_ue_dl_set_rnti()
* - PDCCH decoding: Find DCI for RNTI given by previous call to srslte_ue_dl_set_rnti()
* - PDSCH decoding: Decode TB scrambling with RNTI given by srslte_ue_dl_set_rnti()
*/
int srs_ue_dl_decode(srs_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx) {
return srs_ue_dl_decode_rnti_rv(q, input, data, sf_idx, q->current_rnti, 0);
int srslte_ue_dl_decode(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx) {
return srslte_ue_dl_decode_rnti_rv(q, input, data, sf_idx, q->current_rnti, 0);
}
int srs_ue_dl_decode_rnti(srs_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx, uint16_t rnti) {
return srs_ue_dl_decode_rnti_rv(q, input, data, sf_idx, rnti, 0);
int srslte_ue_dl_decode_rnti(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx, uint16_t rnti) {
return srslte_ue_dl_decode_rnti_rv(q, input, data, sf_idx, rnti, 0);
}
int srs_ue_dl_decode_fft_estimate(srs_ue_dl_t *q, cf_t *input, uint32_t sf_idx, uint32_t *cfi) {
int srslte_ue_dl_decode_fft_estimate(srslte_ue_dl_t *q, cf_t *input, uint32_t sf_idx, uint32_t *cfi) {
float cfi_corr;
if (input && q && cfi && sf_idx < SRSLTE_NSUBFRAMES_X_FRAME) {
@ -208,7 +208,7 @@ int srs_ue_dl_decode_fft_estimate(srs_ue_dl_t *q, cf_t *input, uint32_t sf_idx,
}
}
int srs_ue_dl_decode_rnti_rv_packet(srs_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint8_t *data,
int srslte_ue_dl_decode_rnti_rv_packet(srslte_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint8_t *data,
uint32_t cfi, uint32_t sf_idx, uint16_t rnti, uint32_t rvidx)
{
int ret = SRSLTE_ERROR;
@ -245,7 +245,7 @@ int srs_ue_dl_decode_rnti_rv_packet(srs_ue_dl_t *q, srslte_dci_msg_t *dci_msg, u
return ret;
}
int srs_ue_dl_find_ul_dci(srs_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint32_t cfi, uint32_t sf_idx, uint16_t rnti)
int srslte_ue_dl_find_ul_dci(srslte_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint32_t cfi, uint32_t sf_idx, uint16_t rnti)
{
srslte_dci_location_t locations[MAX_CANDIDATES];
uint32_t nof_locations = srslte_pdcch_ue_locations(&q->pdcch, locations, MAX_CANDIDATES, sf_idx, cfi, rnti);
@ -260,7 +260,7 @@ int srs_ue_dl_find_ul_dci(srs_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint32_t cf
return srslte_crc_rem == rnti;
}
int srs_ue_dl_decode_rnti_rv(srs_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx, uint16_t rnti, uint32_t rvidx)
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)
{
uint32_t cfi, i;
srslte_dci_msg_t dci_msg;
@ -271,7 +271,7 @@ int srs_ue_dl_decode_rnti_rv(srs_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_
uint32_t nof_formats;
srslte_dci_format_t *formats = NULL;
if ((ret = srs_ue_dl_decode_fft_estimate(q, input, sf_idx, &cfi)) < 0) {
if ((ret = srslte_ue_dl_decode_fft_estimate(q, input, sf_idx, &cfi)) < 0) {
return ret;
}
@ -300,7 +300,7 @@ int srs_ue_dl_decode_rnti_rv(srs_ue_dl_t *q, cf_t *input, uint8_t *data, uint32_
if (srslte_crc_rem == rnti) {
found_dci++;
ret = srs_ue_dl_decode_rnti_rv_packet(q, &dci_msg, data, cfi, sf_idx, rnti, rvidx);
ret = srslte_ue_dl_decode_rnti_rv_packet(q, &dci_msg, data, cfi, sf_idx, rnti, rvidx);
}
}
}

@ -228,7 +228,7 @@ void srslte_ue_sync_decode_sss_on_track(srslte_ue_sync_t *q, bool enabled) {
q->decode_sss_on_track = enabled;
}
void ue_srslte_sync_set_N_id_2(srslte_ue_sync_t *q, uint32_t N_id_2) {
void srslte_ue_sync_set_N_id_2(srslte_ue_sync_t *q, uint32_t N_id_2) {
if (!q->file_mode) {
srslte_ue_sync_reset(q);
srslte_sync_set_N_id_2(&q->strack, N_id_2);

Loading…
Cancel
Save