Merge branch 'next' into novolk

This commit is contained in:
Ismael Gomez 2017-03-14 11:01:37 +01:00
commit 0764836ed8
8 changed files with 19 additions and 15 deletions

View File

@ -65,6 +65,7 @@ typedef struct SRSLTE_API {
uint32_t N_cs; // Cyclic shift size
uint32_t N_seq; // Preamble length
float T_seq; // Preamble length in seconds
float T_tot; // Total sequence length in seconds
uint32_t N_cp; // Cyclic prefix length
// Generated tables

View File

@ -163,7 +163,7 @@ SRSLTE_API void srslte_vec_max_fff(float *x, float *y, float *z, uint32_t len);
/* quantify vector of floats or int16 and convert to uint8_t */
SRSLTE_API void srslte_vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, float clip, uint32_t len);
SRSLTE_API void srslte_vec_quant_suc(int16_t *in, uint8_t *out, int16_t norm, int16_t offset, int16_t clip, uint32_t len);
SRSLTE_API void srslte_vec_quant_suc(int16_t *in, uint8_t *out, float gain, int16_t offset, int16_t clip, uint32_t len);
/* magnitude of each vector element */
SRSLTE_API void srslte_vec_abs_cf(cf_t *x, float *abs, uint32_t len);

View File

@ -407,7 +407,7 @@ struct lte_band lte_bands[SRSLTE_NOF_LTE_BANDS] = {
{30, 2350, 9770, 27660, 45, SRSLTE_BAND_GEO_AREA_NAR},
{31, 462.5, 9870, 27760, 10, SRSLTE_BAND_GEO_AREA_CALA},
{32, 1452, 9920, 0, 0, SRSLTE_BAND_GEO_AREA_EMEA},
{64, 0, 10359, 10359, 0, SRSLTE_BAND_GEO_AREA_ALL},
{64, 0, 10359, 27809, 0, SRSLTE_BAND_GEO_AREA_ALL},
{65, 2110, 65536, 131072, 90, SRSLTE_BAND_GEO_AREA_ALL},
{66, 2110, 66436, 131972, 90, SRSLTE_BAND_GEO_AREA_NAR},
{67, 738, 67336, 0, 0, SRSLTE_BAND_GEO_AREA_EMEA},
@ -441,7 +441,7 @@ float get_fd(struct lte_band *band, uint32_t dl_earfcn) {
float get_fu(struct lte_band *band, uint32_t ul_earfcn) {
if (ul_earfcn >= band->ul_earfcn_offset) {
return band->fd_low_mhz + band->duplex_mhz + 0.1*(ul_earfcn - band->ul_earfcn_offset);
return band->fd_low_mhz - band->duplex_mhz + 0.1*(ul_earfcn - band->ul_earfcn_offset);
} else {
return 0.0;
}
@ -478,7 +478,7 @@ float srslte_band_fu(uint32_t ul_earfcn) {
fprintf(stderr, "Invalid UL_EARFCN=%d\n", ul_earfcn);
}
i--;
while(i > 0 && lte_bands[i].dl_earfcn_offset>ul_earfcn) {
while(i > 0 && (lte_bands[i].ul_earfcn_offset>ul_earfcn || lte_bands[i].ul_earfcn_offset == 0)) {
i--;
}
return get_fu(&lte_bands[i], ul_earfcn);
@ -493,7 +493,7 @@ uint32_t srslte_band_ul_earfcn(uint32_t dl_earfcn) {
while(i > 0 && lte_bands[i].dl_earfcn_offset>dl_earfcn) {
i--;
}
return lte_bands[i].ul_earfcn_offset + (lte_bands[i].dl_earfcn_offset-dl_earfcn);
return lte_bands[i].ul_earfcn_offset + (dl_earfcn-lte_bands[i].dl_earfcn_offset);
}
int srslte_band_get_fd_band_all(uint32_t band, srslte_earfcn_t *earfcn, uint32_t max_elems) {

View File

@ -287,11 +287,10 @@ int srslte_viterbi_decode_s(srslte_viterbi_t *q, int16_t *symbols, uint8_t *data
int16_t max = -INT16_MAX;
for (int i=0;i<len;i++) {
if (abs(symbols[i]) > max) {
max = symbols[i];
max = abs(symbols[i]);
}
}
srslte_vec_quant_suc(symbols, q->symbols_uc, q->gain_quant/max, 127, 255, len);
srslte_vec_quant_suc(symbols, q->symbols_uc, (float) q->gain_quant/max, 127, 255, len);
return srslte_viterbi_decode_uc(q, q->symbols_uc, data, frame_length);
}

View File

@ -461,6 +461,7 @@ int srslte_prach_init(srslte_prach_t *p,
p->N_seq = prach_Tseq[p->f]*p->N_ifft_ul/2048;
p->N_cp = prach_Tcp[p->f]*p->N_ifft_ul/2048;
p->T_seq = prach_Tseq[p->f]*SRSLTE_LTE_TS;
p->T_tot = (prach_Tseq[p->f]+prach_Tcp[p->f])*SRSLTE_LTE_TS;
ret = SRSLTE_SUCCESS;
} else {

View File

@ -167,8 +167,8 @@ int srslte_ra_ul_dci_to_grant_prb_allocation(srslte_ra_ul_dci_t *dci, srslte_ra_
grant->freq_hopping = 1;
}
if (grant->n_prb[0] + grant->L_prb < nof_prb &&
grant->n_prb[1] + grant->L_prb < nof_prb)
if (grant->n_prb[0] + grant->L_prb <= nof_prb &&
grant->n_prb[1] + grant->L_prb <= nof_prb)
{
return SRSLTE_SUCCESS;
} else {
@ -252,6 +252,7 @@ int srslte_ra_ul_dci_to_grant(srslte_ra_ul_dci_t *dci, uint32_t nof_prb, uint32_
return SRSLTE_ERROR;
}
} else {
printf("Error computing UL PRB allocation\n");
return SRSLTE_ERROR;
}
return SRSLTE_SUCCESS;

View File

@ -394,9 +394,11 @@ static int dci_blind_search(srslte_ue_dl_t *q, dci_blind_search_t *search_space,
// If searching for Format1A but found Format0 save it for later
if (dci_msg->format == SRSLTE_DCI_FORMAT0 && search_space->format == SRSLTE_DCI_FORMAT1A)
{
q->pending_ul_dci_rnti = crc_rem;
memcpy(&q->pending_ul_dci_msg, dci_msg, sizeof(srslte_dci_msg_t));
memcpy(&q->last_location_ul, &search_space->loc[i], sizeof(srslte_dci_location_t));
if (!q->pending_ul_dci_rnti) {
q->pending_ul_dci_rnti = crc_rem;
memcpy(&q->pending_ul_dci_msg, dci_msg, sizeof(srslte_dci_msg_t));
memcpy(&q->last_location_ul, &search_space->loc[i], sizeof(srslte_dci_location_t));
}
// Else if we found it, save location and leave
} else if (dci_msg->format == search_space->format) {
ret = 1;

View File

@ -714,12 +714,12 @@ void srslte_vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, flo
}
}
void srslte_vec_quant_suc(int16_t *in, uint8_t *out, int16_t norm, int16_t offset, int16_t clip, uint32_t len) {
void srslte_vec_quant_suc(int16_t *in, uint8_t *out, float gain, int16_t offset, int16_t clip, uint32_t len) {
int i;
int16_t tmp;
for (i=0;i<len;i++) {
tmp = (int16_t) (offset + in[i]/norm);
tmp = (int16_t) (offset + in[i]*gain);
if (tmp < 0)
tmp = 0;
if (tmp > clip)