Commit a9d3c4ac authored by yihongzheng's avatar yihongzheng

LDPC_FPGA_Encode_tx_test_OK

parent ca7d4208
...@@ -856,14 +856,14 @@ if(!IS_SOFTMODEM_NOS1) ...@@ -856,14 +856,14 @@ if(!IS_SOFTMODEM_NOS1)
} else { } else {
printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n"); printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n");
} }
#if 0
if (nfapi_mode != 1 && nfapi_mode != 2) { if (nfapi_mode != 1 && nfapi_mode != 2) {
printf("Not NFAPI mode - call init_eNB_afterRU()\n"); printf("Not NFAPI mode - call init_eNB_afterRU()\n");
init_eNB_afterRU(); init_eNB_afterRU();
} else { } else {
printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n"); printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n");
} }
#endif
printf("ALL RUs ready - ALL gNBs ready\n"); printf("ALL RUs ready - ALL gNBs ready\n");
// connect the TX/RX buffers // connect the TX/RX buffers
printf("Sending sync to all threads\n"); printf("Sending sync to all threads\n");
......
...@@ -25,6 +25,7 @@ nrLDPC_decoderfunc_t nrLDPC_decoder; ...@@ -25,6 +25,7 @@ nrLDPC_decoderfunc_t nrLDPC_decoder;
nrLDPC_encoderfunc_t nrLDPC_encoder; nrLDPC_encoderfunc_t nrLDPC_encoder;
LDPC_FPGA_EnTx_Test add; LDPC_FPGA_EnTx_Test add;
LDPC_FPGA_HugePage_Init HugePage_Init; LDPC_FPGA_HugePage_Init HugePage_Init;
LDPC_FPGA_HugePage_Init main234;
LDPC_FPGA_EnTx encoder_load; LDPC_FPGA_EnTx encoder_load;
#else #else
/* functions to load the LDPC shared lib, implemented in openair1/PHY/CODING/nrLDPC_load.c */ /* functions to load the LDPC shared lib, implemented in openair1/PHY/CODING/nrLDPC_load.c */
...@@ -35,6 +36,7 @@ extern nrLDPC_decoderfunc_t nrLDPC_decoder; ...@@ -35,6 +36,7 @@ extern nrLDPC_decoderfunc_t nrLDPC_decoder;
extern nrLDPC_encoderfunc_t nrLDPC_encoder; extern nrLDPC_encoderfunc_t nrLDPC_encoder;
extern LDPC_FPGA_EnTx_Test add; extern LDPC_FPGA_EnTx_Test add;
extern LDPC_FPGA_HugePage_Init HugePage_Init; extern LDPC_FPGA_HugePage_Init HugePage_Init;
extern LDPC_FPGA_HugePage_Init main234;
extern LDPC_FPGA_EnTx encoder_load; extern LDPC_FPGA_EnTx encoder_load;
// inline functions: // inline functions:
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init_mem.h" #include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init_mem.h"
......
...@@ -86,17 +86,28 @@ int load_nrLDPClib(void) { ...@@ -86,17 +86,28 @@ int load_nrLDPClib(void) {
return -1; return -1;
} }
#if 1 #if 1
HugePage_Init = (LDPC_FPGA_HugePage_Init) dlsym(handle, "HugePage_Init"); // HugePage_Init = (LDPC_FPGA_HugePage_Init) dlsym(handle, "HugePage_Init");
if(!HugePage_Init){ // if(!HugePage_Init){
printf("FPGA loading HugePage_Init error!\n"); // printf("FPGA loading HugePage_Init error!\n");
// dlclose(handle);
// return -1;
// }
// int HP = HugePage_Init(1);
// if(HP){
// printf("HugePage_Init error!\n");
// }
main234 = (LDPC_FPGA_HugePage_Init) dlsym(handle, "main234");
if(!main234){
printf("FPGA loading main234 error!\n");
dlclose(handle); dlclose(handle);
return -1; return -1;
} }
int HP = HugePage_Init(1); int HP = main234(1);
if(HP){ if(HP != 0){
printf("HugePage_Init error!\n"); printf("main234 error!\n");
} }
printf("load_nrLDPClib \n");
encoder_load = (LDPC_FPGA_EnTx) dlsym(handle, "encoder_load"); encoder_load = (LDPC_FPGA_EnTx) dlsym(handle, "encoder_load");
if(!encoder_load){ if(!encoder_load){
printf("FPGA loading encoder_load error!\n"); printf("FPGA loading encoder_load error!\n");
......
...@@ -267,6 +267,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -267,6 +267,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
uint8_t Ilbrm = 1; uint8_t Ilbrm = 1;
uint32_t Tbslbrm = 950984; //max tbs uint32_t Tbslbrm = 950984; //max tbs
uint8_t nb_re_dmrs; uint8_t nb_re_dmrs;
int fileSize,ret;
FILE *fp;
if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1) if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1)
nb_re_dmrs = 6*rel15->numDmrsCdmGrpsNoData; nb_re_dmrs = 6*rel15->numDmrsCdmGrpsNoData;
...@@ -283,6 +285,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -283,6 +285,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
EncodeInHeaderStruct EncodeHead; EncodeInHeaderStruct EncodeHead;
uint8_t *pEnDataIn = NULL; uint8_t *pEnDataIn = NULL;
uint8_t *pEnDataOut = NULL; uint8_t *pEnDataOut = NULL;
pEnDataOut=(unsigned char *)malloc(0x400000);
static uint32_t iLS = 0; static uint32_t iLS = 0;
static uint32_t lsIndex = 0; static uint32_t lsIndex = 0;
uint32_t *iLS_out = &iLS; uint32_t *iLS_out = &iLS;
...@@ -489,13 +492,32 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -489,13 +492,32 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
} }
#if 1 #if 1
if(dl_encode_count == dl_encode_count_set2){ if(dl_encode_count == dl_encode_count_set2){
// int dl_encode_i;
// for (dl_encode_i = 0; dl_encode_i<(rel15->TBSize[0]); dl_encode_i++){
// a[dl_encode_i] = dl_encode_i;
// }
// int fileSize,ret;
// FILE *fp;
#if 0
fp=fopen("oai_encode_data_0.bin","rb");
if(fp==NULL){
printf("This oai_encode_data_0 file is open failed.\n");
}
fseek(fp,0,SEEK_END);
fileSize=ftell(fp);
rewind(fp);
printf("fileSize=0x%x\n",fileSize);
ret=fread(a,1,fileSize,fp);
fclose(fp);
#endif
#if 1
//word 0 //word 0
EncodeHead.pktType = 0x12; EncodeHead.pktType = 0x12;
EncodeHead.rsv0 = 0x00; EncodeHead.rsv0 = 0x00;
EncodeHead.chkCode = 0xFAFA; EncodeHead.chkCode = 0xFAFA;
//word 1 //word 1
EncodeHead.pktLen = 32+((EncodeHead.tbSizeB+32-1)/32)*32;
//Byte,pktLen=encoder header(32byte)+ tbszie (byte),并且32Byte对齐,是32的整数倍
EncodeHead.rsv1 = 0x0000; EncodeHead.rsv1 = 0x0000;
//word 2 //word 2
EncodeHead.rsv2 = 0x0; EncodeHead.rsv2 = 0x0;
...@@ -505,13 +527,15 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -505,13 +527,15 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
//word 3 //word 3
EncodeHead.sfn = frame; EncodeHead.sfn = frame;
EncodeHead.rsv4 = 0x0; EncodeHead.rsv4 = 0x0;
EncodeHead.subfn = EncodeHead.slotNum/2;
EncodeHead.slotNum = slot; EncodeHead.slotNum = slot;
EncodeHead.subfn = EncodeHead.slotNum/2;
EncodeHead.pduIdx = 0x0; EncodeHead.pduIdx = 0x0;
//=0表示第一个码字,总共一个码字 //=0表示第一个码字,总共一个码字
EncodeHead.rev5 = 0x0; EncodeHead.rev5 = 0x0;
//word 4 //word 4
EncodeHead.tbSizeB = rel15->TBSize[0]; EncodeHead.tbSizeB = rel15->TBSize[0];
EncodeHead.pktLen = 32+((EncodeHead.tbSizeB+32-1)/32)*32;
//Byte,pktLen=encoder header(32byte)+ tbszie (byte),并且32Byte对齐,是32的整数倍
EncodeHead.rev6 = 0x0; EncodeHead.rev6 = 0x0;
EncodeHead.lastTb = 0x1; EncodeHead.lastTb = 0x1;
EncodeHead.firstTb = 0x1; EncodeHead.firstTb = 0x1;
...@@ -555,9 +579,60 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -555,9 +579,60 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
nr_get_E0_E1(G, harq->C, mod_order, rel15->nrOfLayers, r, dl_e0, dl_e1); nr_get_E0_E1(G, harq->C, mod_order, rel15->nrOfLayers, r, dl_e0, dl_e1);
EncodeHead.e0 = *dl_e0; EncodeHead.e0 = *dl_e0;
EncodeHead.e1 = *dl_e1; EncodeHead.e1 = *dl_e1;
#endif
/////////////////////////////////////////////
#if 0
//word 0
EncodeHead.pktType=0x12;
EncodeHead.rsv0=0x00;
EncodeHead.chkCode=0xFAFA;
//word 1
EncodeHead.pktLen=0x1000;
EncodeHead.rsv1=0x0000;
//word 2
EncodeHead.rsv2=0x0;
EncodeHead.sectorId=0x0;
EncodeHead.rsv3=0x0;
//word 3
EncodeHead.sfn=0x13c;
EncodeHead.rsv4=0x0;
EncodeHead.subfn=0x1;
EncodeHead.slotNum=0x2;
EncodeHead.pduIdx=0x0;
EncodeHead.rev5=0x0;
//word 4
EncodeHead.tbSizeB=0x0fc1;
EncodeHead.rev6=0x0;
EncodeHead.lastTb=0x1;
EncodeHead.firstTb=0x1;
EncodeHead.rev7=0x0;
EncodeHead.cbNum=0x04;
//word 5
EncodeHead.qm=0x3;
EncodeHead.rev8=0x0;
EncodeHead.fillbit=0x160;
EncodeHead.rev9=0x0;
EncodeHead.kpInByte=0x3f4;
EncodeHead.rev10=0x0;
//word 6
EncodeHead.gamma=0x02;
EncodeHead.codeRate=0x2e;
EncodeHead.rev11=0x0;
EncodeHead.rvIdx=0x0;
EncodeHead.rev12=0x0;
EncodeHead.lfSizeIx=0x7;
EncodeHead.rev13=0x0;
EncodeHead.iLs=0x1;
EncodeHead.bg=0x0;
//word 7
EncodeHead.e1=0x44be;
EncodeHead.e0=0x44b8;
#endif
printf("EncodeHead_fill_finished\n"); printf("EncodeHead_fill_finished\n");
encoder_load( &EncodeHead, pEnDataIn, pEnDataOut ); encoder_load( &EncodeHead, pEnDataIn, pEnDataOut );
LOG_M("pEnDataOut.m","pEnDataOut", pEnDataOut, G+32, 1, 9); printf("encoder_load_end\n");
// encoder_load( &EncodeHead, pEnDataIn, pEnDataOut );
//LOG_M("pEnDataOut.m","pEnDataOut", pEnDataOut, G+32, 1, 9);
} }
dl_encode_count++; //count +1 after encoding dl_encode_count++; //count +1 after encoding
#endif #endif
......
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