Reduced sampling rates (not power of 2 fft sizes)

master
ismagom 9 years ago
parent cb61ff4009
commit 48076a77fa

@ -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";

@ -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);

@ -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) {

@ -27,6 +27,8 @@
#include <math.h>
#include <string.h>
#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);

Loading…
Cancel
Save