From 48076a77fa5f4c6cb633998dcb7761de79150db5 Mon Sep 17 00:00:00 2001 From: ismagom Date: Fri, 25 Sep 2015 20:07:34 +0200 Subject: [PATCH] Reduced sampling rates (not power of 2 fft sizes) --- srslte/examples/pdsch_ue.c | 2 +- srslte/include/srslte/common/phy_common.h | 3 +- srslte/lib/common/src/phy_common.c | 55 +++++++++++++++++++++++ srslte/lib/phch/src/prach.c | 27 ++--------- 4 files changed, 61 insertions(+), 26 deletions(-) diff --git a/srslte/examples/pdsch_ue.c b/srslte/examples/pdsch_ue.c index dfc152177..d081e5efe 100644 --- a/srslte/examples/pdsch_ue.c +++ b/srslte/examples/pdsch_ue.c @@ -107,7 +107,7 @@ void args_default(prog_args_t *args) { args->file_cell_id = 0; args->uhd_args = ""; args->uhd_freq = -1.0; - args->uhd_freq_offset = 8000000.0; + args->uhd_freq_offset = 0.0; args->uhd_gain = -1.0; args->net_port = -1; args->net_address = "127.0.0.1"; diff --git a/srslte/include/srslte/common/phy_common.h b/srslte/include/srslte/common/phy_common.h index c37922185..1cc5baf8f 100644 --- a/srslte/include/srslte/common/phy_common.h +++ b/srslte/include/srslte/common/phy_common.h @@ -43,8 +43,6 @@ #include "srslte/config.h" -#define USE_REDUCED_SAMPLING_RATES - #define SRSLTE_NSUBFRAMES_X_FRAME 10 #define SRSLTE_NSLOTS_X_FRAME (2*SRSLTE_NSUBFRAMES_X_FRAME) @@ -211,6 +209,7 @@ SRSLTE_API bool srslte_symbol_sz_isvalid(uint32_t symbol_sz); SRSLTE_API int srslte_symbol_sz(uint32_t nof_prb); +SRSLTE_API int srslte_nof_prb(uint32_t symbol_sz); SRSLTE_API int srslte_sampling_freq_hz(uint32_t nof_prb); diff --git a/srslte/lib/common/src/phy_common.c b/srslte/lib/common/src/phy_common.c index ba976a0cc..f79c96bf5 100644 --- a/srslte/lib/common/src/phy_common.c +++ b/srslte/lib/common/src/phy_common.c @@ -36,6 +36,10 @@ #include "srslte/common/sequence.h" +#define USE_REDUCED_SAMPLING_RATES + + + /* Returns true if the structure pointed by cell has valid parameters */ @@ -229,16 +233,67 @@ int srslte_symbol_sz(uint32_t nof_prb) { return SRSLTE_ERROR; } +int srslte_nof_prb(uint32_t symbol_sz) +{ +#ifdef USE_REDUCED_SAMPLING_RATES + switch(symbol_sz) { + case 128: + return 6; + case 256: + return 15; + case 384: + return 25; + case 768: + return 50; + case 1024: + return 75; + case 1536: + return 100; + } +#else + switch(symbol_sz) { + case 128: + return 6; + case 256: + return 15; + case 512: + return 25; + case 1024: + return 50; + case 1536: + return 75; + case 2048: + return 100; + } +#endif + return SRSLTE_ERROR; +} + bool srslte_symbol_sz_isvalid(uint32_t symbol_sz) { +#ifdef USE_REDUCED_SAMPLING_RATES + if (symbol_sz == 128 || + symbol_sz == 256 || + symbol_sz == 384 || + symbol_sz == 768 || + symbol_sz == 1024 || + symbol_sz == 1536) { + return true; + } else { + return false; + } +#else if (symbol_sz == 128 || symbol_sz == 256 || symbol_sz == 512 || symbol_sz == 1024 || + symbol_sz == 1536 || symbol_sz == 2048) { return true; } else { return false; } +#endif + } uint32_t srslte_voffset(uint32_t symbol_id, uint32_t cell_id, uint32_t nof_ports) { diff --git a/srslte/lib/phch/src/prach.c b/srslte/lib/phch/src/prach.c index 62ff7fed1..c497fcdca 100644 --- a/srslte/lib/phch/src/prach.c +++ b/srslte/lib/phch/src/prach.c @@ -27,6 +27,8 @@ #include #include + +#include "srslte/common/phy_common.h" #include "srslte/phch/prach.h" #include "srslte/utils/debug.h" #include "srslte/utils/vector.h" @@ -222,27 +224,6 @@ void print(void *d, uint32_t size, uint32_t len, char* file_str) fclose(f); } -uint32_t prach_get_rb_ul(uint32_t N_ifft_ul) -{ - switch(N_ifft_ul) - { - case 128: - return 6; - case 256: - return 15; - case 512: - return 25; - case 1024: - return 50; - case 1536: - return 75; - case 2048: - return 100; - default: - return 0; - } -} - int srslte_prach_gen_seqs(srslte_prach_t *p) { uint32_t u = 0; @@ -448,7 +429,7 @@ int srslte_prach_gen(srslte_prach_t *p, signal != NULL) { // Calculate parameters - uint32_t N_rb_ul = prach_get_rb_ul(p->N_ifft_ul); + uint32_t N_rb_ul = srslte_nof_prb(p->N_ifft_ul); uint32_t k_0 = freq_offset*N_RB_SC - N_rb_ul*N_RB_SC/2 + p->N_ifft_ul/2; uint32_t K = DELTA_F/DELTA_F_RA; uint32_t begin = PHI + (K*k_0) + (K/2); @@ -501,7 +482,7 @@ int srslte_prach_detect(srslte_prach_t *p, *n_indices = 0; // Extract bins of interest - uint32_t N_rb_ul = prach_get_rb_ul(p->N_ifft_ul); + uint32_t N_rb_ul = srslte_nof_prb(p->N_ifft_ul); uint32_t k_0 = freq_offset*N_RB_SC - N_rb_ul*N_RB_SC/2 + p->N_ifft_ul/2; uint32_t K = DELTA_F/DELTA_F_RA; uint32_t begin = PHI + (K*k_0) + (K/2);