adding support for mbsfn subframe configuration to pdsch examples

master
yagoda 7 years ago
parent 61d525ea80
commit 54bdfd83ec

@ -32,10 +32,10 @@ target_link_libraries(synch_file srslte_phy)
if(RF_FOUND) if(RF_FOUND)
add_executable(pdsch_ue pdsch_ue.c) add_executable(pdsch_ue pdsch_ue.c)
target_link_libraries(pdsch_ue srslte_phy srslte_rf pthread) target_link_libraries(pdsch_ue srslte_phy srslte_common srslte_rf pthread)
add_executable(pdsch_enodeb pdsch_enodeb.c) add_executable(pdsch_enodeb pdsch_enodeb.c)
target_link_libraries(pdsch_enodeb srslte_phy srslte_rf pthread) target_link_libraries(pdsch_enodeb srslte_phy srslte_common srslte_rf pthread)
else(RF_FOUND) else(RF_FOUND)
add_definitions(-DDISABLE_RF) add_definitions(-DDISABLE_RF)

@ -35,7 +35,7 @@
#include <signal.h> #include <signal.h>
#include <srslte/phy/common/phy_common.h> #include <srslte/phy/common/phy_common.h>
#include <srslte/phy/phch/pdsch_cfg.h> #include <srslte/phy/phch/pdsch_cfg.h>
#include "srslte/common/gen_mch_tables.h"
#include "srslte/srslte.h" #include "srslte/srslte.h"
@ -79,7 +79,7 @@ char mimo_type_str[32] = "single";
uint32_t nof_tb = 1; uint32_t nof_tb = 1;
uint32_t multiplex_pmi = 0; uint32_t multiplex_pmi = 0;
uint32_t multiplex_nof_layers = 1; uint32_t multiplex_nof_layers = 1;
uint8_t mbsfn_sf_mask = 32;
int mbsfn_area_id = -1; int mbsfn_area_id = -1;
char *rf_args = ""; char *rf_args = "";
float rf_amp = 0.8, rf_gain = 60.0, rf_freq = 2400000000; float rf_amp = 0.8, rf_gain = 60.0, rf_freq = 2400000000;
@ -154,7 +154,7 @@ void usage(char *prog) {
void parse_args(int argc, char **argv) { void parse_args(int argc, char **argv) {
int opt; int opt;
while ((opt = getopt(argc, argv, "aglfmoncpvutxbwMs")) != -1) { while ((opt = getopt(argc, argv, "aglfmoncpvutxbwMsB")) != -1) {
switch (opt) { switch (opt) {
case 'a': case 'a':
@ -206,6 +206,9 @@ void parse_args(int argc, char **argv) {
case 's': case 's':
output_file_snr = atof(argv[optind]); output_file_snr = atof(argv[optind]);
break; break;
case 'B':
mbsfn_sf_mask = atoi(argv[optind]);
break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
@ -257,6 +260,7 @@ void base_init() {
bzero(data[i], sizeof(uint8_t) * SOFTBUFFER_SIZE); bzero(data[i], sizeof(uint8_t) * SOFTBUFFER_SIZE);
} }
data_mbms = srslte_vec_malloc(sizeof(uint8_t) * SOFTBUFFER_SIZE); data_mbms = srslte_vec_malloc(sizeof(uint8_t) * SOFTBUFFER_SIZE);
/* init memory */ /* init memory */
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (i = 0; i < SRSLTE_MAX_PORTS; i++) {
@ -721,6 +725,11 @@ int main(int argc, char **argv) {
parse_args(argc, argv); parse_args(argc, argv);
uint8_t mch_table[10];
bzero(&mch_table[0], sizeof(uint8_t)*10);
if(mbsfn_area_id < -1) {
generate_mcch_table(mch_table, mbsfn_sf_mask);
}
N_id_2 = cell.id % 3; N_id_2 = cell.id % 3;
sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE; sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE;
sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb)); sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb));
@ -848,7 +857,7 @@ int main(int argc, char **argv) {
memcpy(sf_symbols[i], sf_symbols[0], sizeof(cf_t) * sf_n_re); memcpy(sf_symbols[i], sf_symbols[0], sizeof(cf_t) * sf_n_re);
} }
if(sf_idx == 2 && mbsfn_area_id > -1){ if(mch_table[sf_idx] == 1 && mbsfn_area_id > -1){
srslte_refsignal_mbsfn_put_sf(cell, 0,csr_refs.pilots[0][sf_idx], mbsfn_refs.pilots[0][sf_idx], sf_symbols[0]); srslte_refsignal_mbsfn_put_sf(cell, 0,csr_refs.pilots[0][sf_idx], mbsfn_refs.pilots[0][sf_idx], sf_symbols[0]);
} else { } else {
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
@ -869,13 +878,13 @@ int main(int argc, char **argv) {
} }
/* Transmit PDCCH + PDSCH only when there is data to send */ /* Transmit PDCCH + PDSCH only when there is data to send */
if ((net_port > 0) && (sf_idx == 1 || mbsfn_area_id < 0)) { if ((net_port > 0) && (mch_table[sf_idx] == 1 && mbsfn_area_id > -1)) {
send_data = net_packet_ready; send_data = net_packet_ready;
if (net_packet_ready) { if (net_packet_ready) {
INFO("Transmitting packet\n"); INFO("Transmitting packet from port\n");
} }
} else { } else {
printf("SF: %d, Generating %d random bits\n", sf_idx, pdsch_cfg.grant.mcs[0].tbs + pdsch_cfg.grant.mcs[1].tbs); INFO("SF: %d, Generating %d random bits\n", sf_idx, pdsch_cfg.grant.mcs[0].tbs + pdsch_cfg.grant.mcs[1].tbs);
for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) { for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) {
if (pdsch_cfg.grant.tb_en[tb]) { if (pdsch_cfg.grant.tb_en[tb]) {
for (i = 0; i < pdsch_cfg.grant.mcs[tb].tbs / 8; i++) { for (i = 0; i < pdsch_cfg.grant.mcs[tb].tbs / 8; i++) {
@ -891,7 +900,7 @@ int main(int argc, char **argv) {
} }
} }
if (send_data) { if (send_data) {
if(sf_idx != 2 || mbsfn_area_id < 0) { // PDCCH + PDSCH if(mch_table[sf_idx] == 0 || mbsfn_area_id < 0) { // PDCCH + PDSCH
srslte_dci_format_t dci_format; srslte_dci_format_t dci_format;
switch(pdsch_cfg.mimo_type) { switch(pdsch_cfg.mimo_type) {
case SRSLTE_MIMO_TYPE_SINGLE_ANTENNA: case SRSLTE_MIMO_TYPE_SINGLE_ANTENNA:
@ -962,7 +971,7 @@ int main(int argc, char **argv) {
grant.tb_en[0] = true; grant.tb_en[0] = true;
grant.tb_en[1] = false; grant.tb_en[1] = false;
grant.mcs[0].idx = 13; grant.mcs[0].idx = 2;
grant.nof_prb = cell.nof_prb; grant.nof_prb = cell.nof_prb;
grant.sf_type = SRSLTE_SF_MBSFN; grant.sf_type = SRSLTE_SF_MBSFN;
srslte_dl_fill_ra_mcs(&grant.mcs[0], cell.nof_prb); srslte_dl_fill_ra_mcs(&grant.mcs[0], cell.nof_prb);
@ -1000,7 +1009,7 @@ int main(int argc, char **argv) {
} }
/* Transform to OFDM symbols */ /* Transform to OFDM symbols */
if(sf_idx != 2 || mbsfn_area_id < 0){ if(mch_table[sf_idx] == 0 || mbsfn_area_id < 0){
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
srslte_ofdm_tx_sf(&ifft[i]); srslte_ofdm_tx_sf(&ifft[i]);
} }
@ -1025,9 +1034,6 @@ int main(int argc, char **argv) {
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
float norm_factor = (float) cell.nof_prb/15/sqrtf(pdsch_cfg.grant.nof_prb); float norm_factor = (float) cell.nof_prb/15/sqrtf(pdsch_cfg.grant.nof_prb);
//norm_factor = 0.066667;
//rf_amp = 0.8;
printf("power adj is %f\n",rf_amp * norm_factor);
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
srslte_vec_sc_prod_cfc(output_buffer[i], 0.01, output_buffer[i], SRSLTE_SF_LEN_PRB(cell.nof_prb)); srslte_vec_sc_prod_cfc(output_buffer[i], 0.01, output_buffer[i], SRSLTE_SF_LEN_PRB(cell.nof_prb));
} }

@ -36,6 +36,7 @@
#include <signal.h> #include <signal.h>
#include <pthread.h> #include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
#include "srslte/common/gen_mch_tables.h"
#include <srslte/phy/common/phy_common.h> #include <srslte/phy/common/phy_common.h>
#include "srslte/phy/io/filesink.h" #include "srslte/phy/io/filesink.h"
#include "srslte/srslte.h" #include "srslte/srslte.h"
@ -103,6 +104,7 @@ typedef struct {
int decimate; int decimate;
int32_t mbsfn_area_id; int32_t mbsfn_area_id;
uint8_t non_mbsfn_region; uint8_t non_mbsfn_region;
uint8_t mbsfn_sf_mask;
int verbose; int verbose;
}prog_args_t; }prog_args_t;
@ -138,6 +140,7 @@ void args_default(prog_args_t *args) {
args->cpu_affinity = -1; args->cpu_affinity = -1;
args->mbsfn_area_id = -1; args->mbsfn_area_id = -1;
args->non_mbsfn_region = 2; args->non_mbsfn_region = 2;
args->mbsfn_sf_mask = 32;
} }
void usage(prog_args_t *args, char *prog) { void usage(prog_args_t *args, char *prog) {
@ -185,7 +188,7 @@ void usage(prog_args_t *args, char *prog) {
void parse_args(prog_args_t *args, int argc, char **argv) { void parse_args(prog_args_t *args, int argc, char **argv) {
int opt; int opt;
args_default(args); args_default(args);
while ((opt = getopt(argc, argv, "aAoglipPcOCtdDFRnvrfuUsSZyWMN")) != -1) { while ((opt = getopt(argc, argv, "aAoglipPcOCtdDFRnvrfuUsSZyWMNB")) != -1) {
switch (opt) { switch (opt) {
case 'i': case 'i':
args->input_file_name = argv[optind]; args->input_file_name = argv[optind];
@ -275,6 +278,9 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
case 'N': case 'N':
args->non_mbsfn_region = atoi(argv[optind]); args->non_mbsfn_region = atoi(argv[optind]);
break; break;
case 'B':
args->mbsfn_sf_mask = atoi(argv[optind]);
break;
default: default:
usage(args, argv[0]); usage(args, argv[0]);
exit(-1); exit(-1);
@ -364,8 +370,11 @@ int main(int argc, char **argv) {
go_exit = true; go_exit = true;
} }
} }
uint8_t mch_table[10];
bzero(&mch_table[0], sizeof(uint8_t)*10);
if(prog_args.mbsfn_area_id < -1) {
generate_mcch_table(mch_table, prog_args.mbsfn_sf_mask);
}
if(prog_args.cpu_affinity > -1) { if(prog_args.cpu_affinity > -1) {
cpu_set_t cpuset; cpu_set_t cpuset;
@ -668,7 +677,7 @@ int main(int argc, char **argv) {
decode_pdsch = true; decode_pdsch = true;
} else { } else {
/* We are looking for SIB1 Blocks, search only in appropiate places */ /* We are looking for SIB1 Blocks, search only in appropiate places */
if ((sfidx == 5 && (sfn%2)==0) || sfidx == 1) { if ((sfidx == 5 && (sfn%2)==0) ||mch_table[sfidx] == 1) {
decode_pdsch = true; decode_pdsch = true;
} else { } else {
decode_pdsch = false; decode_pdsch = false;
@ -677,7 +686,7 @@ int main(int argc, char **argv) {
gettimeofday(&t[1], NULL); gettimeofday(&t[1], NULL);
if (decode_pdsch) { if (decode_pdsch) {
if(sfidx != 1 || prog_args.mbsfn_area_id < 0){ // Not an MBSFN subframe if(mch_table[sfidx] == 0 || prog_args.mbsfn_area_id < 0){ // Not an MBSFN subframe
if (cell.nof_ports == 1) { if (cell.nof_ports == 1) {
/* Transmission mode 1 */ /* Transmission mode 1 */
n = srslte_ue_dl_decode(&ue_dl, data, 0, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), acks); n = srslte_ue_dl_decode(&ue_dl, data, 0, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), acks);

@ -32,21 +32,21 @@
*****************************************************************************/ *****************************************************************************/
#include <pthread.h> #include <pthread.h>
#include <string.h> #include <string.h>
#include <vector> #include <stdint.h>
#include "srslte/common/common.h"
#ifdef __cplusplus
namespace srslte { extern "C" {
#endif // __cplusplus
void generate_frame_mch_table(uint8_t *table, uint8_t alloc); void generate_frame_mch_table(uint8_t *table, uint8_t alloc);
void generate_mch_table(uint8_t *table, uint32_t sf_alloc, uint8_t num_frames); void generate_mch_table(uint8_t *table, uint32_t sf_alloc, uint8_t num_frames);
void generate_mcch_table(uint8_t *table, uint32_t sf_alloc); void generate_mcch_table(uint8_t *table, uint32_t sf_alloc);
#ifdef __cplusplus
}
#endif // __cplusplus
} // namespace srsue
#endif // SECURITY_H #endif // SECURITY_H

@ -22,8 +22,8 @@ file(GLOB CXX_SOURCES "*.cc")
file(GLOB C_SOURCES "*.c") file(GLOB C_SOURCES "*.c")
add_library(srslte_common STATIC ${C_SOURCES} ${CXX_SOURCES}) add_library(srslte_common STATIC ${C_SOURCES} ${CXX_SOURCES})
add_custom_target(gen_build_info COMMAND cmake -P ${CMAKE_BINARY_DIR}/SRSLTEbuildinfo.cmake) #add_custom_target(gen_build_info COMMAND cmake -P ${CMAKE_BINARY_DIR}/SRSLTEbuildinfo.cmake)
add_dependencies(srslte_common gen_build_info) #add_dependencies(srslte_common gen_build_info)
target_include_directories(srslte_common PUBLIC ${SEC_INCLUDE_DIRS}) target_include_directories(srslte_common PUBLIC ${SEC_INCLUDE_DIRS})
target_link_libraries(srslte_common ${SEC_LIBRARIES}) target_link_libraries(srslte_common ${SEC_LIBRARIES})

@ -27,7 +27,6 @@
#include "srslte/common/gen_mch_tables.h" #include "srslte/common/gen_mch_tables.h"
namespace srslte {
/****************************************************************************** /******************************************************************************
* Key Generation * Key Generation
@ -61,5 +60,3 @@ void generate_mcch_table(uint8_t *table, uint32_t sf_alloc)
uint8_t alloc = (sf_alloc) & 0x3F; uint8_t alloc = (sf_alloc) & 0x3F;
generate_frame_table(table, alloc); generate_frame_table(table, alloc);
} }
} // namespace srsue

@ -194,7 +194,7 @@ void phch_common::build_mch_table() {
// First reset tables // First reset tables
bzero(&mch_table[0], sizeof(uint8_t)*40); bzero(&mch_table[0], sizeof(uint8_t)*40);
// 40 element table represents 4 frames (40 subframes) // 40 element table represents 4 frames (40 subframes)
srslte::generate_mch_table(&mch_table[0], mbsfn.mbsfn_subfr_cnfg.subfr_alloc,(LIBLTE_RRC_SUBFRAME_ALLOCATION_NUM_FRAMES_ONE == mbsfn.mbsfn_subfr_cnfg.subfr_alloc_num_frames)?1:4); generate_mch_table(&mch_table[0], mbsfn.mbsfn_subfr_cnfg.subfr_alloc,(LIBLTE_RRC_SUBFRAME_ALLOCATION_NUM_FRAMES_ONE == mbsfn.mbsfn_subfr_cnfg.subfr_alloc_num_frames)?1:4);
// Debug // Debug
std::stringstream ss; std::stringstream ss;
ss << "|"; ss << "|";
@ -206,7 +206,7 @@ void phch_common::build_mch_table() {
void phch_common::build_mcch_table() { void phch_common::build_mcch_table() {
bzero(&mcch_table[0], sizeof(uint8_t)*10); bzero(&mcch_table[0], sizeof(uint8_t)*10);
srslte::generate_mcch_table(&mcch_table[0], mbsfn.mbsfn_area_info.sf_alloc_info_r9); generate_mcch_table(&mcch_table[0], mbsfn.mbsfn_area_info.sf_alloc_info_r9);
std::stringstream ss; std::stringstream ss;
ss << "|"; ss << "|";

@ -381,7 +381,7 @@ void phch_common::build_mch_table()
bzero(&mch_table[0], sizeof(uint8_t)*40); bzero(&mch_table[0], sizeof(uint8_t)*40);
// 40 element table represents 4 frames (40 subframes) // 40 element table represents 4 frames (40 subframes)
srslte::generate_mch_table(&mch_table[0], config->mbsfn.mbsfn_subfr_cnfg.subfr_alloc,(LIBLTE_RRC_SUBFRAME_ALLOCATION_NUM_FRAMES_ONE == config->mbsfn.mbsfn_subfr_cnfg.subfr_alloc_num_frames)?1:4); generate_mch_table(&mch_table[0], config->mbsfn.mbsfn_subfr_cnfg.subfr_alloc,(LIBLTE_RRC_SUBFRAME_ALLOCATION_NUM_FRAMES_ONE == config->mbsfn.mbsfn_subfr_cnfg.subfr_alloc_num_frames)?1:4);
// Debug // Debug
@ -397,7 +397,7 @@ void phch_common::build_mcch_table()
{ {
// First reset tables // First reset tables
bzero(&mcch_table[0], sizeof(uint8_t)*10); bzero(&mcch_table[0], sizeof(uint8_t)*10);
srslte::generate_mcch_table(&mcch_table[0], config->mbsfn.mbsfn_area_info.sf_alloc_info_r9); generate_mcch_table(&mcch_table[0], config->mbsfn.mbsfn_area_info.sf_alloc_info_r9);
// Debug // Debug
std::stringstream ss; std::stringstream ss;
ss << "|"; ss << "|";

Loading…
Cancel
Save