Merge branch 'next' into novolk

master
Ismael Gomez 8 years ago
commit ae146695fa

@ -609,7 +609,7 @@ int main(int argc, char **argv) {
/* Encode PDCCH */
INFO("Putting DCI to location: n=%d, L=%d\n", locations[sf_idx][0].ncce, locations[sf_idx][0].L);
srslte_dci_msg_pack_pdsch(&ra_dl, SRSLTE_DCI_FORMAT1, &dci_msg, cell.nof_prb, false);
srslte_dci_msg_pack_pdsch(&ra_dl, SRSLTE_DCI_FORMAT1, &dci_msg, cell.nof_prb, cell.nof_ports, false);
if (srslte_pdcch_encode(&pdcch, &dci_msg, locations[sf_idx][0], UE_CRNTI, sf_symbols, sf_idx, cfi)) {
fprintf(stderr, "Error encoding DCI message\n");
exit(-1);

@ -53,7 +53,14 @@ SRSLTE_API int srslte_precoding_single(cf_t *x,
SRSLTE_API int srslte_precoding_diversity(cf_t *x[SRSLTE_MAX_LAYERS],
cf_t *y[SRSLTE_MAX_PORTS],
int nof_ports, int nof_symbols);
int nof_ports,
int nof_symbols);
SRSLTE_API int srslte_precoding_cdd(cf_t *x[SRSLTE_MAX_LAYERS],
cf_t *y[SRSLTE_MAX_PORTS],
int nof_layers,
int nof_ports,
int nof_symbols);
SRSLTE_API int srslte_precoding_type(cf_t *x[SRSLTE_MAX_LAYERS],
cf_t *y[SRSLTE_MAX_PORTS],

@ -165,6 +165,7 @@ SRSLTE_API int srslte_dci_msg_pack_pdsch(srslte_ra_dl_dci_t *data,
srslte_dci_format_t format,
srslte_dci_msg_t *msg,
uint32_t nof_prb,
uint32_t nof_ports,
bool crc_is_crnti);
SRSLTE_API int srslte_dci_msg_unpack_pdsch(srslte_dci_msg_t *msg,

@ -238,7 +238,7 @@ int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t *q, srslte_ra_dl_dci_t *grant,
rnti_is_user = false;
}
srslte_dci_msg_pack_pdsch(grant, format, &dci_msg, q->cell.nof_prb, rnti_is_user);
srslte_dci_msg_pack_pdsch(grant, format, &dci_msg, q->cell.nof_prb, q->cell.nof_ports, rnti_is_user);
if (srslte_pdcch_encode(&q->pdcch, &dci_msg, location, rnti, q->sf_symbols, sf_idx, q->cfi)) {
fprintf(stderr, "Error encoding DCI message\n");
return SRSLTE_ERROR;

@ -69,7 +69,7 @@ int srslte_softbuffer_rx_init(srslte_softbuffer_rx_t *q, uint32_t nof_prb) {
return SRSLTE_ERROR;
}
}
srslte_softbuffer_rx_reset(q);
//srslte_softbuffer_rx_reset(q);
ret = SRSLTE_SUCCESS;
}
}

@ -115,11 +115,9 @@ int srslte_layermap_type(cf_t *d[SRSLTE_MAX_CODEWORDS], cf_t *x[SRSLTE_MAX_LAYER
}
break;
case SRSLTE_MIMO_TYPE_SPATIAL_MULTIPLEX:
case SRSLTE_MIMO_TYPE_CDD:
return srslte_layermap_multiplex(d, x, nof_cw, nof_layers, nof_symbols);
break;
case SRSLTE_MIMO_TYPE_CDD:
fprintf(stderr, "CDD Not implemented\n");
return -1;
}
return 0;
}

@ -620,6 +620,31 @@ int srslte_precoding_diversity(cf_t *x[SRSLTE_MAX_LAYERS], cf_t *y[SRSLTE_MAX_PO
}
}
int srslte_precoding_cdd(cf_t *x[SRSLTE_MAX_LAYERS], cf_t *y[SRSLTE_MAX_PORTS], int nof_layers, int nof_ports, int nof_symbols)
{
int i;
if (nof_ports == 2) {
if (nof_layers != 2) {
fprintf(stderr, "Invalid number of layers %d for 2 ports\n", nof_layers);
return -1;
}
for (i = 0; i < nof_symbols; i++) {
y[0][i] = (x[0][i]+x[1][i])/2;
y[1][i] = (x[0][i]-x[1][i])/2;
i++;
y[0][i] = (x[0][i]+x[1][i])/2;
y[1][i] = (-x[0][i]+x[1][i])/2;
}
return 2 * i;
} else if (nof_ports == 4) {
fprintf(stderr, "Not implemented\n");
return -1;
} else {
fprintf(stderr, "Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)\n", nof_ports);
return -1;
}
}
/* 36.211 v10.3.0 Section 6.3.4 */
int srslte_precoding_type(cf_t *x[SRSLTE_MAX_LAYERS], cf_t *y[SRSLTE_MAX_PORTS], int nof_layers,
int nof_ports, int nof_symbols, srslte_mimo_type_t type) {
@ -637,8 +662,7 @@ int srslte_precoding_type(cf_t *x[SRSLTE_MAX_LAYERS], cf_t *y[SRSLTE_MAX_PORTS],
switch (type) {
case SRSLTE_MIMO_TYPE_CDD:
fprintf(stderr, "CCD not supported\n");
return -1;
return srslte_precoding_cdd(x, y, nof_layers, nof_ports, nof_symbols);
case SRSLTE_MIMO_TYPE_SINGLE_ANTENNA:
if (nof_ports == 1 && nof_layers == 1) {
return srslte_precoding_single(x[0], y[0], nof_symbols);

@ -1010,6 +1010,77 @@ int dci_format1D_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_
}
int dci_format2AB_pack(srslte_ra_dl_dci_t *data, srslte_dci_msg_t *msg, uint32_t nof_prb, uint32_t nof_ports) {
/* pack bits */
uint8_t *y = msg->data;
if (nof_prb > 10) {
*y++ = data->alloc_type;
}
/* Resource allocation: type0 or type 1 */
uint32_t P = srslte_ra_type0_P(nof_prb);
uint32_t alloc_size = (uint32_t) ceilf((float) nof_prb / P);
switch (data->alloc_type) {
case SRSLTE_RA_ALLOC_TYPE0:
srslte_bit_unpack((uint32_t) data->type0_alloc.rbg_bitmask, &y, alloc_size);
break;
case SRSLTE_RA_ALLOC_TYPE1:
srslte_bit_unpack((uint32_t) data->type1_alloc.rbg_subset, &y, (int) ceilf(log2f(P)));
*y++ = data->type1_alloc.shift ? 1 : 0;
srslte_bit_unpack((uint32_t) data->type1_alloc.vrb_bitmask, &y,
alloc_size - (int) ceilf(log2f(P)) - 1);
break;
default:
fprintf(stderr,
"Format 1 accepts type0 or type1 resource allocation only\n");
return SRSLTE_ERROR;
}
// pack TPC command for PUCCH (not implemented)
y+=2;
/* harq process number */
srslte_bit_unpack(data->harq_process, &y, harq_pid_len);
// Transpor block to codeword swap flag
if (msg->format == SRSLTE_DCI_FORMAT2B) {
*y++ = data->sram_id;
} else {
*y++ = data->tb_cw_swap;
}
/* pack TB1 */
srslte_bit_unpack(data->mcs_idx, &y, 5);
*y++ = data->ndi;
srslte_bit_unpack(data->rv_idx, &y, 2);
/* pack TB2 */
srslte_bit_unpack(data->mcs_idx_1, &y, 5);
*y++ = data->ndi_1;
srslte_bit_unpack(data->rv_idx_1, &y, 2);
// Precoding information
if (msg->format == SRSLTE_DCI_FORMAT2) {
srslte_bit_unpack(data->pinfo, &y, precoding_bits_f2(nof_ports));
} else if (msg->format == SRSLTE_DCI_FORMAT2A) {
srslte_bit_unpack(data->pinfo, &y, precoding_bits_f2a(nof_ports));
}
// Padding with zeros
uint32_t n = srslte_dci_format_sizeof(msg->format, nof_prb, nof_ports);
while (y - msg->data < n) {
*y++ = 0;
}
msg->nof_bits = (y - msg->data);
return SRSLTE_SUCCESS;
}
int dci_format2AB_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_t nof_prb, uint32_t nof_ports) {
/* pack bits */
@ -1073,7 +1144,7 @@ int dci_format2AB_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
}
// Precoding information
if (msg->format == SRSLTE_DCI_FORMAT2A) {
if (msg->format == SRSLTE_DCI_FORMAT2) {
data->pinfo = srslte_bit_pack(&y, precoding_bits_f2(nof_ports));
} else if (msg->format == SRSLTE_DCI_FORMAT2A) {
data->pinfo = srslte_bit_pack(&y, precoding_bits_f2a(nof_ports));
@ -1086,19 +1157,27 @@ int dci_format2AB_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
int srslte_dci_msg_pack_pdsch(srslte_ra_dl_dci_t *data, srslte_dci_format_t format,
srslte_dci_msg_t *msg, uint32_t nof_prb,
srslte_dci_msg_t *msg, uint32_t nof_prb, uint32_t nof_ports,
bool crc_is_crnti)
{
msg->format = format;
switch (format) {
case SRSLTE_DCI_FORMAT1:
msg->format = format;
return dci_format1_pack(data, msg, nof_prb);
case SRSLTE_DCI_FORMAT1A:
msg->format = format;
return dci_format1As_pack(data, msg, nof_prb, crc_is_crnti);
case SRSLTE_DCI_FORMAT1C:
msg->format = format;
return dci_format1Cs_pack(data, msg, nof_prb);
case SRSLTE_DCI_FORMAT2:
case SRSLTE_DCI_FORMAT2A:
case SRSLTE_DCI_FORMAT2B:
msg->format = format;
return dci_format2AB_pack(data, msg, nof_prb, nof_ports);
default:
fprintf(stderr, "DCI pack pdsch: Invalid DCI format %s in \n",
fprintf(stderr, "DCI pack pdsch: Invalid DCI format %s\n",
srslte_dci_format_string(format));
return SRSLTE_ERROR;
}

@ -607,7 +607,7 @@ int srslte_pdcch_encode(srslte_pdcch_t *q, srslte_dci_msg_t *msg, srslte_dci_loc
ret = SRSLTE_SUCCESS;
} else {
fprintf(stderr, "Illegal DCI message nCCE: %d, L: %d, nof_cce: %d\n", location.ncce, location.L, q->nof_cce);
fprintf(stderr, "Illegal DCI message nCCE: %d, L: %d, nof_cce: %d, nof_bits=%d\n", location.ncce, location.L, q->nof_cce, msg->nof_bits);
}
} else {
fprintf(stderr, "Invalid parameters: cfi=%d, L=%d, nCCE=%d\n", cfi, location.L, location.ncce);

@ -191,11 +191,11 @@ int main(int argc, char **argv) {
ra_dl.alloc_type = SRSLTE_RA_ALLOC_TYPE0;
ra_dl.type0_alloc.rbg_bitmask = 0x5;
srslte_dci_msg_pack_pdsch(&ra_dl, SRSLTE_DCI_FORMAT1, &dci_tx[0], cell.nof_prb, false);
srslte_dci_msg_pack_pdsch(&ra_dl, SRSLTE_DCI_FORMAT1, &dci_tx[0], cell.nof_prb, cell.nof_ports, false);
srslte_dci_location_set(&dci_locations[0], 0, 0);
ra_dl.mcs_idx = 15;
srslte_dci_msg_pack_pdsch(&ra_dl, SRSLTE_DCI_FORMAT1, &dci_tx[1], cell.nof_prb, false);
srslte_dci_msg_pack_pdsch(&ra_dl, SRSLTE_DCI_FORMAT1, &dci_tx[1], cell.nof_prb, cell.nof_ports, false);
srslte_dci_location_set(&dci_locations[1], 0, 1);
for (i=0;i<nof_dcis;i++) {

Loading…
Cancel
Save