Commit 1ee1b48a authored by Robert Schmidt's avatar Robert Schmidt

L1 DLSCH: don't "steal" pointer but cpy payload

parent f8beeb47
...@@ -105,8 +105,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) ...@@ -105,8 +105,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
harq->unav_res = ptrsSymbPerSlot * n_ptrs; harq->unav_res = ptrsSymbPerSlot * n_ptrs;
/// CRC, coding, interleaving and rate matching /// CRC, coding, interleaving and rate matching
AssertError(harq->pdu!=NULL, return, "harq->pdu is null\n"); AssertError(harq->sdu_len > 0, return, "no HARQ SDU present\n");
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers] __attribute__((aligned(64))); unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers] __attribute__((aligned(64)));
DevAssert(harq->sdu_len < rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers);
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers); bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers);
start_meas(dlsch_encoding_stats); start_meas(dlsch_encoding_stats);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu); void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu);
void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu); void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu, uint16_t sdu_len);
void nr_generate_pdsch(processingData_L1tx_t *msgTx, void nr_generate_pdsch(processingData_L1tx_t *msgTx,
int frame, int frame,
......
...@@ -72,7 +72,6 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM ...@@ -72,7 +72,6 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM
harq->c[r] = NULL; harq->c[r] = NULL;
} }
free(harq->c); free(harq->c);
free(harq->pdu);
for (int layer = 0; layer < max_layers; layer++) { for (int layer = 0; layer < max_layers; layer++) {
for (int aa = 0; aa < 64; aa++) for (int aa = 0; aa < 64; aa++)
...@@ -113,10 +112,9 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB) ...@@ -113,10 +112,9 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
bzero(harq, sizeof(NR_DL_gNB_HARQ_t)); bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
harq->b = malloc16(dlsch_bytes); harq->b = malloc16(dlsch_bytes);
AssertFatal(harq->b, "cannot allocate memory for harq->b\n"); AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
harq->pdu = malloc16(dlsch_bytes); bzero(harq->sdu, dlsch_bytes);
AssertFatal(harq->pdu, "cannot allocate memory for harq->pdu\n"); harq->sdu_len = dlsch_bytes;
bzero(harq->pdu, dlsch_bytes); nr_emulate_dlsch_payload(harq->sdu, (dlsch_bytes) >> 3);
nr_emulate_dlsch_payload(harq->pdu, (dlsch_bytes) >> 3);
bzero(harq->b, dlsch_bytes); bzero(harq->b, dlsch_bytes);
harq->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *)); harq->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
...@@ -275,7 +273,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -275,7 +273,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
impp.Zc = harq->Z; impp.Zc = harq->Z;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
uint32_t A = rel15->TBSize[0]<<3; uint32_t A = rel15->TBSize[0]<<3;
unsigned char *a=harq->pdu; AssertFatal(A == harq->sdu_len * 8, "A %d bits sdu_len %d bytes %d bits\n", A, harq->sdu_len, harq->sdu_len * 8);
unsigned char *a=harq->sdu;
if (rel15->rnti != SI_RNTI) if (rel15->rnti != SI_RNTI)
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], WS_C_RNTI, rel15->rnti, frame, slot,0, 0); trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], WS_C_RNTI, rel15->rnti, frame, slot,0, 0);
......
...@@ -55,10 +55,10 @@ void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsc ...@@ -55,10 +55,10 @@ void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsc
pdsch_pdu->pdsch_pdu_rel15.pduIndex, pdsch_pdu->pdsch_pdu_rel15.pduIndex,
msgTx->num_pdsch_slot); msgTx->num_pdsch_slot);
msgTx->num_pdsch_slot++; msgTx->num_pdsch_slot++;
harq->pdu = NULL; harq->sdu_len = 0;
} }
void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu) void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu, uint16_t sdu_len)
{ {
AssertFatal(sdu != NULL, "sdu is null\n"); AssertFatal(sdu != NULL, "sdu is null\n");
...@@ -68,5 +68,6 @@ void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu) ...@@ -68,5 +68,6 @@ void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu)
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
nfapi_nr_dl_tti_pdsch_pdu *pdsch = &harq->pdsch_pdu; nfapi_nr_dl_tti_pdsch_pdu *pdsch = &harq->pdsch_pdu;
AssertFatal(pdsch->pdsch_pdu_rel15.pduIndex == idx, "PDSCH PDU index %d does not match %d\n", pdsch->pdsch_pdu_rel15.pduIndex, idx); AssertFatal(pdsch->pdsch_pdu_rel15.pduIndex == idx, "PDSCH PDU index %d does not match %d\n", pdsch->pdsch_pdu_rel15.pduIndex, idx);
harq->pdu = sdu; harq->sdu_len = sdu_len;
memcpy(harq->sdu, sdu, sdu_len);
} }
...@@ -73,8 +73,10 @@ typedef enum { ...@@ -73,8 +73,10 @@ typedef enum {
typedef struct { typedef struct {
/// Nfapi DLSCH PDU /// Nfapi DLSCH PDU
nfapi_nr_dl_tti_pdsch_pdu pdsch_pdu; nfapi_nr_dl_tti_pdsch_pdu pdsch_pdu;
/// pointer to pdu from MAC interface (this is "a" in 36.212) /// length of PDU to encode
uint8_t *pdu; uint32_t sdu_len;
/// sdu from MAC interface (this is "a" in 36.212)
uint8_t sdu[65536];
/// Pointer to the payload /// Pointer to the payload
uint8_t *b; uint8_t *b;
/// Pointers to transport block segments /// Pointers to transport block segments
......
...@@ -192,8 +192,9 @@ void nr_schedule_tx_req(PHY_VARS_gNB *gNB, nfapi_nr_tx_data_request_t *TX_req) ...@@ -192,8 +192,9 @@ void nr_schedule_tx_req(PHY_VARS_gNB *gNB, nfapi_nr_tx_data_request_t *TX_req)
processingData_L1tx_t *msgTx = gNB->msgDataTx; processingData_L1tx_t *msgTx = gNB->msgDataTx;
for (int idx = 0; idx < TX_req->Number_of_PDUs; ++idx) { for (int idx = 0; idx < TX_req->Number_of_PDUs; ++idx) {
uint16_t len = TX_req->pdu_list[idx].TLVs[0].length;
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[idx].TLVs[0].value.direct; uint8_t *sdu = (uint8_t *)TX_req->pdu_list[idx].TLVs[0].value.direct;
nr_fill_dlsch_tx_req(msgTx, idx, sdu); nr_fill_dlsch_tx_req(msgTx, idx, sdu, len);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment