|
|
@ -200,7 +200,7 @@ int srslte_psbch_encode(srslte_psbch_t* q, uint8_t* input, uint32_t input_len, c
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Copy into codeword buffer
|
|
|
|
// Copy into codeword buffer
|
|
|
|
memcpy(q->c, input, sizeof(uint8_t) * input_len);
|
|
|
|
srs_vec_u8_copy(q->c, input, input_len);
|
|
|
|
|
|
|
|
|
|
|
|
// CRC Attachment
|
|
|
|
// CRC Attachment
|
|
|
|
srslte_crc_attach(&q->crc_mib_sl, q->c, input_len);
|
|
|
|
srslte_crc_attach(&q->crc_mib_sl, q->c, input_len);
|
|
|
@ -284,7 +284,7 @@ int srslte_psbch_decode(srslte_psbch_t* q, cf_t* equalized_sf_syms, uint8_t* out
|
|
|
|
srslte_viterbi_decode_s(&q->dec, q->d_16, q->c, q->sl_bch_tb_crc_len);
|
|
|
|
srslte_viterbi_decode_s(&q->dec, q->d_16, q->c, q->sl_bch_tb_crc_len);
|
|
|
|
|
|
|
|
|
|
|
|
// Copy received crc to temp
|
|
|
|
// Copy received crc to temp
|
|
|
|
memcpy(q->crc_temp, &q->c[q->sl_bch_tb_len], sizeof(uint8_t) * SRSLTE_SL_BCH_CRC_LEN);
|
|
|
|
srs_vec_u8_copy(q->crc_temp, &q->c[q->sl_bch_tb_len], SRSLTE_SL_BCH_CRC_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
// Re-attach crc
|
|
|
|
// Re-attach crc
|
|
|
|
srslte_crc_attach(&q->crc_mib_sl, q->c, q->sl_bch_tb_len);
|
|
|
|
srslte_crc_attach(&q->crc_mib_sl, q->c, q->sl_bch_tb_len);
|
|
|
@ -295,7 +295,7 @@ int srslte_psbch_decode(srslte_psbch_t* q, cf_t* equalized_sf_syms, uint8_t* out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Remove CRC and copy to output buffer
|
|
|
|
// Remove CRC and copy to output buffer
|
|
|
|
memcpy(output, q->c, sizeof(uint8_t) * q->sl_bch_tb_len);
|
|
|
|
srs_vec_u8_copy(output, q->c, q->sl_bch_tb_len);
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -326,9 +326,8 @@ int srslte_psbch_put(srslte_psbch_t* q, cf_t* symbols, cf_t* sf_buffer)
|
|
|
|
// Mapping to physical resources
|
|
|
|
// Mapping to physical resources
|
|
|
|
for (uint32_t i = 0; i < srslte_sl_get_num_symbols(q->tm, q->cp); i++) {
|
|
|
|
for (uint32_t i = 0; i < srslte_sl_get_num_symbols(q->tm, q->cp); i++) {
|
|
|
|
if (srslte_psbch_is_symbol(SRSLTE_SIDELINK_DATA_SYMBOL, q->tm, i, q->cp)) {
|
|
|
|
if (srslte_psbch_is_symbol(SRSLTE_SIDELINK_DATA_SYMBOL, q->tm, i, q->cp)) {
|
|
|
|
memcpy(&sf_buffer[k + i * q->nof_prb * SRSLTE_NRE],
|
|
|
|
srs_vec_cf_copy(
|
|
|
|
&symbols[sample_pos],
|
|
|
|
&sf_buffer[k + i * q->nof_prb * SRSLTE_NRE], &symbols[sample_pos], SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB);
|
|
|
|
sizeof(cf_t) * (SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB));
|
|
|
|
|
|
|
|
sample_pos += (SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB);
|
|
|
|
sample_pos += (SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -344,9 +343,8 @@ int srslte_psbch_get(srslte_psbch_t* q, cf_t* sf_buffer, cf_t* symbols)
|
|
|
|
// Get PSBCH REs
|
|
|
|
// Get PSBCH REs
|
|
|
|
for (uint32_t i = 0; i < srslte_sl_get_num_symbols(q->tm, q->cp); i++) {
|
|
|
|
for (uint32_t i = 0; i < srslte_sl_get_num_symbols(q->tm, q->cp); i++) {
|
|
|
|
if (srslte_psbch_is_symbol(SRSLTE_SIDELINK_DATA_SYMBOL, q->tm, i, q->cp)) {
|
|
|
|
if (srslte_psbch_is_symbol(SRSLTE_SIDELINK_DATA_SYMBOL, q->tm, i, q->cp)) {
|
|
|
|
memcpy(&symbols[sample_pos],
|
|
|
|
srs_vec_cf_copy(
|
|
|
|
&sf_buffer[k + i * q->nof_prb * SRSLTE_NRE],
|
|
|
|
&symbols[sample_pos], &sf_buffer[k + i * q->nof_prb * SRSLTE_NRE], SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB);
|
|
|
|
sizeof(cf_t) * (SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB));
|
|
|
|
|
|
|
|
sample_pos += (SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB);
|
|
|
|
sample_pos += (SRSLTE_NRE * SRSLTE_PSBCH_NOF_PRB);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|