21 #include <arpa/inet.h> 104 {25, 52, 79, 106, 133, 160, 216, 270, 0, 0, 0, 0, 0},
105 {11, 24, 38, 51, 65, 78, 106, 133, 162, 0, 217, 245, 273},
106 {0, 11, 18, 24, 31, 38, 51, 65, 79, 0, 107, 121, 135}
141 {{40, 36}, {80, 72}, {120, 108}, {160, 144}, {160, 144}, {240, 216}, {320, 288}, {320, 288}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},
142 {{22, 18}, {44, 36}, {66, 54}, {88, 72}, {88, 72}, {132, 108}, {176, 144}, {176, 144}, {264, 216}, {264, 216}, {352, 288}, {352, 288}, {352, 288}},
143 { {0, 0}, {26, 18}, {39, 27}, {52, 36}, {52, 36}, {78, 54}, {104, 72}, {104, 72}, {156, 108}, {156, 108}, {208, 144}, {208, 144}, {208, 144}},
150 { {0, 0}, {104, 72}, {208, 144}, {416, 288}},
151 {{68, 36}, {136, 72}, {272, 144}, {544, 288}},
176 printf(
"ERROR: %s Mu[%d] is not valid\n",__FUNCTION__, nMu);
190 printf(
"ERROR: %s Mu[%d] is not valid\n",__FUNCTION__, nMu);
218 if (nAbsFrePointA <= 6000000)
285 if ((nNumerology >= 2) && (nNumerology <= 3))
316 printf(
"ERROR: %s: nNumerology[%d] nBandwidth[%d] nAbsFrePointA[%d]\n",__FUNCTION__, nNumerology, nBandwidth, nAbsFrePointA);
320 printf(
"%s: nNumerology[%d] nBandwidth[%d] nAbsFrePointA[%d] numRBs[%d]\n",__FUNCTION__, nNumerology, nBandwidth, nAbsFrePointA, numRBs);
340 uint32_t nDeltaFglobal,nFoffs,nNoffs;
341 uint32_t nNRARFCN = 0;
343 if(nCenterFreq > 0 && nCenterFreq < 3000*1000)
349 else if(nCenterFreq >= 3000*1000 && nCenterFreq < 24250*1000)
355 else if(nCenterFreq >= 24250*1000 && nCenterFreq <= 100000*1000)
363 printf(
"@@@@ incorrect center frerquency %d\n",nCenterFreq);
367 nNRARFCN = ((nCenterFreq - nFoffs)/nDeltaFglobal) + nNoffs;
369 printf(
"%s: nCenterFreq[%d] nDeltaFglobal[%d] nFoffs[%d] nNoffs[%d] nNRARFCN[%d]\n", __FUNCTION__, nCenterFreq, nDeltaFglobal, nFoffs, nNoffs, nNRARFCN);
390 g_NumSlotTDDLoop[nPhyInstanceId] = 1;
395 uint32_t nSlotNum, nSymNum, nVal, i;
396 uint32_t numDlSym, numUlSym, numGuardSym;
397 uint32_t numDlSlots = 0, numUlSlots = 0, numSpDlSlots = 0, numSpUlSlots = 0, numSpSlots = 0;
407 g_NumSlotTDDLoop[nPhyInstanceId] = nTddPeriod;
412 g_NumDLSymSp[nPhyInstanceId][i] = 0;
413 g_NumULSymSp[nPhyInstanceId][i] = 0;
422 g_NumSlotTDDLoop[nPhyInstanceId] = 1;
428 for (nSlotNum = 0; nSlotNum < nTddPeriod; nSlotNum++)
435 switch(psSlotConfig[nSlotNum].nSymbolType[nSymNum])
451 if ((numUlSym == 0) && (numGuardSym == 0))
456 else if ((numDlSym == 0) && (numGuardSym == 0))
469 g_NumDLSymSp[nPhyInstanceId][nSlotNum] = numDlSym;
474 g_NumULSymSp[nPhyInstanceId][nSlotNum] = numUlSym;
481 g_DlRate[nPhyInstanceId] = (float)(numDlSlots + numSpDlSlots) / (float)nTddPeriod;
482 g_UlRate[nPhyInstanceId] = (float)(numUlSlots + numSpUlSlots) / (float)nTddPeriod;
485 printf(
"set_slot_type: nPhyInstanceId[%d] nFrameDuplexType[%d], nTddPeriod[%d]\n",
486 nPhyInstanceId, nFrameDuplexType, nTddPeriod);
488 printf(
"DLRate[%f] ULRate[%f]\n",
g_DlRate[nPhyInstanceId],
g_UlRate[nPhyInstanceId]);
490 nVal = (g_NumSlotTDDLoop[nPhyInstanceId] < 10) ? g_NumSlotTDDLoop[nPhyInstanceId] : 10;
492 printf(
"SlotPattern:\n");
494 for (nSlotNum = 0; nSlotNum < nVal; nSlotNum++)
496 printf(
"%d ", nSlotNum);
501 for (nSlotNum = 0, i = 0; nSlotNum < g_NumSlotTDDLoop[nPhyInstanceId]; nSlotNum++)
503 printf(
"%s ", sSlotPattern[g_SlotType[nPhyInstanceId][nSlotNum]]);
505 if ((i == 10) && ((nSlotNum+1) < g_NumSlotTDDLoop[nPhyInstanceId]))
508 printf(
" %3d ", nSlotNum);
519 int32_t nSfIdxMod, nSfType, ret = 0;
521 nSfIdxMod =
app_xran_slot_limit(nSlotdx) % ((g_NumSlotTDDLoop[nCellIdx] > 0) ? g_NumSlotTDDLoop[nCellIdx]: 1);
522 nSfType = g_SlotType[nCellIdx][nSfIdxMod];
524 if (nSfType == nType)
550 void sys_save_buf_to_file(
char *filename,
char *bufname,
unsigned char *pBuffer,
unsigned int size,
unsigned int buffers_num)
554 if (filename && bufname)
557 printf(
"Storing %s to file %s: ", bufname, filename);
558 file = fopen(filename,
"wb");
561 printf(
"can't open file %s!!!", filename);
566 num =
fwrite(pBuffer, buffers_num, size, file);
569 printf(
"from addr (0x%lx) size (%d) bytes num (%d)", (uint64_t)pBuffer, size, num);
575 printf(
" the file name, buffer name are not set!!!");
580 printf(
" the %s is free: size = %d bytes!!!", bufname, size);
584 int sys_load_file_to_buff(
char *filename,
char *bufname,
unsigned char *pBuffer,
unsigned int size,
unsigned int buffers_num)
586 unsigned int file_size = 0;
591 if (filename && bufname)
594 printf(
"Loading file %s to %s: ", filename, bufname);
595 file = fopen(filename,
"rb");
600 printf(
"can't open file %s!!!", filename);
605 fseek(file, 0, SEEK_END);
606 file_size = ftell(file);
607 fseek(file, 0, SEEK_SET);
609 if ((file_size > size) || (file_size == 0))
612 printf(
"Reading IQ samples from file: File Size: %d [Buffer Size: %d]\n", file_size, size);
614 num = fread(pBuffer, buffers_num, size, file);
617 printf(
"from addr (0x%lx) size (%d) bytes num (%d)", (uint64_t)pBuffer, file_size, num);
624 printf(
" the file name, buffer name are not set!!!");
629 printf(
" the %s is free: size = %d bytes!!!", bufname, size);
644 if (filename && bufname)
647 printf(
"Storing %s to file %s: ", bufname, filename);
648 file = fopen(filename,
"w");
651 printf(
"can't open file %s!!!", filename);
658 signed short *ptr = (
signed short*)pBuffer;
659 for (i = 0; i < (size/((
unsigned int)
sizeof(
signed short) )); i = i + 2)
662 ret = fprintf(file,
"%d %d\n", ptr[i], ptr[i + 1]);
664 ret = fprintf(file,
"%d %d ", ptr[i], ptr[i + 1]);
672 fprintf(file,
"0x%04x: ant %d Subframe-ID %d Slot-ID %d Symbol-ID %d\n",
673 ptr[i + 1], (ptr[i + 1]>>14) & 0x3, (ptr[i + 1]>>8) & 0xF, (ptr[i + 1]>>4) & 0xF, (ptr[i + 1]>>0) & 0xF);
677 printf(
"fprintf %d\n", ret);
685 printf(
"from addr (0x%lx) size (%d) IQ num (%d)", (uint64_t)pBuffer, size, num);
691 printf(
" the file name, buffer name are not set!!!");
696 printf(
" the %s is free: size = %d bytes!!!", bufname, size);
int16_t * p_rx_buffer[MAX_ANT_CARRIER_SUPPORTED]
int32_t prach_log_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
#define MAX_ANT_CARRIER_SUPPORTED
int iq_bfw_buffer_size_ul
int32_t tx_dl_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
#define XRAN_SYMBOL_TYPE_GUARD
#define XRAN_MAX_ANT_ARRAY_ELM_NR
int32_t rx_ul_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
int32_t tx_ul_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
#define XRAN_SLOT_TYPE_LAST
float g_UlRate[XRAN_MAX_SECTOR_NR]
int32_t rx_log_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
int16_t * p_rx_log_buffer[MAX_ANT_CARRIER_SUPPORTED]
int32_t app_xran_get_slot_type(int32_t nCellIdx, int32_t nSlotdx, int32_t nType)
int16_t * p_rx_ul_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED]
#define XRAN_SLOT_TYPE_DL
uint32_t app_xran_get_scs(uint8_t nMu)
int iq_playback_buffer_size_dl
int32_t rx_dl_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
#define IQ_PLAYBACK_BUFFER_BYTES
int32_t tx_prach_play_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
#define XRAN_MAX_SECTOR_NR
fwrite(fileID, antX_16, 'int16')
uint16_t nNumRbsPerSymF2[2][4]
int16_t * p_tx_buffer[MAX_ANT_CARRIER_SUPPORTED]
void app_xran_clear_slot_type(uint32_t nPhyInstanceId)
int32_t rx_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
#define XRAN_NUM_OF_SLOT_IN_TDD_LOOP
int sys_load_file_to_buff(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num)
int32_t tx_dl_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
void sys_save_buf_to_file_txt(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num)
#define XRAN_SLOT_TYPE_INVALID
int16_t nCpSizeF2[2][4][2]
int32_t rx_ul_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
int32_t tx_srs_play_buffer_size[XRAN_MAX_SECTOR_NR *XRAN_MAX_ANT_ARRAY_ELM_NR]
void sys_save_buf_to_file(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num)
int32_t app_xran_slot_limit(int32_t nSfIdx)
uint16_t app_xran_get_num_rbs(uint32_t nNumerology, uint32_t nBandwidth, uint32_t nAbsFrePointA)
int16_t * p_tx_ul_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED]
int16_t * p_tx_play_buffer[MAX_ANT_CARRIER_SUPPORTED]
int16_t * p_rx_dl_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED]
int32_t tx_srs_play_buffer_position[XRAN_MAX_SECTOR_NR *XRAN_MAX_ANT_ARRAY_ELM_NR]
uint32_t app_xran_cal_nrarfcn(uint32_t nCenterFreq)
int16_t * p_srs_log_buffer[XRAN_MAX_SECTOR_NR *XRAN_MAX_ANT_ARRAY_ELM_NR]
#define XRAN_SYMBOL_TYPE_DL
int32_t app_xran_set_slot_type(uint32_t nPhyInstanceId, uint32_t nFrameDuplexType, uint32_t nTddPeriod, struct xran_slot_config *psSlotConfig)
#define XRAN_SLOT_TYPE_FDD
int iq_playback_buffer_size_ul
int32_t prach_log_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
This file provides the definitions for User Plane Messages APIs.
float g_DlRate[XRAN_MAX_SECTOR_NR]
uint16_t nSubCarrierSpacing[5]
uint16_t nCpSizeF1[3][13][2]
int32_t tx_play_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
int32_t tx_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
#define XRAN_NUM_OF_SYMBOL_PER_SLOT
int32_t tx_prach_play_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
int16_t * p_tx_dl_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED]
uint16_t nNumRbsPerSymF1[3][13]
Definitions and support functions to process XRAN packet.
This file provides public interface to xRAN Front Haul layer implementation as defined in the ORAN-WG...
int32_t srs_log_buffer_position[XRAN_MAX_SECTOR_NR *XRAN_MAX_ANT_ARRAY_ELM_NR]
Definitions and support functions to process XRAN packet.
int iq_srs_buffer_size_ul
#define XRAN_SLOT_TYPE_SP
int32_t rx_dl_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
int16_t * p_tx_prach_play_buffer[MAX_ANT_CARRIER_SUPPORTED]
int32_t rx_log_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
int iq_bfw_buffer_size_dl
uint32_t app_xran_get_tti_interval(uint8_t nMu)
int32_t tx_ul_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED]
int32_t tx_play_buffer_size[MAX_ANT_CARRIER_SUPPORTED]
int32_t srs_log_buffer_size[XRAN_MAX_SECTOR_NR *XRAN_MAX_ANT_ARRAY_ELM_NR]
This file provides the definitions for Control Plane Messages APIs.
int16_t * p_prach_log_buffer[MAX_ANT_CARRIER_SUPPORTED]
int16_t * p_tx_srs_play_buffer[XRAN_MAX_SECTOR_NR *XRAN_MAX_ANT_ARRAY_ELM_NR]
#define XRAN_SLOT_TYPE_UL