Fix memory alignment in PUCCH processing. Fixes #94

master
Ismael Gomez 7 years ago
parent 14ab68e652
commit 5341d79b8a

@ -57,8 +57,8 @@ typedef struct SRSLTE_API {
} srslte_uci_cqi_pusch_t;
typedef struct SRSLTE_API {
uint8_t cqi_table[16][32];
int16_t cqi_table_s[16][32]; // aligned for simd
uint8_t *cqi_table[16];
int16_t *cqi_table_s[16];
} srslte_uci_cqi_pucch_t;
typedef struct SRSLTE_API {
@ -85,6 +85,8 @@ typedef struct {
SRSLTE_API void srslte_uci_cqi_pucch_init(srslte_uci_cqi_pucch_t *q);
SRSLTE_API void srslte_uci_cqi_pucch_free(srslte_uci_cqi_pucch_t *q);
SRSLTE_API int srslte_uci_encode_cqi_pucch(uint8_t *cqi_data,
uint32_t cqi_len,
uint8_t b_bits[SRSLTE_UCI_CQI_CODED_PUCCH_B]);

@ -465,6 +465,7 @@ void srslte_pucch_free(srslte_pucch_t *q) {
}
free(q->users);
}
srslte_uci_cqi_pucch_free(&q->cqi);
if (q->z) {
free(q->z);
}

@ -32,6 +32,7 @@
#include <stdbool.h>
#include <assert.h>
#include <math.h>
#include <srslte/phy/phch/uci.h>
#include "srslte/phy/phch/uci.h"
#include "srslte/phy/fec/cbsegm.h"
@ -109,6 +110,8 @@ void srslte_uci_cqi_pucch_init(srslte_uci_cqi_pucch_t *q) {
uint32_t nwords = 16;
for (uint32_t w=0;w<nwords;w++) {
q->cqi_table[w] = srslte_vec_malloc(SRSLTE_UCI_CQI_CODED_PUCCH_B*sizeof(int8_t));
q->cqi_table_s[w] = srslte_vec_malloc(SRSLTE_UCI_CQI_CODED_PUCCH_B*sizeof(int16_t));
uint8_t *ptr = word;
srslte_bit_unpack(w, &ptr, 4);
srslte_uci_encode_cqi_pucch(word, 4, q->cqi_table[w]);
@ -118,6 +121,18 @@ void srslte_uci_cqi_pucch_init(srslte_uci_cqi_pucch_t *q) {
}
}
void srslte_uci_cqi_pucch_free(srslte_uci_cqi_pucch_t *q) {
uint32_t nwords = 16;
for (uint32_t w=0;w<nwords;w++) {
if (q->cqi_table[w]) {
free(q->cqi_table[w]);
}
if (q->cqi_table_s[w]) {
free(q->cqi_table_s[w]);
}
}
}
/* Encode UCI CQI/PMI as described in 5.2.3.3 of 36.212
*/
int srslte_uci_encode_cqi_pucch(uint8_t *cqi_data, uint32_t cqi_len, uint8_t b_bits[SRSLTE_UCI_CQI_CODED_PUCCH_B])

Loading…
Cancel
Save